KEK/tests/test.mac
folkert van heusden 1e5fa1b9ec tests
2022-03-20 11:52:42 +01:00

50 lines
760 B
Text

; in simh:
; simh> set console telnet=3333
; then invoke telnet to port 3333 on the simh systm
; simh> load test.bin
; simh> run
; initialize stack pointer
start: MOV #1000, R6
; store pointer to text in R0
loop: MOV #text, R0
CALL printstart
JMP loop
; store copy of R0 on the stack
printstart: MOV R0,-(SP)
; store PSW (status register) on stack
MOV R1,-(SP)
MFPS R1
MOV R1,-(SP)
; string ends with 0x00
print: TSTB (R0)
BEQ pdone
; put character in tty buffer
MOVB (R0), @#TTYTX
; wait for it to be transmitted
waittx: TSTB @#TTYST
BPL waittx
INC R0
JMP print
; retrieve stored r0, r1 and psw from stack
pdone: MOV (SP)+,R1
MTPS R1
MOV (SP)+,R1
MOV (SP)+,R0
RET
make_raw
text: .ASCII "test\r\n\x00"
TTYST = 177564
TTYTX = 177566