Common pitfalls: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
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 $300001 at least each frame.
* Misaligned word or longword read/write (generates an [[68k error handling|Address error]])
* An exception is occuring, set up a simple [[68k exception handling]] screen to debug your code.
* RTS with wrong return address in stack (or bad SP ?)
** Misaligned word or longword read/write
* JSR to BIOSF_BOOTSCR ($C00438) instead of JMP
** RTS with wrong return address in stack (or bad SP ?)
** JSR instead of JMP
** Jump table with bad index


=Invisible sprites=
=Invisible sprites=
* Sprites are disabled (NeoGeo CD only)
* Sprites are disabled (NeoGeo CD only, activated by default)
* The [[fix layer]] is filled with non-transparent tiles and hides everything.
* The [[fix layer]] is filled with non-transparent tiles and hides everything. Clear fix with tiles filled with color 0.
* Sprite position is out of the 320x224 visible area.
* Sprite position is out of the 320x224 visible area.
* Sprite height is set to 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 ?).
* Tile colors are the same as the backdrop color
* Shrinking values too low (at least one pixel should still be visible).
* Shrinking values too low (at least one pixel should still be visible).
* Bad [[C ROM]], it happens...
* Bad [[C ROM]], it happens...
Line 18: Line 21:


=Invisible fix layer=
=Invisible fix layer=
* Fix is disabled (NeoGeo CD only)
* Fix is disabled (NeoGeo CD only, activated 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 is not black.
* Reference color is not black.
Line 43: Line 47:
* Check the "NEO-GEO" string at 0x100
* Check the "NEO-GEO" string at 0x100
* Check the security code at (0x182).l
* Check the security code at (0x182).l
=Vblank routine is long=
* Stop the timer interrupt when out of the active display. The timer interrupt can be very mean.


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

Revision as of 04:35, 29 October 2011

Check your hardware before checking your code...

Unwanted resets

  • The watchdog isn't reset often enough, write a byte to $300001 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
    • RTS with wrong return address in stack (or bad SP ?)
    • JSR instead of JMP
    • Jump table with bad index

Invisible sprites

  • Sprites are disabled (NeoGeo CD only, activated by default)
  • The fix layer is filled with non-transparent tiles and hides everything. Clear fix with tiles filled with color 0.
  • Sprite position is out of the 320x224 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
  • Shrinking values too low (at least one pixel should still be visible).
  • Bad C ROM, it happens...
  • Reference color (0) is not black.

Invisible fix layer

  • Fix is disabled (NeoGeo CD only, activated 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.
  • VRAM writes too fast.
  • Never use CLR instructions on LSPC registers.

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_HBLANKCNT ($3C0006).
  • 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)

  • Check the "NEO-GEO" string at 0x100
  • Check the security code at (0x182).l

Vblank routine is long

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