diff options
| author | kx <kx@radix-linux.su> | 2026-10-09 18:00:15 +0300 |
|---|---|---|
| committer | kx <kx@radix-linux.su> | 2026-10-09 18:00:15 +0300 |
| commit | 065da3509019b15dd0e678072e6be629e5330bef (patch) | |
| tree | 69c934c9e786ac048b4fbe8f4c4c5571661521f4 /tests/fixtures/hll/program-main.S | |
| parent | d130fe27fa753be02ed76fd9b277aa3c3d928eb9 (diff) | |
| download | libmcpu-0.4.0.tar.xz | |
Version 0.4.00.4.0
Diffstat (limited to 'tests/fixtures/hll/program-main.S')
| -rw-r--r-- | tests/fixtures/hll/program-main.S | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/fixtures/hll/program-main.S b/tests/fixtures/hll/program-main.S new file mode 100644 index 0000000..3161343 --- /dev/null +++ b/tests/fixtures/hll/program-main.S @@ -0,0 +1,48 @@ +; Assembler emulator of future mcpu-cc PROGRAM output. +; +; It intentionally defines only main() and fini(); lifecycle symbols belong +; to CRT and must be inserted automatically by mcpu-ld. + +.global main +.global fini + +.text +main: + ; Startup hooks must already have completed. + LDI r64@0x70100, 2 + ICMP r64@0x70000, r64@0x70100 + JNZ .L_main_bad + + ; argc must include argv[0] plus the two test arguments. + LDSP r64@0x70108, 8 + LDI r64@0x70110, 3 + ICMP r64@0x70108, r64@0x70110 + JNZ .L_main_bad + + ; argv[argc] is the required NULL terminator. + LDSP r64@0x70118, 16 + PADDI r64@0x70120, r64@0x70118, 24 + LOADP r64@0x70128, r64@0x70120 + CLR r64@0x70130 + ICMP r64@0x70128, r64@0x70130 + JNZ .L_main_bad + + LDI r64@0x70000, 3 + LDI r32@0x7fffc, 42 + RET + +.L_main_bad: + LDI r64@0x70000, 900 + LDI r32@0x7fffc, 43 + RET + +fini: + LDI r64@0x70100, 3 + ICMP r64@0x70000, r64@0x70100 + JNZ .L_fini_bad + LDI r64@0x70000, 4 + RET + +.L_fini_bad: + LDI r64@0x70000, 901 + RET |
