Files

23 lines
869 B
NASM

; char-test.asm -- run the compiled char helpers and publish their results.
;
; Appended after char.s so _loadb/_storeb (and every earlier function) keep
; their linked addresses. _start calls this instead of calling _second
; directly, which is the same one-word-size calla; _char_test calls _second
; and returns its result in A0 so the existing second() marker still works.
;
; storeb(018A8080, 0x81) writes the byte 0x81
; loadb(018A8080) returns the sign-extended 0xFFFFFF81
.text
.globl _char_test
_char_test:
calla _second ; A0 = &arr[1]
move a0, a3 ; save it for the second() marker
movi 018A8080h, a0 ; p = storeb/loadb marker byte
movi 81h, a1 ; v = 0x81 (low byte stored by MOVB)
calla _storeb
calla _loadb ; A0 is still 018A8080
movi 018A8060h, a2
move a0, *a2, 1 ; 32-bit loadb marker
move a3, a0 ; restore &arr[1]
rets