JF-13 (yes, lovely baseball) could be a good donor to build your own Family Basic and many other things.
#1 It's JEDEC compatible, so you don't need to bend pins(i
love HATE bending pins and hot glue).
#2 There is decoder chip almost ready to control WRAM(no battery, but not a big deal).
#3 This cart also can be used as NROM-256 donor or CNROM donor
#4 This cart is dirt cheap and thousands of them floating around without any use.
Below schematics of slightly modified decoder of
JF-13 cart. Connections with ticks exist on PCB, only you have to cut trace from pin1 of '139 chip and ground that pin. So to replicate Basic you need only one extra chip - 8kB SRAM, and you can reuse diodes and 1kOhm resistor from top part of
JF-13.
(http://i42.tinypic.com/2nqtlps.jpg)
After some thinking, tossing and soldering parts appeared that compromized final specs are
ROM 16K C000-FFFFh, RAM 24K 6000-BFFFh, CHR RAM, vertical mirroringI/O description
&H5xxx read
bit0 - data from SD card and wi-fi ESP module
bit1 - if "low" SD card plugged, otherwise "high"
the rest are not used for now.
&H5xxx write
bit0 - data to SD card and wi-fi ESP module
bit1 - clock for SD card and wi-fi ESP module
bit2 - CS for SD card
bit3 - CS for wi-fi ESP module
bit4 - beeper output(similar to PC speaker, Apple II music or ZX Spectrum 48k beeper.)
bit5 - reserved for banking, pin 27 of ROM pulled up
reserved for V/H mirroring or NROM-lock.bit6 - N/A
bit7 - N/A
SD card support - it's possible to make "software SPI"(like software RS-232). Not fast(about speed of FDS, maybe little bit faster), but very simple circuit. Software for support FAT12/16 needed. On boot up check, if SD card plugged and if so, check for files
chr.bin and
boot.bin and load them and execute
boot.bin
"Parts list"
27128, 6264, 62256, '368, 5 diodes(1N4148 or similar), 4 1kOhm, 1 4.7kOhm and 3 2kOhm resistors. 3.3v voltage regulator, SD card slot. LED and 1kOhm resistor is option. 1 resistor for beeper, 1kOhm as well, is option.
STEP 1 First of all, my "lab rat", FB cart with "VRC7" on prototype board. You see this thing? No hot glue involved, even so, i kick this around the table for last ummm... half year maybe without any broken wire.
(http://i42.tinypic.com/2a3j9s.jpg)
Ok, next photo is sliced(yes, you can call me a butcher LOL)
JF-13, NROM-256 ready. One of two capacitors in the top right corner of the board is not in use, since one '174 removed(it saves few cuts of traces). This chip controlled CHR banking, which is no use in Family Basic.
(http://i43.tinypic.com/2hnxc39.jpg)
The other side of the cart with soldered 8kB WRAM, hooked to the decoder at &H6000-7FFF and PRG ROM is NROM-256. I said, that i hate bend pins and i do, but this is most fast, reliable and convinient way to convert
JF-13 into NROM-256+WRAM. Diodes and resistor used to make 2AND "gate" to decode 8kB WRAM. Layout of this cart is so convinient - minimum rewiring/cuts.
(http://i39.tinypic.com/idr6yq.jpg)
I had to replace SRAM chip due to a very fragile pins and resolder diodes to make this part of the circuit less confusing. Also Family Basic have
vertical mirroring, so one more cut and solder lump to adjust mirroring on
JF-13.
(http://i40.tinypic.com/2py56wi.jpg)
(http://i40.tinypic.com/1z1xlr5.jpg)
For communication with "outer world" i will use
'174(already present on PCB and input lines wired perfectly) and
'368. Both chips mapped to &H5XXX. This simple add-on gives 4 lines "OUT"(2 lines of
'174 is not in use, but you always can add them) and 2 lines "IN". This is enough to control GameBoy pocket printer, SD card, "soft" RS-232, SPI flash etc.
'139 and
'174 already soldered on
JF-13 PCB almost correct.
Maybe i will redesign this part and replace '368 with '367+'00 or something else to get more input lines and remove diodes logic. Less parts, but more wires :(
STEP 2Front side
(http://i60.tinypic.com/23mvn1h.jpg)
Spoiler
Rear side right before i replaced 8k SRAM chip with 32k. First i thought to go only 8k RAM and 32k ROM, but difference in the circuit is only one diode and few more cuts on PCB, that's why 24/16 config appeared.
(http://i62.tinypic.com/98vaeh.jpg)
And the shell(Namcot baseball '87 '88 '89)
(http://i58.tinypic.com/15n8uvk.jpg)
This way, unfortunately, since card slot is not on PCB as on everdrive. Anyway, i managed to glue it to the shell(slot is plastic after all), little bit ugly with lots of hot glue, but it's prototype.
(http://i61.tinypic.com/14t7cee.jpg)
(http://i62.tinypic.com/339rtc4.jpg)
(http://i61.tinypic.com/zyhe9d.jpg)
I should stick narrow stripe of paper under the slot pins to prevent melting plastic while soldering :( This way to mount SD card slot without custom PCB looks most robust, on the bad side cut hole is more complicated. Also insert SD card pins to the face side.
More hot glue horror. By the way, i have somewhere blue colour hot glue sticks, so you can choose pink or blue :P
(http://i57.tinypic.com/2s0mro1.jpg)
Spoiler
(http://i57.tinypic.com/rby7f8.jpg)
chips aren't soldered yet and i can't find last card reader, which i bought for card slot. It's appeared, that i made some major mistakes on PCB layout, so i made another board, but <censored> again with some small details, both went to the trash bin and i returned to the fugly hotglued prototype(there were some wiring :-[ ), which completed last night. It doesn't blown my famicom and happily producing 3.3V for SD card, even producing some random movement without ROM :-[
WARNING! Whatever you doing is on your own risk and i do not take any responsibility for any of your damages or lost.NOTICE: following information based on Family Basic v2.1a and might be slightly different for v3 or
v2.0UPDATE: revently i compared V2.0 and V2.1 ROM and they appeared to be identical except two very small patches - in V2.1 two subroutine calls(didn't investigated further yet) patched with NOP and version number changed.
Write your own machine code subroutine and "hide" it inside Basic programm As well known, Basic keeps programm text somwhere(i will explain this little bit later) from &H6000 to &H7FFF separated in lines. Also this version allows to operate with DATA, READ, PEEK(x), POKE x,y.
First we have to place machine code subroutine somewhere in the memory and reserve space for it. Keep it simple
10 REM ............................................................... Remark line above consist of 64(i hope i didn't made a mistake :) ) dots and will go first somewhere in WRAM. Let's found out where... Put signature by replacing first 3 dots by let's say "Q" and scan WRAM for this signature
10 REM QQQ............................................................
20 FOR I=&H6000 to &H7FFFF
30 IF PEEK(I)=PEEK(I+1) AND PEEK(I+1)=PEEK(I+2) AND CHR$(PEEK(I))="Q" THEN 50
40 NEXT I
50 PRINT I
60 END After running this programm(RUN), you will find address, where the first byte of "QQQ" placed. For v2.1 it appeared to be 24643 in decimal. Let's check it. Replace lines from line 20 by following code
20 DATA 60,61,62,63,64,65,66,67,68,69,70
30 FOR I=24643 TO 24653:READ X:POKE I,X:NEXT
40 END Execute this programm(RUN) and do listing(LIST). Surprize :) Some dots replaced with characters. All working, nothing crashed. Let's check calling machine code subroutine. Just write something primitive, like this
NOP
NOP
NOP
NOP
RTS
This code is absolutely harmless, so if system not crashed after executing this code, all solved.
Translating this assemler text to machine code (http://www.e-tradition.net/bytes/6502/assembler.html) and convert hexadecimal to decimal(not sure about syntax for hexadecimal values, so did long run)will give you
234, 234, 234, 234, 96 Replace code in line 20
10 REM QQQ............................................................
20 DATA 234,234,234,234,96,65,66,67,68,69,70
30 FOR I=24643 TO 24653:READ X:POKE I,X:NEXT
40 ENDand execute again. After listing, you can see, that text after REM changed again. There will sit our pure machine code subroutine. You can call it from dialog line or from your programm.
CALL 24643 However subroutine made just for test, so do not producing any visual or audio effects, but returning to Basic without crash. All done. Lenght of each line limited in Basic to 246(please correct me) symbols, so you can pack 246 bytes of code. You don't need to keep whole programm, once you executed DATA-READ-POKE and machine code working correct, you can delete lines from 20 to 60 to save space for other programms. You can store it on the tape just as Basic programm.
Enjoy :)
You probably noticed, that i claimed Basic area from &H6000, which might looks strange - other sources said &H7000 and Basic code from &H7040. It's obvious - mirroring, but... what if... replace 2kB with 8kB SRAM chip? So i wired SRAM chip at &H6000-&H7FFF. No additional components needed. Guess, what? Nothing changed for Basic V2.1a, still avaliable memory the same(now start from &H7000 as stated), but extra 6kB(&H6000-&H6FFF and &H7800-&H7FFF) avaliable for machine code. Unfortunately "CLEAR" can only "go down" and HIMEM does not exist, to shift top memory to &H7FFF
It's time for patch :) to shift Basic area down and make it wider
Spoiler
But before that Basic should burn itself into UV EPROM chip, by using this additional hardware(almost complete)
(http://i43.tinypic.com/334ndvt.jpg)
I used my favorite '138 as decoder and 8255 as PIO and '174 for some control signals.
and programm written in pure Basic to copy itself into EPROM(both PRG and CHR). (50% complete)
To examine PRG ROM i will need HexDump(100% complete), Disassembler(80% complete).
Written in Basic? Why not? Slow? No need rush ::) Also it would be nice to print out listings with GameBoy pocket printer, but i'm not sure, if all this code will fit 2kb ??? Disassembler, written in Family Basic, will fit 2kb, but printer subroutine still under question mark.
According to this (http://www.atomicvpp.com/wpblog/2012/03/04/gameboy-printer-project/), GBPP can do only 20 symbols per line of standart 8*8 pixel font, which is not enough for good listing, but still possible to use. Famicom can drive GBPP via expansion port, but not by Family Basic - there is already keyboard connector. So this connector have to go on the cart. Circuit still stays simple - decoder '139, register to write data/clock/strob '174(these two chips already present on JF-13 and almost wired as needed for this task) and register/buffer to read data '368. Yes, it should be '368 - one half will work as two NOT gates to prevent bus conflict, another half, wired two gates in serial will give non-inverted buffer to read data. This simplicity will takes whole 5th page of address space - 5XXX, but i think it's "good price" for such a simple hardware. By the way Gameboy extension port and SD card share same signals, only need level shifters for card, since it uses 3.3V. One more thing - since this printer is "dot printer" and not "symbol printer", and printing tiles a bit weird way, printing subroutine will need buffer for two lines.
To be continued...
Some "useful calls"
CALL
&H8000 will return to "MENU 1,2,3"
CALL
&H8100 will reset Basic
CALL
&HB5AF will execute BG editor from Basic
CALL
&HAB71 will clean screen same as
CLSCALL
&HAF88 return in
A scancode of pressed key
to be continued...
It's too bad about the kana.
Beeper, I see it's hardware in the cartridge.
SD would be nice indeed. I was never successful with SAVE/LOAD to a computer.
Will there be some kind of character generator or something to make it easier to make character data?
Yeah well if you can easily transfer character data files from a computer (SD or whatever) then it's not a problem.
If this is something you're making, count me in.
I'd probably prefer the extra RAM, but I can see the extra ROM data is just as useful - so you guys decide :-[
Looks like it's coming along nicely! How many do you think you'll make initial run and for how much? I'm really hoping to get one of the first run and play more with Basic.
JF-13 sounds good, everyone has tons of them.
What do you use to cut the cart? I use a craft knife easily enough but that's just small cuts as a rule for Everdrive shells.
On those, I've found it's alot easier to cut a groove into the side/top, rather than a slit.
So this:
-------______---------
_______________
rather than this:
--------------------------
======
_______________
Not sure if that actually explains what I'm trying to illustarte or not!
If you can see it, maybe you can elevante the SD card connector to make this easier? Might be more work than it's worth - all I know is it would make cutting the cart a lot easier.
What kind of hardware would you trade? I'll see what spares I've got around.
Looks like good progress.
Also, hot glue. You know what I'm getting at :)
Looks good. :)
How is it on the software side? Will it have a 6502 assembler like you mentioned before?
Also if you decides to make new boards instead of using baseball you could use Krikzz' everdrive shells http://shop.retrogate.com/Famicom-shell-SHELLFC.htm. Only problem that they are a bit expensive and "EVERDRIVE" is merged in the mold. :-[ Could be hidden under a label though.