mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-26 05:08:06 +11:00
61 lines
1.3 KiB
Z80 Assembly
61 lines
1.3 KiB
Z80 Assembly
( Save ACIA conf )
|
|
ACIA_CTL
|
|
: ACIA_CTL [ LITN ] ;
|
|
ACIA_IO
|
|
: ACIA_IO [ LITN ] ;
|
|
ACIA_MEM
|
|
: ACIA_MEM [ LITN ] ;
|
|
( Memory layout
|
|
+0 ACIAR>
|
|
+2 ACIAW>
|
|
+4 ACIA(
|
|
+6 ACIA)
|
|
)
|
|
|
|
(xentry) ~ACIA
|
|
AF PUSHqq,
|
|
HL PUSHqq,
|
|
DE PUSHqq,
|
|
|
|
( Read our character from ACIA into our BUFIDX )
|
|
ACIA_CTL INAn,
|
|
0x01 ANDn, ( is ACIA rcv buf full? )
|
|
IFNZ,
|
|
( correct interrupt cause )
|
|
( +2 == ACIAW> )
|
|
ACIA_MEM 2+ LDHL(nn),
|
|
( is it == to ACIAR>? )
|
|
( +0 == ACIAR> )
|
|
DE ACIA_MEM LDdd(nn),
|
|
( carry cleared from ANDn above )
|
|
DE SBCHLss,
|
|
IFNZ, ( buffer full? )
|
|
( no, continue )
|
|
DE ADDHLss, ( restore ACIAW> )
|
|
( buffer not full, let's write )
|
|
ACIA_IO INAn,
|
|
(HL) A LDrr,
|
|
|
|
( advance W> )
|
|
HL INCss,
|
|
( +2 == ACIAW> )
|
|
ACIA_MEM 2+ LD(nn)HL,
|
|
( +6 == ACIA) )
|
|
DE ACIA_MEM 6 + LDdd(nn),
|
|
DE SUBHLss,
|
|
IFZ, ( end of buffer reached? )
|
|
( yes )
|
|
( +4 == ACIA( )
|
|
ACIA_MEM 4 + LDHL(nn),
|
|
( +2 == ACIAW> )
|
|
ACIA_MEM 2+ LD(nn)HL,
|
|
THEN,
|
|
THEN,
|
|
THEN,
|
|
|
|
DE POPqq,
|
|
HL POPqq,
|
|
AF POPqq,
|
|
EI,
|
|
RETI,
|