mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-11-01 12:14:56 +02:00
80 lines
1.5 KiB
NASM
80 lines
1.5 KiB
NASM
; entry.asm -- payload entry and ROM socket/allocator thunks.
|
|
;
|
|
; The payload is entered by a debugger/rdebug jump and never returns. Set the
|
|
; C stack, call main, and spin if main ever returns.
|
|
;
|
|
; The firmware's wrappers end in RETS 2 (they pop the return address and two
|
|
; argument words, and restore A14 from a caller-pushed slot). A plain calla
|
|
; would leave SP off by one word; these thunks save/restore SP and A14 exactly
|
|
; as harness/udpstream/entry.asm does.
|
|
|
|
.text
|
|
.globl _start
|
|
.globl _main
|
|
_start:
|
|
setf 32, 0, 1
|
|
movi _cstack, a14
|
|
move a14, a13
|
|
calla _main
|
|
spin:
|
|
jruc spin
|
|
|
|
.globl _socket_
|
|
_socket_:
|
|
move sp, @_sys_sp, 1
|
|
move a14, @_sys_a14, 1
|
|
calla 3F5C9A00h
|
|
move @_sys_sp, sp, 1
|
|
move @_sys_a14, a14, 1
|
|
rets 2
|
|
|
|
.globl _bind_
|
|
_bind_:
|
|
move sp, @_sys_sp, 1
|
|
move a14, @_sys_a14, 1
|
|
calla 3F5CAA80h
|
|
move @_sys_sp, sp, 1
|
|
move @_sys_a14, a14, 1
|
|
rets 2
|
|
|
|
.globl _recvfrom_
|
|
_recvfrom_:
|
|
move sp, @_sys_sp, 1
|
|
move a14, @_sys_a14, 1
|
|
calla 3F5D7D50h
|
|
move @_sys_sp, sp, 1
|
|
move @_sys_a14, a14, 1
|
|
rets 2
|
|
|
|
.globl _close_
|
|
_close_:
|
|
move sp, @_sys_sp, 1
|
|
move a14, @_sys_a14, 1
|
|
calla 3F5E8930h
|
|
move @_sys_sp, sp, 1
|
|
move @_sys_a14, a14, 1
|
|
rets 2
|
|
|
|
.globl _malloc_
|
|
_malloc_:
|
|
move sp, @_sys_sp, 1
|
|
move a14, @_sys_a14, 1
|
|
calla 3F701230h
|
|
move @_sys_sp, sp, 1
|
|
move @_sys_a14, a14, 1
|
|
rets 2
|
|
|
|
.globl _delay_
|
|
_delay_:
|
|
move sp, @_sys_sp, 1
|
|
move a14, @_sys_a14, 1
|
|
calla 3F833A20h
|
|
move @_sys_sp, sp, 1
|
|
move @_sys_a14, a14, 1
|
|
rets 2
|
|
|
|
.bss _cstack, 32768, 16 ; 32768 bits = 4096 bytes
|
|
.bss _sys_sp, 32, 16
|
|
.bss _sys_a14, 32, 16
|
|
.end
|