80-Bus News

  

November–December 1984, Volume 3, Issue 6











Page 40 of 55











out (c),a dec c

nop

out (Cc) ,b out Ce) ,d out Ce) ,b im 2

et

reti

List status

FF if ready

eentst: ld hl,lstin ld a,(hl) ine hh sub Chil) ine a ret Zz 1d a, OFFH ret 3; List output 3; on entry C = character centro: call centst or a je z,centro jd hi ,lstin push hl ld a,(hl) ine hl ine AL add a,l ld l,a jr ne,centrl ine h centri: ld Chl) ,c pop hL ine Chi) id a,(pport) add a, 02 ld e,a ld a,83H out Ce),a

Intercupt service routine

os

wt

a

c

rt

vu

4 ene

Cusersp) ,sp ld sp,iststk push af

push hl

push be

on exit A= 00 if not ready

;Output null

;PIO port A data (strobe/busy) ssettle

;Strobe high

;Strobe low

;8trobe high

;Interrupt mode 2

;Enable interrupts

;Clear spurious interrupts

sLf input pointer – output pointer

sis -1 CFF) then buffer is full 3(1.e. not ready) ;Otherwise return ready

Wait for ready

3 > ;Get input pointer

s;save Input pointer address >

;Get buffer address

;Get next address in buffer

>

,

; ;Store character there seetrlLeve input pointer address s;Increment input pointer

;Get port address

3PIO A control

sEnable PIO A interrupts

3

;Done

jsave user SP suse own stack ;Save regs

, ,

intl:

int2:

ld out dec out dec ld out ld out pop pop pop 1d et reti

equ equ

defb defb

program

eall Ld ld inc or ret ld push call pop jr

end

hl ,lstout a,(hl) (hl)

hl

a,l

l,a ne,intl h

b, (hl) a,(pport) a,02

c,a hl,ilstin a,Chl)

hl

Chl) nz,int2 a,0O3H

Cc) ,a

c

(e),b

c

a, OFDH (c),a

a, OFFH (cc),a

be

hl

af sp,(usersp)

ODH OAH

sOQutput pointer

;Get output pointer

;Point to next

3Get buffer address

;Get address of output characte

3;Get output character 3;Get port address s;PIO A control

;Get pointer address

If input pointer = output pointer

sthen buffer is empty ;Not empty ;Disable PIO A interrupts

3PIO A data

;Output character

;PLO A data (strobe/​busy) Strobe low

Strobe high

Restore regs

s;cestore user SP ;Re-enable interrupts sReturn from interrupt

“This is a test message” ,CR,LF “Test finished” ,CR,LF,O

init RL text a,(hl) hl

a

Z

c,a

hl centro hl loop

start

sPerform initialisation

;Output text string terminated by null

Note HL destroyed by centro

40


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











Page 40 of 55