1
0
mirror of https://github.com/livingcomputermuseum/UniBone.git synced 2026-01-29 05:01:09 +00:00

PDP-11 test program for concurrent INTR/DMA

Serial, Clock, RL02, RK05, MSCP
This commit is contained in:
Joerg Hoppe
2019-08-19 12:57:18 +02:00
parent 8ff33a0be1
commit e2229871de
8 changed files with 553 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
.title ma_cons - Serial Console I/O
corvec= 060 ; vector for Receiver
coxvec= 064 ; vector for Xmitter
corbas= 777560 ; base addr of Receiver
coxbas= 777564 ; base addr of Xmitter
; -- ISRs, increment Interrupt FLags
corifl: .word 1 ; Interrupt flags
coxifl: .word 1
corbuf: .blkw 1 ; data buffer
coxbuf: .blkw 1
corisr:
mov @#corbas+2,corbuf ; read char, clear INTR
inc corifl
rti
coxisr:
inc coxifl
rti
; -- Initialize device after RESET
corini:
mov #100,@#corbas ; Bit 6 = Receiver Interrupt Enable
clr corifl
return
coxini:
mov #100,@#coxbas ; Bit 6 = Transmitter Interrupt Enable
clr coxifl
return
; -------- Console I/O --------
; puts - print a string
; r1 = pointer, r0,r1 changed
puts:
movb (r1)+,r0 ; load xmt char
beq 1$ ; string ends with 0
call @#putc
br puts ; transmit nxt char of string
1$: return
; putnum - print the octal number in r0
numbf0: .blkw 10 ; space to mount number string
numbf1 =.
putnum:
mov r3,-(sp)
mov r0,r2 ; r2 = shifter
mov #numbf1,r1 ; r1 = buffer pointer, backwards
movb #0,-(r1) ; set terminating 0
; repeat 6 times
mov #6,r3
1$:
mov r2,r0
; extract lower 3 bits = octal digit
bic #177770,r0 ; r0 &= 0x07
add #60,r0 ; r0 += '0'
movb r0,-(r1) ; write in buffer
clc
asr r2 ; shift to next digit
asr r2
asr r2
sob r3,1$ ; loop for all 6 digits
call @#puts
mov (sp)+,r3
return
; putc - output a single char
; r0 = char
putc:
clr coxifl ; reset interrupt flag
mov r0,@#coxbas+2 ; char into transmit buffer
1$: tst coxifl ; XMT RDY?
beq 1$ ; no, loop
; UART is buffering: char only started to sent now
; interrupt active until next putc
return
; getc - poll and input a single char
; result in r0
; carry clear : nothing received
; carry set: char received
getc:
clr r0
tst corifl
bne 1$
clc ; Carry clear, no Interrupt, nothing received
return
1$:
mov corbuf,r0 ; Interrupt, return char
clr corifl ; reset interrupt flag
sec ; Carry Set
return

View File

@@ -0,0 +1,29 @@
.title ma_kw - KW11 test driver
; KW11 raises INTR at 50 Hz
kwvect = 100 ; vector of KW11 line clock
kwbase = 777546 ; base addr of KW11 register
kwlabl = 'W ; label char
; --- ISRs, increment Interrupt FLags
kwiflg: .word 1 ; Interrupt flags
kwecnt: .word 1 ; event counter
kwisr:
inc kwecnt ; register as event
inc kwiflg ; set ISR flag
rti
; --- Initialize device after RESET
kwinit:
mov #100,@#kwbase ; set interrupt enable
clr kwecnt
return
; --- Restart new INTR
kwgo:
return

View File

@@ -0,0 +1,34 @@
.title ma_rk - RK11/RK05 test driver
; RK11 DMA is generated by reading cylinder 0, head 0, sector 0
rkvect = 220 ; vector of RK11 controller
rkbase = 777400 ; base addr of RK11 controller
rklabl = 'K ; label char
; --- ISRs, increment Interrupt FLags
rkiflg: .word 1 ; Interrupt flags
rkbuff: .blkw 400+1 ; data buffer: 1 sector = 256 words
rkecnt: .word 1 ; event counter
rkisr:
inc rkiflg ; set ISR flag
rti
; --- Initialize device after RESET
rkinit:
clr rkecnt
return
; --- Restart new DMA transmission
rkgo:
; read first sector into rkbuff
clr @#rkbase+12 ; DA disk address = 0: unit 0, cyl/hd/sec=0
mov #rkbuff,@#rkbase+10 ; BA bus address of DMA
mov #-400,@#rkbase+6 ; WC word count = 256 words
mov #100+4+1,@#rkbase+4 ; Command INT ENABLE + "READ" + GO
inc rkecnt ; register as event
return

View File

