80-Bus News

  

September–October 1984, Volume 3, Issue 5











Page 17 of 47











3; If “!” hale for debug

yin8:

weg

cp fronz,yind halt

; If “R” handshake (not usually needed)

yind:

No input from keyboard

if cent jr tin else

ep WR

jr nz,tin in a,(pd2) jr tinx endif

>

Does not apply unless host uses interrupt lines

3 3 Test if chars are waiting

noin:

Id a,(wait-1) ep mt ott

jr nz,n6

ld a,(wait) ep Hon

jr nz,n6

; None waiting, so test if some spare

: Still

n4a:

ndb:

xor a push af

ld a,(spare-1) cp won

jr nz,n4

ld a,(spare) ep tou

jr z,n5

some spare so allow PIO input

if cent ei

xor a

out (pdi),a ld a,3 dec a

4r nz,n4a 1d a,Olh out (pdl),a ld a,20 dec a

jr nz,n4b di

else

ei

nop

nop

di

endif

pop af dec a

jr onz,n3 qr tinx

Enable interrupts

Show printer not busy

Allow time for host to realise (assume tight loop)

Show printer busy again

Allow plenty of time for host to send data

Disable interrupts

Enable interrupts

Disable interrupts

Loop

; Some waiting, so test if halted

n6: ld a,(headh)

won,

cp jr nz,n2

3 Chars are waiting for output

ld a,(hl) 5; Decompress spaces bit 7,a jr z,p4 ep 80h jr z,p3 dec (hi) ld a,” “ ir p6e p3: ld a,” “ ld (hl),a 3 Add 1 to Spare p4: push af call sparep pop af

3; Test for end of buffer

inc hl

or a

sbe hil,be add hl,be jr nz,p6 ld hi,stk

3; Subtract 1 from Waiting

pe: push af call waitm pop af

; Call output routine

call out jr tinx

>

Includes EI/DI

3 ***kkk INTERRUPT HANDLING INPUT ROUTINE ***%*

procl: push af push hl if cent id a,Oih out (pdl),a endif in a,(pd2) and 07fh ep woe ir nz,pr5 ; Compress blanks ld a,(de) bit 7,a jr z,pr4 ep Offh jv z,pr4

en om oe

Set port A bit 0 to show busy

Get data Strip parity Check for blank

Character in buffer Test for first blank

Test for too many blanks

17


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 17 of 47