Library - PS8 Computing

Go to content

Library

Relay Computers > SBRC
[serial]
;----------------------------------------------------------
; Write zero terminated string to serial
;
; Save P1 address
_ws st _ws_p1, _ws_p
st _wsr, _ws_a
clr _ws_t1
; Save [P1] value to _ws_t1
_ws_a add _ws_t1, 0
;
add _ws_p, _ws_t1
_ws_l clr _ws_tmp
_ws_p add _ws_tmp, 0
; If the character is zero, then return
jeq _ws_tmp, _ws_d
outc _ws_tmp
inc _ws_p
jmp _ws_l
; Increment 'back address' to skip over P1, the jump back to calling routine
_ws_d inc _wsr
_wsr jmp 0
;
_ws_t1 data 0
_ws_tmp data 0
_ws_a1 add _ws_t1, 0
_ws_p1 add _ws_tmp, 0
;----------------------------------------------------------
;
; Write newline to serial
_wsnl outc #10
outc #13
_wsnlr jmp 0
;----------------------------------------------------------

              ; Write zero terminated string to serial
             ;
             ; Save P1 address
0050 0800_352B _ws st _ws_p1, _ws_p
0051 0800_3128 st _wsr, _ws_a
0052 4800_0032 clr _ws_t1
             ; Save [P1] value to _ws_t1
0053 8080_3200 _ws_a add _ws_t1, 0
             ;
0054 8080_2B32 add _ws_p, _ws_t1
0055 4800_0033 _ws_l clr _ws_tmp
0056 8080_3300 _ws_p add _ws_tmp, 0
             ; If the character is zero, then return
0057 0062_3330 jeq _ws_tmp, _ws_d
0058 9800_3300 outc _ws_tmp
0059 4880_012B inc _ws_p
005A 4018_FF2A jmp _ws_l
             ; Increment 'back address' to skip over P1, the jump back to calling routine
005B 4880_0131 _ws_d inc _wsr
005C 4018_FF00 _wsr jmp 0
             ;
005D C810_FF00 _ws_t1 data 0
005E C810_FF00 _ws_tmp data 0
005F 8080_3200 _ws_a1 add _ws_t1, 0
0060 8080_3300 _ws_p1 add _ws_tmp, 0
             ;----------------------------------------------------------
             ;
             ; Write newline to serial
0061 D800_0A00 _wsnl outc #10
0062 D800_0D00 outc #13
0063 4018_FF00 _wsnlr jmp 0
             ;----------------------------------------------------------





Back to content