From f1d4d8e5ca67a34ca49726c875caf8fe9c0f93bd Mon Sep 17 00:00:00 2001 From: mgcaret Date: Tue, 10 Dec 2019 16:03:04 -0800 Subject: [PATCH] Neon816: get some of the hardware support done --- platforms/Neon816/Neon816-hw.inc | 2 +- platforms/Neon816/build.sh | 2 +- platforms/Neon816/platform-lib.s | 148 +++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+), 2 deletions(-) diff --git a/platforms/Neon816/Neon816-hw.inc b/platforms/Neon816/Neon816-hw.inc index 10ccf54..dcb3915 100644 --- a/platforms/Neon816/Neon816-hw.inc +++ b/platforms/Neon816/Neon816-hw.inc @@ -16,7 +16,7 @@ ; 88-8F RAM 2 ; 90-FF Reserved for RAM -cpu_clk = 14000000 +cpu_clk = 12000000 ; ***************** ; Memory regions diff --git a/platforms/Neon816/build.sh b/platforms/Neon816/build.sh index 480bc0e..d968952 100755 --- a/platforms/Neon816/build.sh +++ b/platforms/Neon816/build.sh @@ -3,7 +3,7 @@ set -e -x ca65 -I ../../inc Neon816.s -l Neon816.lst ca65 -I ../../inc romboot.s -l romboot.lst ../../build.sh Neon816 -ld65 -C Neon816.l -S 0x8000 Neon816.o ../../forth.o ./romboot.o -m forth.map -o of816-neon.bin +ld65 -C Neon816.l Neon816.o ../../forth.o ./romboot.o -m forth.map -o of816-neon.bin ls -l of816-neon.bin if which -s bin2hex; then hex2bin of816-neon.bin > of816-neon.hex diff --git a/platforms/Neon816/platform-lib.s b/platforms/Neon816/platform-lib.s index f91b3fc..6d4c836 100644 --- a/platforms/Neon816/platform-lib.s +++ b/platforms/Neon816/platform-lib.s @@ -2,6 +2,142 @@ ; .include "./Neon816-hw.inc" +; Neon816 dictionary, a bit of a different approach than the other ports +; This will get set up by the post init function of the system interface +; The system interface functions are after this dictionary. + +; Note that most of the words are based on words found in NeonFORTH and +; are not subject to the OF816 license terms, but rather any terms that +; Lenore Byron places on them. + +dstart "neon816" +dchain H_FORTH ; Make branch off the word FORTH + +dword PS2K_STORE,"PS2K!" + jsr _popay + tya + sep #SHORT_A + .a8 + sta f:PS2Kio +: lda f:PS2Kstat + bit #$08 + bne :- + rep #SHORT_A + .a16 + NEXT +eword + +dword PS2K_QUERY,"PS2K?" + ldy #$0000 + sep #SHORT_A + .a8 + lda f:PS2Kstat + ror + rep #SHORT_A + .a16 + bcc :+ + dey +: tya + PUSHNEXT +eword + +dword PS2K_FETCH,"PS2K@" + lda #$0000 + sep #SHORT_A + .a8 +: lda f:PS2Kstat + ror + bcc :- + lda f:PS2Kio + rep #SHORT_A + .a16 + tay + lda #$0000 + PUSHNEXT +eword + +dword PS2M_STORE,"PS2M!" + jsr _popay + tya + sep #SHORT_A + .a8 + sta f:PS2Mio +: lda f:PS2Mstat + bit #$08 + bne :- + rep #SHORT_A + .a16 + NEXT +eword + +dword PS2M_QUERY,"PS2M?" + ldy #$0000 + sep #SHORT_A + .a8 + lda f:PS2Mstat + ror + rep #SHORT_A + .a16 + bcc :+ + dey +: tya + PUSHNEXT +eword + +dword PS2M_FETCH,"PS2M@" + lda #$0000 + sep #SHORT_A + .a8 +: lda f:PS2Mstat + ror + bcc :- + lda f:PS2Mio + rep #SHORT_A + .a16 + tay + lda #$0000 + PUSHNEXT +eword + +; this probably isn't fast enough to reliably set micro and milliseconds +dword SETRTC,"SETRTC" + ENTER + ONLIT RTCus + .dword WSTORE + ONLIT RTCms + .dword WSTORE + ONLIT RTCsec + .dword CSTORE + ONLIT RTCmin + .dword CSTORE + ONLIT RTChour + .dword CSTORE + ONLIT RTCday + .dword WSTORE + EXIT +eword + +dword GETRTC,"GETRTC" + ENTER + ONLIT RTCday + .dword WFETCH + ONLIT RTChour + .dword CFETCH + ONLIT RTCmin + .dword CFETCH + ONLIT RTCsec + .dword CFETCH + ONLIT RTCms + .dword WFETCH + ONLIT RTCus + .dword WFETCH + EXIT +eword + +dend + +; and now for the system interface + .proc _system_interface ;wdm 3 phx @@ -53,6 +189,17 @@ table: .addr _sf_pre_init .proc _sf_post_init plx + ; Here we make a vocabulary definition for the neon816 dictionary + ; that we defined at the beginning of this file. + ENTER + ONLIT LAST_neon816 + SLIT "NEON816" + .dword dVOCAB + .dword LAST ; now set the head of the vocabulary to the + .dword drXT ; last word defined in the neon816 dictionary + .dword rBODY + .dword STORE + CODE jmp _sf_success .endproc @@ -134,3 +281,4 @@ list: plx jmp _sf_fail .endproc +