1
0
mirror of https://github.com/wfjm/w11.git synced 2026-01-26 04:21:05 +00:00

pc11_buf: buffered PC11; add lp11,pc11 mcodes

This commit is contained in:
wfjm
2019-04-24 12:59:58 +02:00
parent 544f1c99d2
commit 785016763f
33 changed files with 2666 additions and 65 deletions

View File

@@ -3,4 +3,6 @@ This directory tree contains **miscellaneous codes** and is organized in
| Directory | Content |
| --------- | ------- |
| [dl11](dl11) | for DL11 |
| [lp11](lp11) | for LP11 |
| [pc11](pc11) | for PC11 |
| [sys](sys) | for whole system |

View File

@@ -0,0 +1,5 @@
This directory tree contains **LP11 test codes** and contains
| File | Docu | Comments |
| --------- | --------- | ------- |
| [lp11write.mac](lp11write.mac) | - | write test for LP11 |

View File

@@ -0,0 +1,112 @@
; $Id: lp11write.mac 1134 2019-04-21 17:18:03Z mueller $
; Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
; 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_lp.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..lp
.word vh.lp
.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 @#lp.csr ; wait printer 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 #lp.ie,@#lp.csr ; start printer
spl 0 ; allow interrupts
3$: wait ; and idle
br 3$
;
; printer interrupt handler -----------------------
;
vh.lp: tst @#lp.csr ; printer offline ?
bmi perr ; if mi yes, error halt
1$: movb (r1)+,@#lp.buf ; send byte
cmp r1,#bend ; end of buffer ?
bhis 100$ ; if his yes, handle new line
tstb @#lp.csr ; ready for next char
bmi 1$ ; if mi yes, doit
rti ; else quit irupt
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
rti
200$: jmp stop
perr: halt ; printer 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

31
tools/mcode/pc11/Makefile Normal file
View File

@@ -0,0 +1,31 @@
# $Id: Makefile 1135 2019-04-23 12:56:23Z mueller $
#
# Revision History:
# Date Rev Version Comment
# 2013-03-22 496 1.0 Initial version
#---
#
MAC_all = $(wildcard *.mac)
LDA_all = $(MAC_all:.mac=.lda)
COF_all = $(MAC_all:.mac=.cof)
LST_all = $(MAC_all:.mac=.lst)
#
include ${RETROBASE}/tools/make/generic_asm11.mk
#
.PHONY : alllda allcof alllst clean
#
def : alllda
#
alllda : $(LDA_all)
#
allcof : $(COF_all)
#
alllst : $(LST_all)
#
clean :
@ rm -f $(LDA_all)
@ echo "Object files removed"
@ rm -f $(COF_all)
@ echo "Compound files removed"
@ rm -f $(LST_all)
@ echo "Listing files removed"

View File

@@ -0,0 +1,7 @@
This directory tree contains **PC11 test codes** and contains
| File | Docu | Comments |
| --------- | --------- | ------- |
| [pc11copy.mac](pc11copy.mac) | - | copy test for PC11 |
| [pc11read.mac](pc11read.mac) | - | read test for PC11 |
| [pc11write.mac](pc11write.mac) | - | write test for PC11 |

View File

