2019-11-21 02:22:11 +00:00
|
|
|
; Platform support library for Neon816
|
|
|
|
;
|
2019-12-01 08:41:06 +00:00
|
|
|
.include "./Neon816-hw.inc"
|
2019-12-01 03:08:45 +00:00
|
|
|
|
2019-11-21 02:22:11 +00:00
|
|
|
.proc _system_interface
|
|
|
|
;wdm 3
|
|
|
|
phx
|
|
|
|
asl
|
|
|
|
tax
|
2019-12-05 05:18:42 +00:00
|
|
|
jmp (.loword(table),x)
|
2019-11-21 02:22:11 +00:00
|
|
|
table: .addr _sf_pre_init
|
|
|
|
.addr _sf_post_init
|
|
|
|
.addr _sf_emit
|
|
|
|
.addr _sf_keyq
|
|
|
|
.addr _sf_key
|
|
|
|
.addr _sf_fcode
|
|
|
|
.addr _sf_reset_all
|
|
|
|
.endproc
|
|
|
|
.export _system_interface
|
|
|
|
|
|
|
|
.proc _sf_success
|
|
|
|
lda #$0000
|
|
|
|
tay
|
|
|
|
clc
|
|
|
|
rtl
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
.proc _sf_fail
|
|
|
|
ldy #.loword(-21)
|
|
|
|
lda #.hiword(-21)
|
|
|
|
sec
|
|
|
|
rtl
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
|
|
|
|
.proc _sf_pre_init
|
2019-12-05 05:18:42 +00:00
|
|
|
; NeonFORTH does this, presumably to initialize the serial port
|
|
|
|
sep #SHORT_A
|
|
|
|
.a8
|
|
|
|
lda #$8D
|
|
|
|
sta f:SERctrlA
|
|
|
|
lda #$06
|
|
|
|
sta f:SERctrlB
|
|
|
|
lda #$00
|
|
|
|
sta f:SERctrlC
|
|
|
|
rep #SHORT_A
|
|
|
|
.a16
|
2019-11-21 02:22:11 +00:00
|
|
|
plx
|
2019-12-05 05:18:42 +00:00
|
|
|
jmp _sf_success
|
2019-11-21 02:22:11 +00:00
|
|
|
.endproc
|
|
|
|
|
|
|
|
.proc _sf_post_init
|
|
|
|
plx
|
|
|
|
jmp _sf_success
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
.proc _sf_emit
|
|
|
|
plx ; get forth SP
|
|
|
|
jsr _popay ; grab the top item
|
|
|
|
phx ; and save new SP
|
2019-12-01 03:08:45 +00:00
|
|
|
sep #SHORT_A
|
|
|
|
.a8
|
|
|
|
tya
|
2019-12-01 08:41:06 +00:00
|
|
|
sta f:SERio
|
|
|
|
: lda f:SERstat
|
2019-12-01 03:08:45 +00:00
|
|
|
bit #$08
|
|
|
|
bne :-
|
|
|
|
rep #SHORT_A
|
|
|
|
.a16
|
2019-11-21 02:22:11 +00:00
|
|
|
plx
|
|
|
|
jmp _sf_success
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
.proc _sf_keyq
|
|
|
|
ldy #$0000 ; anticipate false
|
2019-12-01 03:08:45 +00:00
|
|
|
sep #SHORT_A
|
|
|
|
.a8
|
2019-12-01 08:41:06 +00:00
|
|
|
lda f:SERstat ; b0=1 if data ready
|
2019-12-01 03:08:45 +00:00
|
|
|
ror
|
|
|
|
bcc :+
|
|
|
|
iny
|
|
|
|
: rep #SHORT_A
|
|
|
|
.a16
|
2019-11-21 02:22:11 +00:00
|
|
|
tya
|
|
|
|
plx
|
|
|
|
jsr _pushay
|
|
|
|
jmp _sf_success
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
.proc _sf_key
|
2019-12-01 03:08:45 +00:00
|
|
|
sep #SHORT_A
|
|
|
|
.a8
|
2019-12-01 08:41:06 +00:00
|
|
|
: lda f:SERstat
|
2019-12-01 03:08:45 +00:00
|
|
|
ror
|
|
|
|
bcc :-
|
2019-12-01 08:41:06 +00:00
|
|
|
lda f:SERio
|
2019-12-01 03:08:45 +00:00
|
|
|
rep #SHORT_A
|
|
|
|
.a16
|
|
|
|
and #$00FF
|
|
|
|
tay
|
2019-11-21 02:22:11 +00:00
|
|
|
lda #$0000
|
|
|
|
plx
|
|
|
|
jsr _pushay
|
|
|
|
jmp _sf_success
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
.proc _sf_fcode
|
|
|
|
.if include_fcode
|
|
|
|
ldy #.loword(list)
|
|
|
|
lda #.hiword(list)
|
|
|
|
.else
|
|
|
|
lda #$0000
|
|
|
|
tay
|
|
|
|
.endif
|
|
|
|
plx
|
|
|
|
jsr _pushay
|
|
|
|
jmp _sf_success
|
|
|
|
.if include_fcode
|
|
|
|
list:
|
|
|
|
.dword 0
|
|
|
|
.endif
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
; TODO....
|
|
|
|
.proc _sf_reset_all
|
|
|
|
plx
|
|
|
|
jmp _sf_fail
|
|
|
|
.endproc
|