getting ready for the Neon816

This commit is contained in:
mgcaret 2019-11-20 18:22:11 -08:00
parent 2a2a826f40
commit 9e53bf4532
7 changed files with 175 additions and 0 deletions

View File

@ -0,0 +1,16 @@
FEATURES {
STARTADDRESS: default = $8000;
}
MEMORY {
ROM: start = $8000, size = $7800, file = %O;
ZP: start = $0000, size = $100;
}
SEGMENTS {
FStartup: load=ROM,type=ro;
FSystem: load=ROM, type=ro;
FCode: load=ROM, type=ro, optional=yes;
ZEROPAGE: load=ZP, type=bss;
}

View File

@ -0,0 +1,40 @@
.p816
.a16
.i16
.include "macros.inc"
.import _Forth_initialize
.import _Forth_ui
.import _system_interface
.pushseg
.segment "FStartup"
.proc startup
clc
xce
rep #SHORT_A|SHORT_I
lda #$0300 ; direct page for Forth
tcd
lda #.hiword($020000) ; top of dictionary memory
pha
lda #.loword($020000)
pha
lda #.hiword($010000) ; bottom of dictionary
pha
lda #.loword($010000)
pha
lda #$0300 ; first usable stack cell (relative to direct page)
pha
lda #$0100 ; last usable stack cell+1 (relative to direct page)
pha
lda #$09FF ; return stack first usable byte
pha
lda #.hiword(_system_interface)
pha
lda #.loword(_system_interface)
pha
jsl _Forth_initialize
jsl _Forth_ui
brk
.byte $00
.endproc
.popseg

View File

@ -0,0 +1,14 @@
# Nein816
This is a port to Lenore Byron's [Neon816](https://hackaday.io/project/164325-neon816)
system. To build it, change to the platform directory and run
build.sh. Right now, this does not produce a working Forth because I don't know
how to interact with the hardware just yet. That being siad, it will
output a binary named "forth" that isn't suitable for anything, just yet.
Details about how to buld it for RAM/ROM/whatnot will be forthcoming.
## Port Features
Hopefully this section will be filled up with stuff that works like Lenore's
Forth. See the [Neon816 Manual](https://cdn.hackaday.io/files/1643257030480800/sysmanual.pdf)

7
platforms/Neon816/build.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e -x
ca65 -I ../../inc Neon816.s -l Neon816.lst
../../build.sh Neon816
ld65 -C Neon816.l -S 0x8000 Neon816.o ../../forth.o -m forth.map -o forth
ls -l forth

View File

@ -0,0 +1,2 @@
; nothing here yet!

View File

@ -0,0 +1,94 @@
; Platform support library for Neon816
;
cpu_clk = 14000000
.proc _system_interface
;wdm 3
phx
asl
tax
jmp (table,x)
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
plx
jmp _sf_success ; we'll see what we need to do
.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
; TODO: interact with the hardware here
plx
jmp _sf_success
.endproc
.proc _sf_keyq
ldy #$0000 ; anticipate false
; TODO: interact with the hardware here, set y to FFFF if char available
tya
plx
jsr _pushay
jmp _sf_success
.endproc
.proc _sf_key
; TODO: interact with hardware, wait for char, get it into Y
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

View File

@ -0,0 +1,2 @@
; Platform support dictionary words for Neon816