More realistic initial V/RAM values in the boot ROM. Fixes #150 and #91

This commit is contained in:
Lior Halphon 2019-06-09 00:53:44 +03:00
parent 49d8a5cb44
commit a0c5baecd8

View File

@ -5,21 +5,26 @@ Start:
; Init stack pointer ; Init stack pointer
ld sp, $fffe ld sp, $fffe
; Clear memory VRAM
ld hl, $8000
call ClearMemoryPage
ld a, 2
ld c, $70
ld [c], a
; Clear RAM Bank 2 (Like the original boot ROM
ld h, $D0
xor a xor a
call ClearMemoryPage
ld [c], a
; Clear chosen input palette ; Clear chosen input palette
ldh [InputPalette], a ldh [InputPalette], a
; Clear title checksum ; Clear title checksum
ldh [TitleChecksum], a ldh [TitleChecksum], a
; Clear memory VRAM
ld hl, $8000
call ClearMemoryPage
ld h, $d0
call ClearMemoryPage
; Clear OAM ; Clear OAM
ld hl, $fe00 ld h, $fe
ld c, $a0 ld c, $a0
xor a
.clearOAMLoop .clearOAMLoop
ldi [hl], a ldi [hl], a
dec c dec c
@ -67,7 +72,7 @@ Start:
ld hl, $8000 ld hl, $8000
call ClearMemoryPage call ClearMemoryPage
; Copy Sameboy Logo ; Copy SameBoy Logo
ld de, SameboyLogo ld de, SameboyLogo
ld hl, $8080 ld hl, $8080
ld c, (SameboyLogoEnd - SameboyLogo) / 2 ld c, (SameboyLogoEnd - SameboyLogo) / 2
@ -183,7 +188,7 @@ ENDC
ld hl, BgPalettes ld hl, BgPalettes
ld d, 64 ; Length of write ld d, 64 ; Length of write
ld e, 0 ; Index of write ld e, c ; Index of write (C=0)
call LoadBGPalettes call LoadBGPalettes
; Turn on LCD ; Turn on LCD
@ -1008,7 +1013,7 @@ ClearVRAMViaHDMA:
ld hl, $FF51 ld hl, $FF51
; Src ; Src
ld a, $D0 ld a, $88
ld [hli], a ld [hli], a
xor a xor a
ld [hli], a ld [hli], a
@ -1021,7 +1026,7 @@ ClearVRAMViaHDMA:
; Do it ; Do it
ld a, $12 ld a, $12
ld [hli], a ld [hl], a
ret ret
GetInputPaletteIndex: GetInputPaletteIndex: