80-Bus News

  

September–October 1984, Volume 3, Issue 5











Page 18 of 47











inc a 5 jr pr6 ; Compress first blank pra: ld a,80h 3; Subtract 1 from Spare prs: push af call sparem pop af $ Test for end of buffer ine de 1d hyd ld l,e ora sbe hl,be jr nz,pr6 ld de,stk ; Set to 3 Store character in buffer ld (de),a to Waiting call waitp pop hl pop af ; Do not reti

Not too many so increment ascdec:

nt zero:

start

; Add l prs:

enable interrupts wfin: wfin2:

3 *e**kk ARITHMETIC ROUTINES ****% 3; Add 1 to chars spare 5 sparep: push hl

ld hl,spare ld a,(hl)

ep wo

jr nz,gotdig 1d (hl) ,"1" pop hl

ret

cp "9"

jr onz,not9 ld (h1),"0" dec hl ; jr ascine ine a

ld C(hi),a pop hl ret

sparem:

ascine:

sn O

ut: gotdig:

out:

nots: outl:

3; Add 1 waltp:

to chars waiting push hi

ld hl wait

jr ascine

out2:

; Subtract 1 from chars waiting waitm: push hl

ld hl,wait ascsub: push hi

ld a,(hl) cp Ngit

jr nz,ntzero ld (hl) ,"9" dec hil

jv asedec dec a

ld Chl),a ep Hot

qv onz,wfin dec hl

ld a," " ep (hl)

jr nz,wfin ine hl

ld (hl),a pop hl

ep (hl)

jr nz,wfin2 ld (hl) ,"0" pop hi

ret

pop hi

pop hl

ret

outa:

out2b:

out:

; Subtract 1 from chars spare

push hl ld hl,spare ir ascsub

RRAKK OUTPUT ROUTINE **%&x Output character to printer

or a

push af

ip pe,outd 3 xor 80h

Make parity even

; Decide if interrupts enabled while waiting

push af 3 ld a,(spare-1) ; cp ont

jv nz,out2

ld a,(spare)

ep fg"

jr z,out4

ei ; Enable interrupts if cent

xor a ; Show printer not busy out (pdl),a

ld a,3 3; Allow time for host to realise (assume tight loop)

Low level I/0 routine Test if any spare

dec a

dr nz,out2a ld a,Olh out (pdl),a ld a,20

dec a

jr nz,out2b endif

in a,(uarth) bit 4,a

di

jr z,outl

in a,(uarts) bit 5,a

jr z,outl pop af

out (uartd),a pop af

ret

end

on

>

Show printer busy again

Allow plenty of time for host to send dat

Test handshake Test CTS

Disable interrupts See if free yet Wait until free

Output data

18


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











Page 18 of 47