; $Id: pc11write.mac 1134 2019-04-21 17:18:03Z mueller $ ; Copyright 2019- by Walter F.J. Mueller ; License disclaimer see License.txt in $RETROBASE directory ; ; Revision History: ; Date Rev Version Comment ; 2019-04-21 1134 1.0 Initial version ; ; write test tape ; ; definitions ---------------------------------------------- ; .include |lib/defs_cpu.mac| .include |lib/defs_pc.mac| ; lcnt = 1000. ; number of lines to print ; CR = 015 LF = 012 ; ; vector area ---------------------------------------------- ; .include |lib/vec_cpucatch.mac| .include |lib/vec_devcatch.mac| . = v..ptp .word vh.ptp .word cp.pr7 ; ; stack area ----------------------------------------------- ; . = 1000 ; stack (below); code (above) stack: ; ; code area ------------------------------------------------ ; ; gobal register usage ; r0 line count ; !! visible in wait !! ; r1 write buffer pointer ; ; start/stop area --------------------------------- ; start: br start1 stop: halt ; sucessfull stop reset ; and allow re-start ; ; main program ------------------------------------ ; start1: mov #stack,sp ; setup stack 2$: tst @#pp.csr ; wait punch online bmi 2$ ; clr r0 ; clear line count mov #bnum,r1 ; write buffer pointer clr r2 clr r3 clr r4 clr r5 mov #"00,bnum mov #"00,bnum+2 ; mov #pp.ie,@#pp.csr ; start puncher spl 0 ; allow interrupts 3$: wait ; and idle br 3$ ; ; puncher interrupt handler ----------------------- ; vh.ptp: tst @#pp.csr ; punch error bmi perr ; if mi yes, error halt movb (r1)+,@#pp.buf ; send byte cmp r1,#bend ; end of buffer ? blo 100$ mov #bnum+3,r1 ; if yes, increment number jsr pc,incnum inc r0 ; inc line counter cmp r0,#lcnt ; enough lines send ? beq 200$ mov #bnum,r1 ; ready for next line 100$: rti 200$: jmp stop perr: halt ; puncher error halt br perr ; ; increment 4 digit decimal number --------------- ; incnum: mov #4,r5 ; max 4 digits 1$: incb (r1) cmpb (r1),#'9 ; went above 9 ble 100$ ; if not, done movb #'0,(r1) ; if yes, restore 0 dec r1 ; and go for next digit sob r5,1$ 100$: rts pc ; ; data area ------------------------------------------------ ; bnum: .ascii /0000/ btxt: .ascii /: / .ascii /ABCDEFGHIJKLMNOPQRSTUVWXYZ/ .ascii /abcdefghijklmnopqrstuvwxyz/ .ascii /!@#$%^&*()/ .byte CR,LF bend: .end start