Balloon Fight:ROM map

From Data Crystal
Revision as of 18:16, 3 September 2011 by Alchemic (talk | contribs) (Added rommap template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

NMI

The NMI handler runs every vertical blank in response to NMI. The pseudocode looks like this:

nmi = $C08A
push a, x, y
OAMADDR = 0
OAM_DMA = >OAM
if [$52] != [$53]:
  call $C172
call updateStars
call updateStatusBar
retraces += 1
PPUADDR = $2000
PPUSCROLL = (0, 0)
call $FFF7
vblanked = $01
if [$16] != 0:
  spinwait for vblank on PPUSTATUS=0  -- Nesticle code!
  x = 4
  y = $C6
  spinwait x*1284+y*5-1 cycles
  PPUCTRL = [$18] | [$00]
  PPUSCROLL = ([$17], 0)
pull y, x, a
return

updateStatusBar = $D78E
y = [$46] - 1
if y != 0:
  if y < 128:
    tailcall $D7FB
  return
PPUADDR = $2043
to PPUDATA write:
  $8E, [$07] through [$03], $00, $24, 24,
  $8C, $8D, [$11] through [$0D], $00, $24, 24
if [$16] != 0:
  tailcall writeRank
if [$40] != 0:
  to PPUDATA write:
    $8F, [$0C] through [$0A], 0
[$46] -= 1
return

updateLives = $D7FB
writeGameOver = $D831

writeRank:
to PPUDATA write $F7, $F8, $F9, $FA, $FB, [$4A], [$49]
  -- this text is "RANK-"
[$46] -= 1
return

updateStars = $D603
if [$4C] == 0:
  return
[$4C] -= 1  
[$4F] = X = ([$4F] + 2) & $3F
call writeOneStar
PPUADDR = ([$51], [$50])
a = PPUDATA
a = PPUDATA
for y in 3 to 0:
  if a == $D642[y]:
    tailcall $D631
return

writeOneStar:
PPUADDR = ([$51], [$50])
PPUDATA = $D643[y]
return

$FFF7:
tailcall $F758

$F758:
JOY2 = $C0
call $FB25
call $F90A
call $FA38
call $FAAC
call $F824
[$06E9] = [$F1]
[$F0] = [$F1] = [$F2] = [$F3] = 0
return

Physics

Code to handle physics starts at $EB84

; these two update the X and Y coordinates by adding the velocity to the position.
updateActorX = $EB84
updateActorY = $EB96

; these two call $F0AA before and after calling updateActorX, updateActorY
; the function of $F0AA is still not known
updateActorXWithF0AA = $EBA8
updateActorYWithF0AA = $EBB1