45 lines
1.2 KiB
NASM
45 lines
1.2 KiB
NASM
; entry.asm -- M1 smoke-test entry, linked at bit 018A0000.
|
|
;
|
|
; M1 has no stack frame, no calls and no TI ABI. The generated functions are
|
|
; leaf functions: i32/pointer arguments in A0-A3, result in A0.
|
|
;
|
|
; Marker words (bit addresses, 0x20 bits apart = 4 bytes):
|
|
; 018A8000 add(20, 22)
|
|
; 018A8020 load(018A8100)
|
|
; 018A8040 second() == &arr[1]
|
|
; 018A8060 loadb(018A8080) == 0xFFFFFF81 (sign-extended 0x81)
|
|
; 018A8080 storeb(018A8080, 0x81) leaves the byte 0x81
|
|
;
|
|
; _late is linked but not called: it is a compile-time check that a surviving
|
|
; GEP offset is 24 bits, not 192.
|
|
;
|
|
; The char helpers are exercised by _char_test (char-test.asm, appended after
|
|
; the compiled functions). Calling it here instead of calling _second keeps
|
|
; this entry's size -- and therefore every function's linked address -- the
|
|
; same; _char_test calls _second and returns its result in A0.
|
|
.text
|
|
.globl _start
|
|
_start:
|
|
setf 32, 0, 1 ; FS1 = 32 for 32-bit MOVE
|
|
setf 16, 0, 0 ; FS0 = 16, for any i16 code
|
|
movi 20, a0
|
|
movi 22, a1
|
|
calla _add
|
|
movi 018A8000h, a2
|
|
move a0, *a2, 1
|
|
|
|
movi 018A8100h, a2
|
|
movi 12345678h, a3
|
|
move a3, *a2, 1
|
|
move a2, a0
|
|
calla _load
|
|
movi 018A8020h, a2
|
|
move a0, *a2, 1
|
|
|
|
calla _char_test
|
|
|
|
movi 018A8040h, a2
|
|
move a0, *a2, 1
|
|
|
|
rets
|