1
0
mirror of https://github.com/wfjm/w11.git synced 2026-01-15 00:12:31 +00:00
wfjm.w11/tools/mcode/pc11/pc11write.mac
wfjm 13a72d1b4b mcode: use call/return; fix (lp11|pc11)write; add scmd
- tools/mcode
  - *.mac: use call/return
  - (lp11|pc11)write: check line count after last char is accepted
  - pc11copy: kw11-p: use 100 kHz/13.; ensure last puncher interrupt
  - *.scmd: add SimH startup files when reasonable
- tools/simh/setup_w11a_(max|min).scmd: enable pclk
2022-08-13 07:45:28 +02:00

112 lines
3.4 KiB
Plaintext

; $Id: pc11write.mac 1276 2022-08-12 10:25:13Z mueller $
; SPDX-License-Identifier: GPL-3.0-or-later
; Copyright 2019-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
;
; Revision History:
; Date Rev Version Comment
; 2022-08-10 1276 1.0.2 check line count after last char is accepted
; 2022-08-09 1275 1.0.1 use call/return
; 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 -----------------------
; the line count stop is checked after the last char is accepted by PC11
;
vh.ptp: tst @#pp.csr ; punch error
bmi perr ; if mi yes, error halt
cmp r0,#lcnt ; enough lines send ?
beq 200$
movb (r1)+,@#pp.buf ; send byte
cmp r1,#bend ; end of buffer ?
blo 100$
mov #bnum+3,r1 ; if yes, increment number
call incnum
inc r0 ; inc line counter
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$: return
;
; data area ------------------------------------------------
;
bnum: .ascii /0000/
btxt: .ascii /: /
.ascii /ABCDEFGHIJKLMNOPQRSTUVWXYZ/
.ascii /abcdefghijklmnopqrstuvwxyz/
.ascii /!@#$%^&*()/
.byte CR,LF
bend:
.end start