Whatevers

This commit is contained in:
2022-01-04 09:09:21 -08:00
commit c882f07089
16 changed files with 635 additions and 0 deletions

82
src/main.c Normal file
View File

@@ -0,0 +1,82 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "libs.h"
#include "text.h"
const uint8_t std_data[] = {
/* Basic tiles (0xFC to 0xFF) */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,
0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#define NBDFRAMES 0x18 /* Nb frames for the door */
#define NBSFRAMES 0x07 /* Nb frames for the sprite */
#define WINSZX 0x80 /* Size of the picture in the window */
#define WINSZY 0x50
#define MINWINX (MAXWNDPOSX-WINSZX+1) /* Bounds of the window origin */
#define MINWINY (MAXWNDPOSY-WINSZY+1)
#define MAXWINX MAXWNDPOSX
#define MAXWINY MAXWNDPOSY
#define FADESTEP 0x10 /* Nb steps for the fading effect */
#define STARTFADE (0x06*FADESTEP) /* Initial value for the fading effect */
#define CLOSED 0x00
#define OPENING 0x01
#define OPENED 0x02
#define CLOSING 0x03
static uint8_t time = 0;/* Global "time" value (counter) */
void main() {
uint8_t i;
int16_t j;
disable_interrupts();
DISPLAY_OFF;
LCDC_REG = LCDCF_OFF | LCDCF_BG8800 | LCDCF_BG9800 | LCDCF_BGON;
/*
* LCD = Off
* BG Chr = 0x8800
* BG Bank = 0x9800
* BG = On
*/
BGP_REG = 0xE4U;
set_bkg_data(0x00, 0x04, std_data);
set_bkg_data(0x04, FONT_TILE_COUNT, FONT);
// Fill screen white
uint8_t filled[0x20*0x20];
for(j = 0; j < 0x20*0x20; j++) {
filled[j] = 0x00;
}
set_bkg_tiles(0x00, 0x00, 0x20, 0x20, filled);
SCX_REG = 0x00;
SCY_REG = 0x00;
DISPLAY_ON;
enable_interrupts();
wait_vbl_done();
// Now set BKG tiles
uint8_t bkg_tiles[FONT_TILE_COUNT];
for(i = 0; i < FONT_TILE_COUNT; i++) {
bkg_tiles[i] = i;
}
set_bkg_tiles(0, 0, 0x08, 0x08, bkg_tiles);
while(1) {
/* Skip four VBLs (slow down animation) */
for(i = 0; i < 4; i++) {
wait_vbl_done();
}
time++;
}
}