1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-05-28 23:41:32 +00:00

updated presets

This commit is contained in:
Steven Hugg 2019-12-16 11:17:57 -06:00
parent 7910f7ad4c
commit 0daea22c2a
2 changed files with 29 additions and 12 deletions

View File

@ -114,7 +114,7 @@ void dll_add_sprite(word addr, byte x, byte y, byte wpal) {
// add a string to currently selected page // add a string to currently selected page
// strings are aligned to top of slot // strings are aligned to top of slot
void dll_add_string(const char* str, byte x, byte y, byte wpal) { void dll_add_string(register const char* str, byte x, byte y, byte wpal) {
byte slot = (y / SLOTHEIGHT) | slot0; byte slot = (y / SLOTHEIGHT) | slot0;
register DL5Entry* dl = (DL5Entry*) dll_alloc(slot, 5); register DL5Entry* dl = (DL5Entry*) dll_alloc(slot, 5);
dl->data_lo = (byte)str; dl->data_lo = (byte)str;

View File

@ -22,6 +22,29 @@ be written while the other is displayed.
char* hello = "\2\4\6\0\220\222\102"; char* hello = "\2\4\6\0\220\222\102";
/*{pal:"vcs",n:16}*/
const byte PALETTE[25] = {
0x02, // background color
0x8f, 0x4f, 0x1f, // palette 0
0x34, 0x28, 0x1f, // palette 1
0x7f, 0x5f, 0x1f, // palette 2
0x44, 0x38, 0x1f, // palette 3
0x6f, 0x6f, 0x1f, // palette 4
0x54, 0x48, 0x1f, // palette 5
0x0f, 0x7f, 0x1f, // palette 6
0x14, 0x58, 0x1f, // palette 7
};
// set entire palette including background color
void set_palette(register const byte* pal) {
byte i;
register byte* reg = (byte*) 0x20;
for (i=0; i<32; i++) {
if (i==0 || (i&3)) *reg = *pal++;
reg++;
}
}
void main() { void main() {
byte i; byte i;
byte y = 0; byte y = 0;
@ -30,24 +53,18 @@ void main() {
// activate DMA // activate DMA
MARIA.CHARBASE = 0x80; MARIA.CHARBASE = 0x80;
MARIA.P0C1 = 0x8f; set_palette(PALETTE);
MARIA.P0C2 = 0x4f;
MARIA.P0C3 = 0x1f;
MARIA.P1C1 = 0x34;
MARIA.P1C2 = 0x28;
MARIA.P1C3 = 0x1f;
MARIA.BACKGRND = 0;
MARIA.CTRL = CTRL_DMA_ON | CTRL_DBLBYTE | CTRL_160AB; MARIA.CTRL = CTRL_DMA_ON | CTRL_DBLBYTE | CTRL_160AB;
dll_clear(); dll_clear();
dll_add_string(hello, y+32, 32, DL_WP(8,0)); dll_add_string(hello, y+32, 32, DL_WP(8,0));
for (i=0; i<8; i++) { for (i=0; i<8; i++) {
dll_page(0); dll_page(0);
dll_add_sprite(0xa068, i*4, i*33, DL_WP(4,1)); dll_add_sprite(0xa068, i*4, i*33, DL_WP(4,i));
dll_add_sprite(0xa06c, i*8, i*25, DL_WP(4,1)); dll_add_sprite(0xa06c, i*8, i*25, DL_WP(4,i));
dll_page(1); dll_page(1);
dll_add_sprite(0xa068, i*4, i*32, DL_WP(4,1)); dll_add_sprite(0xa068, i*4, i*32, DL_WP(4,i));
dll_add_sprite(0xa06c, 128-i*8, i*24, DL_WP(4,1)); dll_add_sprite(0xa06c, 128-i*8, i*24, DL_WP(4,i));
} }
dll_save(); dll_save();