From e73066a53f2061480ca8c6c3c1000b7e31a11d1a Mon Sep 17 00:00:00 2001 From: mgcaret Date: Sun, 1 Dec 2019 00:41:06 -0800 Subject: [PATCH] Neon816: hardware equates include file --- platforms/Neon816/Neon816-hw.inc | 79 ++++++++++++++++++++++++++++++++ platforms/Neon816/Neon816.s | 9 ++-- platforms/Neon816/platform-lib.s | 18 +++----- 3 files changed, 90 insertions(+), 16 deletions(-) create mode 100644 platforms/Neon816/Neon816-hw.inc diff --git a/platforms/Neon816/Neon816-hw.inc b/platforms/Neon816/Neon816-hw.inc new file mode 100644 index 0000000..56dcd88 --- /dev/null +++ b/platforms/Neon816/Neon816-hw.inc @@ -0,0 +1,79 @@ + +cpu_clk = 14000000 + +; ***************** +; MMU +; ***************** + +NeonMMU = $080000 + +; ***************** +; I/O Ports +; +; Generally for the status ports, unless otherwise stated +; b3 = transmit buffer full (output is busy) +; b0 = receive buffer full (input is ready) +; ***************** + +SERio = $100008 +SERstat = $100009 +; Presumably baud and line setup +SERctrlA = $10000A ; NeonForth sets this to $8D +SERctrlB = $10000B ; ditto $06 +SERctrlC = $10000C ; ditto $00 + +; MIDI ports +MIDIio = $100020 +MIDIstat = $100021 + +; PS/2 Keyboard Port +PS2Kio = $100022 +PS2Kstat = $100023 + +; PS/2 Mouse Port +PS2Mio = $100024 +PS2Mstat = $100025 + +; ***************** +; RTC +; ***************** + +RTCus = $100100 ; 2 bytes +RTCms = $100102 ; 2 bytes +RTCsec = $100104 ; 1 byte +RTCmin = $100105 ; 1 byte +RTChour = $100106 ; 1 byte +RTCday = $100108 ; 2 bytes + +; ***************** +; I2C +; ***************** + +I2C2io = $100014 +I2C2ctrl = $100015 ; read: b3 = busy; write: $01 = start, $02 = stop, $04 = receive, $08 = send, $44 = receive/ack + +; ***************** +; SPI +; ***************** + +SPI2io = $10001C +SPI2ctrl = $10001D ; read: b3 = tx busy, b2 = rx full; write: $01 = start, $00 = stop; init = $00 +SPI2ctrl2 = $10001E ; init = $00 +SPI2ctrl3 = $10001F ; init = $05 + + +; ***************** +; VDC +; ***************** + +VDCio = $100120 ; read: 1 byte, write: 1 or 2 bytes + +; ***************** +; FDC +; ***************** + +FDCio = $090004 +FDCstat = $090005 ; b7=0 = tx busy + + + diff --git a/platforms/Neon816/Neon816.s b/platforms/Neon816/Neon816.s index f25bcdc..a205b0d 100644 --- a/platforms/Neon816/Neon816.s +++ b/platforms/Neon816/Neon816.s @@ -2,6 +2,7 @@ .a16 .i16 .include "macros.inc" +.include "./Neon816-hw.inc" .import _Forth_initialize .import _Forth_ui .import _system_interface @@ -34,7 +35,7 @@ ; MMU setup, maybe. Found at page $FF in Neon bank 0 ldx #$001C lda #$8000 -: sta f:$080000,x +: sta f:NeonMMU,x dex dex bpl :- @@ -42,11 +43,11 @@ sep #SHORT_A ; not necessary unless we were already native & long .a8 lda #$8D - sta f:$10000A + sta f:SERctrlA lda #$06 - sta f:$10000B + sta f:SERctrlB lda #$00 - sta f:$10000C + sta f:SERctrlC rep #SHORT_A|SHORT_I .a16 .i16 diff --git a/platforms/Neon816/platform-lib.s b/platforms/Neon816/platform-lib.s index 66e1792..3596690 100644 --- a/platforms/Neon816/platform-lib.s +++ b/platforms/Neon816/platform-lib.s @@ -1,12 +1,6 @@ ; Platform support library for Neon816 ; - -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 - +.include "./Neon816-hw.inc" .proc _system_interface ;wdm 3 @@ -56,8 +50,8 @@ table: .addr _sf_pre_init sep #SHORT_A .a8 tya - sta f:ser_io -: lda f:ser_stat + sta f:SERio +: lda f:SERstat bit #$08 bne :- rep #SHORT_A @@ -70,7 +64,7 @@ table: .addr _sf_pre_init ldy #$0000 ; anticipate false sep #SHORT_A .a8 - lda f:ser_stat ; b0=1 if data ready + lda f:SERstat ; b0=1 if data ready ror bcc :+ iny @@ -85,10 +79,10 @@ table: .addr _sf_pre_init .proc _sf_key sep #SHORT_A .a8 -: lda f:ser_stat +: lda f:SERstat ror bcc :- - lda f:ser_io + lda f:SERio rep #SHORT_A .a16 and #$00FF