Addng Support for New/Modified ROMs Using Neogeo.drv

The file format for Neogeo.drv is straightforward.

Ex.

[kof98]
King of Fighters '98
noclone
1998
SNK
MVS
20
ROM_REGION 0x500000
ROM_LOAD_WIDE_SWAP kof98_p1.rom 0x000000 0x100000 0x61ac868a 
ROM_LOAD_WIDE_SWAP kof98_p2.rom 0x100000 0x400000 0x980aba4c 
NEO_SFIX_128K kof98_s1.rom 0x7f7b4805 
ROM_REGION 0x2000000
ROM_LOAD kof98_c1.rom 0x0000000 0x800000 0xe564ecd6  
ROM_LOAD kof98_c3.rom 0x0800000 0x800000 0x22127b4f  
ROM_LOAD kof98_c5.rom 0x1000000 0x800000 0x9d10bed3  
ROM_LOAD kof98_c7.rom 0x1800000 0x800000 0xf6d7a38a  
ROM_REGION 0x2000000
ROM_LOAD kof98_c2.rom 0x0000000 0x800000 0xbd959b60  
ROM_LOAD kof98_c4.rom 0x0800000 0x800000 0x0b4fa044  
ROM_LOAD kof98_c6.rom 0x1000000 0x800000 0xda07b6a2  
ROM_LOAD kof98_c8.rom 0x1800000 0x800000 0xc823e045  
NEO_BIOS_SOUND_256K kof98_m1.rom 0x4e7a6b1b 
ROM_REGION_OPTIONAL 0x1000000
ROM_LOAD kof98_v1.rom 0x000000 0x400000 0xb9ea8051 
ROM_LOAD kof98_v2.rom 0x400000 0x400000 0xcc11106e 
ROM_LOAD kof98_v3.rom 0x800000 0x400000 0x044ea4e1 
ROM_LOAD kof98_v4.rom 0xc00000 0x400000 0x7985ea30 

Looks familiar? If you know how to add drivers to NeoMAME, it should.
The name of the game (and the rom file) is in square brackets.
The next four lines specify the game description,year of release, 
game manufacturer, and ROM image type (MVS or MGD2). 

The number on the next line specfies how many lines of driver data follow.
This means that there are 20 lines from ROM_REGION 0x500000 to 
ROM_LOAD kof98_v4.rom 0xc00000 0x400000 0x7985ea30. 

The next section, is pretty much the same as MAME's driver macros,
except for the fact that there are no parentheses, commas, comments, or
quotation marks.

The supported driver-definition macros are :

ROM_REGION
ROM_REGION_DISPOSE
ROM_REGION_OPTIONAL
ROM_LOAD
ROM_CONTINUE
ROM_RELOAD
ROM_LOAD_WIDE
ROM_LOAD_WIDE_SWAP
ROM_LOAD_EVEN
ROM_LOAD_ODD
NEO_BIOS_SOUND_256K
NEO_BIOS_SOUND_128K
NEO_BIOS_SOUND_64K
NEO_SFIX_128K
NEO_SFIX_64K
NEO_SFIX_32K

Notes : the parser is a bit unforgiving. no blank lines allowed, except between 
game drivers. No comments, too. Numbers are hexadecimal only. Oh, and don't make 
your strings too long. It's quite easy to crash KBMAME if there's an error in 
the driver file. Noclone means an entire driver is in the file. IF a clone is specfied,
ex. clone wakuwak7, the old driver will be used (useful for changing just checksums).

Basically, to port an existing driver from the MAME source for modification, you do
this (more or less) :

1) add a new header [gamename] in neogeo.drv.
2) specify if it is a clone (uses an existng driver) or not
3) add the description,year,manufacturer in next 3 lines
4) place MVS or MGD2 on the next line
5) leave a blank line (to be filled later)
6) copy and paste the driver definition from the MAME source
   (everything between ROM_START and ROM_END)
7) remove all comments
8) search and replace the ff: (replace with blanks)
    a) "
    b) ,
    c) (
    d) )
   No, do not search and replace the ENTIRE file. Just the macros ;)
   
8) evaluate all expressions like (0x20000 | ROM_FLAG_WIDE | ROM_FLAG_SWAP)
   and 0x0000 & ~1 and replace them with equivalents.

   For an example of this, compare the shocktro & aof entries in the sample
   neogeo.drv file to the MAME source.

9) count all the entries (lines) from the first MACRO (not header) to the last
   and place the number on the blank line in step 4.

To use the driver in the neogeo.drv file, use the commandline
 
KBMAMEA nameofgame -newdrv
        -or-
KBMAMEC nameofgame -newdrv

If MAME already supports the specified game, any settings for the same game 
in neogeo.drv will override MAME's settings if the -newdrv parameter is used.


**** NEW ****

To just change checksums in an existing driver file without having to write another driver, 
use this format :

[wakuwak7]
clone  wakuwak7
Waku Waku 7
199x
SNK
MVS
0
waku7_v1.rom 0x75bbd358
waku7_v2.rom 0x4c568c78
-1

Since an existing driver will be used, that driver is specified (wakuwak7). Since there
is no driver definition here, the line specifying the number of macros in the driver definition 
is zero. From this point on is a list of filenames and checksums to change in the existing driver,
in this (hypothetical) example, two sound roms for Waku Waku 7. After all the files have been 
listed, the entry shows -1 to indicate the end of the list.

Additionally, support for MAME's SRAM hacks now exists. As the last line of the driver definition,
create an entry like this :

SRAMHACK 0x100

where 0x100 is the address to watch. If you do not understand what I mean, you are better off
leaving this one alone!

Note : If the SRAM hack doesn't seem to work, delete the game's .hi file and run KBMAME again.

**** NEW (3/6/98) ****

The -newdrv parameter has been removed.  Now, KBMAME will check the neogeo.drv file FIRST. If
it finds a driver for  the specified game there, it overrides the default driver automatically.
This is really useful for those checksum changes (no need to type -newdrv to get rid of the checksum
error). 

To force KBMAME to use the existing driver instead of the one in neogeo.drv,  use the -olddrv parameter.

**** NEW (4/13/99) ****

In addition to MVS and MGD2, the dynamic driver now has a RASTER option for those
games which need the MVS Raster driver. Usage : just like the previous ones :)

- Deimos (http://members.xoom.com/Deimos0)