Program Setup – Neo-Geo Programming Guide


Program Setup

In order to make a "working" Neo-Geo binary, you don't really need to have much code. However, if you want to make sure no stone is unturned, keep reading...

68K Header

The 68K header begins at $0 and defines the Supervisor Stack Pointer, Initial Program Counter, and various vector points.

Location Description Notes
$00 Initial Supervisor Stack Pointer  
$04 Initial Program Counter  
$08 Bus Error  
$0C Address Error Used by Debug BIOS for starting the Monitor.
$10 Illegal Instruction  
$14 Divide by 0 YOU CAN'T DO THIS!!! but your game/program can catch it in case it does.
$18 CHK Instruction  
$1C TRAPV Instruction  
$20 Privilege Violation  
$24 Trace  
$28 Line 1010 Emulator Used when running an instruction of the format $Axxx.
$2C Line 1111 Emulator Used when running an instruction of the format $Fxxx.
$30-$3B Reserved  
$3C Uninitialized Interrupt Vector  
$40-$5F Reserved  
$60 Spurious Interrupt  
$64 Level 1 Interrupt Level 2 INT on NeoGeo CD!
$68 Level 2 Interrupt Level 1 INT on NeoGeo CD!
$6C Level 3 Interrupt  
$70 Level 4 Interrupt  
$74 Level 5 Interrupt  
$78 Level 6 Interrupt  
$7C Level 7 Interrupt  
$80-$FF Traps  

Neo-Geo Header

The Neo-Geo header begins at $100 and represents the bulk of the required code for making a booting binary.

Location Description Notes
$100 "NEO-GEO" magic number/string NEO-GEO
$107 System Version (1 byte)  
$108 NGH number (1 word [2 bytes]) 0000 prohibited.
$10A Program size in bytes (1 longword [4 bytes])  
$10E Pointer to 68K user backup RAM block (1 longword [4 bytes]) First two bytes are Debug DIPs.
$112 Size of save game in bytes (1 word [2 bytes])  
$114 Eye-catch animation flag (1 byte) 0=Handled by BIOS; 1=Handled by game; 2=Nothing
$115 Sprite bank number for BIOS eyecatch (1 byte) Used if $114 is 0. Always shown on Universe BIOS.
$116 Pointer to Japanese soft DIP (1 longword [4 bytes])  
$11A Pointer to USA soft DIP (1 longword [4 bytes])  
$11E Pointer to European soft DIP (1 longword [4 bytes])  
$122 JMP to USER subroutine  
$128 JMP to PLAYER_START  
$12E JMP to DEMO_END  
$134 JMP to COIN_SOUND  
$182 Pointer to Security Code (1 longword [4 bytes])  

Security Code

You might find this being called "Trap Code" as well. It's just another thing required by the system before you can boot the game. The value at $182 must point to it as well.

TrapCode:
	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

Software DIPs

Most arcade games use physical dip switches to change the game settings. Since the Neo-Geo uses multiple cartridges, these dip switches needed to be moved to the software side.

(todo)

This guide written by AJ/freem, 2014-2015.
"NEOGEO" is a registered trademark of SNK Playmore Corp. All other company and product names used are trademarks or registered trademarks of their respective owners.
This guide is not authorized or licensed by SNK Playmore.