the cutting room mirror

Dr. Mario (Game Boy)

This article has a talk page!
view on tcrf.net

This page contains notes for the game Dr. Mario (Game Boy).

Cut code#

This cut code has something to do with when the game is being played. This appears to be early code for rendering some early version of the HUD.

$FFEF hWaitFrames
$FFE1 hGameStatus
$FFB1 hIsOnPlayerSelect
$FF85 hVBlankStatus

$C4F1 wIsGameStarted

VBLANK_COMPLETE %00000001
GAME_STARTED    %00000011

0:01A6
VBlank:
  push af
  push bc
  push de
  push hl

  ldh a, hIsOnPlayerSelect ; Also true during 2 player.
  and a
  jr  z, .renderSprites
  ld  a, wIsGameStarted
  and a
  jr  z, .renderSprites
  ldh a, hWaitFrames
  and a
  jr  nz, .renderGameBoard

.renderSprites
  ldh a, hGameStatus
  cp  a, GAME_STARTED
  jr  z, .renderGameBoard
  call RenderSprites

.renderGameBoard
  call RenderGameBoard

  ldh a, isOnPlayerSelect
  and a
  jr  nz, .renderCutOutContent
  ld de, $C0A3 ; CHR data to place
  ld hl, $984C ; CHRRAM - Scoreboard
  call DrawScoreDigits ; maybe copy routine.

.renderCutOutContent
  ldh a, hIsOnPlayerSelect  ; Also true during 2 player.
  and a
  jr  z, .l4
  ld  a, wIsGameStarted
  and a
  jr  z, .l4

  ;; Cut out code. Probably some UI component.
  ;; Maybe some old magazines/screenshots could shine some light here.

.l4
  ld a, VBLANK_COMPLETE
  ldh hVBlankStatus, a

  pop hl
  pop de
  pop bc
  pop af
  reti

0:257B
DrawScoreDigits:
  ret

0:2E2D
RenderGameBoard:
  ret

0:FFB6
RenderSprites:
  ret

Virus placement algorithm#

The algorithm is:

b = t1[lvl] c = t2[lvl] a = [$FF04] (divisor register, aka "random number generator" but not truly.)

swap_nibbles_in(a)

b = b and a (and is used as a cheap max() function) c = c and a

d = 0x7F - (b + c) position_on_board = 0xC800 + d

This board is filled with 0xFF, 0xE0, 0xE1 and 0xE2.