lots of changes
This commit is contained in:
parent
ef96734b3b
commit
c22c25b9ae
|
@ -1,5 +1,9 @@
|
|||
; Copyright (C) 2018-2020 Eldred Habert
|
||||
;
|
||||
; Modified by:
|
||||
; Copyright (C) 2020 Alex Gentilucci
|
||||
; - added vwf library
|
||||
;
|
||||
; 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.
|
||||
|
@ -17,7 +21,6 @@
|
|||
; 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
|
||||
; include the libraries
|
||||
INCLUDE "hardware.inc/hardware.inc"
|
||||
rev_Check_hardware_inc 3.0
|
||||
|
@ -115,3 +118,4 @@ error: MACRO
|
|||
jr \1, @-1
|
||||
ENDC
|
||||
ENDM
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ Reset::
|
|||
|
||||
; set up oam dma function in hram
|
||||
ld a, BANK(OAMDMA)
|
||||
; no need to write bank number to hram, interrupts aren't active
|
||||
; no need to write bank number to hram var, interrupts aren't active
|
||||
|
||||
ld [rROMB0], a
|
||||
ld hl, OAMDMA
|
||||
lb bc, OAMDMA.end - OAMDMA, LOW(hOAMDMA)
|
||||
|
@ -108,7 +109,7 @@ Reset::
|
|||
|
||||
SECTION "OAM DMA routine", ROMX
|
||||
; oam dma prevents access to most memory, but never hram.
|
||||
; this routine starts an oam dma transfer, then waits for it to complete.
|
||||
; this starts an oam dma transfer, then waits for it to complete.
|
||||
; it gets copied to hram and is called there from the vblank handler
|
||||
OAMDMA:
|
||||
ldh [rDMA], a
|
||||
|
@ -127,6 +128,9 @@ hCurROMBank:: db
|
|||
; 0 if cgb (including dmg mode and gba), non-zero for other models
|
||||
hConsoleType:: db
|
||||
|
||||
; useful for storing temporary data if you run out of registers
|
||||
hTempByte:: db
|
||||
|
||||
|
||||
SECTION "OAM DMA", HRAM
|
||||
hOAMDMA::
|
||||
|
|
|
@ -2,7 +2,12 @@
|
|||
; This file is licensed under the terms of the MIT License.
|
||||
; For more license details, see LICENSE or <https://mit-license.org/>.
|
||||
|
||||
INCLUDE "defines.asm"
|
||||
|
||||
SECTION "Intro", ROMX
|
||||
; render the intro scene
|
||||
Intro::
|
||||
rst $38
|
||||
; TODO: animate intro logo
|
||||
; TODO: create start screen
|
||||
jp EnterMainLoop
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
; Copyright (C) 2020 nytpu
|
||||
; This file is licensed under the terms of the MIT License.
|
||||
; For more license details, see LICENSE or <https://mit-license.org/>.
|
||||
|
||||
INCLUDE "defines.asm"
|
||||
|
||||
SECTION "Game Loop", ROM0
|
||||
EnterMainLoop::
|
||||
di
|
||||
; wait for vblank and turn lcd off
|
||||
.waitVBlank
|
||||
ldh a, [rLY]
|
||||
cp SCRN_Y
|
||||
jr c, .waitVBlank
|
||||
xor a
|
||||
ldh [rLCDC], a ; will burn screen if not done during vblank
|
||||
|
||||
; loading in main gameplay tiles and such
|
||||
ld a, BANK(GameTiles)
|
||||
ldh [hCurROMBank], a
|
||||
ld [rROMB0], a
|
||||
|
||||
ld de, GameTiles.bgTiles
|
||||
ld hl, $9000
|
||||
INCLUDE "res/game_map.2bpp.pb16.size"
|
||||
ld bc, NB_PB16_BLOCKS
|
||||
PURGE NB_PB16_BLOCKS
|
||||
call pb16_unpack_block
|
||||
|
||||
ld de, GameTiles.bgTileMap
|
||||
ld hl, $9800
|
||||
ld bc, GameTiles.bgTileMapEnd - GameTiles.bgTileMap
|
||||
call LCDMemcpy
|
||||
|
||||
ld de, GameTiles.spriteTiles
|
||||
ld hl, $8000
|
||||
INCLUDE "res/spritemap.2bpp.pb16.size"
|
||||
ld b, NB_PB16_BLOCKS
|
||||
PURGE NB_PB16_BLOCKS
|
||||
call pb16_unpack_block
|
||||
|
||||
ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BG9800 | LCDCF_BG8800
|
||||
ldh [rLCDC], a
|
||||
|
||||
ei
|
||||
; soft reset during gameplay is fine
|
||||
ld a, 1
|
||||
ldh [hCanSoftReset], a
|
||||
MainLoop:
|
||||
ld hl, hHeldKeys
|
||||
bit 0, [hl]
|
||||
jr z, .notA
|
||||
ld a, %00011011
|
||||
ld [rBGP], a
|
||||
.notA
|
||||
ld a, %11100100
|
||||
ld [hBGP], a
|
||||
.keypadDone
|
||||
; if there's any more time before vblank
|
||||
rst WaitVBlank
|
||||
jr MainLoop
|
||||
|
||||
|
||||
SECTION "Gameplay Tiles", ROMX
|
||||
GameTiles:
|
||||
.bgTiles
|
||||
INCBIN "res/game_map.2bpp.pb16"
|
||||
.bgTileMap
|
||||
INCBIN "res/game_map.2bpp.tilemap"
|
||||
.bgTileMapEnd
|
||||
.spriteTiles
|
||||
INCBIN "res/spritemap.2bpp.pb16"
|
Binary file not shown.
After Width: | Height: | Size: 441 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 187 B |
Loading…
Reference in New Issue