10

I just learned from a YouTube video that in Japan there was an add-on for the original Nintendo Famicom console that included a keyboard (HVC-007) and compact cassette tape player & recorder (HVC-008).

The full system

Since I've dabbled in disk and tape formats in the past I immediately started Googling for the format Nintendo used for this. But I was unable to find anything.

Is it documented somewhere? I presume somebody must have at least reverse engineered it to add support to an emulator, but so far I can't even find any info about that though I've never been into Nintendo emulation so might not know where best to look.

7
  • 3
    The Nintaco emulator supports the tape drive and comes with full Java source code. It doesn't seem to include a document on the tape format though maybe there's an overview in the code comments I haven't found yet... Commented May 22, 2022 at 1:55
  • 1
    There is some incomplete low-level information on the Nes Dev wiki. Commented May 22, 2022 at 2:21
  • 1
    Here's the actual audio if you'd like to listen to it: archive.org/details/… Commented May 22, 2022 at 15:11
  • 1
    I'd assume tape images (used by an emulator) could at least be analyzed (in a hex editor) to understand the binary format. Though, I suppose the modulation details would require analyzing the actual tape audio, right?
    – Brian H
    Commented May 22, 2022 at 15:13
  • 1
    @snips-n-snails: That's really cool! Listening to a couple of them it seems the BASIC files consist of a sync tone followed by a short header followed by the same sync tone followed by the program data, which can vary in length so the length should be one field of the header. I don't think I have the skills do analyse it further. Commented May 22, 2022 at 15:40

2 Answers 2

11

Springing from the link provided by hippietrail to the Nes Dev wiki, the data recorder doesn't use any particular format — it provides only a 1-bit DAC under programmatic control, much like many 8-bit computers, and leaves the software to define a format on top of that. Different software defines different formats.

So in terms of reverse-engineering for an emulator, any recording of square waves will do; if a Nintendo emulator author were aware of them, then formats and the corresponding capture tools used with other emulators such as CSW could be appropriated without modification.

Per the linked article:

  • it's unknown what encoding Family BASIC uses;
  • Castle Excellent uses a 1200 baud format that is almost CUTS but outputs bits the opposite way around; and
  • Wrecking Crew appropriates the tape encoding of the Sharp MZ line of home computers.
1
  • 2
    Interesting. I'm mostly asking about the files you could save and load from BASIC and perhaps assumed games that used the data recorder would use something based on it. Which turns out to be wrong! Makes sense since games couldn't use the BASIC ROM routines. Even more interesting that the BASIC encoding is unknown. Typically there would be things like sync tone frequency and length and a header containing length of the data, whether it is BASIC, machine code, or raw data, address in memory to load, line number to start BASIC, memory address to commence machine code execution etc. Commented May 22, 2022 at 15:35
9

I didn't foresee when asking that I was asking about the file format used for saving and loading from Family BASIC. Unlike other home computers such as the ZX Spectrum, the BASIC is in a cartridge ROM and other games which use the Data Recorder have their own cartridge with their own ROM and the BASIC ROM is not present, so they implement their own custom save and load routines rather calling the BASIC routines.

The Nes Dev wiki linked says it's not known which encoding convention Family BASIC uses. But that's the low-level format. Basically magnetic media will have a low-level format relating to encoding digital data into audio, and a high-level byte-oriented format encoding information about the file's data and the data itself. The low-level format is the tape equivalent of GCR and MFM used on floppy disks whereas the high-level format is comparable to an OS's directory structure and file formats.

I was asking about both but actually I was most interested in the high-level format. It turns out that the same Nes Dev wiki actually has this link that includes that info, but in Japanese. Google Translate does well with it though:

 Similar to Sharp's MZ and X1, the PWM method is used for soft timing.
 The tape format is also quite close to MZ and X1.
 BASIC itself can only save and load BASIC programs.
 If you want to save and load the binary file, you need to create your own program.
 
   Information block (FCB)
    "0" * 20000
    Tape mark ("1" * 40 + "0" * 40)
    "1"
    Information 128 bytes
    Checksum 2 bytes
    "1"
 
  Data block
    "0" * 20000
    Tape mark ("1" * 20 + "0" * 20)
    "1"
    Data block
    Checksum 2 bytes
    "1"
 
   Contents of 1-byte data
      "1", d7, d6, d5, d4, d3, d2, d1, d0
 
   Information block
      Attribute 1 byte ($ 02 = BASIC, $ 03 = BG-GRAPHIC)
      File name 16 bytes 16 characters or less End mark $ 00 at the end
      Spare 1 byte $ 00
      2 bytes long
      Load address 2 bytes
      Execution address 2 bytes
      104 bytes free
 
 (Note) The checksum is not simply the sum of data, but
    It is the number of "1" in the content of each bit of 1-byte data.
    If the data is $ FF, it will be +8, if it is $ C0, it will be +2, and if it is $ 00, it will be +0.
 
    BG-GRAPHIC data
    Save the data transferred from the contents of BG2 to CPU $ 0700- $ 07FFH in 4 divisions
    Data to be transferred to BG2 is loaded into CPU $ 0700- $ 07FFH in 4 divisions and transferred to PPU.

Notes:

  • PWM is "pulse width modulation".
  • It says BASIC itself can only save and load BASIC programs, but the information block contains a type field which differentiates between two file types: BASIC or "BG-GRAPHIC".
  • The information block contains load address and execute address fields, but those would only make sense for machine code files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .