When I first wrote GIBL (My TinyBasic) I wrote in the README.TXT that it ought to be able to run in a very minimal system having just 4K of ROM and 4K of RAM... (And yes, I know there are more minimal interpreted BASIC/BASIC-like systems out there!)
So... As my winter solstice project (although I'm currently a week ahead of the game as it's not until the 22nd of December this year; 2023) I decided to take up my own challenge... And what better variant of the 6502 to use than the 6507 - as with only 28 pins and just 13 address lines that forces me to stick to 8KB in total and so I split it 4KB ROM and 4KB RAM.
To keep the chip count low, I use a GAL for address decoding and the R/W qualifying and to handle the serial input. There is an 8-bit latch with 4 LEDs and the serial output and decoding for a button input and VIA.
While the 6507 and GAL are proper parts from the 80s the RAM and ROM are more modern parts..
The RAM is a 28-pin static RAM IC (IDT 7164) which actually has 8KB but I'm only using 4KB, tying it's A12 line low.
The ROM is a 28-pin Flash/EEPROM (Atmel 28C256) with 32KB capacity, arranged as 8 "banks" of 4KB. The code resides in the first 4KB bank, the other 7 banks are used for program storage - in a very simple way, filenames are numbers from 1 through 7, but like my SXB version if the first line of the program has a specially crafted REM statement it's used as a filename for the DIR command.
28-pin CPU, 28 pin RAM, ROM, hence "
Project-28"...
3 outputs from the 8-bit latch (74ALS573) are used to control the EEPROM bank (A12,13,14), and code to read/write the EEPROM needs to be copied into RAM.
Serial is software at 9600 baud - it could trivially go much faster, but that's good enough for a retro project for now.
There is a 1-bit input button too.
GIBL/TinyBasic supports the LEDs via the LED command and things like
LED=LED+1works as expected.
And to my surprise it's all working very solidly at 2Mhz on breadboards. I was pleasantly surprised that the 6507 works at 2Mhz too (and I have a few and they're all fine). Their date codes are mid 80's all salvaged from dead Atari 2600s.
Code in the 4K ROM is tight - currently I have just one byte free... Although there is a tiny bit of debug in there, so if I need to tweak something, I have a bit of wiggle room. There is no "monitor" as such - it boots directly into GIBL.
A lot of the spare (from my first GIBL release) space is taken up by the EEPROM read/write codes. I copy a 256 byte page into RAM to do the save/load/chain/dir and auto-start routines.
GIBL uses practically all of page zero - although 16 bytes are used for hardware. There are currently 4 bytes spare in ZP. GIBL doesn't use any RAM outside ZP either - all program variables (@, A...Z), stacks (for/gosub/do and arithmetic evaluation) and other variables are all in ZP.
There is also space for a VIA and that's mapped to the top of page 1.
I've tried to keep it minimal - originally I was going to use the VIA for the bank latch, but decided that might be optional, so am using a separate latch for that plus the LEDs. There is no space in the ROM to add any VIA code, so that will all have to be poked from BASIC, but setting up a timer ought to be possible - although no interrupts here as the 6507 doesn't have any!
There is also no protection against poking garbage into the hardware but that's no different from other systems - see e.g.
https://en.wikipedia.org/wiki/Killer_pokeRight now it's all on breadboards but I've just finished up a PCB, so will get it sent off to China today hopefully I'll get them back by the solstice so I can use it to power some LEDs in a festive pattern or something... The PCB is bigger than I had hoped at 100x90mm .
One thing of note - might be handy for others doing software/bit-bang serial... I added an option to disable all output which makes it much easier/faster to upload code into it by copy/paste - So here, typing Ctrl-O toggles output on/off. The issue I was having was that if the system printed a character while being sent a character it would drop the sent character as it can only do one thing at a time, so for quick copy/pastes, Ctrl-O then do the copy/paste thing then Ctrl-O again. It works well.
Code:
;********************************************************************************
;*
;* project-28 memory map:
;* $00-$EF: All GIBL data fits here (with a few bytes spare)
;* $F0 Hardware input. Reads the rxD input pin into D7
;* $F8 Hardware output: An 8-bit latch:
;* Bit 7 is serial Tx
;* Bits 6,5,4 are the EEPROM bank select
;* Bits 3,2,1,0 are LEDs
;* $F8 Hardware input: Reads the "button" input into D7.
;* $0100-$018F Keyboard input buffer and temp. space for DIR command.
;* $0190-$01EF 6502 stack - Initialised to $EF.
;* $01F0-$01FF Hardware - Reserved for a VIA
;* $0200-$02FF Code copied from the ROM into RAM to access the FLASH
;* ROM banks as we can only do this from RAM.
;* $0300-$0FFF BASIC Program code store and dynamic ram for strings,
;* arrays, etc.
;* $1000-$1FF9 GIBL ROM code.
;* $1FFA-$1FFF 6507 Vectors - NMI/Reset/IRQ
;*
;********************************************************************************
Attachment:
IMG_20231215_115832_DRO.jpg [ 722.27 KiB | Viewed 4349 times ]
I've quite enjoyed the challenge of making a very minimal retro system over the past few weeks and being able to recycle old 6507s as in the past few years I've sort of had the attitude that RAM is cheap, so use it - here I have some very hard constraints to work with...
I have enough bits to make a handful of kits up, (assuming the PCB works!) so if anyone's interested in it let me know and I'll put something together in the new year.
Code:
Project-28
GIBL [v05]
Welcome to GIBL: Gordons Interactive BASIC Language
>LIST
0 REM!BOOT
10 PRINT ""
20 PRINT "Welcome to GIBL: Gordons Interactive BASIC Language"
30 PRINT ""
40 END
>DIR
1: !BOOT
2:
3:
4: VCCC 2023
5: Mandelbrot
6: Dumper
7: FillerUp
>CH 5
Mandelbrot - Gordons TinyBasic - Integers
Start
......,,,,,,,,,,,,,,,,,,,,,,'''''''''~~~~~=+:*$O:;==~~'''''',,,,,,,,,,,........
.......,,,,,,,,,,,,,,,,,,,,,'''''''''~~~==+%*O ;;%=~~~~''''',,,,,,,,,.........
........,,,,,,,,,,,,,,,,''''''''~~~'====++: %++=~~~~'',,,,,,,,,..........
........,,,,,,,,,,,',,,,'''''''~~~=++::+;;* %;:++===='''',,,,,,..........
.....,,,,,,,,,,,,''''''''~~~~~~~==+; &$% ;*;$+=~',,,,,,,,,,.......
...,,,,,,,,,,,''''''''''~~~~~~===::; +~'''',,,,,,,,,.....
....,,,,,,,,,,,'''~~~=========+++& %:==~~''',,,,,,,......
.....,,,,,,''''''~~=+X::+; :+++:;% &&=~~''',,,,,,,......
....,,''''''''~~~~=+:% *O B*;*% $=~~'',,,,,,,,......
,,,,,,''''''~~~~~=++;*X B =~~''',,,,,,,,,,,,.
,,,,,'''~~~~=====;*%& +=~~'',,,,,,,,,,,,,.
,,,,''~~==++++:+*& O:=~~'''''',,,,,,,,,,.
,,,,' %;+==~~'''',,,,,,,,,,,.
,,,,''~~==++++:+*& O:=~~'''''',,,,,,,,,,.
,,,,,'''~~~~=====;*%& +=~~'',,,,,,,,,,,,,.
,,,,,,''''''~~~~~=++;*X B =~~''',,,,,,,,,,,,.
....,,''''''''~~~~=+:% *O B*;*% $=~~'',,,,,,,,......
.....,,,,,,''''''~~=+X::+; :+++:;% &&=~~''',,,,,,,......
....,,,,,,,,,,,'''~~~=========+++& %:==~~''',,,,,,,......
...,,,,,,,,,,,''''''''''~~~~~~===::; +~'''',,,,,,,,,.....
.....,,,,,,,,,,,,''''''''~~~~~~~==+; &$% ;*;$+=~',,,,,,,,,,.......
........,,,,,,,,,,,',,,,'''''''~~~=++::+;;* %;:++===='''',,,,,,..........
........,,,,,,,,,,,,,,,,''''''''~~~'====++: %++=~~~~'',,,,,,,,,..........
.......,,,,,,,,,,,,,,,,,,,,,'''''''''~~~==+%*O ;;%=~~~~''''',,,,,,,,,.........
......,,,,,,,,,,,,,,,,,,,,,,'''''''''~~~~~=+:*$O:;==~~'''''',,,,,,,,,,,........
Finished
Time: 0 secs.
>
>CH 4
* * *
* * * * * *
* * * * * *
* * * *
* * * * * *
* * * * * *
* * *
* * * * * *
* * * * * *
* * * *
* * * * * *
* * * * * *
* * *
* * * * * *
* * * * * *
* * * *
* * * * * *
* * * * * *
* * *
>
Cheers,
-Gordon