Skip to content

Commit

Permalink
Merge pull request #33 from andwhyisit/vwf
Browse files Browse the repository at this point in the history
VWF Part 1
  • Loading branch information
andwhyisit authored Aug 13, 2023
2 parents 72b4932 + d97cd88 commit e93333c
Show file tree
Hide file tree
Showing 5 changed files with 1,543 additions and 427 deletions.
12 changes: 12 additions & 0 deletions game/src/common/macros.asm
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ MACRO TableAddressBankEntry
EXPORT \1IDX_\2
ENDM

MACRO VRAMSwitchToBank1
ld a, 1
ld [W_CurrentVRAMBank], a
ldh [H_RegVBK], a
ENDM

MACRO VRAMSwitchToBank0
xor a
ld [W_CurrentVRAMBank], a
ldh [H_RegVBK], a
ENDM

MACRO dcolor
dw ((\3) << 10) + ((\2) << 5) + (\1)
ENDM
Expand Down
16 changes: 8 additions & 8 deletions game/src/core/interrupts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ VBlankingIRQ::
call CGBCommitFadePalettesOBP
ld a, 1
ldh [H_VBlankCompleted], a
call $0399 ; Music most likely.
call HighBankSafeMusic
call SerIO_SwitchToInternalClock
xor a
ld [W_VBlankInterruptInProgress], a
Expand All @@ -80,7 +80,7 @@ VBlankingIRQ::
ld [W_VBlankInterruptInProgress], a
ld a, [W_ShadowREG_SCY]
ldh [H_RegSCY], a
call $0399 ; Music most likely.
call HighBankSafeMusic
ld a, 1
ldh [H_VBlankCompleted], a
xor a
Expand All @@ -102,6 +102,8 @@ LCDCStatusIRQ::
push hl
ld a, 8
ld [X_MBC5ROMBankLow], a
xor a
ld [X_MBC5ROMBankHigh], a
ld a, [$C9BC]
srl a
ld hl, $5FF5
Expand Down Expand Up @@ -132,20 +134,18 @@ LCDCStatusIRQ::
ldh [H_RegLYC], a
pop hl
pop de

.skipInterrupt
pop af
reti

.restoreBankDuringVBlankInterrupt
ld a, [W_VBlankInterruptCurrentBank]
ld [X_MBC5ROMBankLow], a
call LCDCStatusRestoreBank
ldh a, [H_RegLYC]
inc a
ldh [H_RegLYC], a
pop hl
pop de
pop af
reti

.skipInterrupt
pop af
reti
nop
Loading

0 comments on commit e93333c

Please sign in to comment.