Boot process

From NeoGeo Development Wiki
Jump to: navigation, search

MVS boot process (SP-E)

  • Interrupts are disabled and acknowledged, watchdog is kicked, $4000 in Reg.png REG_LSPCMODE (Autoanim speed = 64 frames)
  • Puts $FF on all 3 LED latches (uses NOP waits)
  • Use BIOS vector table and onboard FIX/M1 ROM, activate both coin lockouts
  • Checks the 64KiB of work RAM by filling with $5555 and reading back, filling with $AAAA and reading back, filling with increment and reading back.
  • If all dipswitches are down, check backup RAM like before but in an infinite loop
  • If not, check if "BACKUP RAM OK !",$80 is at $D00010
  • If string isn't there:
    • Go for full check
    • Init backup RAM by filling the 64KiB with zeroes backwards ($D0FFFF to $D00000)
    • Copy "BACKUP RAM OK !",$80 string
    • Write 01 01 01 02 01 01 01 03 00 00 30 3B 00 (13 bytes) to $D0003A
    • Write $23(35) to $D00122
    • Write 8 times $0000FFFF from $D00124
    • Write $F0F0F0F0 to $D001AC
    • Write $FFFF to $D001B0
    • Reprotect backup RAM
  • Checks the 2*8KiB of palette RAM, bank 0 and 1
  • Checks the low VRAM ($0000~$7FFF) and high VRAM ($8000~$85FF) with the same $5555/$AAAA/inc method
  • Tells the RTC to output a 1s period pulse, time is measured in frames using the Vblank interrupt between two falling edges, if less than 57 or more than 64 frames: Calendar error. Warning: code can get stuck in a loop if RTC pulse line is cut ?
  • Weird check on the Vblank handler pointer in the bios itself, never changes ?
  • Computes 16bit bios checksum by adding together 128 bytes from $000000 (vector table) and all the ones from $C00082 to $C1FFFF. The value is then compared against the one at $C00080, if it's different: "SYSTEM ROM ERROR"
  • Memory card name is requested with CARD function, if error code $81 (inserted but not formatted), do full check with $55, $AA then 16bit inc.
  • $D0005E=$FFFF,$D00060,$D00048,$D00020=$0000, 16 bytes are cleared from $D00024 upwards
  • Reads the time from RTC and sets $D0005A.b to the hour
  • Reads date from RTC and compares year/month/day with $D00104.b, if difference:
    • $10F300 = $D00105, $D00104.l = $10FDD2, $D00122.b inc'd up to $24 in a loop with other stuff
    • ...

CD boot process (TOP-SP1)

  • CD registers are set like this:
    • $FF0015.b = $07
    • $FF0017.b = 0
    • $FF0006.w = $71FF
    • $FF0008.w = 0
    • $FF000A.w = $7E40
    • $FF0165.b = 3, then 1
    • $FF000D.b = 3
    • $FF000E.b = 0
    • $FF0119.b = 0 (disable video output)
    • $FF0111.b = 1 (enable sprites)
    • $FF0115.b = 1 (enable fix)
    • $FF0101.b = $A
    • $FF0103.b = 0
    • $FF0101.b = $E
    • $FF0103.b = $10
    • $FF0167.b clr
    • $FF016D.b = 0
    • $FF016F.b = 0 (enable IRQs)
  • Init RAM
  • Load BIOS vector table
  • Disable interrupts
  • Load DRAMs with graphics & stuff
  • Enable interrupts