1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-21 21:29:17 +00:00

updated presets

This commit is contained in:
Steven Hugg 2019-12-14 09:50:57 -06:00
parent 27af51cfc5
commit dca0dd04a5
17 changed files with 49 additions and 36 deletions

7
.gitignore vendored
View File

@ -1,10 +1,9 @@
*~
node_modules
local
release
gen
test/output
./release
./gen
./test/output
tests_output/
.DS_Store
tmp

View File

@ -190,6 +190,7 @@ TODO:
https://8bitworkshop.com/v3.4.1/javatari.js/release/javatari/javatari.js
(32:443651) Safari 12.1.2
- Safari: doesn't send good exception reasons ("undefined")
- probably XMLHttpRequest.timeout (https://github.com/getsentry/sentry-javascript/issues/2210)

View File

@ -2,14 +2,19 @@
#include <cv.h>
#include <cvu.h>
// SMS doesn't have a BIOS
// so we have to link in a pattern table
#ifdef CV_SMS
//#link "fonts.s"
extern uintptr_t font_bitmap_a[];
extern uintptr_t font_bitmap_0[];
#endif
// HALT waits for a 60 Hz interrupt
#define wait_vsync() __asm__("halt")
// VRAM table addresses
#define PATTERN 0x0000 // 256*8 = 2048 bytes
#define IMAGE 0x2000 // 32*24 = 768 bytes
#define COLOR 0x0b00 // 32 bytes
@ -18,37 +23,39 @@ extern uintptr_t font_bitmap_0[];
/*{pal:222,n:16}*/
const char PALETTE0[16] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x0D,
0x10, 0x03, 0x0B, 0x0F, 0x13, 0x17, 0x1B, 0x1F,
0x22, 0x28, 0x2A, 0x2E, 0x30, 0x37, 0x3B, 0x3F,
};
/*{pal:222,n:16}*/
const char PALETTE1[16] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x3F,
0x10, 0x03, 0x0B, 0x0F, 0x13, 0x17, 0x1B, 0x1F,
0x22, 0x28, 0x2A, 0x2E, 0x30, 0x37, 0x3B, 0x3F,
};
/*{w:8,h:8,bpp:1,count:2,brev:1,np:4,pofs:1,sl:4}*/
const char PATTERNS[64] = {
0x00, 0x00, 0x00, 0x00,
0x3C, 0x3C, 0x3C, 0x3C,
0x56, 0x7E, 0x56, 0x56,
0x7E, 0x7E, 0x7E, 0x7E,
0x62, 0x62, 0x62, 0x62,
0x3C, 0x3C, 0x3C, 0x3C,
0x18, 0x3E, 0x18, 0x3E,
0x18, 0x7F, 0x00, 0x7F,
0x7C, 0x1C, 0x64, 0x64,
0xFE, 0x7E, 0xFE, 0xFE,
0xD6, 0x7E, 0xD6, 0xD6,
0xFE, 0x7E, 0xFE, 0xFE,
0x66, 0xE6, 0xE6, 0xE6,
0xBC, 0xBC, 0xBC, 0x3C,
0x18, 0x18, 0x3E, 0x18,
0x7F, 0x18, 0x67, 0x18,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF,
0x55, 0x66, 0x77, 0xFF,
0xC0, 0xC0, 0xC0, 0xC0,
0x05, 0x06, 0x07, 0x08,
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF,
0x7D, 0x3C, 0x02, 0x3C,
0x7D, 0x3C, 0x9A, 0x3C,
0x7C, 0x3C, 0x83, 0x3C,
0x7E, 0x3C, 0x81, 0x3C,
0x3E, 0x3E, 0x00, 0x00,
0x36, 0x36, 0x00, 0x00,
0x36, 0x36, 0x00, 0x00,
0x00, 0x77, 0x77, 0x77,
};
// convert a mono bitmap to 4-plane
// just copy each byte 4 times
void expand_monobitmap(const char* src, int count) {
while (count--) {
char b = *src++;
@ -59,45 +66,51 @@ void expand_monobitmap(const char* src, int count) {
}
}
// set up mode 4 graphics
void setup_graphics() {
cv_set_screen_mode(CV_SCREENMODE_4);
cv_set_character_pattern_t(PATTERN | 0x3000);
cv_set_image_table(IMAGE | 0x400);
// set up tables
cv_set_character_pattern_t(PATTERN | 0x3000); // mask for mode 4
cv_set_image_table(IMAGE | 0x400); // mask for mode 4
cv_set_sprite_attribute_table(SPRITES);
/*
cvu_vmemset(0, 0, 0x4000);
cv_set_colors(0x2, 0x5);
cv_set_color_table(COLOR | 0xfff);
cv_set_sprite_pattern_table(SPRITE_PATTERNS | 0x1800);
*/
cv_set_write_vram_address(PATTERN + '0'*32);
// convert mono bitmap font to 4-plane in VRAM
expand_monobitmap(font_bitmap_0, (128-48)*8);
cvu_memtovmemcpy(PATTERN+32, PATTERNS, 32);
// copy sprites to pattern table VRAM
cvu_memtovmemcpy(PATTERN+32, PATTERNS, sizeof(PATTERNS));
// copy palettes to VRAM
cvu_memtocmemcpy(0xc000, PALETTE0, 16);
cvu_memtocmemcpy(0xc010, PALETTE1, 16);
}
// image table has two bytes per cell (name + attribute)
void show_text() {
cvu_vmemset(IMAGE, 0, 32*28);
cvu_memtovmemcpy(IMAGE, "H e l l o P r o f e s s o r F a l k e n ", 22*2);
cv_voutb(0x01);
cv_voutb(0x00);
cvu_memtovmemcpy(IMAGE, "H e l l o W o r l d \1 ", 12*2);
}
void main() {
char i=0;
struct cvu_sprite4 sprite;
// set up mode 4 and draw initial text
setup_graphics();
show_text();
// turn on screen
cv_set_screen_active(true);
// loop (once per frame)
while (1) {
wait_vsync();
i++;
// scroll background in two directions
cv_set_hscroll(i);
cv_set_vscroll(i);
// move sprite across screen
sprite.y = i;
sprite.x = i;
sprite.name = 1;
cvu_set_sprite4(SPRITES, 0, &sprite);
sprite.y += 8;
sprite.name++;
cvu_set_sprite4(SPRITES, 1, &sprite);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB