mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-30 12:03:54 +02:00
67 lines
1.8 KiB
NASM
67 lines
1.8 KiB
NASM
; marker.asm -- loader acceptance app.
|
|
;
|
|
; Built by dwt/loader/build.sh with three separate section origins:
|
|
; .text 018C0000h (byte 0x318000)
|
|
; .data 018D0000h (byte 0x31A000)
|
|
; .bss 018D8000h (byte 0x31B000)
|
|
;
|
|
; It is the *COFF image* that the loader must place; it is never poked as a
|
|
; raw blob. The loader parses the COFF, copies .text and .data, zeroes .bss,
|
|
; and calls create_process() with the image's entry point.
|
|
;
|
|
; Evidence cells (32-bit, bit addresses; outside every app section):
|
|
; 018E0000 _start address at run time (must be 018C0000)
|
|
; 018E0020 d_magic read from .data (must be DEADBEEF)
|
|
; 018E0040 d_two read from .data (must be 12345678)
|
|
; 018E0060 b_zero read from .bss (must be 0; the harness pre-fills A5)
|
|
; 018E0080 b_counter, incremented forever (proves the child is scheduled)
|
|
;
|
|
; The harness pre-fills the whole .bss range with A5A5A5A5 before the load, so
|
|
; a zero at 018E0060 is the loader's zero-fill, not a fresh-RAM accident.
|
|
|
|
.def _start
|
|
.text
|
|
_start:
|
|
setf 16, 0, 0
|
|
setf 32, 0, 1
|
|
|
|
; Run-time address of this code: position dependence, made visible.
|
|
movi _start, a2, L
|
|
move a2, @018E0000h, 1
|
|
|
|
; Initialised .data must have been copied by the loader.
|
|
move @d_magic, a0, 1
|
|
move a0, @018E0020h, 1
|
|
|
|
move @d_two, a1, 1
|
|
move a1, @018E0040h, 1
|
|
|
|
; .bss must have been zeroed by the loader (harness pre-fills A5).
|
|
move @b_zero, a3, 1
|
|
move a3, @018E0060h, 1
|
|
|
|
; A live counter: a created process, not a one-shot jump.
|
|
sub a4, a4
|
|
loop:
|
|
addi 1, a4
|
|
move a4, @b_counter, 1
|
|
move a4, @018E0080h, 1
|
|
movi 2000h, a5, L
|
|
delay:
|
|
dsjs a5, delay
|
|
jruc loop
|
|
|
|
; Kept to leave a call in the image (and a relocation in the .obj).
|
|
.global sub
|
|
sub:
|
|
rets
|
|
|
|
.data
|
|
d_magic: .long 0DEADBEEFh
|
|
d_two: .long 012345678h
|
|
|
|
.bss b_zero, 32, 1
|
|
.bss b_counter, 32, 1
|
|
|
|
.end
|