1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-24 09:30:45 +00:00

coleco updates

This commit is contained in:
Steven Hugg 2018-11-21 12:54:59 -05:00
parent 527660b121
commit e51bd2a579
4 changed files with 23 additions and 65 deletions

View File

@ -76,6 +76,8 @@ TODO:
- $readmemb/h - $readmemb/h
- maybe don't have grey space with line numbers until inline ASM used? - maybe don't have grey space with line numbers until inline ASM used?
- batariBasic: proper line numbers, listing, syntax highlighting - batariBasic: proper line numbers, listing, syntax highlighting
- show player controls for each platform, allow touch support
- granular control over time scrubbing, show CPU state
WEB WORKER FORMAT WEB WORKER FORMAT

View File

@ -1,14 +1,12 @@

#include <stdio.h>
#include <cv.h> #include <cv.h>
#include <cvu.h> #include <cvu.h>
#define PATTERN 0x0000 #define PATTERN 0x0000
#define IMAGE 0x1c00 #define IMAGE 0x0800
#define COLOR 0x2000 #define COLOR 0x2000
#define SPRITE_PATTERNS 0x3800
#define COLS 32 #define SPRITES 0x3c00
#define ROWS 24
uintptr_t __at(0x6a) font_bitmap_a; uintptr_t __at(0x6a) font_bitmap_a;
uintptr_t __at(0x6c) font_bitmap_0; uintptr_t __at(0x6c) font_bitmap_0;
@ -18,69 +16,22 @@ void setup_32_column_font() {
cv_set_image_table(IMAGE); cv_set_image_table(IMAGE);
cv_set_color_table(COLOR); cv_set_color_table(COLOR);
cv_set_screen_mode(CV_SCREENMODE_STANDARD); cv_set_screen_mode(CV_SCREENMODE_STANDARD);
cv_set_sprite_pattern_table(SPRITE_PATTERNS);
cv_set_sprite_attribute_table(SPRITES);
cvu_vmemset(0, 0, 0x4000);
cvu_memtovmemcpy(PATTERN, (void *)(font_bitmap_0 - '0'*8), 2048); cvu_memtovmemcpy(PATTERN, (void *)(font_bitmap_0 - '0'*8), 2048);
cvu_vmemset(COLOR, 0x36, 8); // set color for chars 0-63 cvu_vmemset(COLOR, 0x36, 8); // set color for chars 0-63
cvu_vmemset(COLOR+8, 0x06, 32-8); // set chars 63-255 cvu_vmemset(COLOR+8, 0x06, 32-8); // set chars 63-255
} }
char cursor_x; void show_text() {
char cursor_y; cvu_vmemset(IMAGE, '.', 40*24);
cvu_memtovmemcpy(IMAGE + 1, "Hello Professor Falken", 22);
void clrscr() { cv_set_screen_active(true);
cvu_vmemset(IMAGE, ' ', COLS*ROWS);
}
void setup_stdio() {
cursor_x = 0;
cursor_y = 0;
clrscr();
}
void scrollup() {
char buf[COLS];
char y;
for (y=0; y<ROWS-1; y++) {
cvu_vmemtomemcpy(buf, IMAGE + COLS*y + COLS, COLS);
cvu_memtovmemcpy(IMAGE + COLS*y, buf, COLS);
}
cvu_vmemset(IMAGE + COLS*(ROWS-1), ' ', COLS);
}
void newline() {
if (cursor_y >= ROWS-1) {
scrollup();
} else {
cursor_y++;
}
}
int putchar(int ch) {
switch (ch) {
case '\n':
newline(); // TODO: scrolling
case '\r':
cursor_x = 0;
return 0;
}
cvu_voutb(ch, IMAGE + COLS*cursor_y + cursor_x);
cursor_x++;
if (cursor_x >= COLS) {
newline();
cursor_x = 0;
}
} }
void main() { void main() {
unsigned char byteval = 123;
signed char charval = 123;
short shortval = 12345;
setup_32_column_font(); setup_32_column_font();
setup_stdio(); show_text();
cv_set_screen_active(true); while (1);
printf("HELLO WORLD!\n");
while (1) {
printf("char %d byte %u sh %d\n",
charval++, byteval++, shortval++);
}
} }

View File

@ -51,6 +51,9 @@ export class SN76489_Audio {
this.psg.setDevice(PsgDeviceChannel.DEVICE_SN76489); this.psg.setDevice(PsgDeviceChannel.DEVICE_SN76489);
master.master.addChannel(this.psg); master.master.addChannel(this.psg);
} }
reset() {
// TODO
}
setData(val : number) { setData(val : number) {
this.psg.writeRegisterSN(0, val & 0xff); this.psg.writeRegisterSN(0, val & 0xff);
} }

View File

@ -21,7 +21,7 @@ import { TMS9918A } from "../video/tms9918a";
var ColecoVision_PRESETS = [ var ColecoVision_PRESETS = [
{id:'text.c', name:'Text Mode'}, {id:'text.c', name:'Text Mode'},
{id:'hello.c', name:'Scrolling Text'}, {id:'hello.c', name:'Scrolling Text'},
{id:'text32.c', name:'32-Column Text'}, {id:'text32.c', name:'32-Column Color Text'},
{id:'stars.c', name:'Scrolling Starfield'}, {id:'stars.c', name:'Scrolling Starfield'},
{id:'cursorsmooth.c', name:'Moving Cursor'}, {id:'cursorsmooth.c', name:'Moving Cursor'},
{id:'simplemusic.c', name:'Simple Music'}, {id:'simplemusic.c', name:'Simple Music'},
@ -201,6 +201,8 @@ const _ColecoVisionPlatform = function(mainElement) {
reset() { reset() {
cpu.reset(); cpu.reset();
cpu.setTstates(0); cpu.setTstates(0);
vdp.reset();
psg.reset();
} }
getDebugCategories() { getDebugCategories() {