Add a vm6502 variant

This commit is contained in:
Matus Horvath 2024-02-13 06:45:09 +01:00
parent c15c84741a
commit 6c2a5aeb44
9 changed files with 122 additions and 2 deletions

View File

@ -25,6 +25,9 @@ AIM65 := 1
.elseif .def(sym1)
SYM1 := 1
.include "defines_sym1.s"
.elseif .def(vm6502)
VM6502 := 1
.include "defines_vm6502.s"
.endif
.ifdef CONFIG_2C

22
defines_vm6502.s Normal file
View File

@ -0,0 +1,22 @@
; Inspired by https://github.com/beneater/msbasic
; configuration
CONFIG_2A := 1
CONFIG_SCRTCH_ORDER := 2
; zero page
ZP_START1 = $00
ZP_START2 = $0A
ZP_START3 = $60
ZP_START4 = $6B
; extra/override ZP variables
USR := GORESTART
; constants
SPACE_FOR_GOSUB := $3E
STACK_TOP := $FA
WIDTH := 40
WIDTH2 := 30
RAMSTART2 := $0400

View File

@ -24,6 +24,10 @@
.include "aim65_extra.s"
.endif
.ifdef VM6502
.include "vm6502_extra.s"
.endif
.ifdef SYM1
.byte 0,0,0
.endif
.endif

View File

@ -11,3 +11,6 @@
.ifdef SYM1
jmp PR_WRITTEN_BY
.endif
.ifdef VM6502
jmp COLD_START
.endif

View File

@ -26,4 +26,7 @@
.ifdef SYM1
.include "sym1_iscntc.s"
.endif
.ifdef VM6502
.include "vm6502_iscntc.s"
.endif
;!!! runs into "STOP"

View File

@ -2,7 +2,7 @@ if [ ! -d tmp ]; then
mkdir tmp
fi
for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft microtan aim65 sym1; do
for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft microtan aim65 sym1 vm6502; do
echo $i
ca65 -D $i msbasic.s -o tmp/$i.o &&

19
vm6502.cfg Normal file
View File

@ -0,0 +1,19 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $C000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}

49
vm6502_extra.s Normal file
View File

@ -0,0 +1,49 @@
; Inspired by https://github.com/beneater/msbasic
; TODO implement
LOAD:
rts
SAVE:
rts
; On return, carry flag indicates whether a key was pressed
; If a key was pressed, the key value will be in the A register
;
; Modifies: flags, A
MONRDKEY:
CHRIN:
; lda ACIA_STATUS
; and #$08
; beq @no_keypressed
; lda ACIA_DATA
; jsr CHROUT ; echo
; sec
; rts
;@no_keypressed:
clc
rts
; Output a character (from the A register)
;
; Modifies: flags
MONCOUT:
CHROUT:
; pha
; sta ACIA_DATA
; lda #$FF
;@txdelay: dec
; bne @txdelay
; pla
rts
; TODO set up reset vector
;.segment "RESETVEC"
; .word $0F00 ; NMI vector
; .word RESET ; RESET vector
; .word $0000 ; IRQ vector

17
vm6502_iscntc.s Normal file
View File

@ -0,0 +1,17 @@
; Inspired by https://github.com/beneater/msbasic
; TODO implement
ISCNTC:
; jsr MONRDKEY
; bcc not_cntc
; cmp #3
; bne not_cntc
; jmp is_cntc
;
;not_cntc:
rts
;is_cntc:
; ; Fall through