Files
2026-09-19 20:21:47 +02:00

21 lines
730 B
ArmAsm

; ECHO -- copy each day's uplink into the downlink buffer.
;
.equ RX 0 ; uplink buffer
.equ TX 1024 ; downlink buffer
.equ P_UPNEW 0x70 ; uplink-arrived flag / acknowledge
.equ P_UPLEN 0x71 ; uplink length in bytes
wait: in r1, P_UPNEW
ldi r2, 0
beq r1, r2, sleep ; nothing new today
in r4, P_UPLEN
ldi r5, 0 ; r5 = byte index
copy: bge r5, r4, done
ldb r6, [r5+RX]
stb r6, [r5+TX]
addi r5, 1
jmp copy
done: out P_UPNEW, r1 ; acknowledge
sleep: yield
jmp wait