Compare commits
9 Commits
056bdf36a5
...
3829f62100
Author | SHA1 | Date |
---|---|---|
Randy Thiemann | 3829f62100 | |
Randy Thiemann | 679a6ee907 | |
Randy Thiemann | d10444cca6 | |
Randy Thiemann | db3276b925 | |
Randy Thiemann | 183be391da | |
Randy Thiemann | 9c32202e95 | |
Randy Thiemann | 83006e64eb | |
Randy Thiemann | 3a6de627ee | |
Randy Thiemann | 078c2001e7 |
Binary file not shown.
6
Makefile
6
Makefile
|
@ -41,9 +41,9 @@ ROM = $(BINDIR)/$(ROMNAME).$(ROMEXT)
|
||||||
# Argument constants
|
# Argument constants
|
||||||
INCDIRS = src/ src/include/
|
INCDIRS = src/ src/include/
|
||||||
WARNINGS = all extra
|
WARNINGS = all extra
|
||||||
ASFLAGS = -p $(PADVALUE) $(addprefix -i,$(INCDIRS)) $(addprefix -W,$(WARNINGS))
|
ASFLAGS = -p 0xFF $(addprefix -i,$(INCDIRS)) $(addprefix -W,$(WARNINGS))
|
||||||
LDFLAGS = -p $(PADVALUE)
|
LDFLAGS = -p 0xFF
|
||||||
FIXFLAGS = -p $(PADVALUE) -v -i "$(GAMEID)" -k "$(LICENSEE)" -l $(OLDLIC) -m $(MBC) -n $(VERSION) -r $(SRAMSIZE) -t $(TITLE)
|
FIXFLAGS = -p 0xFF -l 0x33 -m 0x03 -r 0x02 -v -i $(GAMEID) -k $(LICENSEE) -t $(TITLE) -n $(VERSION)
|
||||||
|
|
||||||
# The list of "root" ASM files that RGBASM will be invoked on
|
# The list of "root" ASM files that RGBASM will be invoked on
|
||||||
SRCS = $(wildcard src/*.asm)
|
SRCS = $(wildcard src/*.asm)
|
||||||
|
|
|
@ -103,9 +103,8 @@ The game can be built using gnu make and the RGBDS toolchain.
|
||||||
|
|
||||||
|
|
||||||
## Future Goals
|
## Future Goals
|
||||||
- Multiplayer with items.
|
- Implement better sound engine.
|
||||||
- Colorization.
|
- Add more speed curves.
|
||||||
- ...
|
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
32
project.mk
32
project.mk
|
@ -1,13 +1,29 @@
|
||||||
PADVALUE := 0xFF
|
# ROM Version
|
||||||
VERSION := 0
|
VERSION := 0x01
|
||||||
|
|
||||||
|
# 4 Character Game ID
|
||||||
GAMEID := DTGM
|
GAMEID := DTGM
|
||||||
|
|
||||||
|
# ROM Title (14 chars max)
|
||||||
TITLE := DMGTRIS
|
TITLE := DMGTRIS
|
||||||
|
|
||||||
|
# "Licensee" code (2 chars)
|
||||||
LICENSEE := NR
|
LICENSEE := NR
|
||||||
OLDLIC := 0x33
|
|
||||||
MBC := 0x03
|
# Output options
|
||||||
SRAMSIZE := 0x02
|
ROMNAME := DMGTRIS
|
||||||
ROMNAME := out
|
ROMEXT := GBC
|
||||||
ROMEXT := gb
|
|
||||||
|
# Extra assembler flags
|
||||||
|
# Do not insert nop after halt
|
||||||
ASFLAGS += -h
|
ASFLAGS += -h
|
||||||
LDFLAGS += -d
|
# Do optimize ld to ldh
|
||||||
|
ASFLAGS += -l
|
||||||
|
|
||||||
|
# Extra linker flags
|
||||||
|
# Tiny Rom
|
||||||
LDFLAGS += -t
|
LDFLAGS += -t
|
||||||
|
|
||||||
|
# Extra fix flags
|
||||||
|
# SEt as gbc compatible
|
||||||
|
FIXFLAGS += -c
|
||||||
|
|
|
@ -110,10 +110,14 @@ sOption4::
|
||||||
sOption5::
|
sOption5::
|
||||||
db " NO"
|
db " NO"
|
||||||
db " YES"
|
db " YES"
|
||||||
sEaster0:: db $C4, $C6, $C8, $CA, $CC
|
sEasterM0:: db $C4, $C6, $C8, $CA, $CC ; MGB
|
||||||
sEaster1:: db $C5, $C7, $C9, $CB, $CD
|
sEasterM1:: db $C5, $C7, $C9, $CB, $CD
|
||||||
sEaster2:: db $CE, $D0, $C8, $CA, $CC
|
sEasterC0:: db $CE, $D0, $C8, $CA, $CC, $72, $74, $76, $78, $7A, $D6, $D7 ; CGB
|
||||||
sEaster3:: db $CF, $D1, $C9, $CB, $CD
|
sEasterC1:: db $CF, $D1, $C9, $CB, $CD, $73, $75, $77, $79, $7B, $01, $01
|
||||||
|
sEasterA0:: db $D2, $D4, $C8, $CA, $CC, $72, $74, $76, $78, $7A, $D6, $D7 ; AGB
|
||||||
|
sEasterA1:: db $D3, $D5, $C9, $CB, $CD, $73, $75, $77, $79, $7B, $01, $01
|
||||||
|
sEasterS0:: db $F6, $F8, $C8, $CA, $CC ; SGB
|
||||||
|
sEasterS1:: db $F7, $F9, $C9, $CB, $CD
|
||||||
sPieceXOffsets:: ; How to draw each piece. X-offsets of the sprites.
|
sPieceXOffsets:: ; How to draw each piece. X-offsets of the sprites.
|
||||||
db 0, 8, 16, 24 ; I
|
db 0, 8, 16, 24 ; I
|
||||||
db 0, 8, 8, 16 ; Z
|
db 0, 8, 8, 16 ; Z
|
||||||
|
@ -225,7 +229,7 @@ sSpeedCurve:: ; Speed curve of the game.
|
||||||
db 20, 1 ; 20G
|
db 20, 1 ; 20G
|
||||||
db 20, 8, 30, 24 ; ARE, DAS, LOCK, LINECLEAR
|
db 20, 8, 30, 24 ; ARE, DAS, LOCK, LINECLEAR
|
||||||
|
|
||||||
dw $0900, 900, $0900 ; Level 0900
|
dw $0900, 900, $1000 ; Level 0900
|
||||||
db 20, 1 ; 20G
|
db 20, 1 ; 20G
|
||||||
db 16, 6, 25, 16 ; ARE, DAS, LOCK, LINECLEAR
|
db 16, 6, 25, 16 ; ARE, DAS, LOCK, LINECLEAR
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,11 @@ FromShadowField:
|
||||||
|
|
||||||
; This routine will copy wField onto the screen.
|
; This routine will copy wField onto the screen.
|
||||||
BlitField::
|
BlitField::
|
||||||
|
; Hold on, are we on a gbc?
|
||||||
|
ld a, [wInitialA]
|
||||||
|
cp a, $11
|
||||||
|
jp z, GBCBlitField
|
||||||
|
|
||||||
; What to copy
|
; What to copy
|
||||||
ld de, wField + 40
|
ld de, wField + 40
|
||||||
; Where to put it
|
; Where to put it
|
||||||
|
@ -1742,6 +1747,8 @@ FieldDelay::
|
||||||
ldh a, [hBravo]
|
ldh a, [hBravo]
|
||||||
add a, 4
|
add a, 4
|
||||||
ldh [hBravo], a
|
ldh [hBravo], a
|
||||||
|
|
||||||
|
; Are there line clears?
|
||||||
call ToShadowField
|
call ToShadowField
|
||||||
call FindClearedLines
|
call FindClearedLines
|
||||||
ldh a, [hClearedLines]
|
ldh a, [hClearedLines]
|
||||||
|
@ -1755,8 +1762,8 @@ FieldDelay::
|
||||||
and a, c
|
and a, c
|
||||||
and a, d
|
and a, d
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
jr z, .skip ; If there were no line clears, skip to ARE delay.
|
jr z, .skip
|
||||||
ld a, DELAY_STATE_LINE_PRE_CLEAR ; Otherwise, do a line clear delay.
|
ld a, DELAY_STATE_LINE_PRE_CLEAR ; If there were line clears, do a line clear delay, then an ARE delay.
|
||||||
ld [wDelayState], a
|
ld [wDelayState], a
|
||||||
ldh a, [hCurrentLineClearDelay]
|
ldh a, [hCurrentLineClearDelay]
|
||||||
ldh [hRemainingDelay], a
|
ldh [hRemainingDelay], a
|
||||||
|
@ -1819,6 +1826,7 @@ FieldDelay::
|
||||||
call LevelUp
|
call LevelUp
|
||||||
|
|
||||||
; Update the combo counter.
|
; Update the combo counter.
|
||||||
|
ldh a, [hLineClearCt]
|
||||||
ld b, a
|
ld b, a
|
||||||
ldh a, [hComboCt] ; Old combo count.
|
ldh a, [hComboCt] ; Old combo count.
|
||||||
add b ; + lines
|
add b ; + lines
|
||||||
|
@ -1916,15 +1924,9 @@ FieldDelay::
|
||||||
cp a, 0
|
cp a, 0
|
||||||
jr nz, .are
|
jr nz, .are
|
||||||
|
|
||||||
; Otherwise, increment the level counter by one if it's not at a breakpoint.
|
; Otherwise, reset the combo.
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ldh [hComboCt], a
|
ldh [hComboCt], a
|
||||||
ldh a, [hRequiresLineClear]
|
|
||||||
cp a, $FF
|
|
||||||
jr z, .are
|
|
||||||
ld e, 1
|
|
||||||
call LevelUp
|
|
||||||
|
|
||||||
|
|
||||||
; ARE delay.
|
; ARE delay.
|
||||||
; Count down the delay. If it hits 0, award levels and score if necessary, then end the delay phase.
|
; Count down the delay. If it hits 0, award levels and score if necessary, then end the delay phase.
|
||||||
|
@ -1935,8 +1937,15 @@ FieldDelay::
|
||||||
cp a, 0
|
cp a, 0
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
|
; Add one level if we're not at a breakpoint.
|
||||||
|
ldh a, [hRequiresLineClear]
|
||||||
|
cp a, $FF
|
||||||
|
jr z, :+
|
||||||
|
ld e, 1
|
||||||
|
call LevelUp
|
||||||
|
|
||||||
; Cycle the RNG.
|
; Cycle the RNG.
|
||||||
ldh a, [hNextPiece]
|
: ldh a, [hNextPiece]
|
||||||
ldh [hCurrentPiece], a
|
ldh [hCurrentPiece], a
|
||||||
call GetNextPiece
|
call GetNextPiece
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,839 @@
|
||||||
|
; DMGTRIS
|
||||||
|
; Copyright (C) 2023 - Randy Thiemann <randy.thiemann@gmail.com>
|
||||||
|
|
||||||
|
; This program is free software: you can redistribute it and/or modify
|
||||||
|
; it under the terms of the GNU General Public License as published by
|
||||||
|
; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
; (at your option) any later version.
|
||||||
|
|
||||||
|
; This program is distributed in the hope that it will be useful,
|
||||||
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
; GNU General Public License for more details.
|
||||||
|
|
||||||
|
; You should have received a copy of the GNU General Public License
|
||||||
|
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
IF !DEF(GBC_ASM)
|
||||||
|
DEF GBC_ASM EQU 1
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDE "globals.asm"
|
||||||
|
|
||||||
|
DEF B0 EQU %0010000000000000
|
||||||
|
DEF B1 EQU %0100000000000000
|
||||||
|
DEF B2 EQU %0101000000000000
|
||||||
|
DEF B3 EQU %0111110000000000
|
||||||
|
DEF G0 EQU %0000000100000000
|
||||||
|
DEF G1 EQU %0000001000000000
|
||||||
|
DEF G2 EQU %0000001010000000
|
||||||
|
DEF G3 EQU %0000001111100000
|
||||||
|
DEF R0 EQU %0000000000001000
|
||||||
|
DEF R1 EQU %0000000000010000
|
||||||
|
DEF R2 EQU %0000000000010100
|
||||||
|
DEF R3 EQU %0000000000011111
|
||||||
|
|
||||||
|
|
||||||
|
SECTION "GBC Shadow Tilemap", WRAM0, ALIGN[8]
|
||||||
|
wShadowTilemap:: ds 32*32
|
||||||
|
|
||||||
|
SECTION "GBC Shadow Tile Attributes", WRAM0, ALIGN[8]
|
||||||
|
wShadowTileAttrs:: ds 32*32
|
||||||
|
|
||||||
|
SECTION "GBC Variables", WRAM0
|
||||||
|
wOuterReps:: ds 1
|
||||||
|
wInnerReps:: ds 1
|
||||||
|
wTitlePal:: ds 1
|
||||||
|
|
||||||
|
|
||||||
|
SECTION "GBC Functions", ROM0
|
||||||
|
ToATTR::
|
||||||
|
ld a, [wInitialA]
|
||||||
|
cp a, $11
|
||||||
|
ret nz
|
||||||
|
|
||||||
|
; Bank 1
|
||||||
|
ld a, 1
|
||||||
|
ldh [rVBK], a
|
||||||
|
ld a, HIGH(wShadowTileAttrs)
|
||||||
|
ldh [rHDMA1], a
|
||||||
|
ld a, LOW(wShadowTileAttrs)
|
||||||
|
ldh [rHDMA2], a
|
||||||
|
ld a, HIGH($9800)
|
||||||
|
ldh [rHDMA3], a
|
||||||
|
ld a, LOW($9800)
|
||||||
|
ldh [rHDMA4], a
|
||||||
|
ld a, 39
|
||||||
|
ldh [rHDMA5], a
|
||||||
|
ld a, 0
|
||||||
|
ldh [rVBK], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
ToVRAM::
|
||||||
|
; Bank 1
|
||||||
|
ld a, 1
|
||||||
|
ldh [rVBK], a
|
||||||
|
ld a, HIGH(wShadowTileAttrs)
|
||||||
|
ldh [rHDMA1], a
|
||||||
|
ld a, LOW(wShadowTileAttrs)
|
||||||
|
ldh [rHDMA2], a
|
||||||
|
ld a, HIGH($9800)
|
||||||
|
ldh [rHDMA3], a
|
||||||
|
ld a, LOW($9800)
|
||||||
|
ldh [rHDMA4], a
|
||||||
|
ld a, 39
|
||||||
|
ldh [rHDMA5], a
|
||||||
|
|
||||||
|
|
||||||
|
; Bank 0
|
||||||
|
ld a, 0
|
||||||
|
ldh [rVBK], a
|
||||||
|
ld a, HIGH(wShadowTilemap)
|
||||||
|
ldh [rHDMA1], a
|
||||||
|
ld a, LOW(wShadowTilemap)
|
||||||
|
ldh [rHDMA2], a
|
||||||
|
ld a, HIGH($9800)
|
||||||
|
ldh [rHDMA3], a
|
||||||
|
ld a, LOW($9800)
|
||||||
|
ldh [rHDMA4], a
|
||||||
|
ld a, 39 | $80
|
||||||
|
ldh [rHDMA5], a
|
||||||
|
jp EventLoop
|
||||||
|
|
||||||
|
|
||||||
|
GBCTitleInit::
|
||||||
|
ld a, [wInitialA]
|
||||||
|
cp a, $11
|
||||||
|
ret nz
|
||||||
|
ld a, BCPSF_AUTOINC
|
||||||
|
ldh [rBCPS], a
|
||||||
|
ldh [rOCPS], a
|
||||||
|
|
||||||
|
; Pal 0 (red, I)
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 1 (green, Z)
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, G1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, G2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, G3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 2 (purple, S)
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R1 | B1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R2 | B2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R3 | B3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 3 (blue, J)
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, B1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, B2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, B3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 4 (orange, L)
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R1 | G0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R2 | G1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R3 | G2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 5 (yellow, O)
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R1 | G1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R2 | G2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, R3 | G3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 6 (cyan, T)
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, B1 | G1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, B2 | G2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, B3 | G3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 7 (grayscale, inverted)
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, %0010000100001000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, %0100001000010000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, %0111111111111111
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Copy the tilemap to shadow.
|
||||||
|
ld de, $9800
|
||||||
|
ld hl, wShadowTilemap
|
||||||
|
ld bc, 32*32
|
||||||
|
call UnsafeMemCopy
|
||||||
|
|
||||||
|
; Set attrs to pal 7 and copy to shadow.
|
||||||
|
ld a, 1
|
||||||
|
ldh [rVBK], a
|
||||||
|
ld d, $03
|
||||||
|
ld hl, $9800
|
||||||
|
ld bc, 32
|
||||||
|
call UnsafeMemSet
|
||||||
|
ld d, $01
|
||||||
|
ld bc, (5*32)
|
||||||
|
call UnsafeMemSet
|
||||||
|
ld d, $07
|
||||||
|
ld bc, (14*32)
|
||||||
|
call UnsafeMemSet
|
||||||
|
ld de, $9800
|
||||||
|
ld hl, wShadowTileAttrs
|
||||||
|
ld bc, 32*32
|
||||||
|
call UnsafeMemCopy
|
||||||
|
|
||||||
|
; Reset back to bank 0.
|
||||||
|
xor a, a
|
||||||
|
ldh [rVBK], a
|
||||||
|
|
||||||
|
; Save the current title palette.
|
||||||
|
ld a, $07
|
||||||
|
ld [wTitlePal], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
GBCGameplayInit::
|
||||||
|
ld a, [wInitialA]
|
||||||
|
cp a, $11
|
||||||
|
ret nz
|
||||||
|
ld a, BCPSF_AUTOINC
|
||||||
|
ldh [rBCPS], a
|
||||||
|
ldh [rOCPS], a
|
||||||
|
|
||||||
|
; Pal 0 (red, I)
|
||||||
|
ld bc, R3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 1 (green, Z)
|
||||||
|
ld bc, G3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, G2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, G1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, G0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 2 (purple, S)
|
||||||
|
ld bc, R3 | B3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R2 | B2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R1 | B1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R0 | B0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 3 (blue, J)
|
||||||
|
ld bc, B3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, B2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, B1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, B0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 4 (orange, L)
|
||||||
|
ld bc, R3 | G2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R2 | G1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R1 | G0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 5 (yellow, O)
|
||||||
|
ld bc, R3 | G3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R2 | G2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R1 | G1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, R0 | G0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 6 (cyan, T)
|
||||||
|
ld bc, B3 | G3
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, B2 | G2
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, B1 | G1
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
ld bc, B0 | G0
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Pal 7 (grayscale)
|
||||||
|
ld bc, %0111111111111111
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, %0100001000010000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, %0010000100001000
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld bc, %0000000000000000
|
||||||
|
ld a, b
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
ld a, c
|
||||||
|
ldh [rBCPD], a
|
||||||
|
ldh [rOCPD], a
|
||||||
|
|
||||||
|
; Copy the tilemap to shadow.
|
||||||
|
ld de, $9800
|
||||||
|
ld hl, wShadowTilemap
|
||||||
|
ld bc, 32*32
|
||||||
|
call UnsafeMemCopy
|
||||||
|
|
||||||
|
; Copy set attrs to pal 7 and copy to shadow.
|
||||||
|
ld a, 1
|
||||||
|
ldh [rVBK], a
|
||||||
|
ld d, $07
|
||||||
|
ld hl, $9800
|
||||||
|
ld bc, (32*32)
|
||||||
|
call UnsafeMemSet
|
||||||
|
ld de, $9800
|
||||||
|
ld hl, wShadowTileAttrs
|
||||||
|
ld bc, 32*32
|
||||||
|
call UnsafeMemCopy
|
||||||
|
|
||||||
|
; Reset back to bank 0.
|
||||||
|
xor a, a
|
||||||
|
ldh [rVBK], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
GBCTitleProcess::
|
||||||
|
ld a, [wInitialA]
|
||||||
|
cp a, $11
|
||||||
|
ret nz
|
||||||
|
|
||||||
|
; Wipe the palettes.
|
||||||
|
ld d, $03
|
||||||
|
ld hl, wShadowTileAttrs
|
||||||
|
ld bc, 32
|
||||||
|
call UnsafeMemSet
|
||||||
|
ld d, $07
|
||||||
|
ld hl, wShadowTileAttrs+32
|
||||||
|
ld bc, (19*32)
|
||||||
|
call UnsafeMemSet
|
||||||
|
|
||||||
|
; Palette for the title?
|
||||||
|
ldh a, [hFrameCtr]
|
||||||
|
and $0F
|
||||||
|
cp a, $01
|
||||||
|
jr nz, .noinc
|
||||||
|
ld a, [wTitlePal]
|
||||||
|
inc a
|
||||||
|
cp a, $07
|
||||||
|
jr c, .nores
|
||||||
|
ld a, $00
|
||||||
|
.nores
|
||||||
|
ld [wTitlePal], a
|
||||||
|
.noinc
|
||||||
|
|
||||||
|
; Set the palette for the title.
|
||||||
|
ld a, [wTitlePal]
|
||||||
|
ld d, a
|
||||||
|
ld hl, wShadowTileAttrs + (2*32)
|
||||||
|
ld bc, (4*32)
|
||||||
|
call UnsafeMemSet
|
||||||
|
|
||||||
|
; And the selected row.
|
||||||
|
ld a, [wSelected]
|
||||||
|
inc a
|
||||||
|
ld hl, wShadowTileAttrs + (5*32)
|
||||||
|
ld bc, 64
|
||||||
|
: add hl, bc
|
||||||
|
dec a
|
||||||
|
jr nz, :-
|
||||||
|
ld a, 3
|
||||||
|
ld d, a
|
||||||
|
ld bc, 32
|
||||||
|
call UnsafeMemSet
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
GBCGameplayProcess::
|
||||||
|
ld a, [wInitialA]
|
||||||
|
cp a, $11
|
||||||
|
ret nz
|
||||||
|
|
||||||
|
|
||||||
|
; What to copy
|
||||||
|
ld de, wField + 40
|
||||||
|
; Where to put it
|
||||||
|
ld hl, wShadowTilemap + 1
|
||||||
|
; How much to increment hl after each row
|
||||||
|
ld bc, 32-10
|
||||||
|
|
||||||
|
; Blit me up daddy.
|
||||||
|
ld a, 20
|
||||||
|
ld [wOuterReps], a
|
||||||
|
.outer1
|
||||||
|
ld a, 10
|
||||||
|
ld [wInnerReps], a
|
||||||
|
.inner1
|
||||||
|
ld a, [de]
|
||||||
|
ld [hl+], a
|
||||||
|
inc de
|
||||||
|
ld a, [wInnerReps]
|
||||||
|
dec a
|
||||||
|
ld [wInnerReps], a
|
||||||
|
jr nz, .inner1
|
||||||
|
|
||||||
|
add hl, bc
|
||||||
|
ld a, [wOuterReps]
|
||||||
|
dec a
|
||||||
|
ld [wOuterReps], a
|
||||||
|
jr nz, .outer1
|
||||||
|
|
||||||
|
|
||||||
|
; What to copy
|
||||||
|
ld de, wField + 40
|
||||||
|
; Where to put it
|
||||||
|
ld hl, wShadowTileAttrs + 1
|
||||||
|
; How much to increment hl after each row
|
||||||
|
ld bc, 32-10
|
||||||
|
|
||||||
|
; Blit me up daddy.
|
||||||
|
ld a, 20
|
||||||
|
ld [wOuterReps], a
|
||||||
|
.outer2
|
||||||
|
ld a, 10
|
||||||
|
ld [wInnerReps], a
|
||||||
|
.inner2
|
||||||
|
ld a, [de]
|
||||||
|
cp a, 10
|
||||||
|
jr c, .empty
|
||||||
|
cp a, 10 + (1*7)
|
||||||
|
jr c, .sub10
|
||||||
|
cp a, 10 + (2*7)
|
||||||
|
jr c, .sub17
|
||||||
|
cp a, 10 + (3*7)
|
||||||
|
jr c, .sub24
|
||||||
|
cp a, 10 + (4*7)
|
||||||
|
jr c, .sub31
|
||||||
|
cp a, 10 + (5*7)
|
||||||
|
jr c, .sub38
|
||||||
|
cp a, 10 + (6*7)
|
||||||
|
jr c, .sub45
|
||||||
|
cp a, 10 + (7*7)
|
||||||
|
jr c, .sub52
|
||||||
|
cp a, 10 + (8*7)
|
||||||
|
jr c, .sub59
|
||||||
|
.empty
|
||||||
|
ld a, $07
|
||||||
|
jr .done
|
||||||
|
.sub59
|
||||||
|
sub a, 7
|
||||||
|
.sub52
|
||||||
|
sub a, 7
|
||||||
|
.sub45
|
||||||
|
sub a, 7
|
||||||
|
.sub38
|
||||||
|
sub a, 7
|
||||||
|
.sub31
|
||||||
|
sub a, 7
|
||||||
|
.sub24
|
||||||
|
sub a, 7
|
||||||
|
.sub17
|
||||||
|
sub a, 7
|
||||||
|
.sub10
|
||||||
|
sub a, 10
|
||||||
|
.done
|
||||||
|
ld [hl+], a
|
||||||
|
inc de
|
||||||
|
ld a, [wInnerReps]
|
||||||
|
dec a
|
||||||
|
ld [wInnerReps], a
|
||||||
|
jr nz, .inner2
|
||||||
|
|
||||||
|
add hl, bc
|
||||||
|
ld a, [wOuterReps]
|
||||||
|
dec a
|
||||||
|
ld [wOuterReps], a
|
||||||
|
jr nz, .outer2
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
GBCBlitField::
|
||||||
|
jp ToVRAM
|
||||||
|
|
||||||
|
|
||||||
|
ENDC
|
|
@ -277,6 +277,7 @@ LevelUp::
|
||||||
and a, $0F
|
and a, $0F
|
||||||
ld hl, hCLevel
|
ld hl, hCLevel
|
||||||
cp a, [hl]
|
cp a, [hl]
|
||||||
|
jr z, :+
|
||||||
ret nc
|
ret nc
|
||||||
|
|
||||||
: ldh a, [hNextSpeedUp]
|
: ldh a, [hNextSpeedUp]
|
||||||
|
|
|
@ -86,6 +86,15 @@ Main::
|
||||||
; Set up stack
|
; Set up stack
|
||||||
ld sp, wStackEnd-1
|
ld sp, wStackEnd-1
|
||||||
|
|
||||||
|
; GBC? Double speed mode and set up palettes.
|
||||||
|
ld a, [wInitialA]
|
||||||
|
cp a, $11
|
||||||
|
jr nz, .notgbc
|
||||||
|
ld a, KEY1F_PREPARE
|
||||||
|
ldh [rKEY1], a
|
||||||
|
stop
|
||||||
|
.notgbc
|
||||||
|
|
||||||
; We use a single set of tiles for the entire game, so we copy it at the start.
|
; We use a single set of tiles for the entire game, so we copy it at the start.
|
||||||
ld de, Tiles
|
ld de, Tiles
|
||||||
ld hl, _VRAM
|
ld hl, _VRAM
|
||||||
|
|
Binary file not shown.
|
@ -440,20 +440,20 @@ Tiles::
|
||||||
DB $2D,$25,$3D,$3D,$01,$01,$00,$00
|
DB $2D,$25,$3D,$3D,$01,$01,$00,$00
|
||||||
DB $01,$01,$3D,$3D,$2D,$35,$C5,$FD
|
DB $01,$01,$3D,$3D,$2D,$35,$C5,$FD
|
||||||
DB $08,$F8,$10,$F0,$E0,$E0,$00,$00
|
DB $08,$F8,$10,$F0,$E0,$E0,$00,$00
|
||||||
DB $00,$00,$7C,$7C,$44,$44,$7C,$7C
|
DB $03,$03,$02,$02,$04,$04,$06,$04
|
||||||
DB $44,$44,$44,$44,$00,$00,$00,$00
|
DB $05,$04,$0B,$09,$0F,$09,$00,$00
|
||||||
DB $00,$00,$7C,$7C,$40,$40,$5C,$5C
|
DB $0D,$0B,$1A,$16,$17,$1B,$10,$1F
|
||||||
DB $44,$44,$7C,$7C,$00,$00,$00,$00
|
DB $23,$3F,$24,$3C,$3C,$3C,$00,$00
|
||||||
DB $00,$00,$7C,$7C,$44,$44,$78,$78
|
DB $C0,$C0,$40,$40,$20,$20,$A1,$21
|
||||||
DB $44,$44,$7C,$7C,$00,$00,$00,$00
|
DB $61,$21,$B1,$91,$F1,$91,$00,$00
|
||||||
DB $00,$00,$7C,$7C,$10,$10,$10,$10
|
DB $D1,$B1,$69,$59,$D9,$E9,$09,$F9
|
||||||
DB $10,$10,$10,$10,$00,$00,$00,$00
|
DB $C4,$FC,$24,$3C,$3C,$3C,$00,$00
|
||||||
DB $00,$00,$7C,$7C,$40,$40,$7C,$7C
|
DB $3C,$3C,$3E,$3E,$36,$36,$36,$36
|
||||||
DB $04,$04,$7C,$7C,$00,$00,$00,$00
|
DB $3E,$3E,$3C,$3C,$00,$00,$00,$00
|
||||||
DB $00,$00,$7C,$7C,$40,$40,$5C,$5C
|
DB $C6,$C6,$6C,$6C,$38,$38,$38,$38
|
||||||
DB $44,$44,$7C,$7C,$00,$00,$00,$00
|
DB $6C,$6C,$C6,$C6,$00,$00,$00,$00
|
||||||
DB $00,$00,$7C,$7C,$44,$44,$78,$78
|
DB $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
DB $44,$44,$7C,$7C,$00,$00,$00,$00
|
DB $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
DB $00,$75,$00,$47,$00,$55,$00,$55
|
DB $00,$75,$00,$47,$00,$55,$00,$55
|
||||||
DB $00,$75,$00,$00,$00,$3E,$00,$00
|
DB $00,$75,$00,$00,$00,$3E,$00,$00
|
||||||
DB $00,$75,$00,$47,$00,$55,$00,$55
|
DB $00,$75,$00,$47,$00,$55,$00,$55
|
||||||
|
@ -512,14 +512,14 @@ Tiles::
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $03,$03,$04,$04,$08,$08,$0D,$08
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $0B,$09,$0D,$08,$0F,$08,$00,$00
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $06,$05,$03,$03,$00,$00,$0F,$0F
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $08,$0F,$08,$0F,$0F,$0F,$00,$00
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $FC,$FC,$04,$04,$04,$04,$FD,$FD
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $01,$01,$F1,$F1,$F9,$09,$00,$00
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $AD,$55,$D5,$ED,$2D,$35,$C5,$FD
|
||||||
DB $00,$00,$00,$00,$00,$00,$00,$00
|
DB $04,$FC,$08,$F8,$F0,$F0,$00,$00
|
||||||
DB $44,$44,$44,$44,$28,$28,$28,$28
|
DB $44,$44,$44,$44,$28,$28,$28,$28
|
||||||
DB $28,$28,$10,$10,$12,$12,$00,$00
|
DB $28,$28,$10,$10,$12,$12,$00,$00
|
||||||
DB $C4,$C4,$2A,$2A,$2A,$2A,$4A,$4A
|
DB $C4,$C4,$2A,$2A,$2A,$2A,$4A,$4A
|
||||||
|
@ -528,10 +528,10 @@ Tiles::
|
||||||
DB $82,$82,$82,$82,$EC,$EC,$00,$00
|
DB $82,$82,$82,$82,$EC,$EC,$00,$00
|
||||||
DB $44,$44,$CA,$CA,$4A,$4A,$4A,$4A
|
DB $44,$44,$CA,$CA,$4A,$4A,$4A,$4A
|
||||||
DB $4A,$4A,$4A,$4A,$E4,$E4,$00,$00
|
DB $4A,$4A,$4A,$4A,$E4,$E4,$00,$00
|
||||||
DB $CC,$CC,$22,$22,$22,$22,$44,$44
|
DB $CA,$CA,$2A,$2A,$2A,$2A,$4E,$4E
|
||||||
DB $82,$82,$82,$82,$EC,$EC,$00,$00
|
DB $82,$82,$82,$82,$E2,$E2,$00,$00
|
||||||
DB $0E,$0E,$08,$08,$08,$08,$0C,$0C
|
DB $04,$04,$0A,$0A,$0A,$0A,$0E,$0E
|
||||||
DB $08,$08,$08,$08,$0E,$0E,$00,$00
|
DB $0A,$0A,$0A,$0A,$0A,$0A,$00,$00
|
||||||
TilesEnd::
|
TilesEnd::
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,12 @@ ClearOAM::
|
||||||
SECTION "Domain Specific Functions", ROM0
|
SECTION "Domain Specific Functions", ROM0
|
||||||
; Index of next piece in A.
|
; Index of next piece in A.
|
||||||
ApplyNext::
|
ApplyNext::
|
||||||
|
; Correct color
|
||||||
|
ld [wSPRNext1+3], a
|
||||||
|
ld [wSPRNext2+3], a
|
||||||
|
ld [wSPRNext3+3], a
|
||||||
|
ld [wSPRNext4+3], a
|
||||||
|
|
||||||
; Correct tile
|
; Correct tile
|
||||||
add a, TILE_PIECE_0
|
add a, TILE_PIECE_0
|
||||||
ld [wSPRNext1+2], a
|
ld [wSPRNext1+2], a
|
||||||
|
@ -167,6 +173,12 @@ ApplyHold::
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.doApplyHold
|
.doApplyHold
|
||||||
|
; Correct color
|
||||||
|
ld [wSPRHold1+3], a
|
||||||
|
ld [wSPRHold2+3], a
|
||||||
|
ld [wSPRHold3+3], a
|
||||||
|
ld [wSPRHold4+3], a
|
||||||
|
|
||||||
; Correct tile
|
; Correct tile
|
||||||
add a, TILE_PIECE_0
|
add a, TILE_PIECE_0
|
||||||
ld [wSPRHold1+2], a
|
ld [wSPRHold1+2], a
|
||||||
|
@ -277,7 +289,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -289,7 +301,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -301,7 +313,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -313,7 +325,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -325,7 +337,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -336,7 +348,7 @@ SetNumberSpritePositions::
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
||||||
ld a, LEVEL_BASE_X
|
ld a, LEVEL_BASE_X
|
||||||
|
@ -347,7 +359,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -359,7 +371,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -371,7 +383,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -382,7 +394,7 @@ SetNumberSpritePositions::
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
||||||
ld a, LEVEL_BASE_X
|
ld a, LEVEL_BASE_X
|
||||||
|
@ -393,7 +405,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -405,7 +417,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -417,7 +429,7 @@ SetNumberSpritePositions::
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, 8
|
add a, 8
|
||||||
|
@ -428,7 +440,7 @@ SetNumberSpritePositions::
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
inc hl
|
inc hl
|
||||||
inc hl
|
inc hl
|
||||||
ld a, OAMF_PAL1
|
ld a, OAMF_PAL1 | $07
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,9 @@ SwitchToGameplay::
|
||||||
ld a, LEADY_TIME
|
ld a, LEADY_TIME
|
||||||
ldh [hModeCounter], a
|
ldh [hModeCounter], a
|
||||||
|
|
||||||
|
; GBC init
|
||||||
|
call GBCGameplayInit
|
||||||
|
|
||||||
; Install the event loop handlers.
|
; Install the event loop handlers.
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ldh [hGameState], a
|
ldh [hGameState], a
|
||||||
|
@ -526,6 +529,8 @@ drawStaticInfo:
|
||||||
ld de, hNLevel
|
ld de, hNLevel
|
||||||
call ApplyNumbers
|
call ApplyNumbers
|
||||||
|
|
||||||
|
call GBCGameplayProcess
|
||||||
|
|
||||||
jp EventLoopPostHandler
|
jp EventLoopPostHandler
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ INCLUDE "globals.asm"
|
||||||
|
|
||||||
|
|
||||||
SECTION "Title Variables", WRAM0
|
SECTION "Title Variables", WRAM0
|
||||||
wSelected: ds 1
|
wSelected:: ds 1
|
||||||
|
|
||||||
|
|
||||||
SECTION "Title Functions", ROM0
|
SECTION "Title Functions", ROM0
|
||||||
|
@ -42,30 +42,63 @@ SwitchToTitle::
|
||||||
ld bc, TitleScreenTilemapEnd - TitleScreenTilemap
|
ld bc, TitleScreenTilemapEnd - TitleScreenTilemap
|
||||||
call UnsafeMemCopy
|
call UnsafeMemCopy
|
||||||
|
|
||||||
; Little easter egg.
|
; Title screen easter egg.
|
||||||
ld a, [wInitialA]
|
ld a, [wInitialC]
|
||||||
cp a, $FF
|
cp a, $14
|
||||||
jr nz, :+
|
jr nz, .notsgb
|
||||||
ld de, sEaster0
|
ld de, sEasterS0
|
||||||
ld hl, EASTER_0
|
ld hl, EASTER_0
|
||||||
ld bc, 5
|
ld bc, 5
|
||||||
call UnsafeMemCopy
|
call UnsafeMemCopy
|
||||||
ld de, sEaster1
|
ld de, sEasterS1
|
||||||
ld hl, EASTER_1
|
ld hl, EASTER_1
|
||||||
ld bc, 5
|
ld bc, 5
|
||||||
call UnsafeMemCopy
|
call UnsafeMemCopy
|
||||||
jr .oam
|
jr .oam
|
||||||
|
|
||||||
: cp a, $11
|
.notsgb
|
||||||
jr nz, .oam
|
ld a, [wInitialA]
|
||||||
ld de, sEaster2
|
cp a, $FF
|
||||||
|
jr nz, .notmgb
|
||||||
|
ld de, sEasterM0
|
||||||
ld hl, EASTER_0
|
ld hl, EASTER_0
|
||||||
ld bc, 5
|
ld bc, 5
|
||||||
call UnsafeMemCopy
|
call UnsafeMemCopy
|
||||||
ld de, sEaster3
|
ld de, sEasterM1
|
||||||
ld hl, EASTER_1
|
ld hl, EASTER_1
|
||||||
ld bc, 5
|
ld bc, 5
|
||||||
call UnsafeMemCopy
|
call UnsafeMemCopy
|
||||||
|
jr .oam
|
||||||
|
|
||||||
|
.notmgb
|
||||||
|
ld a, [wInitialA]
|
||||||
|
cp a, $11
|
||||||
|
jr nz, .noegg
|
||||||
|
|
||||||
|
ld a, [wInitialB]
|
||||||
|
bit 0, a
|
||||||
|
jr nz, .agb
|
||||||
|
ld de, sEasterC0
|
||||||
|
ld hl, EASTER_0-1
|
||||||
|
ld bc, 12
|
||||||
|
call UnsafeMemCopy
|
||||||
|
ld de, sEasterC1
|
||||||
|
ld hl, EASTER_1-1
|
||||||
|
ld bc, 12
|
||||||
|
call UnsafeMemCopy
|
||||||
|
jr .oam
|
||||||
|
|
||||||
|
.agb
|
||||||
|
ld de, sEasterA0
|
||||||
|
ld hl, EASTER_0-1
|
||||||
|
ld bc, 12
|
||||||
|
call UnsafeMemCopy
|
||||||
|
ld de, sEasterA1
|
||||||
|
ld hl, EASTER_1-1
|
||||||
|
ld bc, 12
|
||||||
|
call UnsafeMemCopy
|
||||||
|
jr .oam
|
||||||
|
.noegg
|
||||||
|
|
||||||
; Clear OAM.
|
; Clear OAM.
|
||||||
.oam
|
.oam
|
||||||
|
@ -78,6 +111,9 @@ SwitchToTitle::
|
||||||
set_obj0_palette
|
set_obj0_palette
|
||||||
set_obj1_palette
|
set_obj1_palette
|
||||||
|
|
||||||
|
; GBC init
|
||||||
|
call GBCTitleInit
|
||||||
|
|
||||||
; Install the event loop handlers.
|
; Install the event loop handlers.
|
||||||
ld a, 0
|
ld a, 0
|
||||||
ldh [hGameState], a
|
ldh [hGameState], a
|
||||||
|
@ -94,6 +130,8 @@ SwitchToTitle::
|
||||||
|
|
||||||
|
|
||||||
TitleEventLoopHandler::
|
TitleEventLoopHandler::
|
||||||
|
call GBCTitleProcess
|
||||||
|
|
||||||
; Start game?
|
; Start game?
|
||||||
.abstart
|
.abstart
|
||||||
ldh a, [hStartState]
|
ldh a, [hStartState]
|
||||||
|
@ -407,6 +445,8 @@ CheckLevelRange:
|
||||||
|
|
||||||
|
|
||||||
TitleVBlankHandler::
|
TitleVBlankHandler::
|
||||||
|
call ToATTR
|
||||||
|
|
||||||
ld a, TILE_UNSELECTED
|
ld a, TILE_UNSELECTED
|
||||||
ld hl, TITLE_OPTION_0
|
ld hl, TITLE_OPTION_0
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
Loading…
Reference in New Issue