etabeta's playground

MESS & MAME wip

Archive for June, 2013

Digging into uncommon items

without comments

One thing which I have always wanted to add support for in MESS was tape loading from inside Family BASIC for the Japanese Famicom. I’m not sure if I was fascinated to see what could be done when using my fav 8bit console as an home computer, or if I wanted to support it because only a bunch of other emus do (NEStopia, NesterJ, any other?), fact his that I had made multiple attempts in the past 2 years to add cassettes to Famicom in MESS, with no luck.

The problem was not the cassette recorder connection in itself: it was well documented which bits correspond to read from tape and write to tape, respectively. The problem was the small number of testcases and the apparent lack of documentation about the cassette file formats!

Once Anna Wu managed to find for me a few .tp files to play with (many thanks as usual, Anna), I thought I was ready to go, but I realized soon that the problem was not so easy to solve: a .tp file contains a sort of waveform pattern, but I was unable to convert it to something that Family BASIC was capable to recognize…

The real breakthrough happened when I got in touch with Pokun at nesdev boards, who in turn pointed me to UglyJoe, brilliant and very friendly admin at famicom world forums
He not only had found out that .tp was just a raw wave file at 32kHz (very easy to convert to a .wav file to be fed to MESS, e.g. with Audacity), but he also spent a lot of time last year typing a dozen of Family BASIC programs in his FC and saving them to tape!!!

Hence, by converting Anna’s .tp files and studying UglyJoe’s .wav files, I finally succeeded in adding tape support to our beloved emulator.

EDIT: I recall that if you launch BASIC V3.0 and you get an error message displayed, or if you launch BASIC V2.0/V2.0A and you get a grey screen, it means that you haven’t connected the Famicom Keyboard! To test any of the games below, you need to launch famicom emulation in MESS with one of the BASIC carts mounted, then access the internal UI with TAB, go into Driver Configurations and change the Expansion port to “FC Keyboard”. Once you’ve done this, the BASIC cart will work as shown in the pictures 🙂

Hero
basgam01 basgam02
basgam03 basgam04

Star Killer
basgam05 basgam06

Urban Champ
basgam07 basgam08

and some of the files typed in by UglyJoe (that you can find at famicomworld and maybe you can also say thanks for his work, while you’re there)

uglyjoe01 uglyjoe02
uglyjoe03 uglyjoe04
uglyjoe05 uglyjoe06

The new feature revealed also that our NES input handling, whose cleanup I had kept postponing for months, really needed to be revamped in order to allow working controls in these games. Indeed, our code had been written with NES controllers in mind (and it worked well for those), but Famicom controllers were different. Original FC had indeed hardwired controllers and any additional peripheral had to be connected to the expansion port which we were not emulating properly. This has been mostly fixed now and, when tape support will be added, you will be able to also control the main characters in the games 🙂

An interesting feature of UglyJoe’s tapes is that you have to load the BG data separately. Luckily, UJ gave all the necessary details and I post them here too, for reference. So you need to launch Famicom in MESS with the Family BASIC v2.0 (or v2.0A) cart, with the FC Keyboard enabled as controller, and with one of the bg data wav file as cassette. Then, follow next steps

1. After entering your name, the cart will ask you if you want to load GAME BASIC. Either press Yes (F1), or type “GAME BASIC” and press Enter.
load01

2. At next menu, select “2. BG GRAPHIC” by pressing “2”
load02

3. Then press FC “ESC” key (in emulated keyboard mode, it is mapped by default to your TAB key; in natural keyboard mode, it is mapped to your own ESC key) and select “FILE” (scroll with arrow keys and confirm with the SpaceBar)
load03

4. Press “L” (for LOAD) and Enter (no need to specify a filename). Then, enter the Internal UI and press Play in the Tape Control menu: after some second the program will be recognized and loaded (you can always FastForward the emulation to reduce the loading times!)
load04

5. When loading procedure completes, the graphics will be displayed. Here you can access again the menu as before, by pressing the FC “ESC” key and then press the FC “STOP” key (mapped by default to your Backspace key) to go back to the main BASIC menu
load05

6. Select “1. BASIC” by pressing “1”, to finally access the BASIC prompt
load06

7. Now, enter the Internal UI, and load the program wav file through the File Manager menu. Then go back to emulation and type LOAD. Start the new tape from the Tape Control submenu of the Internal UI and wait for its completion
load07

8. Typing RUN, you will be finally able to play the game and help Mario to kill the floating crab 🙂
load08 load09

None of these programs is going to compete with main Famicom productions (2KB of memory is too small for that), of course, but Family BASIC was a piece of Famicom history and it was a pity not to document it properly… and who knows, maybe some Japanese user will dig out his old collection of tapes and we might find more of these before they get lost forever!

p.s. there were a few more programs supporting tapes on the Famicom, and a few on chinese famiclones. if someone still has such tapes, please contact us at MESS boards!

Written by etabeta

June 14th, 2013 at 10:35 pm

Posted in MESS