Balloon Fight (NES)/ROM map: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(Added rommap template)
 
(2 intermediate revisions by 2 users not shown)
Line 101: Line 101:
updateActorYWithF0AA = $EBB1
updateActorYWithF0AA = $EBB1
</pre>
</pre>
{{Internal Data}}

Latest revision as of 21:08, 28 January 2024

Chip tiny.png The following article is a ROM map for Balloon Fight (NES).

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