1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 18:08:06 +11:00
collapseos/arch/z80/sms/blk/625
Virgil Dupras 7d568bd782 sms: simplify and solidify ports-related drivers
Add _TRA!, _THA!, _TRB!, _THB! routines to easily handle those pins'
value without stepping on other pins like the drivers previously
did. For SDC driver, it's going to be important soon because it turns
out that I can't get away with "always on" CS, so I'll need a scheme
where it's important that TH/TR pins have stable values.
2020-11-02 18:53:57 -05:00

16 lines
581 B
Plaintext

( Routines for interacting with SMS controller ports.
Requires CPORT_CTL, CPORT_D1 and CPORT_D2 to be defined.
Will usually be 0x3f, 0xdc, 0xdd. )
( mode -- set TR pin on mode a on:
0= output low 1=output high 2=input )
CODE _TRA! HL POP, chkPS, ( B0 -> B4, B1 -> B0 )
L RR, RLA, RLA, RLA, RLA, L RR, RLA,
0x11 ANDi, L A LDrr, CPORT_CTL INAi,
0xee ANDi, L ORr, CPORT_CTL OUTiA,
;CODE
CODE _THA! HL POP, chkPS, ( B0 -> B5, B1 -> B1 )
L RR, RLA, RLA, RLA, RLA, L RR, RLA, RLA,
0x22 ANDi, L A LDrr, CPORT_CTL INAi,
0xdd ANDi, L ORr, CPORT_CTL OUTiA,
;CODE