This commit is contained in:
Alvin-Zilverstand committed 2026-10-08 01:03:31 +02:00
1 parent 6dfe517094
commit 78dd619293
9 files changed
+159 -168

No files matched your search

+2
View File
@@ -3,3 +3,5 @@ __pycache__/
bob-files.b16
bob-files.b16.tmp
*.exe
+2
View File
@@ -581,3 +581,5 @@ The bob32 resident compiler now emits into the native app staging region and sav
The bob32 resident compiler now accepts one-dimensional array parameters, adjusting them to pointer-valued stack arguments. It derives addresses for local array arguments, loads and indexes parameter pointers in the callee, and preserves mutation visibility through the caller's array. Prototype/definition signatures retain array-versus-scalar parameter shape, and calls reject known mismatches. Tests cover `sum(values,length)`, indexed iteration, mutation, a nested forwarding call, repeated helper calls, conflicting/multidimensional declarations, and existing local-array behavior. Full suites: CPU 203, OS/compiler 1,825, console 28.
Started the app-side standard library with `kernel/bob_string.h`: basic string operations, whitespace detection, overflow-checked signed decimal/hex parsing, bounded integer formatting and quote-aware in-place tokenization. Runtime tests exercise edge cases in bob32, and a compiled app using the header is imported, launched, snapshotted, restored and run again from the bob32 filesystem. Full suites: CPU 203, OS/compiler 1,840, console 28.
Native bob32 apps can now use `int main(int argc, char **argv)`. The OS shell accepts quoted arguments after an imported app name, preserves empty strings and backslash escapes, and supplies the guest filename as `argv[0]`. A compiled app checks its argument count and values—including a word with spaces and an empty argument—through the real import/run path. Full suites: CPU 203, OS/compiler 1,844, console 28.
+7 -1
View File
@@ -41,6 +41,12 @@ image in the guest filesystem, use `import32 build/app.b32 myapp`, then launch
it with `run myapp`. `save` includes imported applications in the B32S snapshot;
after `restore yes`, run them again without re-importing. `run32` remains
available for direct host-path launches.
Native applications may define either `int main(void)` or the conventional
`int main(int argc, char **argv)`. For the latter, `argv[0]` is the guest app
name and `argc` includes it. Pass arguments with `run myapp first "two words"`;
quotes group spaces and backslash escapes the next character. Empty quoted
arguments are preserved. This applies to imported guest files; direct host-path
`run32` launches currently start without command-line arguments.
Set `BOB16_TRACE_FAULT=1` before launching the emulator to log the address and
instruction when a supervised application faults.
The updated emulator also accepts `bob.exe --os` from that directory to boot
@@ -87,7 +93,7 @@ token, 0 at end, or -1 for an unclosed quote.
| `save` | Save all files to a host snapshot |
| `restore yes` | Validate/load that snapshot, replacing the RAM files |
| `load name 0x4001 ...` | Store raw bob16 machine words as a program file |
| `run name` | Load a binary program into reserved RAM, execute, return |
| `run name` | Load a program into reserved RAM and run it; native apps accept arguments |
| `run32 path` | Load and run a native B32K v2 image from a host path or guest filename |
| `import32 path name` | Import a host B32K v2 image into bob32 RAM files |
| `halt` | Stop the emulator |
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+141 -164
View File
@@ -22306,7 +22306,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8cb7
.fill 8c96
.fill 1dff
.fill 9180
.fill 10d0
@@ -22337,7 +22337,7 @@
.fill a40e
.fill 4001
.fill ae01
.fill 8cbc
.fill 8c9b
.fill 1dff
.fill 9180
.fill 4601
@@ -22351,7 +22351,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8d43
.fill 8d22
.fill 1dff
.fill 9180
.fill 10d0
@@ -22382,7 +22382,7 @@
.fill aa27
.fill 4001
.fill ae01
.fill 8d48
.fill 8d27
.fill 1dff
.fill 9180
.fill 10d0
@@ -22425,7 +22425,7 @@
.fill a40e
.fill 4001
.fill ae01
.fill 8d4d
.fill 8d2c
.fill 1dff
.fill 9180
.fill 4601
@@ -22439,7 +22439,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8dfe
.fill 8ddd
.fill 1dff
.fill 9180
.fill 10d0
@@ -22470,7 +22470,7 @@
.fill aa27
.fill 4001
.fill ae01
.fill 8e04
.fill 8de3
.fill 1dff
.fill 9180
.fill 10d0
@@ -22513,7 +22513,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 8e08
.fill 8de7
.fill 1dff
.fill 9180
.fill 4601
@@ -22524,7 +22524,7 @@
.fill aeb2
.fill 4001
.fill ae01
.fill 8e8d
.fill 8e6c
.fill 1dff
.fill 9180
.fill 10d0
@@ -22555,7 +22555,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 8e92
.fill 8e71
.fill 1dff
.fill 9180
.fill 4601
@@ -22566,7 +22566,7 @@
.fill ae88
.fill 4001
.fill ae01
.fill 8ebc
.fill 8e9b
.fill 1dff
.fill 9180
.fill 10d0
@@ -22597,7 +22597,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 8ec2
.fill 8ea1
.fill 1dff
.fill 9180
.fill 4601
@@ -22608,7 +22608,7 @@
.fill ae5e
.fill 4001
.fill ae01
.fill 8f00
.fill 8edf
.fill 1dff
.fill 9180
.fill 10d0
@@ -22639,7 +22639,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 8f05
.fill 8ee4
.fill 1dff
.fill 9180
.fill 4601
@@ -22650,7 +22650,7 @@
.fill ae34
.fill 4001
.fill ae01
.fill 8f60
.fill 8f3f
.fill 1dff
.fill 9180
.fill 10d0
@@ -22681,7 +22681,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 8f65
.fill 8f44
.fill 1dff
.fill 9180
.fill 4601
@@ -22692,7 +22692,7 @@
.fill ae0a
.fill 4001
.fill ae01
.fill 8fbd
.fill 8f9c
.fill 1dff
.fill 9180
.fill 4601
@@ -22758,7 +22758,7 @@
.fill ae00
.fill 4001
.fill ae01
.fill 8f60
.fill 8f3f
.fill 1dff
.fill 9180
.fill 10d0
@@ -22822,7 +22822,7 @@
.fill ae00
.fill 4001
.fill ae01
.fill 8ff6
.fill 8fd5
.fill 1dff
.fill 9180
.fill 4601
@@ -22832,7 +22832,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 901c
.fill 8ffb
.fill 1dff
.fill 9180
.fill 4601
@@ -22842,7 +22842,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 904c
.fill 902b
.fill 1dff
.fill 9180
.fill 4601
@@ -22852,7 +22852,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 9086
.fill 9065
.fill 1dff
.fill 9180
.fill 4601
@@ -22862,7 +22862,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 90c5
.fill 90a4
.fill 1dff
.fill 9180
.fill 4601
@@ -22872,7 +22872,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 910f
.fill 90f8
.fill 1dff
.fill 9180
.fill 4601
@@ -22882,7 +22882,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 9151
.fill 913a
.fill 1dff
.fill 9180
.fill 4601
@@ -22892,7 +22892,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 9181
.fill 916a
.fill 1dff
.fill 9180
.fill 4601
@@ -22902,7 +22902,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 91c1
.fill 91aa
.fill 1dff
.fill 9180
.fill 4601
@@ -22912,7 +22912,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 9209
.fill 91f2
.fill 1dff
.fill 9180
.fill 4601
@@ -22964,7 +22964,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 9257
.fill 9240
.fill 1dff
.fill 9180
.fill 4601
@@ -23018,7 +23018,7 @@
.fill a43d
.fill 4001
.fill ae01
.fill 9273
.fill 925c
.fill 1dff
.fill 9180
.fill 4601
@@ -23055,7 +23055,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 9277
.fill 9260
.fill 1dff
.fill 9180
.fill 4601
@@ -23079,7 +23079,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8e8d
.fill 8e6c
.fill 1dff
.fill 9180
.fill 10d0
@@ -23125,7 +23125,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8ebc
.fill 8e9b
.fill 1dff
.fill 9180
.fill 10d0
@@ -23156,7 +23156,7 @@
.fill a40e
.fill 4001
.fill ae01
.fill 92c0
.fill 92a9
.fill 1dff
.fill 9180
.fill 4601
@@ -23170,7 +23170,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8e04
.fill 8de3
.fill 1dff
.fill 9180
.fill 10d0
@@ -23209,7 +23209,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8f00
.fill 8edf
.fill 1dff
.fill 9180
.fill 10d0
@@ -23684,7 +23684,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 92c8
.fill 92b1
.fill 1dff
.fill 9180
.fill 4601
@@ -23709,7 +23709,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 92d8
.fill 92c1
.fill 1dff
.fill 9180
.fill 4601
@@ -23840,7 +23840,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 92f1
.fill 92da
.fill 1dff
.fill 9180
.fill 4601
@@ -23911,7 +23911,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8cb7
.fill 8c96
.fill 1dff
.fill 9180
.fill 10d0
@@ -24159,7 +24159,7 @@
.fill a410
.fill 4001
.fill ae01
.fill 9346
.fill 932f
.fill 1dff
.fill 9180
.fill 4601
@@ -24194,7 +24194,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 9375
.fill 935e
.fill 6380
.fill 1d81
.fill 9040
@@ -24290,7 +24290,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8dfe
.fill 8ddd
.fill 1dff
.fill 9180
.fill 10d0
@@ -24354,7 +24354,7 @@
.fill a410
.fill 4001
.fill ae01
.fill 9379
.fill 9362
.fill 1dff
.fill 9180
.fill 4601
@@ -24401,7 +24401,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 93c8
.fill 93b1
.fill 1dff
.fill 9180
.fill 4601
@@ -24429,7 +24429,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 8d43
.fill 8d22
.fill 1dff
.fill 9180
.fill 10d0
@@ -24460,7 +24460,7 @@
.fill aa27
.fill 4001
.fill ae01
.fill 8d48
.fill 8d27
.fill 1dff
.fill 9180
.fill 10d0
@@ -24540,7 +24540,7 @@
.fill a410
.fill 4001
.fill ae01
.fill 941c
.fill 9405
.fill 1dff
.fill 9180
.fill 4601
@@ -24566,7 +24566,7 @@
.fill 9040
.fill 4001
.fill ae01
.fill 8d48
.fill 8d27
.fill 1dff
.fill 9180
.fill 10d0
@@ -24630,7 +24630,7 @@
.fill a40d
.fill 4001
.fill ae01
.fill 9459
.fill 9442
.fill 1dff
.fill 9180
.fill 4601
@@ -24728,7 +24728,7 @@
.fill a40d
.fill 4001
.fill ae01
.fill 948d
.fill 9476
.fill 1dff
.fill 9180
.fill 4601
@@ -24784,7 +24784,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 94b0
.fill 9499
.fill 1dff
.fill 9180
.fill 4601
@@ -24805,7 +24805,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 94b3
.fill 949c
.fill 1dff
.fill 9180
.fill 4601
@@ -24816,7 +24816,7 @@
.fill ae0a
.fill 4001
.fill ae01
.fill 94b5
.fill 949e
.fill 1dff
.fill 9180
.fill 4601
@@ -25018,7 +25018,7 @@
.fill ae00
.fill 4001
.fill ae01
.fill 94d1
.fill 94ba
.fill 1dff
.fill 9180
.fill 4601
@@ -25116,7 +25116,7 @@
.fill a416
.fill 4001
.fill ae01
.fill 94dc
.fill 94c5
.fill 1dff
.fill 9180
.fill 4601
@@ -25744,7 +25744,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 94e0
.fill 94c9
.fill 6380
.fill 1d81
.fill 9040
@@ -28291,7 +28291,7 @@
.fill 1ae0
.fill 4001
.fill ae01
.fill 9554
.fill 953d
.fill 1dff
.fill 9180
.fill 4601
@@ -28766,7 +28766,7 @@
.fill afaf
.fill 4001
.fill ae01
.fill 9557
.fill 9540
.fill 1dff
.fill 9180
.fill 4601
@@ -28776,7 +28776,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 9565
.fill 954e
.fill 1dff
.fill 9180
.fill 4601
@@ -28808,7 +28808,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 9570
.fill 9559
.fill 1dff
.fill 9180
.fill 4601
@@ -29271,7 +29271,7 @@
.fill 1d82
.fill 4001
.fill ae01
.fill 9573
.fill 955c
.fill 1dff
.fill 9180
.fill 4601
@@ -29310,7 +29310,7 @@
.fill 1d82
.fill 4001
.fill ae01
.fill 959a
.fill 9583
.fill 1dff
.fill 9180
.fill 4601
@@ -29346,7 +29346,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 95a1
.fill 958a
.fill 6380
.fill 1d81
.fill 9040
@@ -29469,7 +29469,7 @@
.fill ae00
.fill 4001
.fill ae01
.fill 95bd
.fill 95a6
.fill 1dff
.fill 9180
.fill 10d0
@@ -29674,7 +29674,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 95dd
.fill 95c6
.fill 6380
.fill 1d81
.fill 9040
@@ -29685,7 +29685,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 9600
.fill 95e9
.fill 6380
.fill 1d81
.fill 9040
@@ -29958,7 +29958,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 961b
.fill 9604
.fill 6380
.fill 1d81
.fill 9040
@@ -30908,7 +30908,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 962e
.fill 9617
.fill 6380
.fill 1d81
.fill 9040
@@ -30918,7 +30918,7 @@
.fill b600
.fill 4001
.fill ae01
.fill 92c0
.fill 92a9
.fill 1dff
.fill 9180
.fill 4601
@@ -30941,7 +30941,7 @@
.fill 1dfe
.fill 4001
.fill ae01
.fill 9652
.fill 963b
.fill 1dff
.fill 9180
.fill 4601
@@ -30951,7 +30951,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 9657
.fill 9640
.fill 1dff
.fill 9180
.fill 4601
@@ -30961,7 +30961,7 @@
.fill 1d81
.fill 4001
.fill ae01
.fill 9694
.fill 967d
.fill 1dff
.fill 9180
.fill 4601
@@ -30975,7 +30975,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 96cc
.fill 96b5
.fill 6380
.fill 1d81
.fill 9040
@@ -31001,7 +31001,7 @@
.fill 9180
.fill 4001
.fill ae01
.fill 96fa
.fill 96e3
.fill 1dff
.fill 9180
.fill 4601
@@ -31015,7 +31015,7 @@
.fill a452
.fill 4001
.fill ae01
.fill 9700
.fill 96e9
.fill 1dff
.fill 9180
.fill 4601
@@ -31075,7 +31075,7 @@
.fill a40b
.fill 4001
.fill ae01
.fill 9706
.fill 96ef
.fill 1dff
.fill 9180
.fill 4601
@@ -35888,33 +35888,29 @@
.fill 0041
.fill 004d
.fill 0045
.fill 0020
.fill 005b
.fill 0041
.fill 0052
.fill 0047
.fill 0020
.fill 002e
.fill 002e
.fill 002e
.fill 005d
.fill 003a
.fill 0020
.fill 0065
.fill 0078
.fill 0065
.fill 0063
.fill 0072
.fill 0075
.fill 006e
.fill 0020
.fill 0061
.fill 0020
.fill 0067
.fill 0075
.fill 0065
.fill 0073
.fill 0074
.fill 0065
.fill 0020
.fill 0061
.fill 0020
.fill 0063
.fill 006f
.fill 006d
.fill 0070
.fill 0069
.fill 006c
.fill 0065
.fill 0064
.fill 002f
.fill 006c
.fill 006f
.fill 0061
.fill 0064
.fill 0065
.fill 0064
.fill 0020
.fill 0070
.fill 0072
@@ -35925,42 +35921,48 @@
.fill 006d
.fill 002e
.fill 0020
.fill 0045
.fill 0078
.fill 004e
.fill 0061
.fill 006d
.fill 0070
.fill 006c
.fill 0065
.fill 003a
.fill 0020
.fill 0063
.fill 0063
.fill 0020
.fill 0062
.fill 006f
.fill 0062
.fill 002e
.fill 0063
.fill 0020
.fill 0062
.fill 006f
.fill 0062
.fill 002c
.fill 0020
.fill 0074
.fill 0068
.fill 0069
.fill 0076
.fill 0065
.fill 006e
.fill 0020
.fill 0072
.fill 0075
.fill 006e
.fill 0020
.fill 0062
.fill 006f
.fill 0062
.fill 002e
.fill 0033
.fill 0032
.fill 0020
.fill 0061
.fill 0070
.fill 0070
.fill 0073
.fill 0020
.fill 0061
.fill 0063
.fill 0063
.fill 0065
.fill 0070
.fill 0074
.fill 0020
.fill 0071
.fill 0075
.fill 006f
.fill 0074
.fill 0065
.fill 0064
.fill 0020
.fill 0061
.fill 0072
.fill 0067
.fill 0075
.fill 006d
.fill 0065
.fill 006e
.fill 0074
.fill 0073
.fill 003b
.fill 0020
.fill 0045
.fill 0078
@@ -35985,41 +35987,6 @@
.fill 006c
.fill 0075
.fill 0065
.fill 003b
.fill 0020
.fill 0066
.fill 0061
.fill 0075
.fill 006c
.fill 0074
.fill 0073
.fill 002f
.fill 0074
.fill 0069
.fill 006d
.fill 0065
.fill 006f
.fill 0075
.fill 0074
.fill 0073
.fill 0020
.fill 0072
.fill 0065
.fill 0073
.fill 0074
.fill 006f
.fill 0072
.fill 0065
.fill 0020
.fill 0074
.fill 0068
.fill 0065
.fill 0020
.fill 0073
.fill 0068
.fill 0065
.fill 006c
.fill 006c
.fill 002e
.fill 0000
.fill 006c
@@ -37092,6 +37059,16 @@
.fill 004d
.fill 0045
.fill 0020
.fill 005b
.fill 0041
.fill 0052
.fill 0047
.fill 0020
.fill 002e
.fill 002e
.fill 002e
.fill 005d
.fill 0020
.fill 007c
.fill 0020
.fill 0063
+4
View File
@@ -140,3 +140,7 @@ Native C applications can include `bob_string.h` for small app-side string
and parsing helpers. It provides bounded integer formatting, status-returning
decimal/hex parsing, and in-place quoted tokenization without depending on the
kernel's private runtime functions.
Native apps may define `main(int argc, char **argv)`; when launched by guest
filename, `argv[0]` is that filename and `argc` includes it. `run app first
"two words"` groups quoted words; backslash escapes the following character
and `""` supplies an empty argument.
+2 -2
View File
@@ -298,7 +298,7 @@ void command_help(char *name) {
println("ls / dir / list: show names, lengths and text/program kinds. Files are in RAM; save keeps them between sessions.");
else if (strcmp(name, "copy") == 0 || strcmp(name, "rename") == 0 || strcmp(name, "delete") == 0)
println("copy OLD NEW | rename OLD NEW | delete NAME. Example: copy bob.c backup.c. Destinations must be new. Copy needs a free slot; rename does not. Delete is permanent.");
else if (strcmp(name, "run") == 0) println("run NAME: execute a compiled/loaded program. Example: cc bob.c bob, then run bob. Exit shows return value; faults/timeouts restore the shell.");
else if (strcmp(name, "run") == 0) println("run NAME [ARG ...]: run a guest program. Native bob32 apps accept quoted arguments; Exit shows return value.");
#ifdef BOBC_WIDE
else if (strcmp(name, "run32") == 0) println("run32 PATH: load and run a B32K v2 application image in the bob32 OS. Example: run32 build/wide-app.b32. Compile with bobcc --wide-app.");
else if (strcmp(name, "import32") == 0) println("import32 HOST_PATH GUEST_NAME: import a B32K v2 image into RAM files; then run GUEST_NAME and save to keep it in B32S.");
@@ -330,7 +330,7 @@ void SHELL_COMMAND_BODY(char *line) {
println("peek ADDRESS | poke ADDRESS VALUE | alloc WORDS");
println("list / ls / dir | read NAME | write NAME TEXT | edit NAME");
println("copy OLD NEW | rename OLD NEW | delete NAME (permanent in RAM)");
println("load NAME 0xWORD ... | run NAME | cc SOURCE [OUTPUT] | go SOURCE [OUTPUT]");
println("load NAME 0xWORD ... | run NAME [ARG ...] | cc SOURCE [OUTPUT] | go SOURCE [OUTPUT]");
#ifdef BOBC_WIDE
println("run32 PATH: run a native bob32 B32K v2 application image.");
println("import32 HOST_PATH GUEST_NAME: import once, then run the guest filename.");
+1 -1
View File
@@ -98,7 +98,7 @@ static void native_string_library(void) {
write_text("build/argv-app.c",
"#include \"bob.h\"\n#include \"bob_string.h\"\n"
"int main(int argc,char **argv){if(argc!=5)return argc;"
"if(bob_strcmp(argv[1],\"Bob OS\")||bob_strcmp(argv[2],\"escaped token\")||bob_strcmp(argv[3],\"\"))return 2;"
"if(bob_strcmp(argv[0],\"argvapp\")||bob_strcmp(argv[1],\"Bob OS\")||bob_strcmp(argv[2],\"escaped token\")||bob_strcmp(argv[3],\"\"))return 2;"
"bob_puts(\"bob!\");return 0;}\n");
check(system("gcc -E -P -nostdinc -undef -DBOBC_LEGACY=0 -I kernel build/argv-app.c -o build/argv-app.i > build/compiler.log 2>&1")==0,"bob32 argv app preprocessing");
check(system(COMPILER " build/argv-app.i build/argv-app.basm build/argv-app.b32 --wide-app > build/compiler.log 2>&1")==0,"bob32 argv app compilation");