Advertisement
luckytyphlosion

LoadEDTile

Nov 1st, 2015
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LoadEDTile: ; 675b (1:675b)
  2. ; In Red/Blue, the bank for the ED_tile was defined incorrectly as bank0
  3. ; Luckily, the MBC3 treats loading $0 into $2000-$2fff range as loading bank1 into $4000-$7fff range
  4. ; Because Yellow uses the MBC5, loading $0 into $2000 - $2fff range will load bank0 instead of bank1 and thus incorrectly load the tile
  5. ; Instead of defining the correct bank, GameFreak decided to simply copy the ED_Tile in the function during HBlank
  6.     ld de, ED_Tile
  7.     ld hl, vFont + $700
  8.     ld c, $4 ; number of copies needed
  9. .waitForHBlankLoop
  10.     ld a, [rSTAT]
  11.     and %10 ; in HBlank?
  12.     jr nz, .waitForHBlankLoop
  13.     ld a, [de]
  14.     ld [hli], a
  15.     ld [hli], a
  16.     inc de
  17.     ld a, [de]
  18.     ld [hli], a
  19.     ld [hli], a
  20.     inc de
  21.     dec c
  22.     jr nz, .waitForHBlankLoop
  23.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement