From e51bd2a579fa240fe68067e7d5ce21802cb67df8 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Wed, 21 Nov 2018 12:54:59 -0500 Subject: [PATCH] coleco updates --- doc/notes.txt | 2 ++ presets/coleco/text32.c | 79 ++++++++--------------------------------- src/audio.ts | 3 ++ src/platform/coleco.ts | 4 ++- 4 files changed, 23 insertions(+), 65 deletions(-) diff --git a/doc/notes.txt b/doc/notes.txt index 27866262..27a03632 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -76,6 +76,8 @@ TODO: - $readmemb/h - maybe don't have grey space with line numbers until inline ASM used? - 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 diff --git a/presets/coleco/text32.c b/presets/coleco/text32.c index d983b074..d8025106 100644 --- a/presets/coleco/text32.c +++ b/presets/coleco/text32.c @@ -1,14 +1,12 @@ - -#include + #include #include -#define PATTERN 0x0000 -#define IMAGE 0x1c00 -#define COLOR 0x2000 - -#define COLS 32 -#define ROWS 24 +#define PATTERN 0x0000 +#define IMAGE 0x0800 +#define COLOR 0x2000 +#define SPRITE_PATTERNS 0x3800 +#define SPRITES 0x3c00 uintptr_t __at(0x6a) font_bitmap_a; uintptr_t __at(0x6c) font_bitmap_0; @@ -18,69 +16,22 @@ void setup_32_column_font() { cv_set_image_table(IMAGE); cv_set_color_table(COLOR); 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_vmemset(COLOR, 0x36, 8); // set color for chars 0-63 cvu_vmemset(COLOR+8, 0x06, 32-8); // set chars 63-255 } -char cursor_x; -char cursor_y; - -void clrscr() { - 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) { - 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 show_text() { + cvu_vmemset(IMAGE, '.', 40*24); + cvu_memtovmemcpy(IMAGE + 1, "Hello Professor Falken", 22); + cv_set_screen_active(true); } void main() { - unsigned char byteval = 123; - signed char charval = 123; - short shortval = 12345; - setup_32_column_font(); - setup_stdio(); - cv_set_screen_active(true); - printf("HELLO WORLD!\n"); - while (1) { - printf("char %d byte %u sh %d\n", - charval++, byteval++, shortval++); - } + show_text(); + while (1); } diff --git a/src/audio.ts b/src/audio.ts index 999be8d0..9d8f57b8 100644 --- a/src/audio.ts +++ b/src/audio.ts @@ -51,6 +51,9 @@ export class SN76489_Audio { this.psg.setDevice(PsgDeviceChannel.DEVICE_SN76489); master.master.addChannel(this.psg); } + reset() { + // TODO + } setData(val : number) { this.psg.writeRegisterSN(0, val & 0xff); } diff --git a/src/platform/coleco.ts b/src/platform/coleco.ts index e2387fa6..983e7fe8 100644 --- a/src/platform/coleco.ts +++ b/src/platform/coleco.ts @@ -21,7 +21,7 @@ import { TMS9918A } from "../video/tms9918a"; var ColecoVision_PRESETS = [ {id:'text.c', name:'Text Mode'}, {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:'cursorsmooth.c', name:'Moving Cursor'}, {id:'simplemusic.c', name:'Simple Music'}, @@ -201,6 +201,8 @@ const _ColecoVisionPlatform = function(mainElement) { reset() { cpu.reset(); cpu.setTstates(0); + vdp.reset(); + psg.reset(); } getDebugCategories() {