1

Apologies in advance as this is an old topic. I was reading the following post on how the Nintendo logo data is decompressed and scaled before being copied into the v-ram during bootstrap and interestingly enough the data written does indeed look gibberish (as pointed out by the questioner) and I have tried my best (with a gb emulator I wrote) to produce that same output...but without success.

Link to post

The assembly code in question is this part of the boot rom:

LD C,A      ; $0095  "Double up" all the bits of the graphics data
    LD B,$04        ; $0096     and store in Video RAM
Addr_0098:
    PUSH BC     ; $0098
    RL C            ; $0099
    RLA         ; $009b
    POP BC      ; $009c
    RL C            ; $009d
    RLA         ; $009f
    DEC B           ; $00a0
    JR NZ, Addr_0098    ; $00a1
    LD (HL+),A      ; $00a3
    INC HL      ; $00a4
    LD (HL+),A      ; $00a5
    INC HL      ; $00a6
    RET

In reply to above post the output to v-ram is show to be:

8000: 00000000000000000000000000000000
8010: F000F000FC00FC00FC00FC00F300F300
8020: 3C003C003C003C003C003C003C003C00
8030: F000F000F000F00000000000F300F300
8040: 000000000000000000000000CF00CF00
... and so on

Can anyone explain how this output is generated and if it is indeed correct?

Many thanks in advance.

P.S. Assumption is made that the Nintendo logo is explicitly (inside some C/Java code) copied over to v-ram starting at address 0104h during boot process to test the bootstrap.

.DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D 
.DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 
.DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E 
Faiz
  • 133
  • 1
  • 6

1 Answers1

1

After going through my code and seeing a potential silly bug (maybe a couple or two) I was able to finally get the same result as above. Please consider this resolved.

Basically I was forgetting to update the F register after the settings were changed for INC n, Add n and Sub n.

So technically, the above output seems to be correct.

Faiz
  • 133
  • 1
  • 6