2020-04-04 17:07:35 -04:00
|
|
|
( Save ACIA conf )
|
2020-04-04 10:31:22 -04:00
|
|
|
ACIA_CTL
|
|
|
|
: ACIA_CTL [ LITN ] ;
|
|
|
|
ACIA_IO
|
|
|
|
: ACIA_IO [ LITN ] ;
|
2020-04-11 15:11:36 -04:00
|
|
|
ACIA_MEM
|
|
|
|
: ACIA_MEM [ LITN ] ;
|
|
|
|
( Memory layout
|
|
|
|
+0 ACIAR>
|
|
|
|
+2 ACIAW>
|
|
|
|
+4 ACIA(
|
|
|
|
+6 ACIA)
|
|
|
|
)
|
2020-04-04 10:31:22 -04:00
|
|
|
|
2020-04-11 15:11:36 -04:00
|
|
|
(xentry) ~ACIA
|
2020-04-04 10:31:22 -04:00
|
|
|
AF PUSHqq,
|
|
|
|
HL PUSHqq,
|
|
|
|
DE PUSHqq,
|
|
|
|
|
|
|
|
( Read our character from ACIA into our BUFIDX )
|
|
|
|
ACIA_CTL INAn,
|
|
|
|
0x01 ANDn, ( is ACIA rcv buf full? )
|
|
|
|
JRZ, L2 FWR ( end, no, wrong interrupt cause. )
|
|
|
|
|
2020-04-11 15:11:36 -04:00
|
|
|
( +2 == ACIAW> )
|
|
|
|
ACIA_MEM 2 + LDHL(nn),
|
2020-04-04 10:31:22 -04:00
|
|
|
( is it == to ACIAR>? )
|
2020-04-11 15:11:36 -04:00
|
|
|
( +0 == ACIAR> )
|
|
|
|
DE ACIA_MEM LDdd(nn),
|
2020-04-04 10:31:22 -04:00
|
|
|
( carry cleared from ANDn above )
|
|
|
|
DE SBCHLss,
|
|
|
|
JRZ, L3 FWR ( end, buffer full )
|
|
|
|
|
2020-04-04 17:07:35 -04:00
|
|
|
DE ADDHLss, ( restore ACIAW> )
|
2020-04-04 10:31:22 -04:00
|
|
|
( buffer not full, let's write )
|
|
|
|
ACIA_IO INAn,
|
|
|
|
(HL) A LDrr,
|
|
|
|
|
|
|
|
( advance W> )
|
|
|
|
HL INCss,
|
2020-04-11 15:11:36 -04:00
|
|
|
( +2 == ACIAW> )
|
|
|
|
ACIA_MEM 2 + LD(nn)HL,
|
|
|
|
( +6 == ACIA) )
|
|
|
|
DE ACIA_MEM 6 + LDdd(nn),
|
2020-04-04 10:31:22 -04:00
|
|
|
DE SUBHLss,
|
|
|
|
JRNZ, L4 FWR ( skip )
|
|
|
|
( end of buffer reached )
|
2020-04-11 15:11:36 -04:00
|
|
|
( +4 == ACIA( )
|
|
|
|
ACIA_MEM 4 + LDHL(nn),
|
|
|
|
( +2 == ACIAW> )
|
|
|
|
ACIA_MEM 2 + LD(nn)HL,
|
2020-04-04 10:31:22 -04:00
|
|
|
L4 FSET ( skip )
|
|
|
|
L3 FSET L2 FSET ( end )
|
|
|
|
|
|
|
|
DE POPqq,
|
|
|
|
HL POPqq,
|
|
|
|
AF POPqq,
|
|
|
|
EI,
|
|
|
|
RETI,
|