Home Back

Informações Técnicas

Como juntar roms?
Para construir cartuchos multi-jogos p/ Atari ou de qualquer outro video game,
é preciso juntar as roms p/ serem gravadas na eprom, abaixo segue o metodo de junção de arquivos.

P/ juntar as roms basta digitar o seguinte comando no DOS.

copy /b rom1.bin+rom2.bin+rom... romsjuntas.bin
Bank Swtich - Seleção de Bancos de Memória (Inglês)

Bankswitching allows game programmers to include more data into a cartridge,
therefore making (hopefully) a better game with more graphics/ levels.

Bankswitching works under similar principals in all cases.  Basically, by
reading a certain location in ROM switches banks.  

(this is the F8-style of bankswitching)

Bank #1                               Bank #2
1000 JSR $1800 (do subroutine)        .
1003 (program continues)              1200 _subroutine goes here_
.                                     1209 RTS
.                                     .
1800 LDA $1FF9 (switch to bank 2)     1802 (rest of program)
1803 NOP                              1803 JSR $1200
1804 NOP                              .       
1805 NOP                              .       
1806 NOP                              1806 LDA $1FF8  (Switch back to bank 1)        
1807 NOP                              .
1808 NOP                              .
1809 RTS   (We're done w/ routine)    1809 (rest of program)                          

OK, we start out in bank #1 and we want to run a subroutine in bank #2.

What happens is this- the processor starts at 1000h in bank #1.  We call
our subroutine from here.  1800h:  We do a read to change us to bank #2.
Remember that when we change banks, we are basically doing a ROM swap.
(You can think of bankswitching as 'hot-swapping' ROMs)  Now that we're
in bank #2, the processor sees that JSR to $1200, which is the subroutine
that we wanted to execute.  We execute the subroutine and exit it with an
RTS.  This brings us back to 1806h.  We then do another read to select bank
#1.  After this instruction finishes, the processor is now in bank #1, with
the program counter pointing to 1809, which is an RTS which will take us
back to 1003 and let us continue on with our program.

                             Extra RAM in Carts
                             ----- --- -- -----

Some carts have extra RAM; There are three known formats for this:

Atari's 'Super Chip' is nothing more than a 128-byte RAM chip that maps
itsself in the first 256 bytes of cart memory.  (1000-10FFh)  
The first 128 bytes is the write port, while the second 128 bytes is the
read port.  This is needed, because there is no R/W line to the cart.

CBS  RAM Plus (RAM+)  This maps in 256 bytes of RAM in the first 512 bytes
of the cart; 1000-11FF.  The lower 256 addresses are the write port, while
the upper 256 addresses are the read port.  To store a byte and retrieve it:

LDA #$69  ; byte to store
STA $1000 ; store it
.         ; rest of program goes here
LDA $1100 ; read it back
.         ; acc=$69, which is what we stored here earlier.

M-network (AFAIK it has no name)

OK, the RAM setup in these carts is very complex.  There is a total of 2K
of RAM broken up into 2 1K pieces.  One 1K piece goes into 1000-17FF
if the bankswitch is set to $1FE7.  The other is broken up into 4 256-byte

You select which part to use by issuing a fake read to 1FE8-1FEB.  The
RAM is then available for use by all banks at 1800-19FF.  

Similar to other schemes, 1800-18FF is write while 1900-19FF is read.
Low RAM uses 1000-13FF for write and 1400-17FF for read.

Note that the 256-byte banks and the large 1K bank are seperate entities.
The M-Network carts are about as complex as it gets.

                   Descriptions of the Various Bankswitch Modes   

 -These carts are not bankswitched, however the data repeats twice in the
  4K address space.  You'll need to manually double-up these images to 4K
  if you want to put these in say, a 4K cart.

 -These images are not bankswitched.


 -AR: The Arcadia (aka Starpath) Supercharger uses 6K of RAM to store the 
  games loaded from tape. 

 -F8: This is the 'standard' method to implement 8K carts.  There are two
  addresses which select between two unique 4K sections.  They are 1FF8
  and 1FF9.  Any access to either one of these locations switches banks.
  Accessing 1FF8 switches in the first 4K, and accessing 1FF9 switches in
  the last 4K.  Note that you can only access one 4K at a time!
 -FE: Used only on two carts (Robot Tank and Decathlon).  You select banks
  via accesses to the stack.  You set the stack pointer to FF, and then a
  JSR switches banks one way, while RTS switches you back to the original
  bank (both banks are 4K).  This allows the programmers to perform 
  'automatic' bankswitching.  All the subroutines are in one bank, while
  all the game code is in another.  When you perform a JSR; you switch banks
  to the bank containg the subroutines.  Upon encoutering an RTS, the bank
  is switched back to the original calling bank.  Pretty spiffy!

 -E0: Parker Brothers was the main user of this method.  This cart is
  segmented into 4 1K segments.  Each segment can point to one 1K slice of 
  the ROM image.  You select the desired 1K slice by accessing 1FE0 to 1FE7
  for the first 1K (1FE0 selects slice 0, 1FE1 selects slice 1, etc).
  1FE8 to 1FEF selects the slice for the second 1K, and 1FF0 to 1FF8 selects
  the slice for the third 1K.  The last 1K always points to the last 1K
  of the ROM image so that the cart always starts up in the exact same place.

 -3F: Tigervision was the only user of this intresting method.  This works
  in a similar fashion to the above method; however, there are only 4 2K
  segments instead of 4 1K ones, and the ROM image is broken up into 4 2K
  slices.  As before, the last 2K always points to the last 2K of the image.
  You select the desired bank by performing an STA $3F instruction.  The
  accumulator holds the desired bank number (0-3; only the lower two bits
  are used).  Any STA in the $00-$3F range will change banks.  This appears to
  interfere with the TIA addresses, which it does; however you just use
  $40 to $7F instead! :-)  $3F does not have a corresponding TIA register, so
  writing here has no effect other than switching banks.  Very clever;
  especially since you can implement this with only one chip! (a 74LS173)


 -FA: Used only by CBS.  Similar to F8, except you have three 4K banks 
  instead of two.  You select the desired bank via 1FF8, 1FF9, and 1FFA.
  These carts also have 256 bytes of RAM mapped in at 1000-11FF.  1000-10FF
  is the write port while 1100-11FF is the read port.


 -F6: The 'standard' method for implementing 16K of data.  It is identical
  to the F8 method above, except there are 4 4K banks.  You select which
  4K bank by accessing 1FF6, 1FF7, 1FF8, and 1FF9.

 -E7: Only M-Network used this scheme.  This has to be the most complex
  method used in any cart! :-)  It allows for the capability of 2K of RAM;
  although it doesn't have to be used (in fact, only one cart used it-
  Burgertime).  This is similar to the 3F type with a few changes.  There are
  now 8 2K banks, instead of 4.  The last 2K in the cart always points to
  the last 2K of the ROM image, while the first 2K is selectable.  You
  access 1FE0 to 1FE6 to select which 2K bank. Note that you cannot select 
  the last 2K of the ROM image into the lower 2K of the cart!  Accessing
  1FE7 selects 1K of RAM at 1000-17FF instead of ROM!  The 2K of RAM is 
  broken up into two 1K sections.  One 1K section is mapped in at 1000-17FF
  if 1FE7 has been accessed.  1000-13FF is the write port, while 1400-17FF
  is the read port.  The second 1K of RAM appears at 1800-19FF.  1800-18FF
  is the write port while 1900-19FF is the read port.  You select which
  256 byte block appears here by accessing 1FF8 to 1FFB.

 -F4: The 'standard' method for implementing 32K.  Only one cart is known
  to use it- Fatal Run.  Like the F6 method, however there are 8 4K
  banks instead of 4.  You use 1FF4 to 1FFB to select the desired bank.


 -F0: Only used one cart, AFAIK.  (the 'Megaboy' cart from Dynacom)  It
  has 16 4K banks.  Accessing 1FF0 will increment the current bank.  The
  program uses location 1FEC to tell it which bank it's in.  There's a
  little loop at 1FE0 that checks this location against the accumulator,
  and if they're equal it does an RTS.  Otherwise it does an STA 1FF0
  and repeats the loop.