Compare commits
10 Commits
0653447bb6
...
55392b1acc
| Author | SHA1 | Date | |
|---|---|---|---|
| 55392b1acc | |||
|
|
b69c9b91dc | ||
|
|
2fca4a9a09 | ||
|
|
a2e82037df | ||
|
|
1d49826117 | ||
|
|
a74131c1be | ||
|
|
94ea749c25 | ||
|
|
22850286e5 | ||
|
|
21a66fb027 | ||
|
|
860170ebc1 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,3 +2,6 @@
|
|||||||
/obj/
|
/obj/
|
||||||
/dep/
|
/dep/
|
||||||
/assets/
|
/assets/
|
||||||
|
|
||||||
|
src/*.2bpp
|
||||||
|
src/*.tilemap
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "src/include/hardware.inc"]
|
|
||||||
path = include/hardware.inc
|
|
||||||
url = https://github.com/gbdev/hardware.inc.git
|
|
||||||
|
|||||||
18
.vscode/launch.json
vendored
Normal file
18
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "emulicious-debugger",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Launch in Emulicious",
|
||||||
|
"program": "./bin/binx.gb",
|
||||||
|
"host": "172.19.64.1",
|
||||||
|
"port": 58870,
|
||||||
|
"stopOnEntry": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -2,6 +2,7 @@
|
|||||||
"rgbdsz80.includePath": [
|
"rgbdsz80.includePath": [
|
||||||
"src/",
|
"src/",
|
||||||
"src/constants",
|
"src/constants",
|
||||||
"src/macros"
|
"src/macros",
|
||||||
|
"include"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
19
LICENSE
19
LICENSE
@@ -1,19 +0,0 @@
|
|||||||
zlib License
|
|
||||||
|
|
||||||
Copyright (c) 2020-2022 Eldred Habert
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
10
Makefile
10
Makefile
@@ -10,7 +10,7 @@ RM_RF := rm -rf
|
|||||||
MKDIR_P := mkdir -p
|
MKDIR_P := mkdir -p
|
||||||
ifeq ($(strip $(shell which rm)),)
|
ifeq ($(strip $(shell which rm)),)
|
||||||
# Windows *really* tries its hardest to be Special™!
|
# Windows *really* tries its hardest to be Special™!
|
||||||
RM_RF := -del /q
|
RM_RF := -rmdir /s /q
|
||||||
MKDIR_P := -mkdir
|
MKDIR_P := -mkdir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -60,14 +60,14 @@ VPATH := src
|
|||||||
# Define how to compress files using the PackBits16 codec.
|
# Define how to compress files using the PackBits16 codec.
|
||||||
# (The compressor script requires Python 3.)
|
# (The compressor script requires Python 3.)
|
||||||
assets/%.pb16: src/tools/pb16.py assets/%
|
assets/%.pb16: src/tools/pb16.py assets/%
|
||||||
@${MKDIR_P} ${@D}
|
@${MKDIR_P} "${@D}"
|
||||||
$^ $@
|
$^ $@
|
||||||
|
|
||||||
# How to build a ROM.
|
# How to build a ROM.
|
||||||
# Notice that the build date is always refreshed.
|
# Notice that the build date is always refreshed.
|
||||||
bin/%.${ROMEXT}: $(patsubst src/%.asm,obj/%.o,${SRCS})
|
bin/%.${ROMEXT}: $(patsubst src/%.asm,obj/%.o,${SRCS})
|
||||||
@${MKDIR_P} ${@D}
|
@${MKDIR_P} "${@D}"
|
||||||
${RGBASM} ${ASFLAGS} -o obj/build_date.o src/assets/build_date.asm
|
${RGBASM} ${ASFLAGS} -o obj/lib/build_date.o src/lib/build_date.asm
|
||||||
${RGBLINK} ${LDFLAGS} -m bin/$*.map -n bin/$*.sym -o $@ $^ \
|
${RGBLINK} ${LDFLAGS} -m bin/$*.map -n bin/$*.sym -o $@ $^ \
|
||||||
&& ${RGBFIX} -v ${FIXFLAGS} $@
|
&& ${RGBFIX} -v ${FIXFLAGS} $@
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ bin/%.${ROMEXT}: $(patsubst src/%.asm,obj/%.o,${SRCS})
|
|||||||
# Caution: some of these flags were added in RGBDS 0.4.0, using an earlier version WILL NOT WORK
|
# Caution: some of these flags were added in RGBDS 0.4.0, using an earlier version WILL NOT WORK
|
||||||
# (and produce weird errors).
|
# (and produce weird errors).
|
||||||
obj/%.mk: src/%.asm
|
obj/%.mk: src/%.asm
|
||||||
@${MKDIR_P} ${@D}
|
@${MKDIR_P} "${@D}"
|
||||||
${RGBASM} ${ASFLAGS} -M $@ -MG -MP -MQ ${@:.mk=.o} -MQ $@ -o ${@:.mk=.o} $<
|
${RGBASM} ${ASFLAGS} -M $@ -MG -MP -MQ ${@:.mk=.o} -MQ $@ -o ${@:.mk=.o} $<
|
||||||
# DO NOT merge this with the rule above, otherwise Make will assume that the `.o` file is generated,
|
# DO NOT merge this with the rule above, otherwise Make will assume that the `.o` file is generated,
|
||||||
# even when it isn't!
|
# even when it isn't!
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -25,6 +25,14 @@ Always comes in handy.
|
|||||||
If you want to add resources, I recommend using the `src/assets` directory.
|
If you want to add resources, I recommend using the `src/assets` directory.
|
||||||
Add rules in the Makefile; an example is provided for compressing files using PB16 (a variation of [PackBits](https://wiki.nesdev.com/w/index.php/Tile_compression#PackBits)).
|
Add rules in the Makefile; an example is provided for compressing files using PB16 (a variation of [PackBits](https://wiki.nesdev.com/w/index.php/Tile_compression#PackBits)).
|
||||||
|
|
||||||
|
## Licensing
|
||||||
|
|
||||||
|
You must keep LICENSE-gb-boilerplate in your repository, but it will not affect the rest of your project (i.e. your files).
|
||||||
|
Attribution in the README is appreciated, for instance like this:
|
||||||
|
```
|
||||||
|
This project uses the [gb-boilerplate](https://codeberg.org/ISSOtm/gb-boilerplate) template by ISSOtm, under the zlib license.
|
||||||
|
```
|
||||||
|
|
||||||
## Compiling
|
## Compiling
|
||||||
|
|
||||||
Simply open you favorite command prompt / terminal, place yourself in this directory (the one the Makefile is located in), and run the command `make`.
|
Simply open you favorite command prompt / terminal, place yourself in this directory (the one the Makefile is located in), and run the command `make`.
|
||||||
@@ -40,7 +48,7 @@ If that still doesn't work, feel free to ask for help.
|
|||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
If you want something less barebones, already including some "base" code, check out [gb-starter-kit](https://github.com/ISSOtm/gb-starter-kit).
|
If you want something less barebones, already including some "base" code, check out [gb-starter-kit](https://codeberg.org/ISSOtm/gb-starter-kit).
|
||||||
|
|
||||||
Perhaps [a gbdev style guide](https://gbdev.io/guides/asmstyle) may be of interest to you?
|
Perhaps [a gbdev style guide](https://gbdev.io/guides/asmstyle) may be of interest to you?
|
||||||
|
|
||||||
@@ -49,5 +57,5 @@ I recommend the [BGB](https://bgb.bircd.org) emulator for developing ROMs on Win
|
|||||||
|
|
||||||
### Libraries
|
### Libraries
|
||||||
|
|
||||||
- [Variable-width font engine](https://github.com/ISSOtm/gb-vwf)
|
- [Variable-width font engine](https://codeberg.org/ISSOtm/gb-vwf)
|
||||||
- [Structs in RGBDS](https://github.com/ISSOtm/rgbds-structs)
|
- [Structs in RGBDS](https://codeberg.org/ISSOtm/rgbds-structs)
|
||||||
|
|||||||
Submodule include/hardware.inc deleted from 05f5a9b6c7
1157
include/hardware.inc
Normal file
1157
include/hardware.inc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# Value that the ROM will be filled with.
|
# Value that the ROM will be filled with.
|
||||||
PADVALUE := 0xFF
|
PADVALUE := 0x00
|
||||||
|
|
||||||
## Header constants (passed to RGBFIX).
|
## Header constants (passed to RGBFIX).
|
||||||
|
|
||||||
@@ -11,10 +11,10 @@ PADVALUE := 0xFF
|
|||||||
VERSION := 0
|
VERSION := 0
|
||||||
|
|
||||||
# 4-ASCII letter game ID.
|
# 4-ASCII letter game ID.
|
||||||
GAMEID := BOIL
|
GAMEID := BINX
|
||||||
|
|
||||||
# Game title, up to 11 ASCII chars.
|
# Game title, up to 11 ASCII chars.
|
||||||
TITLE := BOILERPLATE
|
TITLE := BINX
|
||||||
|
|
||||||
# New licensee, 2 ASCII chars.
|
# New licensee, 2 ASCII chars.
|
||||||
# Homebrew games FTW!.
|
# Homebrew games FTW!.
|
||||||
@@ -36,7 +36,7 @@ MBC := 0x00
|
|||||||
SRAMSIZE := 0x00
|
SRAMSIZE := 0x00
|
||||||
|
|
||||||
# ROM name.
|
# ROM name.
|
||||||
ROMNAME := boilerplate
|
ROMNAME := binx
|
||||||
ROMEXT := gb
|
ROMEXT := gb
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
scripts/update_hardware_inc.sh
Executable file
6
scripts/update_hardware_inc.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
HARDWARE_INC_URL='https://raw.githubusercontent.com/gbdev/hardware.inc/refs/heads/master/hardware.inc'
|
||||||
|
GIT_ROOT=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
|
curl "${HARDWARE_INC_URL}" -o "${GIT_ROOT}/include/hardware.inc"
|
||||||
1
src/data.asm
Normal file
1
src/data.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
if !DEF(DATA_ASM)
|
||||||
23
src/game.asm
Normal file
23
src/game.asm
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
if !def(GAME_INC)
|
||||||
|
DEF GAME_INC EQU 1
|
||||||
|
|
||||||
|
INCLUDE "hardware.inc"
|
||||||
|
rev_Check_hardware_inc 5.3.0
|
||||||
|
|
||||||
|
INCLUDE "input.asm"
|
||||||
|
INCLUDE "util.asm"
|
||||||
|
INCLUDE "ram.asm"
|
||||||
|
|
||||||
|
SECTION FRAGMENT "Game", ROM0
|
||||||
|
loop: ; Main Loop
|
||||||
|
call WaitVBlank
|
||||||
|
|
||||||
|
call RUN_DMA
|
||||||
|
|
||||||
|
call HandleDirectionInput
|
||||||
|
|
||||||
|
jr loop
|
||||||
|
done:
|
||||||
|
jr done
|
||||||
|
|
||||||
|
endc ; game_inc
|
||||||
@@ -1,21 +1,68 @@
|
|||||||
|
INCLUDE "hardware.inc"
|
||||||
|
rev_Check_hardware_inc 5.3.0
|
||||||
|
|
||||||
|
INCLUDE "util.asm"
|
||||||
|
INCLUDE "ram.asm"
|
||||||
|
INCLUDE "data.asm"
|
||||||
|
INCLUDE "game.asm"
|
||||||
|
INCLUDE "input.asm"
|
||||||
|
INCLUDE "screen.asm"
|
||||||
|
|
||||||
SECTION "Header", ROM0[$100]
|
SECTION "Header", ROM0[$100]
|
||||||
|
|
||||||
; This is your ROM's entry point
|
|
||||||
; You have 4 bytes of code to do... something
|
|
||||||
di
|
di
|
||||||
jp EntryPoint
|
jp EntryPoint
|
||||||
|
|
||||||
; Make sure to allocate some space for the header, so no important
|
|
||||||
; code gets put there and later overwritten by RGBFIX.
|
|
||||||
; RGBFIX is designed to operate over a zero-filled header, so make
|
|
||||||
; sure to put zeros regardless of the padding value. (This feature
|
|
||||||
; was introduced in RGBDS 0.4.0, but the -MG etc flags were also
|
|
||||||
; introduced in that version.)
|
|
||||||
ds $150 - @, 0
|
ds $150 - @, 0
|
||||||
|
|
||||||
SECTION "Entry point", ROM0
|
SECTION "Entry point", ROM0
|
||||||
|
|
||||||
EntryPoint:
|
EntryPoint:
|
||||||
; Here is where the fun begins, happy coding :)
|
; turn off audio
|
||||||
jr @
|
ld a, $00
|
||||||
|
ld [rNR52], a
|
||||||
|
|
||||||
|
call WaitVBlank
|
||||||
|
|
||||||
|
; turn the LCD off, but wait for VBlank first
|
||||||
|
ld a, $00
|
||||||
|
ld [rLCDC], a
|
||||||
|
|
||||||
|
; Copy the DMA proc to HRAM
|
||||||
|
ld de, RUN_DMA
|
||||||
|
ld hl, DMA_Stub
|
||||||
|
ld bc, DMA_Stub.End - DMA_Stub
|
||||||
|
call CopyData
|
||||||
|
|
||||||
|
; Clear shadow OAM
|
||||||
|
call ResetShadowOAM
|
||||||
|
|
||||||
|
; Load tile data
|
||||||
|
ld de, $9000
|
||||||
|
ld hl, TestLevelTileData
|
||||||
|
ld bc, TestLevelTileData.End - TestLevelTileData
|
||||||
|
call CopyData
|
||||||
|
|
||||||
|
; Load level tilemap
|
||||||
|
ld de, $9800
|
||||||
|
ld hl, TestLevelTileMap
|
||||||
|
ld bc, TestLevelTileMap.End - TestLevelTileMap
|
||||||
|
call CopyData
|
||||||
|
|
||||||
|
; Set the scroll registers
|
||||||
|
ld a, $00
|
||||||
|
ld [rSCY], a
|
||||||
|
ld [rSCX], a
|
||||||
|
|
||||||
|
; Initialize scroll speed counter
|
||||||
|
ld a, $00
|
||||||
|
ld [INPUT_COUNTER_ADDR], a
|
||||||
|
|
||||||
|
; Set the pallets
|
||||||
|
ld a, %11100100
|
||||||
|
ld [rBGP], a
|
||||||
|
|
||||||
|
; Turn on the display
|
||||||
|
ld a, %11000001
|
||||||
|
ld [rLCDC], a
|
||||||
|
|
||||||
|
jp loop
|
||||||
121
src/input.asm
Normal file
121
src/input.asm
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
if !def(INPUT_INC)
|
||||||
|
DEF INPUT_INC EQU 1
|
||||||
|
|
||||||
|
INCLUDE "hardware.inc"
|
||||||
|
rev_Check_hardware_inc 5.3.0
|
||||||
|
|
||||||
|
INCLUDE "ram.asm"
|
||||||
|
|
||||||
|
SECTION FRAGMENT "Input", ROM0
|
||||||
|
|
||||||
|
DEF DPAD_BUTTON_MASK EQU %11101111
|
||||||
|
DEF RIGHT_DPAD_MASK EQU %00000001
|
||||||
|
DEF LEFT_DPAD_MASK EQU %00000010
|
||||||
|
DEF UP_DPAD_MASK EQU %00000100
|
||||||
|
DEF DOWN_DPAD_MASK EQU %00001000
|
||||||
|
|
||||||
|
DEF COUNTER_TICKRATE EQU 10
|
||||||
|
|
||||||
|
; register b will contain the direction button data
|
||||||
|
ReadDirectionButtons:
|
||||||
|
ld a, DPAD_BUTTON_MASK
|
||||||
|
ld [rJOYP], a
|
||||||
|
|
||||||
|
ld a, [rJOYP]
|
||||||
|
ld a, [rJOYP]
|
||||||
|
ld a, [rJOYP]
|
||||||
|
ld a, [rJOYP]
|
||||||
|
ld b, a
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
HandleDirectionInput:
|
||||||
|
; load counter and check
|
||||||
|
ld a, [INPUT_COUNTER_ADDR]
|
||||||
|
cp a, COUNTER_TICKRATE
|
||||||
|
jr c, .ret ; return if we haven't hit the tickrate
|
||||||
|
|
||||||
|
call ReadDirectionButtons ; b = input data
|
||||||
|
ld a, b
|
||||||
|
|
||||||
|
ld a, b
|
||||||
|
and a, RIGHT_DPAD_MASK
|
||||||
|
call z, PressRight
|
||||||
|
|
||||||
|
ld a, b
|
||||||
|
and a, LEFT_DPAD_MASK
|
||||||
|
call z, PressLeft
|
||||||
|
|
||||||
|
ld a, b
|
||||||
|
and a, UP_DPAD_MASK
|
||||||
|
call z, PressUp
|
||||||
|
|
||||||
|
ld a, b
|
||||||
|
and a, DOWN_DPAD_MASK
|
||||||
|
call z, PressDown
|
||||||
|
|
||||||
|
; reset the counter
|
||||||
|
ld a, $00
|
||||||
|
ld [INPUT_COUNTER_ADDR], a
|
||||||
|
.ret
|
||||||
|
; increment the counter on every call
|
||||||
|
ld a, [INPUT_COUNTER_ADDR]
|
||||||
|
inc a
|
||||||
|
ld [INPUT_COUNTER_ADDR], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
PressLeft:
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld a, [rSCX]
|
||||||
|
or a, a
|
||||||
|
jr z, .ret
|
||||||
|
|
||||||
|
dec a
|
||||||
|
ld [rSCX], a
|
||||||
|
.ret:
|
||||||
|
pop af
|
||||||
|
ret
|
||||||
|
|
||||||
|
PressRight:
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld a, [rSCX]
|
||||||
|
add a, 159
|
||||||
|
jr c, .ret ; c is set if we go above 255, which means past this tileset
|
||||||
|
|
||||||
|
ld a, [rSCX]
|
||||||
|
inc a
|
||||||
|
ld [rSCX], a
|
||||||
|
.ret:
|
||||||
|
pop af
|
||||||
|
ret
|
||||||
|
|
||||||
|
PressUp:
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld a, [rSCY]
|
||||||
|
or a, a
|
||||||
|
jr z, .ret
|
||||||
|
|
||||||
|
dec a
|
||||||
|
ld [rSCY], a
|
||||||
|
.ret
|
||||||
|
pop af
|
||||||
|
ret
|
||||||
|
|
||||||
|
PressDown:
|
||||||
|
push af
|
||||||
|
|
||||||
|
ld a, [rSCY]
|
||||||
|
add a, 143
|
||||||
|
jr c, .ret ; c is set if we go above 255, which means past this tileset
|
||||||
|
|
||||||
|
inc a
|
||||||
|
ld [rSCY], a
|
||||||
|
.ret:
|
||||||
|
pop af
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
endc ; input_inc
|
||||||
10
src/ram.asm
Normal file
10
src/ram.asm
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
if !def(RAM_INC)
|
||||||
|
DEF RAM_INC EQU 1
|
||||||
|
|
||||||
|
DEF WRAM_START EQU $C000
|
||||||
|
DEF SHADOW_OAM_ADDR EQU WRAM_START
|
||||||
|
DEF RUN_DMA EQU $FF80
|
||||||
|
|
||||||
|
DEF INPUT_COUNTER_ADDR EQU $C100
|
||||||
|
|
||||||
|
endc ; ram_inc
|
||||||
10
src/screen.asm
Normal file
10
src/screen.asm
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
if !def(SCREEN_INC)
|
||||||
|
DEF SCREEN_INC EQU 1
|
||||||
|
|
||||||
|
INCLUDE "hardware.inc"
|
||||||
|
rev_Check_hardware_inc 5.3.0
|
||||||
|
|
||||||
|
SECTION FRAGMENT "Input", ROM0
|
||||||
|
|
||||||
|
|
||||||
|
endc ; screen_inc
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
from sys import argv
|
|
||||||
|
|
||||||
|
|
||||||
with open(argv[1], "rb") as input:
|
|
||||||
with open(argv[2], "wb") as output:
|
|
||||||
output.write(bytes((byte ^ 0x80 for byte in input.read())))
|
|
||||||
58
src/util.asm
Normal file
58
src/util.asm
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
if !def(UTIL_INC)
|
||||||
|
DEF UTIL_INC EQU 1
|
||||||
|
|
||||||
|
INCLUDE "hardware.inc"
|
||||||
|
rev_Check_hardware_inc 5.3.0
|
||||||
|
|
||||||
|
SECTION FRAGMENT "Utilities", ROM0
|
||||||
|
|
||||||
|
WaitVBlank:
|
||||||
|
ldh a, [rLY]
|
||||||
|
cp 144 ;
|
||||||
|
jr c, WaitVBlank
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Params
|
||||||
|
; de: dest
|
||||||
|
; hl: source
|
||||||
|
; bc: size
|
||||||
|
CopyData:
|
||||||
|
ld a, [hli]
|
||||||
|
ld [de], a
|
||||||
|
|
||||||
|
inc de
|
||||||
|
dec bc
|
||||||
|
|
||||||
|
ld a, b
|
||||||
|
or c
|
||||||
|
jr nz, CopyData
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Needs to be copied to HRAM
|
||||||
|
DMA_Stub:
|
||||||
|
ld a, HIGH($C100)
|
||||||
|
ldh [$FF46], a ; start DMA transfer (starts right after instruction)
|
||||||
|
ld a, 40 ; delay for a total of 4×40 = 160 M-cycles
|
||||||
|
.wait
|
||||||
|
dec a ; 1 M-cycle
|
||||||
|
jr nz, .wait ; 3 M-cycles
|
||||||
|
ret
|
||||||
|
.End
|
||||||
|
|
||||||
|
ResetShadowOAM:
|
||||||
|
ld bc, $F9
|
||||||
|
ld de, $C100
|
||||||
|
.copy
|
||||||
|
ld a, 0
|
||||||
|
ld [de], a
|
||||||
|
|
||||||
|
inc de
|
||||||
|
dec bc
|
||||||
|
|
||||||
|
ld a, b
|
||||||
|
or c
|
||||||
|
jr nz, .copy
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
endc ; util_inc
|
||||||
Reference in New Issue
Block a user