Code: Select all
;Disable interrupts
C79E : 78 sei ;
;Clear the CPU's decimal flag
C79F : D8 cld ;
;Reset PPU control (including the disabling of VBL interrupts)
C7A0 : A9 10 lda #$10 ;
C7A2 : 8D 00 20 sta $2000 ;
;Init stack pointer
C7A5 : A2 FF ldx #$FF ;
C7A7 : 9A txs ;
;Wait for VBL, looping until it happens
C7A8 : AD 02 20 lda $2002 ;
C7AB : 29 80 and #$80 ;
C7AD : F0 F9 beq $C7A8 ;
Code: Select all
C7A0 : A9 10 lda #$10 ;
C7A2 : 8D 00 20 sta $2000 ;
Next, when it does
Code: Select all
C7A8 : AD 02 20 lda $2002 ;
In my emulator, my memory is initialized to 0x00, so when it does the load from $2002, I load the value 0x00 into the accumulator.