@@ -0,0 +1,56 @@
.title ma_rl - RL11/RL01/2 test driver
; RL11 DMA is generated by reading cylinder 0, head0, sector 0
rlvect = 160 ; vector of RL11 controller
rlbase = 774400 ; base addr of RL11 controller
rllabl = 'L ; label char
; --- ISRs, increment Interrupt FLags
rliflg: .word 1 ; Interrupt flags
rlbuff: .blkw 2*400+1 ; data buffer: 2 sector = 256 words
rlecnt: .word 1 ; event counter
rlisr:
inc rliflg ; set ISR flag
rti
; --- Initialize device after RESET
rlinit:
clr rlecnt
return
; --- Restart new DMA transmission
rlgo:
mov #rlbase,r1 ; r1 = controller base address
; sequence from boot loader 23-751A9, lot of testing
; 1. get status
mov #013,4(r1) ; DA subcmd reset+getstatus
mov #4,(r1) ; CSR do "GET STATUS"
1$: tstb (r1) ; test for ready
bpl 1$ ; wait
; 2. read current track
mov #10,(r1) ; CSR read header cmd
2$: tstb (r1) ; test for ready
bpl 2$ ; wait
; 3. seek
mov 6(r1),r2 ; MP retrieve cyl/head/sector
bic #77,r2 ; set sector to zero
inc r2 ; set seek flag, head 0, seek to cyl 0
mov r2,4(r1) ; DA for seek
mov #6,(r1) ; CSR seek cmd
3$: tstb (r1) ; test for ready
bpl 3$ ; wait
; 4. read sector 0+1 and interrupt
mov #rlbuff,2(r1) ; BA bus address of DMA
clr 4(r1) ; DA select cyl0/head0/sector0
mov #-512.,6(r1) ; MP set word count
mov #100+14,(r1) ; CSR read data cmd with Interrupt Enable
inc rlecnt ; register as event
return

View File

@@ -0,0 +1,88 @@
.title ma_ry - RX211/RX02 test driver
; RX11 DMA is generated by reading cylinder 0, head 0, sector 0
ryvect = 264 ; vector of RX211 controller
rybase = 777170 ; base addr of RX211 controller
rylabl = 'Y ; label char
rydens = 400 ; bit 8 in CSR determines density. 400 or 0
; --- ISRs, increment Interrupt FLags
ryiflg: .word 1 ; Interrupt flags
rybuff: .blkw 200+1 ; data buffer: 1 sector = 256 bytes = 128 words for double dens
ryecnt: .word 1 ; event counter
ryphas: .word 1 ; 0 = ISR after "Read sector", 1 = ISR after DMA
ryisr:
tst ryphas
bne ryisr1
; Phase = 0
; RX211 ISR triggered when data in controller buffer
; initiate command to DMA data into buffer, then INTR again
mov r1,-(sp) ; push
mov #rybase,r1 ; r1 = controller base address
; 1. Command "Empty buffer"
mov #rydens+100+2+1,(r1) ; Density, Intr enable + Empty Buffer + GO
1$: tstb (r1) ; wait for TR
bpl 1$
; 2. Word Count
.if ne rydens
mov #200,2(r1) ; double density: 128 words
.endc
.if eq rydens
mov #100,2(r1) ; single density: 64 words
.endc
2$: tstb (r1) ; wait for TR
bpl 2$
; 3. Bus Address
mov #rybuff,2(r1)
; now starting
mov (sp)+,r1 ; pop
inc ryphas
rti
ryisr1:
; Phase = 1
; RX211 ISR triggered on "DMA ready"
inc ryiflg ; set ISR flag after DMA
rti
; --- Initialize device after RESET
ryinit:
mov #rybase,r1 ; r1 = controller base address
mov #rydens+40000,(r1) ; init
1$:
bit #40,@#rybase
beq 1$ ; wait for "done"
clr ryecnt
return
; --- Restart new DMA transmission
rygo:
clr ryphas ; Start with ISR Phase = 0
mov #rybase,r1 ; r1 = controller base address
; sequence from RX02 Floppy Disk System User's Guide (July 1978, EK-RX02-UG-001)
; 1. command "read sector"
mov #rydens+100+6+1,(r1) ; Density, Intr enable + Read Sector + GO
1$: tstb (r1) ; wait for TR
bpl 1$
; 2. sector address into RX2DB
mov #1,2(r1) ; read sector 1
2$: tstb (r1) ; wait for TR
bpl 2$
; 3. track address into RX2DB
mov #0,2(r1)
; now starting
inc ryecnt ; register as event
return

View File

