68k program header: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
ASM ROM header templates.
ASM ROM header templates.


== For cartridge systems ==
==For cartridge systems==


*$0064: VBlank handling routine pointer
{|class="regdef"
*$0100: "NEO-GEO",$00 string
|'''Address'''
*$0108: [[NGH number]]
|'''Size'''
*$010A: program size (isn't read by any bios)
|'''Description'''
*$010E: pointer to debug DIPs (in [[user RAM]]) (isn't read by any bios)
|-
*$0114: boot logo flag and tile number
|$100
*$0116: pointer to Japanese [[settings info block]]
|7 bytes
*$011A: pointer to US settings info block
|"NEO-GEO" string (first cartridge recognition code).
*$011E: pointer to Euro settings info block
|-
*$0122: pointer to code start
|$107
*$0182: pointer to [[security code]]
|byte
|System version (0 for cartridge systems, 1 or 2 for adapted cart games on Neo CD ?).
|-
|$108
|word
|[[NGH number]] in BCD, 0000 prohibited.
|-
|$10A
|longword
|Total [[P ROM]] data size in bytes.
|-
|$10E
|longword
|Pointer to backup RAM data block (in [[68k user RAM]]). The first 2 bytes are the [[debug DIPs]].
|-
|$112
|word
|Size of the required game save data in bytes.
|-
|$114
|byte
|[[Eyecatcher]] animation flag. 0=Done by system ROM, 1=Done by game, 2=Nothing.
|-
|$115
|byte
|Sprite bank number (upper 8 bits of tile number) for the eye-catcher logo, if done by system ROM.
|-
|$116
|longword
|Pointer to Japanese [[Software_DIPs|software DIPs settings layout]].
|-
|$11A
|longword
|Pointer to US settings software DIPs settings layout.
|-
|$11E
|longword
|Pointer to Euro settings software DIPs settings layout.
|-
|$122
|6 bytes
|JMP to [[USER subroutine]] (code start).
|-
|$128
|6 bytes
|JMP to [[PLAYER_START subroutine]].
|-
|$12E
|6 bytes
|JMP to [[DEMO_END subroutine]].
|-
|$134
|6 bytes
|JMP to [[COIN_SOUND subroutine]].
|-
|$182
|longword
|Pointer to [[security code]] (second cartridge recognition code).
|-
|$186
|longword
|Unknown (seems only set to 0x00000000 on boards containing Spanish software DIPs).
|-
|$18A
|longword
|Unknown (seems only set to 0x00000001 on boards containing Spanish software DIPs).
|-
|$18E
|longword
|Pointer to Spanish settings software DIPs settings layout (not all games use this).
|}


===Minimal header (from [[User:Smkdan|Smkdan's]] sources)===
===Minimal header (from [[User:Smkdan|Smkdan's]] sources)===
Line 19: Line 89:
No need for a complete [[68k vector table]].
No need for a complete [[68k vector table]].


<pre>
<syntaxhighlight>
org $0000
dc.l $10F300
 
org $0004
dc.l $C00402
 
org $0064
org $0064
dc.l VBLANK ;IRQ handler
dc.l VBLANK ;IRQ handler
Line 27: Line 103:


org $0108
org $0108
dc.w $017 ;NGH
dc.w $1234 ;NGH


org $0122
org $0122
jmp Start ;entry
jmp USER ;entry


org $0114
org $0114
Line 47: Line 123:
dc.l $588851CF,$FFD83607
dc.l $588851CF,$FFD83607
dc.w $4e75
dc.w $4e75
</pre>
</syntaxhighlight>
 


===Full header (from some unknown example code)===
===Full header (from some unknown example code)===


<pre>
<syntaxhighlight>
     org $0100
     org $0100
     dc.b "NEO-GEO",$00
     dc.b "NEO-GEO",$00


     dc.w $0052       ;NGH
     dc.w $1234       ;NGH
     dc.l $00080000    ;ROM p1 size
     dc.l $00080000    ;P ROM size
     dc.l $00100000    ;debug DIPs pointer
     dc.l $00100000    ;debug DIPs pointer
     dc.w $01          ;unknown
     dc.w $01          ;size of DIP data
     dc.b $00          ;bootscreen flag, anything else than 0x00 means no logo
     dc.b $00          ;let the BIOS show the logo
     dc.b $1B          ;first tile number of the NeoGeo logo in the C ROMs
     dc.b $1B          ;first tile of the logo is $1B00
     dc.l JPConfig    ;Japanese config menu pointer
     dc.l JPConfig    ;Japanese config menu pointer
     dc.l USConfig    ;US config menu pointer
     dc.l USConfig    ;US config menu pointer
     dc.l EUConfig    ;European config menu pointer
     dc.l EUConfig    ;European config menu pointer


     jmp        Start
     jmp        USER
     jmp        Start  ;?
     jmp        PLAYER_START
     jmp        Start  ;?
     jmp        DEMO_END
     jmp        Start  ;?
     jmp        COIN_SOUND


     org $0182
     org $0182
Line 123: Line 198:
     dc.b    "WITH        "
     dc.b    "WITH        "
     dc.b    "WITHOUT    "
     dc.b    "WITHOUT    "
</pre>
</syntaxhighlight>
 
=== Config data description ===
 
{| class="regdef" style="text-align:center;"
| '''0x00'''
| Game Name
|-
| '''0x10'''
| Special entry list, see description below
|-
| '''0x16'''
| Simple options list, up to 10 entry. 1 byte per entry. Padded with 0x00 for unused options.
|-
| '''0x20'''
| Options string table. Strings are 12 bytes long and padded with 0x20 (space).
|}
 
===Special options list description====
 
You can define up to 4 special optjons.
 
The first two words can be used to define two "timer options". You can set minutes and seconds. Upper byte define the amount of minutes and the lower byte the seconds.
 
The next byte can be used for a counter, from 00 to 99. The value written is the default one. (value above 0x63 will show some garbage data).
 
The last byte can be used for a counter plus two special value : "WITHOUT" and "INFINITE" (0x00 is without and 0x64 is infinite). The counter will go from 00 to 99 and add the text "times" after.
 
They all takes one string in the strings table for the description.
 
All those options can be disable by entering 0xFF.
 
====Simple options list description====
 
Each options consist of 1 byte.
 
The upper 4 bits specify the default value and the lower 4 bits the number of choice.
 
TODO: See where the bios put the data (and which form) in the RAM. Bytes from $10FD84 to $10FD93 ?
 
===Config exemples===
 
<pre>
    dc.b    "TEST ROM    "                            ; Game name
    dc.b    $FF,$FF,$FF,$FF,$FF,$FF                  ; Special list
    dc.b    $24,$02,$00,$00,$00,$00,$00,$00,$00,$00  ; Option list
    dc.b    "LIVES      "
    dc.b    "1          "
    dc.b    "2          "
    dc.b    "3          "
    dc.b    "4          "
    dc.b    "HOW TO PLAY "
    dc.b    "WITH        "
    dc.b    "WITHOUT    "
</pre>
 
[[File:Config_1.png]]
 
[[File:Config_2.png]]
 
<pre>
    dc.b    "TEST ROM    "                            ; Game name
    dc.b    $42,$20,$20,$42,$42,$64                  ; Special list
    dc.b    $24,$02,$00,$00,$00,$00,$00,$00,$00,$00  ; Option list
    dc.b    "TIMER 1    "
    dc.b    "TIMER 2    "
    dc.b    "COUNTER    "
    dc.b    "COUNTER SPE "
    dc.b    "LIVES      "
    dc.b    "1          "
    dc.b    "2          "
    dc.b    "3          "
    dc.b    "4          "
    dc.b    "HOW TO PLAY "
    dc.b    "WITH        "
    dc.b    "WITHOUT    "
</pre>
 
[[File:Config_3.png]]


==For CD systems==
==For CD systems==
<pre>
<syntaxhighlight>
     org    $100
     org    $100
     dc.b    "NEO-GEO", $02         ;CDDA flag
     dc.b    "NEO-GEO",$02           ;CDDA flag
     dc.w    $1234                  ;NGH
     dc.w    $1234                  ;NGH
     dc.l    $00500000               ;from Metal Slug 2
     dc.l    $00080000               ;P ROM size
     dc.l    $0010F000               ;debug DIPs pointer
     dc.l    $00100000               ;debug DIPs pointer
     dc.w    $007A                  ;not used ?
     dc.w    $01                    ;size of DIP data
     dc.w   $00A1                  ;not used ?
     dc.b    $00                    ;let the BIOS show the logo
    dc.b   $1B                    ;first tile of the logo is $1B00
    dc.l    JPConfig                ;Japanese config menu pointer
    dc.l    USConfig                ;US config menu pointer
    dc.l    EUConfig                ;European config menu pointer


     org    $122
     org    $122
     jmp    Start
     jmp    Start
    jmp    Generic                ;?
    jmp    Generic                ;?
    jmp    Generic                ;?


     org    $13A
     org    $13A
     dc.w    $0000                  ;Z80 RAM address for CDDA commands
     dc.w    $0000                  ;Z80 RAM address for CDDA commands
</syntaxhighlight>


Generic:
[[Category:Base system]]
    rte
    rts
</pre>
 
[[Category:CPUs]]
[[Category:Code]]
[[Category:Code]]

Latest revision as of 21:45, 11 September 2017

ASM ROM header templates.

For cartridge systems

Address Size Description
$100 7 bytes "NEO-GEO" string (first cartridge recognition code).
$107 byte System version (0 for cartridge systems, 1 or 2 for adapted cart games on Neo CD ?).
$108 word NGH number in BCD, 0000 prohibited.
$10A longword Total P ROM data size in bytes.
$10E longword Pointer to backup RAM data block (in 68k user RAM). The first 2 bytes are the debug DIPs.
$112 word Size of the required game save data in bytes.
$114 byte Eyecatcher animation flag. 0=Done by system ROM, 1=Done by game, 2=Nothing.
$115 byte Sprite bank number (upper 8 bits of tile number) for the eye-catcher logo, if done by system ROM.
$116 longword Pointer to Japanese software DIPs settings layout.
$11A longword Pointer to US settings software DIPs settings layout.
$11E longword Pointer to Euro settings software DIPs settings layout.
$122 6 bytes JMP to USER subroutine (code start).
$128 6 bytes JMP to PLAYER_START subroutine.
$12E 6 bytes JMP to DEMO_END subroutine.
$134 6 bytes JMP to COIN_SOUND subroutine.
$182 longword Pointer to security code (second cartridge recognition code).
$186 longword Unknown (seems only set to 0x00000000 on boards containing Spanish software DIPs).
$18A longword Unknown (seems only set to 0x00000001 on boards containing Spanish software DIPs).
$18E longword Pointer to Spanish settings software DIPs settings layout (not all games use this).

Minimal header (from Smkdan's sources)

No need for a complete 68k vector table.

	org $0000
	dc.l $10F300

	org $0004
	dc.l $C00402

	org $0064
	dc.l VBLANK	;IRQ handler

	org $0100
	dc.b "NEO-GEO",$00

	org $0108
	dc.w $1234	;NGH

	org $0122
	jmp USER	;entry

	org $0114
	dc.w $0100	;logo flag, don't show it just go straight to the entry point

	org $0182
	dc.l Code	;code pointer
Code:
	dc.l $76004A6D,$0A146600,$003C206D,$0A043E2D
	dc.l $0A0813C0,$00300001,$32100C01,$00FF671A
	dc.l $30280002,$B02D0ACE,$66103028,$0004B02D
	dc.l $0ACF6606,$B22D0AD0,$67085088,$51CFFFD4
	dc.l $36074E75,$206D0A04,$3E2D0A08,$3210E049
	dc.l $0C0100FF,$671A3010,$B02D0ACE,$66123028
	dc.l $0002E048,$B02D0ACF,$6606B22D,$0AD06708
	dc.l $588851CF,$FFD83607
	dc.w $4e75

Full header (from some unknown example code)

    org $0100
    dc.b "NEO-GEO",$00

    dc.w $1234        ;NGH
    dc.l $00080000    ;P ROM size
    dc.l $00100000    ;debug DIPs pointer
    dc.w $01          ;size of DIP data
    dc.b $00          ;let the BIOS show the logo
    dc.b $1B          ;first tile of the logo is $1B00
    dc.l JPConfig     ;Japanese config menu pointer
    dc.l USConfig     ;US config menu pointer
    dc.l EUConfig     ;European config menu pointer

    jmp        USER
    jmp        PLAYER_START
    jmp        DEMO_END
    jmp        COIN_SOUND

    org $0182
    dc.l Code         ;code pointer
Code:
    dc.l $76004A6D,$0A146600,$003C206D,$0A043E2D
    dc.l $0A0813C0,$00300001,$32100C01,$00FF671A
    dc.l $30280002,$B02D0ACE,$66103028,$0004B02D
    dc.l $0ACF6606,$B22D0AD0,$67085088,$51CFFFD4
    dc.l $36074E75,$206D0A04,$3E2D0A08,$3210E049
    dc.l $0C0100FF,$671A3010,$B02D0ACE,$66123028
    dc.l $0002E048,$B02D0ACF,$6606B22D,$0AD06708
    dc.l $588851CF,$FFD83607
    dc.w $4e75

    ; Configuration menu layouts (soft DIPs)
 JPConfig:
    dc.b    "0123456789ABCDEF"                            ; Game name
    dc.b    $FF,$FF,$FF,$FF,$FF,$FF                       ; Special list
    dc.b    $24,$02,$00,$00,$00,$00,$00,$00,$00,$00       ; Option list
    dc.b    "LIVES       "
    dc.b    "1           "
    dc.b    "2           "
    dc.b    "3           "
    dc.b    "4           "
    dc.b    "HOW TO PLAY "
    dc.b    "WITH        "
    dc.b    "WITHOUT     "

 USConfig:
    dc.b    "0123456789ABCDEF"                            ; Game name
    dc.b    $FF,$FF,$FF,$FF,$FF,$FF                       ; Special list
    dc.b    $24,$02,$00,$00,$00,$00,$00,$00,$00,$00       ; Option list
    dc.b    "LIVES       "
    dc.b    "1           "
    dc.b    "2           "
    dc.b    "3           "
    dc.b    "4           "
    dc.b    "HOW TO PLAY "
    dc.b    "WITH        "
    dc.b    "WITHOUT     "

 EUConfig:
    dc.b    "0123456789ABCDEF"                            ; Game name
    dc.b    $FF,$FF,$FF,$FF,$FF,$FF                       ; Special list
    dc.b    $24,$02,$00,$00,$00,$00,$00,$00,$00,$00       ; Option list
    dc.b    "LIVES       "
    dc.b    "1           "
    dc.b    "2           "
    dc.b    "3           "
    dc.b    "4           "
    dc.b    "HOW TO PLAY "
    dc.b    "WITH        "
    dc.b    "WITHOUT     "

For CD systems

    org     $100
    dc.b    "NEO-GEO",$02           ;CDDA flag
    dc.w    $1234                   ;NGH
    dc.l    $00080000               ;P ROM size
    dc.l    $00100000               ;debug DIPs pointer
    dc.w    $01                     ;size of DIP data
    dc.b    $00                     ;let the BIOS show the logo
    dc.b    $1B                     ;first tile of the logo is $1B00
    dc.l    JPConfig                ;Japanese config menu pointer
    dc.l    USConfig                ;US config menu pointer
    dc.l    EUConfig                ;European config menu pointer

    org     $122
    jmp     Start

    org     $13A
    dc.w    $0000                   ;Z80 RAM address for CDDA commands