-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
164 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
; Colors definition | ||
DEF WHITE EQU $FFFF | ||
DEF RED EQU $001F | ||
DEF GREEN EQU $03E0 | ||
|
||
TileData: | ||
; bg tile | ||
dw `11111111 | ||
dw `11111111 | ||
dw `11111111 | ||
dw `11111111 | ||
dw `11111111 | ||
dw `11111111 | ||
dw `11111111 | ||
dw `11111111 | ||
|
||
; oam tiles | ||
dw `00000000 | ||
dw `00000010 | ||
dw `00000110 | ||
dw `00001110 | ||
dw `00011110 | ||
dw `00111110 | ||
dw `01111110 | ||
dw `00000000 | ||
dw `00000000 | ||
dw `00000020 | ||
dw `00000220 | ||
dw `00002220 | ||
dw `00022220 | ||
dw `00222220 | ||
dw `02222220 | ||
dw `00000000 | ||
.end | ||
|
||
OAMData: | ||
; Y, X, Tile, attr | ||
db 40, 46, 2, 0 | ||
db 40, 40, 1, 0 | ||
.end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
SECTION "graphics_data", ROM0 | ||
INCLUDE "graphics_data.asm" | ||
INCLUDE "hardware.inc" | ||
|
||
SECTION "std", ROM0 | ||
INCLUDE "../common.asm" | ||
|
||
SECTION "boot", ROM0[$100] | ||
nop | ||
jp Main | ||
|
||
SECTION "main", ROM0[$150] | ||
Main:: | ||
di ; no need for interrupts for now | ||
ld sp, $0FFFE ; setup the stack | ||
|
||
call TurnOffLcd | ||
|
||
; Copy tiles to VRAM | ||
ld hl, _VRAM | ||
ld bc, TileData | ||
ld de, TileData.end - TileData | ||
call Memcpy | ||
|
||
; Set screen 0 to use tile 0 | ||
ld hl, _SCRN0 | ||
ld bc, $400 | ||
ld a, 0 | ||
call Memset | ||
|
||
; set vram bank to 1 in order to set the BG attributes | ||
ld a, 1 | ||
ld [rVBK], a | ||
ld hl, _SCRN0 | ||
ld bc, $400 | ||
ld a, 0 ; bg priority off, bg pallete 0 | ||
call Memset ; loading the first screen attributes with 0 | ||
|
||
; load the oam attributes to the oam ram | ||
ld hl, _OAMRAM | ||
ld bc, OAMData | ||
ld de, OAMData.end - OAMData | ||
call Memcpy | ||
|
||
; set up palletes | ||
ld d, 2 ; color index | ||
ld e, 1 ; BG | ||
ld bc, WHITE | ||
call LoadPallete ; BG pallete - set color 1 of pallete 0 | ||
ld d, 2 ; color index | ||
ld e, 0 ; OAM | ||
ld bc, GREEN | ||
call LoadPallete ; OAM pallete - set color 1 of pallete 0 | ||
ld d, 4 ; color index | ||
ld e, 0 ; OAM | ||
ld bc, RED | ||
call LoadPallete ; OAM pallete - set color 2 of pallete 0 | ||
ld a, LCDCF_ON|LCDCF_BG8000|LCDCF_OBJON|LCDCF_BGON | ||
ld [rLCDC], a ; turn lcd on, with the correct flags | ||
|
||
.loop | ||
jp .loop ; wait forever |