mirror of
https://github.com/mgcaret/of816.git
synced 2025-03-13 13:30:04 +00:00
system interface for serial KEY, KEY?, and EMIT
This commit is contained in:
parent
2fcdeec930
commit
2969d1b9cf
@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
cpu_clk = 14000000
|
cpu_clk = 14000000
|
||||||
|
|
||||||
|
; Serial Port Hardware
|
||||||
|
ser_stat = $100009 ; read: b0 set if data waiting, b3 set if still sending data
|
||||||
|
ser_io = $100008 ; read: receive data. write: send data
|
||||||
|
|
||||||
|
|
||||||
.proc _system_interface
|
.proc _system_interface
|
||||||
;wdm 3
|
;wdm 3
|
||||||
phx
|
phx
|
||||||
@ -48,14 +53,29 @@ table: .addr _sf_pre_init
|
|||||||
plx ; get forth SP
|
plx ; get forth SP
|
||||||
jsr _popay ; grab the top item
|
jsr _popay ; grab the top item
|
||||||
phx ; and save new SP
|
phx ; and save new SP
|
||||||
; TODO: interact with the hardware here
|
sep #SHORT_A
|
||||||
|
.a8
|
||||||
|
tya
|
||||||
|
sta f:ser_io
|
||||||
|
: lda f:ser_stat
|
||||||
|
bit #$08
|
||||||
|
bne :-
|
||||||
|
rep #SHORT_A
|
||||||
|
.a16
|
||||||
plx
|
plx
|
||||||
jmp _sf_success
|
jmp _sf_success
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc _sf_keyq
|
.proc _sf_keyq
|
||||||
ldy #$0000 ; anticipate false
|
ldy #$0000 ; anticipate false
|
||||||
; TODO: interact with the hardware here, set y to FFFF if char available
|
sep #SHORT_A
|
||||||
|
.a8
|
||||||
|
lda f:ser_stat ; b0=1 if data ready
|
||||||
|
ror
|
||||||
|
bcc :+
|
||||||
|
iny
|
||||||
|
: rep #SHORT_A
|
||||||
|
.a16
|
||||||
tya
|
tya
|
||||||
plx
|
plx
|
||||||
jsr _pushay
|
jsr _pushay
|
||||||
@ -63,7 +83,16 @@ table: .addr _sf_pre_init
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc _sf_key
|
.proc _sf_key
|
||||||
; TODO: interact with hardware, wait for char, get it into Y
|
sep #SHORT_A
|
||||||
|
.a8
|
||||||
|
: lda f:ser_stat
|
||||||
|
ror
|
||||||
|
bcc :-
|
||||||
|
lda f:ser_io
|
||||||
|
rep #SHORT_A
|
||||||
|
.a16
|
||||||
|
and #$00FF
|
||||||
|
tay
|
||||||
lda #$0000
|
lda #$0000
|
||||||
plx
|
plx
|
||||||
jsr _pushay
|
jsr _pushay
|
||||||
|
Loading…
x
Reference in New Issue
Block a user