Common pitfalls: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
(Add known problems when games doesn't boot)
mNo edit summary
 
(15 intermediate revisions by the same user not shown)
Line 2: Line 2:


=Unwanted resets=
=Unwanted resets=
* Watchdog not written to often enough
* The [[watchdog]] isn't reset often enough, write a byte to {{Reg|REG_DIPSW}} at least each frame.
* Misaligned word or longword read/write
* An exception is occuring, set up a simple [[68k exception handling]] screen to debug your code.
* Misaligned word or longword read/write (address error)
* RTS with wrong return address in stack (or bad SP ?)
* RTS with wrong return address in stack (or bad SP ?)
* JSR to BIOSF_BOOTSCR ($C00438) instead of JMP
* JSR instead of JMP
* Jump table with bad index (address error)
* [[Timer interrupt]] too fast, causes stack to explode


=Invisible sprites=
=Invisible sprites=
* Sprites are disabled (NeoGeo CD only)
* Sprites are disabled (NeoGeo CD only, they're enabled by default)
* The [[fix layer]] is filled with non-transparent tiles and hides everything.
* The [[fix layer]] is filled with non-transparent tiles which hide everything.
* Sprite position is out of the 320x224 visible area.
* Sprite position is out of the 320*224 visible area.
* Sprite size is 0 ([[Sprites|SCB3]]).
* Sprite height is set to 0 ([[Sprites|SCB3]]).
* Sprite tiles are all transparent (bad tile numbers ?).
* Sprite tiles are all transparent (bad tile numbers ?).
* Shrinking values too low (few pixels should still be visible).
* Tile colors are the same as the backdrop color.
* Wrong palette bank.
* Shrinking values too low (at least 2 pixels should still be visible).
* Bad [[C ROM]], it happens...
* Bad [[C ROM]], it happens...
* [[Palettes|Reference color]] (0) is not black.
* [[Palettes|Reference color]] (0) is not black.


=Invisible fix layer=
=Invisible fix layer=
* Fix is disabled (NeoGeo CD only)
* Fix is disabled (NeoGeo CD only, enabled by default)
* No non-transparent tiles mapped (bad [[S ROM]] ?)
* No non-transparent tiles mapped (bad [[S ROM]] ?)
* Tile colors are the same as the backdrop color.
* Tiles are on the invisible borders.
* Tiles are on the invisible borders.
* Reference color (0) is not black.
* Reference color is not black.


=Wrong colors=
=Wrong colors=
* Reference color (0) is not black. Set $400000 to #$8000.
* The wrong palette bank is selected.
* Palettes loading routine is broken.
* Reference color is not black.
* Palettes loading routine is broken (byte load instead of word, bad offset...).
* Tiles are assigned to an uninitialized palette.
* Tiles are assigned to an uninitialized palette.


=Shrinked sprites show garbage below them=
=Erratic sprite movement or display=
* The unused part of the sprite maps isn't cleared with a transparent tile (hardware glitch ?).
 
=Erratic sprite movement=
* Sprite is driven by the previous one.
* Sprite is driven by the previous one.
* VRAM writes too fast.
* {{Reg|REG_VRAMRW}} or {{Reg|REG_VRAMMOD}} writes too fast.
* '''Never''' use CLR instructions on [[Memory mapped registers|LSPC registers]].
* The [[68k interrupts|Timer interrupt]] routine has VRAM writes which interferes with the VBlank interrupt routine. Disable the Timer interrupt when out of the display area.


=Interrupts don't work=
=Interrupts don't work=
* Some emulators ignore the [[68k interrupts|raster line interrupt]], it may work on the real hardware.
* Some emulators ignore the [[68k interrupts|timer interrupt]], it may work on the real hardware.
* Interrupt mask cause them to be ignored by the 68k. Check the SR register.
* The interrupt mask causes them to be ignored by the 68k. Check the SR register.
* Wrong configuration of the raster line interrupt, see [[Memory mapped registers|'''REG_HBLANKCNT''' ($3C0006)]].
* Wrong configuration of the timer interrupt, see {{Reg|REG_LSPCMODE}}.
* The interrupt vector points to an RTE or RTS. Beware of the different levels between cart and CD systems.
* The interrupt vector points to an RTE or RTS. Beware of the different levels between cart and CD systems.


=Game don't boot (goes directly to the crosshatch)=
=Game doesn't boot (crosshatch or blue screen)=
* Check the "NEO-GEO" string at 0x100
See [[68k program header]]:
* Check the security code at (0x182).l
* Check the "NEO-GEO" string at $100
* Check the security code and pointer at $182
* NGH number at $108 must be greater than 0
 
=Game isn't recognized on Neo CD=
* Check that all files in IPL.TXT are present
* Check that IPL.TXT ends with CR+LF
* Check if the ABS, CPY and BIB files are present and that they contain the right data
 
=Neo CD resets after initial load=
* Check that a file for every type of data is listed in IPL.TXT: [[game CD structure]].
 
=Vblank routine is long=
* Stop the timer interrupt when out of the active display. The timer interrupt can be very mean.


=No sound=
* Writes to YM2610 are [[Z80/YM2610 interface|done too fast]].


[[Category:Code]]
[[Category:Code]]
[[Category:HowTo]]

Latest revision as of 19:16, 13 May 2017

Check your hardware before checking your code...

Unwanted resets

  • The watchdog isn't reset often enough, write a byte to REG_DIPSW at least each frame.
  • An exception is occuring, set up a simple 68k exception handling screen to debug your code.
  • Misaligned word or longword read/write (address error)
  • RTS with wrong return address in stack (or bad SP ?)
  • JSR instead of JMP
  • Jump table with bad index (address error)
  • Timer interrupt too fast, causes stack to explode

Invisible sprites

  • Sprites are disabled (NeoGeo CD only, they're enabled by default)
  • The fix layer is filled with non-transparent tiles which hide everything.
  • Sprite position is out of the 320*224 visible area.
  • Sprite height is set to 0 (SCB3).
  • Sprite tiles are all transparent (bad tile numbers ?).
  • Tile colors are the same as the backdrop color.
  • Wrong palette bank.
  • Shrinking values too low (at least 2 pixels should still be visible).
  • Bad C ROM, it happens...
  • Reference color (0) is not black.

Invisible fix layer

  • Fix is disabled (NeoGeo CD only, enabled by default)
  • No non-transparent tiles mapped (bad S ROM ?)
  • Tile colors are the same as the backdrop color.
  • Tiles are on the invisible borders.
  • Reference color is not black.

Wrong colors

  • The wrong palette bank is selected.
  • Reference color is not black.
  • Palettes loading routine is broken (byte load instead of word, bad offset...).
  • Tiles are assigned to an uninitialized palette.

Erratic sprite movement or display

  • Sprite is driven by the previous one.
  • REG_VRAMRW or REG_VRAMMOD writes too fast.
  • Never use CLR instructions on LSPC registers.
  • The Timer interrupt routine has VRAM writes which interferes with the VBlank interrupt routine. Disable the Timer interrupt when out of the display area.

Interrupts don't work

  • Some emulators ignore the timer interrupt, it may work on the real hardware.
  • The interrupt mask causes them to be ignored by the 68k. Check the SR register.
  • Wrong configuration of the timer interrupt, see REG_LSPCMODE.
  • The interrupt vector points to an RTE or RTS. Beware of the different levels between cart and CD systems.

Game doesn't boot (crosshatch or blue screen)

See 68k program header:

  • Check the "NEO-GEO" string at $100
  • Check the security code and pointer at $182
  • NGH number at $108 must be greater than 0

Game isn't recognized on Neo CD

  • Check that all files in IPL.TXT are present
  • Check that IPL.TXT ends with CR+LF
  • Check if the ABS, CPY and BIB files are present and that they contain the right data

Neo CD resets after initial load

Vblank routine is long

  • Stop the timer interrupt when out of the active display. The timer interrupt can be very mean.

No sound