From 9b1c541bc8a47b46e373d04fb9bebdb1160c6391 Mon Sep 17 00:00:00 2001 From: Philip Zembrod Date: Sat, 29 Aug 2020 22:25:55 +0200 Subject: [PATCH] Create vf-lite-x16 binary target for Commander X16, based on C64 version. vf-sys-x16.fth still is identical to vf-sys-c64.fth. --- 6502/C64/Makefile | 7 +- 6502/C64/src/vf-head-x16.fth | 30 +++++++++ 6502/C64/src/vf-lite-x16.fth | 17 +++++ 6502/C64/src/vf-pr-target.fth | 2 + 6502/C64/src/vf-sys-x16.fth | 123 ++++++++++++++++++++++++++++++++++ 6502/C64/src/vf-trg-c16+.fth | 1 + 6502/C64/src/vf-trg-c16-.fth | 1 + 6502/C64/src/vf-trg-c64.fth | 1 + 6502/C64/src/vf-trg-x16.fth | 11 +++ 9 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 6502/C64/src/vf-head-x16.fth create mode 100644 6502/C64/src/vf-lite-x16.fth create mode 100644 6502/C64/src/vf-sys-x16.fth create mode 100644 6502/C64/src/vf-trg-x16.fth diff --git a/6502/C64/Makefile b/6502/C64/Makefile index bd29ec8..dfa8422 100644 --- a/6502/C64/Makefile +++ b/6502/C64/Makefile @@ -7,7 +7,9 @@ vf_blk_d64_files = $(wildcard disks/*.d64) vf_blk_fth_files = $(patsubst %.d64, %.fth, $(vf_blk_d64_files)) vf_fth_files = $(wildcard src/vf-*.fth) vf_fth_files_petscii = $(patsubst src/%, cbmfiles/%, $(vf_fth_files)) -vf_flavours = full-c64 full-c16+ full-c16- lite-c64 lite-c16+ lite-c16- +vf_flavours = \ + full-c64 full-c16+ full-c16- \ + lite-c64 lite-c16+ lite-c16- lite-x16 vf_binaries = $(patsubst %, cbmfiles/vf-%, $(vf_flavours)) test_files = $(wildcard tests/*.f*) @@ -81,6 +83,9 @@ cbmfiles/vf-lite-c16+: cbmfiles/vf-lite-c16-: emulator/build-vf.sh vf-lite-c16-.fth vf-lite-c16- +cbmfiles/vf-lite-x16: + emulator/build-vf.sh vf-lite-x16.fth vf-lite-x16 + # Core test targets diff --git a/6502/C64/src/vf-head-x16.fth b/6502/C64/src/vf-head-x16.fth new file mode 100644 index 0000000..e1c2b7a --- /dev/null +++ b/6502/C64/src/vf-head-x16.fth @@ -0,0 +1,30 @@ +\ The head of Commander X16 VolkForth + +\ Initial part of load file + +Onlyforth + +$801 dup displace ! +Target definitions here! + + +10 fthpage + +\ FORTH Preamble and ID + +$D c, $8 c, $A c, 00 c, 9E c, 28 c, 32 c, 30 c, +36 c, 34 c, 29 c, 00 c, 00 c, 00 c, 00 c, \ SYS(2064) + +Assembler + nop 0 jmp here 2- >label >cold + nop 0 jmp here 2- >label >restart + +here dup origin! +\ Here are coldstart- and Uservariables +\ +0 jmp 0 jsr here 2- >label >wake + end-code +$100 allot + +Create logo + ," volksFORTH-83 3.90-X16 " diff --git a/6502/C64/src/vf-lite-x16.fth b/6502/C64/src/vf-lite-x16.fth new file mode 100644 index 0000000..6581f9e --- /dev/null +++ b/6502/C64/src/vf-lite-x16.fth @@ -0,0 +1,17 @@ + +include vf-tc-prep.fth + +include vf-trg-x16.fth + +\ The actual volksForth sources + +include vf-head-x16.fth +include vf-cbm-core.fth +include vf-sys-x16.fth +include vf-cbm-file.fth +include vf-finalize.fth + 9f00 ' limit >body ! 9b00 s0 ! 9f00 r0 ! +include vf-memsetup.fth + +include vf-pr-target.fth +quit diff --git a/6502/C64/src/vf-pr-target.fth b/6502/C64/src/vf-pr-target.fth index c14648e..43b3b82 100644 --- a/6502/C64/src/vf-pr-target.fth +++ b/6502/C64/src/vf-pr-target.fth @@ -8,6 +8,7 @@ cr .( Target is: ) \ clv14.4.87) (C16 .( C16 with ) (C16+ .( 64kb ) (C16- .( 32kb ) +(X16 .( Cmdr X16 ) cr .( Target is not: ) @@ -16,3 +17,4 @@ cr .( Target is not: ) (C16 \ ) .( C16, ) (C16+ \ ) .( C16+64kb, ) (C16- \ ) .( C16-32kb, ) +(X16 \ ) .( Cmdr X16, ) diff --git a/6502/C64/src/vf-sys-x16.fth b/6502/C64/src/vf-sys-x16.fth new file mode 100644 index 0000000..a7bf6d1 --- /dev/null +++ b/6502/C64/src/vf-sys-x16.fth @@ -0,0 +1,123 @@ + +include vf-lbls-cbm.fth + +\ *** Block No. 127, Hexblock 7f +7f fthpage + +\ C64-Labels clv13.4.87) + +0E716 >label ConOut + 09d >label MsgFlg + 09a >label OutDev + 099 >label InDev +0d020 >label BrdCol +0d021 >label BkgCol + 0286 >label PenCol + 0ae >label PrgEnd + 0c1 >label IOBeg + 0d4 >label CurFlg + 0d8 >label InsCnt + 028a >label KeyRep + + +\ *** Block No. 129, Hexblock 81 +81 fthpage + +\ C64 c64key? getkey + +Code c64key? ( -- flag) + 0C6 lda + 0<> ?[ 0FF # lda ]? pha + Push jmp end-code + +Code getkey ( -- 8b) + 0C6 lda 0<> + ?[ sei 0277 ldy + [[ 0277 1+ ,X lda 0277 ,X sta inx + 0C6 cpx 0= ?] + 0C6 dec tya cli 0A0 # cmp + 0= ?[ bl # lda ]? + ]? + Push0A jmp end-code + + +\ *** Block No. 130, Hexblock 82 +82 fthpage + +\ C64 curon curoff + +Code curon ( --) + 0D3 ldy 0D1 )Y lda 0CE sta 0CC stx + xyNext jmp end-code + +Code curoff ( --) + iny 0CC sty 0CD sty 0CF stx + 0CE lda 0D3 ldy 0D1 )Y sta + 1 # ldy Next jmp end-code + + +include vf-sys-cbm.fth + + +\ *** Block No. 143, Hexblock 8f +\ ... continued +8f fthpage + +Create ink-pot +\ border bkgnd pen 0 + 6 c, 6 c, 3 c, 0 c, \ Forth + 0E c, 6 c, 3 c, 0 c, \ Edi + 6 c, 6 c, 3 c, 0 c, \ User + + +\ *** Block No. 144, Hexblock 90 +90 fthpage + +\ C64 restore + +Label asave 0 c, Label 1save 0 c, + +Label continue + pha 1save lda 1 sta pla rti + +Label restore sei asave sta + continue $100 /mod + # lda pha # lda pha php \ for RTI + asave lda pha txa pha tya pha + 1 lda 1save sta + $36 # lda 1 sta \ Basic off ROM on + $7F # lda $DD0D sta + $DD0D ldy 0< ?[ +Label 6526-NMI $FE72 jmp ]? + UDTIM jsr STOP jsr \ RUN/STOP ? + 6526-NMI bne \ not >>--> + ' restart @ jmp end-code + + +\ *** Block No. 145, Hexblock 91 +91 fthpage + +\ C64:Init 06nov87re + +: init-system $FF40 dup $C0 cmove + [ restore ] Literal dup + $FFFA ! $318 ! ; \ NMI-Vector to RAM + +Label first-init + sei cld + IOINIT jsr CINT jsr RESTOR jsr + \ init. and set I/O-Vectors + $36 # lda 01 sta \ Basic off + ink-pot lda BrdCol sta \ border + ink-pot 1+ lda BkgCol sta \ backgrnd + ink-pot 2+ lda PenCol sta \ pen +$80 # lda KeyRep sta \ repeat all keys +$17 # lda $D018 sta \ low/upp + + 0 # lda $D01A sta \ VIC-IRQ off +$1B # lda $D011 sta \ Textmode on + 4 # lda $288 sta \ low screen + cli rts end-code +first-init dup bootsystem 1+ ! + warmboot 1+ ! +Code c64init first-init jsr + xyNext jmp end-code diff --git a/6502/C64/src/vf-trg-c16+.fth b/6502/C64/src/vf-trg-c16+.fth index 842b483..3dd0b04 100644 --- a/6502/C64/src/vf-trg-c16+.fth +++ b/6502/C64/src/vf-trg-c16+.fth @@ -6,6 +6,7 @@ : (C16+ ; immediate : (C64 [compile] ( ; immediate : (C16- [compile] ( ; immediate +: (X16 [compile] ( ; immediate include vf-pr-target.fth diff --git a/6502/C64/src/vf-trg-c16-.fth b/6502/C64/src/vf-trg-c16-.fth index 6127f23..7282abe 100644 --- a/6502/C64/src/vf-trg-c16-.fth +++ b/6502/C64/src/vf-trg-c16-.fth @@ -6,6 +6,7 @@ : (C16- ; immediate : (C64 [compile] ( ; immediate : (C16+ [compile] ( ; immediate +: (X16 [compile] ( ; immediate include vf-pr-target.fth diff --git a/6502/C64/src/vf-trg-c64.fth b/6502/C64/src/vf-trg-c64.fth index b190a52..8c880d2 100644 --- a/6502/C64/src/vf-trg-c64.fth +++ b/6502/C64/src/vf-trg-c64.fth @@ -6,5 +6,6 @@ : (C16 [compile] ( ; immediate : (C16+ [compile] ( ; immediate : (C16- [compile] ( ; immediate +: (X16 [compile] ( ; immediate include vf-pr-target.fth diff --git a/6502/C64/src/vf-trg-x16.fth b/6502/C64/src/vf-trg-x16.fth new file mode 100644 index 0000000..38b2e0c --- /dev/null +++ b/6502/C64/src/vf-trg-x16.fth @@ -0,0 +1,11 @@ + +: ) ; immediate +: (C ; immediate + +: (X16 ; immediate +: (C64 [compile] ( ; immediate +: (C16 [compile] ( ; immediate +: (C16+ [compile] ( ; immediate +: (C16- [compile] ( ; immediate + +include vf-pr-target.fth