Keep memory map values in hardware_constants.asm

This commit is contained in:
Remy Oukaour 2017-12-26 23:18:05 -05:00
parent 5d229dcef2
commit 47e4f21e62
8 changed files with 28 additions and 33 deletions

View File

@ -1,4 +1,19 @@
; Graciously aped from http://nocash.emubase.de/pandocs.htm . ; Graciously aped from:
; http://nocash.emubase.de/pandocs.htm
; http://gameboy.mongenel.com/dmg/asmmemmap.html
; memory map
VRAM_Begin EQU $8000
VRAM_End EQU $a000
SRAM_Begin EQU $a000
SRAM_End EQU $c000
WRAM0_Begin EQU $c000
WRAM0_End EQU $d000
WRAM1_Begin EQU $d000
WRAM1_End EQU $e000
; hardware registers $ff00-$ff80 (see below)
HRAM_Begin EQU $ff80
HRAM_End EQU $ffff
; MBC3 ; MBC3
MBC3SRamEnable EQU $0000 MBC3SRamEnable EQU $0000

View File

@ -1398,8 +1398,8 @@ ClearWRAM:: ; 25a
push af push af
ld [rSVBK], a ld [rSVBK], a
xor a xor a
ld hl, WRAM1_Start ld hl, WRAM1_Begin
ld bc, WRAM1_End - WRAM1_Start ld bc, WRAM1_End - WRAM1_Begin
call ByteFill call ByteFill
pop af pop af
inc a inc a

View File

@ -111,8 +111,8 @@ _ResetWRAM: ; 5bae
xor a xor a
call ByteFill call ByteFill
ld hl, WRAM1_Start ld hl, WRAM1_Begin
ld bc, wGameData - WRAM1_Start ld bc, wGameData - WRAM1_Begin
xor a xor a
call ByteFill call ByteFill

View File

@ -69,8 +69,8 @@ Init:: ; 17d
ld [rLCDC], a ld [rLCDC], a
; Clear WRAM bank 0 ; Clear WRAM bank 0
ld hl, WRAM0_Start ld hl, WRAM0_Begin
ld bc, WRAM0_End - WRAM0_Start ld bc, WRAM0_End - WRAM0_Begin
.ByteFill: .ByteFill:
ld [hl], 0 ld [hl], 0
inc hl inc hl
@ -87,8 +87,8 @@ Init:: ; 17d
ld a, [hFFEA] ld a, [hFFEA]
push af push af
xor a xor a
ld hl, HRAM_START ld hl, HRAM_Begin
ld bc, HRAM_END - HRAM_START ld bc, HRAM_End - HRAM_Begin
call ByteFill call ByteFill
pop af pop af
ld [hFFEA], a ld [hFFEA], a
@ -201,8 +201,8 @@ ClearWRAM:: ; 25a
push af push af
ld [rSVBK], a ld [rSVBK], a
xor a xor a
ld hl, WRAM1_Start ld hl, WRAM1_Begin
ld bc, WRAM1_End - WRAM1_Start ld bc, WRAM1_End - WRAM1_Begin
call ByteFill call ByteFill
pop af pop af
inc a inc a

View File

@ -1,4 +1,3 @@
HRAM_START EQU $ff80
hPushOAM EQU $ff80 ; 10 bytes hPushOAM EQU $ff80 ; 10 bytes
hROMBankBackup EQU $ff8a hROMBankBackup EQU $ff8a
@ -124,5 +123,3 @@ hDMATransfer EQU $ffe8
hMobile EQU $ffe9 hMobile EQU $ffe9
hFFEA EQU $ffea hFFEA EQU $ffea
hClockResetTrigger EQU $ffeb hClockResetTrigger EQU $ffeb
HRAM_END EQU $ffff

View File

@ -1,9 +1,3 @@
SRAM_Begin EQU $a000
SRAM_End EQU $c000
GLOBAL SRAM_Begin, SRAM_End
SECTION "Scratch", SRAM SECTION "Scratch", SRAM
sScratch:: ds $600 ; a000 sScratch:: ds $600 ; a000

View File

@ -1,9 +1,3 @@
VRAM_Begin EQU $8000
VRAM_End EQU $a000
GLOBAL VRAM_Begin, VRAM_End
SECTION "VRAM0", VRAM SECTION "VRAM0", VRAM
VTiles0:: ds $800 VTiles0:: ds $800

View File

@ -1,14 +1,9 @@
INCLUDE "includes.asm" INCLUDE "includes.asm"
INCLUDE "macros/wram.asm" INCLUDE "macros/wram.asm"
INCLUDE "vram.asm" INCLUDE "vram.asm"
WRAM0_Start EQU $c000
WRAM0_End EQU $d000
WRAM1_Start EQU $d000
WRAM1_End EQU $e000
GLOBAL WRAM0_Start, WRAM0_End, WRAM1_Start, WRAM1_End
SECTION "Stack", WRAM0 SECTION "Stack", WRAM0