Nintendo DMG-01 - Game Boy Console Manual page 135

Manual
Table of Contents

Advertisement

TM
Game Boy
CPU Manual
Write1:
ldh a,[$41]
and 2
jr nz,Write1
ld [hl],b
ei
ret
There should not be many instructions between the "jr
nz" and write to memory "ld [hl],b". A worst case of
64 CPU clock cycles are available to access main
video memory (not OAM!) following the "jr nz"
command.
The "di" and "ei" commands above are only required
if you are using Serial, Timer, or Hi-2-Lo
interrupts.
5. The LCD display is on at reset (bit 7 of $ff40 set to
bit 7 of $ff40 set to 1). Before the LCD display can
be turned off you must wait for V-Blank. One popular
way of doing this is the following:
; Turn off LCD display
LCDOff:
ldh a,[$44h]
cp $90
jr nz,LCDOff
xor a
ldh [$41],a
ret
Note you should disable interrupts, if they are
enabled, before executing the above code or else the
test of $ff44 could prove invalid.
Turning the LCD display on can be done at any time.
by DP
;read $ff41
;turn on interrupts
; $ff44=LCDC Y-Pos
; $90 and bigger = in VBL
; Loop until = $90
; Turn off LCD display
5.1. Emulator Notes
Page 135

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Game boy

Table of Contents