Files
tms-c-compiler/scripts/m1/entry.asm
T
2026-11-11 08:31:19 +00:00

37 lines
842 B
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]
;
; _late is linked but not called: it is a compile-time check that a surviving
; GEP offset is 24 bits, not 192.
.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 _second
movi 018A8040h, a2
move a0, *a2, 1
rets