BASIC interpreter support, PS/2 serial code, scrolling support, cleanup.

This commit is contained in:
Anders Nielsen 2022-09-18 14:02:18 +02:00
parent 640356a65c
commit 16f6d3de42
7 changed files with 865 additions and 445 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ hardware/6502-backups
hardware/_autosave-6502.kicad_sch
hardware/#auto_saved_files#
_autosave*
msbasic

View File

@ -27,10 +27,18 @@ Build instructions:
3) Source the IC's - the spirit of this project is to contribute as little as possible to the global IC shortage and get used chips locally or from Ebay/AliExpress/etc.
4) Burn the ROMs. I use a TL866II Plus variant for the actual ROMs.
5) Solder away
6) For the PS/2-keyboard I use Ben Eater's (a.k.a. Dieter Müller's) interface: https://www.reddit.com/r/beneater/comments/mjeilv/keyboard_interface_diagram/
6) For the PS/2-keyboard I use the 6522's Shift Register, PB6, and a 74xx74 flip flop. See my R1 Hardware overview at 7:46: https://youtu.be/w5cA64xof2I?t=466 This will hardware-wise be included on the next build.
7) Enjoy!
Optional:
Setup SSH keys with a Raspberry Pi, connect an nRF24L01+ compatible module to it and compile the wireless bootloader code in /software_linux
Also optional:
Microsoft BASIC can be enabled by cloning the msbasic Github repo into the same folder you cloned this repo.
git clone https://github.com/mist64/msbasic.git
Then uncomment ;BASIC := 1 (Remove the ";") and run assemble.sh - this will let you run BASIC by pressing F4.
To change settings for BASIC, values can be changed in defines_abn6502.s
Also, please note that the current code assumes VRAM starts at $0800 rather than the default $2000 in the schematic - resistors will have pads for configuring in the next build, but for now it requires jumpers.
License: Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) https://creativecommons.org/licenses/by-nc/4.0/

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
#!/bin/zsh
ca65 -vv --cpu 6502 -l build/listing.txt -o build/abn6502rom.o abn6502rom.s
ca65 -vvv --cpu 6502 -l build/listing.txt -o build/abn6502rom.o abn6502rom.s
ca65 crom.s -o build/crom.o
ca65 userland.s --cpu 65c02 -l build/userlisting.txt -o build/userland.o
ld65 -o build/abn6502rom.bin -C memmap.cfg "./build/abn6502rom.o" "./build/crom.o" "./build/userland.o"
@ -8,6 +8,5 @@ minipro -s -p "SST39SF010A" -w build/abn6502rom.bin
#The lines below are used to copy the output to a Raspberry Pi and load it
ssh openhabian@openhabiandevice.local killall bootload
scp build/userland.bin openhabian@openhabiandevice.local:./
ssh openhabian@openhabiandevice.local bootload -s userland.bin
ssh openhabian@openhabiandevice.local killall bootload

40
defines_abn6502.s Executable file
View File

@ -0,0 +1,40 @@
; configuration
CONFIG_11A := 1
CONFIG_DATAFLG := 1
;CONFIG_NULL := 1
;CONFIG_PRINT_CR := 1 ; print CR when line end reached
CONFIG_SCRTCH_ORDER := 3
CONFIG_SMALL := 1
ZP_START1 = $00; $00
ZP_START2 = $0D ;$0D
ZP_START3 = $5b; $5B ;10b
ZP_START4 = $65 ;$65 ; 114b
CRLF_1 := $0A
CRLF_2 := $00
;extra ZP variables
USR := $000A; $000A
; constants
STACK_TOP := $80
SPACE_FOR_GOSUB := $33
NULL_MAX := $0A
WIDTH := 46
WIDTH2 := 46
; memory layout
RAMSTART2 := $1000
; magic memory locations
L0200 := $0200
; monitor functions
;MONRDKEY := $FFEB
;MONCOUT := printk ;$FFEE
;MONISCNTC := clcrts;$FFF1
LOAD := basicloadfromtape ;$FFF4
SAVE := basicsavetotape ;$FFF7

View File

@ -1,15 +1,29 @@
MEMORY {
ZP: start = $0, size = $100, type = rw, define = yes;
KBRAM: start = $200, size = $200, define = yes;
RAM: start = $400, size = $1C00, file = "build/userland.bin";
RAM: start = $0300, size = $3700, file = "build/userland.bin";
ROM: start = $8000, size = $8000, file = %O;
CROM: start = $10000, size = $10000, file = "build/crom.bin";
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
USERLAND: load = RAM, type = rw;
RODATA: load = ROM, type = ro;
VECTORS: load = ROM, type = ro, offset = $7FFA;
CROM: load = CROM, type = ro;
ZEROPAGE: load = ZP, type = zp;
HEADER: load = ROM, type = ro;
VECTORS: load = ROM, type = ro;
KEYWORDS: load = ROM, type = ro;
ERROR: load = ROM, type = ro;
CODE: load = ROM, type = ro;
CHRGET: load = ROM, type = ro;
INIT: load = ROM, type = ro;
EXTRA: load = ROM, type = ro;
DUMMY: load = ROM; # don't include
PRIMM: load = ROM, start = $FFC8, type = overwrite;
VECTORS6502: load = ROM, start = $FFFA, type = overwrite;
}

View File

@ -2,7 +2,7 @@
.feature string_escapes ; Allow c-style string escapes when using ca65
;PRIMM = $FFC8 ; Userland can use ROM subroutines if we tell them where they are. Check listing.txt for current subroutine addresses
;.require "abn6502rom.s"
.import scrp: zeropage, scwp: zeropage
.import kb_rptr: zeropage, scrp: zeropage, scwp: zeropage, CRSRPNT: zeropage, MILLIS: zeropage, MILLISH: zeropage
.autoimport + ; Try to import anything unknown from other modules
PORTB = $6000 ; PB0: SCK/SCL, PB1: RF CS, PB2: RF CE, PB3: SDA, PB4,PB5: MISO ,PB6: PS/2 Clock In, PB7: MOSI/T1 Out (Tape drive output)
@ -21,19 +21,14 @@ PCR = $600C ; [7:5] CB2 Control, [4] CBl Control, [3:1] CA2 Control, [0] CAl Co
IFR = $600D ; [7:0] IRQ Tl T2 CBl CB2 SR CA1 CA2
IER = $600E ; [7:0] S/C Tl T2 CBl CB2 SR CA1 CA2
MILLIS = $40
SVP = $42 ; Save pointer
SVPH =$43
TMP = $50;
TMP2 = $51;
kb_wptr = $00
kb_rptr = $01
ESC_KEY = $1b
.segment "USERLAND"
jsr newline
jsr checkkeyboard
beq userland
lda kb_buffer,x
inc kb_rptr
jsr printa
userland:
lda #$0A
jsr printk
@ -48,5 +43,35 @@ cOhtwotest:
jsr PRIMM
.asciiz "Hi! Im a CMOS 65C02! \n\n"
exitnow:
;nop ;
PHA
tsx
txa
jsr printbyte
pha
TSX
txa
jsr printbyte
pla
pla
lda #>main
jsr printbyte
lda #<main
jsr printbyte
; waitforkey:
; jsr MONRDKEY
; bcc waitforkey
; cmp #$0d
; beq done
; jsr printa
; jmp waitforkey
; done:
brk
;jmp main
;jsr resetkb
;rts