@@ -0,0 +1,139 @@
; $Id: pc11copy.mac 1136 2019-04-24 09:27:28Z mueller $
; Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
; License disclaimer see License.txt in $RETROBASE directory
;
; Revision History:
; Date Rev Version Comment
; 2019-04-21 1134 1.0 Initial version
;
; copy input to output tape
;
; definitions ----------------------------------------------
;
.include |lib/defs_cpu.mac|
.include |lib/defs_pc.mac|
bsize = 256.
;
; vector area ----------------------------------------------
;
.include |lib/vec_cpucatch.mac|
.include |lib/vec_devcatch.mac|
. = v..ptr
.word vh.ptr
.word cp.pr7
. = v..ptp
.word vh.ptp
.word cp.pr7
;
; stack area -----------------------------------------------
;
. = 1000 ; stack (below); code (above)
stack:
;
; code area ------------------------------------------------
;
; all context is in 6 register
; r0 bytes read ; !! visible in wait !!
; r1 bytes written
; r2 bytes in buffer
; r3 eof seen flag
; r4 ring buffer write pointer
; r5 ring buffer read pointer
;
; start/stop area ---------------------------------
;
start: br start1
stop: halt ; sucessfull stop
reset ; and allow re-start
;
; main program ------------------------------------
;
start1: mov #stack,sp ; setup stack
1$: tst @#pr.csr ; wait reader online
bmi 1$
2$: tst @#pp.csr ; wait punch online
bmi 2$
;
mov #buf,r4 ; setup wptr
mov #buf,r5 ; setup rptr
clr r2 ; clear cnt
clr r3 ; clear eof
clr r0 ; clear rcnt
clr r1 ; clear wcnt
;
mov #<pr.ie!pr.ena>,@#pr.csr ; start reader
spl 0 ; allow interrupts
3$: wait ; and idle
br 3$
;
; reader interrupt handler ------------------------
;
vh.ptr: tst @#pr.csr ; at eof ?
bmi 100$ ; if mi yes, stop reader
tstb @#pr.csr ; done ?
bpl rerr ; if pl no, error halt
movb @#pr.buf,(r4)+ ; write char to buffer
inc r0 ; inc rcnt
cmp r4,#bufe ; wrap ?
blo 1$
mov #buf,r4
1$: tst r2 ; test buffer count
bne 2$ ; was buffer empty ?
bis #pp.ie,@#pp.csr ; then start punch
2$: inc r2 ; inc cnt
cmp r2,#<bsize-2> ; still space in buffer ?
bge 200$ ; no: stop reader
inc @#pr.csr ; yes: else request next
rti
100$: inc r3 ; set eof flag
tst r2 ; any chars pending ?
beq 300$ ; if eq not, all done
rti
200$: bic #pr.ie,@#pr.csr ; stop reader
rti
300$: jmp stop
rerr: halt ; reader error halt
br rerr
;
; puncher interrupt handler -----------------------
;
vh.ptp: tst @#pp.csr ; punch error
bmi perr ; if mi yes, error halt
tstb @#pp.csr ; ready ?
bpl perr ; if pl no, error halt
tst r2 ; test buffer count
beq 100$ ; if eq suspend or stop
movb (r5)+,@#pp.buf ; and punch next char
inc r1 ; inc wcnt
cmp r5,#bufe ; wrap ?
blo 1$
mov #buf,r5
1$: dec r2 ; dec cnt
bit #pr.ie,@#pr.csr ; reader active ?
bne 2$ ;
mov #<pr.ie!pr.ena>,@#pr.csr ; if not, start reader
2$: rti
100$: bic #pp.ie,@#pp.csr ; stop punch
tstb r3 ; eof seen ?
bne 200$ ; if yes, all done
rti
200$: jmp stop
perr: halt ; puncher error halt
br perr
;
; data area ------------------------------------------------
;
buf: .blkb bsize
bufe:
.end start

View File

@@ -0,0 +1,118 @@
; $Id: pc11read.mac 1134 2019-04-21 17:18:03Z mueller $
; Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
; 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..ptr
.word vh.ptr
.word cp.pr7
;
; stack area -----------------------------------------------
;
. = 1000 ; stack (below); code (above)
stack:
;
; code area ------------------------------------------------
;
; gobal register usage
; r0 line count ; !! visible in wait !!
; r1 read 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 @#pr.csr ; wait reader online
bmi 2$
;
clr r0 ; clear line count
mov #bnum,r1 ; read buffer pointer
clr r2
clr r3
clr r4
clr r5
mov #"00,bnum
mov #"00,bnum+2
;
mov #<pr.ie!pr.ena>,@#pr.csr ; start reader
spl 0 ; allow interrupts
3$: wait ; and idle
br 3$
;
; reader interrupt handler -----------------------
;
vh.ptr: tst @#pr.csr ; reader error
bpl 10$
cmp #bnum,r1 ; at begin of buffer ?
bne rerr ; if not, unexpected EOT
cmp r0,#lcnt ; all lines seen ?
bne rerr ; if not, unexpected EOT
br 200$ ; otherwise success halt
10$: movb @#pr.buf,r2 ; read byte
cmpb r2,(r1)+ ; check byte
bne derr
cmp r1,#bend ; end of buffer ?
blo 100$
mov #bnum+3,r1 ; if yes, increment number
jsr pc,incnum
inc r0 ; inc line counter
mov #bnum,r1 ; ready for next line
100$: inc @#pr.csr ; go for next char
rti
200$: jmp stop
rerr: halt ; reader error halt
br rerr
derr: halt ; data error halt
br derr
;
; 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

View File

@@ -0,0 +1,108 @@
; $Id: pc11write.mac 1134 2019-04-21 17:18:03Z mueller $
; Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
; 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