Compare commits

...

3 Commits

Author SHA1 Message Date
nytpu 4d1b1e3520 process 2bpp images and tilemaps 2020-10-01 22:08:45 -06:00
nytpu c22c25b9ae lots of changes 2020-10-01 22:08:38 -06:00
nytpu ef96734b3b added map graphics and aseprite palette 2020-10-01 22:08:03 -06:00
11 changed files with 96 additions and 4 deletions

View File

@ -54,6 +54,13 @@ $(RESDIR)/%.1bpp: $(RESDIR)/%.png
@$(MKDIR) -p $(@D)
$(RGBGFX) -d 1 -o $@ $<
$(RESDIR)/%.2bpp: $(RESDIR)/%.png
@$(MKDIR) -p $(@D)
$(RGBGFX) -t $@.tilemap -u -o $@ $<
$(RESDIR)/%.tilemap: $(RESDIR)/%.2bpp
# Define how to compress files using the PackBits16 codec
# Compressor script requires Python 3
$(RESDIR)/%.pb16 $(RESDIR)/%.pb16.size: $(RESDIR)/% tools/pb16.py

BIN
gfx/game_map.aseprite Normal file

Binary file not shown.

BIN
gfx/gb_grayscale.aseprite Normal file

Binary file not shown.

BIN
gfx/spritemap.aseprite Normal file

Binary file not shown.

View File

@ -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

View File

@ -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::

View File

@ -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

72
src/loop.asm Normal file
View File

@ -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"

BIN
src/res/game_map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

BIN
src/res/game_map.tilemap Normal file

Binary file not shown.

BIN
src/res/spritemap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B