-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
203 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Build CLI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup | ||
- run: make -C src/cli package | ||
- run: make -C src/cli test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
BasedOnStyle: LLVM | ||
ColumnLimit: 150 | ||
--- | ||
Language: Cpp | ||
AllowShortFunctionsOnASingleLine: Empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
*.sym | ||
*.profraw | ||
*.profdata | ||
*.log | ||
/coverage | ||
/uxnwasm | ||
uxnwasm_core.* | ||
/uxn-wasm-cli | ||
cli_core.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include "cli_core.h" | ||
|
||
typedef struct w2c_system { | ||
wasm_rt_memory_t *mem; | ||
} w2c_system; | ||
|
||
void w2c_system_deo(struct w2c_system *sys, u32 port, u32 value) { | ||
// Console | ||
if (port == 0x18) { | ||
fputc(value, stdout); | ||
} else if (port == 0x18) { | ||
fputc(value, stderr); | ||
} | ||
} | ||
|
||
u32 w2c_system_dei(struct w2c_system *sys, u32 port) { | ||
return (u32)sys->mem->data[0x10200 + port]; | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
if (argc < 2) { | ||
printf("missing rom\n"); | ||
return 1; | ||
} | ||
FILE *file = fopen(argv[1], "rb"); | ||
if (file == NULL) { | ||
printf("error opening file\n"); | ||
return 1; | ||
} | ||
fseek(file, 0, SEEK_END); | ||
long filesize = ftell(file); | ||
fseek(file, 0, SEEK_SET); | ||
|
||
wasm_rt_init(); | ||
w2c_uxn uxn; | ||
w2c_system sys; | ||
wasm2c_uxn_instantiate(&uxn, &sys); | ||
sys.mem = w2c_uxn_memory(&uxn); | ||
|
||
// Read ROM | ||
(void)!fread(sys.mem->data + 0x100, filesize, 1, file); | ||
if (ferror(file)) { | ||
printf("error reading file\n"); | ||
return 1; | ||
} | ||
|
||
// Run | ||
w2c_uxn_eval(&uxn, 0x100); | ||
|
||
// Cleanup | ||
wasm2c_uxn_free(&uxn); | ||
wasm_rt_free(); | ||
fclose(file); | ||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.