@@ -0,0 +1,17 @@
.title ma_strings - String constants
shello:
.byte 15,12 ; space, CR, LF,
.ascii /*** Multi Device Interrupt&DMA test ***/
.byte 15,12 ; CR, LF
.ascii /^C to stop./
.byte 15,12 ; CR, LF
.byte 0
sbye:
.byte 15,12
.ascii /Good Bye!/
.byte 15,12 ; CR, LF
.byte 0

View File

@@ -0,0 +1,200 @@
.title Multi Arbitration DMA/INTR test
; *************************************************
; Exercises several devices in parallel,
; each with INTR and DMA
; For a device XX we have
; XXENAB - flag to enable devcie
; XXBASE - base address of devcie
; XXVEC - the INTR vector
; XXISR - Interrupt Service
; XXIFLG - flag which is incremented in ISR
; XXBUF - data buffer for DMA transfer
; XXINIT - Initialize device after RESET
; XXGO - subroutine to initiate DMA and INTR
; XXECNT - event counter, indicates activity
; XXLABL - single char label to print activity
;
; Devices are
; CO - serial console
; RK - RK11/RK05 disk
; RL - RL11/RL02 disk
; RY - Serial RX211 Floppy,
; enable tests
kwenab = 1
rkenab = 0
rlenab = 0
ryenab = 0
.enable AMA
.asect
; *************************************************
; Vectors
. = corvec
.word corisr ; RCV interrupt
.word 340
. = coxvec
.word coxisr ; XMT interrupt
.word 340
.if ne kwenab
. = kwvect
.word kwisr ; periodic interrupt
.word 340
.endc
.if ne rlenab
. = rlvect ; RL11
.word rlisr
.word 340
.endc
.if ne rkenab
. = rkvect ; RK11
.word rkisr
.word 340
.endc
.if ne ryenab
. = ryvect ; RX211
.word ryisr
.word 340
.endc
psw = 177776
monitr = 165020 ; Monitor addr for back jump
; *************************************************
; Main
. = 1000
stack = .-2
start:
mov #stack,sp
clr @#psw ; priorty level 0, allow INTR
; Initialize devices
reset
call corini
call coxini
.if ne kwenab
call kwinit
.endc
.if ne rkenab
call rkinit
.endc
.if ne rlenab
call rlinit
.endc
.if ne ryenab
call ryinit
.endc
mov #shello,r1 ; Print "Hello" message
call puts
; main loop: check interrupt flags, restart DMA
; process serial input
loop:
call dokbd ; check keyboard input
call dodev ; check device activities
br loop
; --- check keyboard input
dokbd:
call getc
bcc 9$ ; nothing received
; process char in r0
cmpb r0,#3
bne 1$
mov #sbye,r1 ; ^C: print "Bye", back to monitor
call puts
jmp monitr
1$:
; echo chars without special meaning
call putc
9$:
return
; -- check device activities
dodev:
; For all devices: restart device DMA if Interrupt received
.if ne kwenab
tst kwiflg
beq 1$
clr kwiflg
call kwgo
mov #kwlabl,r0 ; progress printout
mov #kwecnt,r1
call progrs
1$:
.endc
.if ne rkenab
tst rkiflg
beq 2$
clr rkiflg
call rkgo
mov #rklabl,r0 ; progress printout
mov #rkecnt,r1
call progrs
2$:
.endc
.if ne rlenab
tst rliflg
beq 3$
clr rliflg
call rlgo
mov #rllabl,r0 ; progress printout
mov #rlecnt,r1
call progrs
3$:
.endc
.if ne ryenab
tst ryiflg
beq 4$
clr ryiflg
call rygo
mov #rylabl,r0 ; progress printout
mov #ryecnt,r1
call progrs
4$:
.endc
return
; progress
; check if the counter with address in r1 is at
; 1024. if yes, print the char in r0
progrs:
bic #776000,(r1) ; mask counter to 0..1023
bne 9$
call putc ; is at 0: print label character
9$:
return
.include ma_cons.mac
.if ne kwenab
.include ma_kw.mac
.endc
.if ne rkenab
.include ma_rk.mac
.endc
.if ne rlenab
.include ma_rl.mac
.endc
.if ne ryenab
.include ma_ry.mac
.endc
.include ma_strings.mac
.end

View File

@@ -0,0 +1,25 @@
; UNIBUS machine to verify "multi arbitration" test program
; To run under PDP11GUI
; for all devices:
; unit 0 is attached to an empty scratch disk
set cpu 11/34
set cpu hist=100
set throttle 2m
set clk 50hz
set rl enabled
set rl0 rl02
attach rl0 scratch.rl02
set rk enabled
attach rk0 scratch.rk05
set rx disabled
set ry enabled
set ry0 double
attach ry0 scratch.rx02_dd
# PDP11GUI
set stdio telnet=23