Re: [stella] Supercharger BIN format

Subject: Re: [stella] Supercharger BIN format
From: Bob Colbert <retroware@xxxxxxxxxxxxx>
Date: Thu, 14 Jan 1999 07:54:03 -0600
Hi,
	Let me clarify the "bank byte" issue I tried to explain recently.
I think I should start at the beginning to make things as clear as possible.
The original question asked about the format of the Supercharger .bin file.
Eckhard provided that format, but provided the wrong formula to calculate
the value of the byte which tells the Supercharger where to put the next
page (256 bytes) of data.  On a Supercharger _TAPE_ (not a Supercharger .bin),
this byte, along with a checksum byte, is sent before each block of data.  In
a Supercharger .bin, this byte (let's call it the Bank Byte) is stored in a
table near the end of the file as described by Eckhard.  So to illustrate:

Supercharger Tape:

Assume that 0 <= n <= 23

[header tone][8 byte load header]
[Bank Byte (block 0)][Checksum Byte (block 0)][256 bytes of data (block 0)]
.
.
.
[Bank Byte (block n)][Checksum Byte (block n)][256 bytes of data (block n)]
[footer tone]
--------------------------------------------------------
Supercharger .bin file:

[256 bytes of data (block 0)]
.
.
.
[256 bytes of data (block 23)]
[8 byte load header]
[8 filler bytes]
[Bank Byte table (24 bytes)]
[8 filler bytes]
[checksum table (24 bytes)]
[184 filler bytes]
--------------------------------------------------------
Note that the tape format has block "n" as the last block while the .bin
format has block
23 as the last block.  This indicates that the tape format is variable in
length with a
maximum of 24 blocks of data while the .bin format always provides 24
blocks of data.

Now, my point is that the formula Eckhard gave:
    
    Assume: Page 1 <= Page <= 8

    [(Page -1)*4 modulo $1f]

is not accurate.  The correct formula is:

    Assume:  0 <= Page <= 7
             0 <= Bank <= 2

    (Page * 4) + Bank

As Eckhard correctly stated, if the pages were loaded in order
 (bank 0 page 0, ... bank 0 page 7,
  bank 1 page 0, ... bank 1 page 7,
  bank 2 page 0, ... bank 2 page 7)
the table would look like this:

                         Page
             | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 
     ----------------------------------------
     (bank 0) $00,$04,$08,$0c,$10,$14,$18,$1c
     (bank 1) $01,$05,$09,$0d,$11,$15,$19,$1d
     (bank 2) $02,$06,$0a,$0e,$12,$16,$1a,$1e

First off, Eckhard's formula assumes a page number with a range of 1 - 8 and
my formula assumes a page number of 0 - 7.  Furthermore, my formula assumes
a bank # range of 0 - 2.  In the example I gave in my last post, Eckhard
correctly pointed out that I used a bank # of 3 - oops! ;)  Anyway, let's
provide some examples that work:

- The block of data will load into bank 0, page 0 so (0 * 4) + 0 = 0
- The block of data will load into bank 2, page 2 so (2 * 4) + 2 = 10 = 0x0a
- The block of data will load into bank 1, page 5 so (5 * 4) + 1 = 21 = 0x15

These values can be verified in the table above.

Now, the IMPORTANT POINT is that in any given load, not all blocks may be
loaded
and those that are may not be loaded in order.  To illustrate, suppose that
the
three examples I provided above were the ONLY blocks in the load ordered as
presented above.  The Table in the .bin file would look like this:

                      
     $00,$0a,$15,$00,$00,$00,$00,$00
     $00,$00,$00,$00,$00,$00,$00,$00
     $00,$00,$00,$00,$00,$00,$00,$00

and the superchager tape would only contain the 3 blocks of data.

I hope this clears things up!

						Bob

At 05:04 PM 1/11/99 +0100, you wrote:
>I don't think I understand what you mean. The bank bytes are fixed
>on the tape. How can you have calculated bank bytes without writing
>a completely new loader BIOS that ignores the bank bytes on the tape?
>
>>            Bank Byte Bits:  7 6 5 4 3 2 1 0
>>                              \_______/   \/
>>                               Page #    Bank #
>>
>>          For example, a page loaded into bank 3, page 4
>>          would have a page # of 000100 and a bank # of
>>          11, combining these together you get 00010011
>>          for a Bank Byte of #$13.  The simple formula to
>>          calculate the Bank Byte is:
>>
>>                 (Page # * 4) + Bank #
>
>Is this just a bad example or can you really load something into
>the ROM area? (Bank 3 must be the ROM, since banks and pages are
>counted from zero. At least the bank bytes in makewav, where I got
>my information from, indicate that.)
>
>
>Thanks, Eckhard Stolberg
>
>
>
>--
>Archives (includes files) at http://www.biglist.com/lists/stella/archives/
>Unsub & more at http://www.biglist.com/lists/stella/
>


--
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Current Thread