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
- 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

View File

@ -1,14 +1,12 @@
#include <stdio.h>

#include <cv.h>
#include <cvu.h>
#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; 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 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);
}

View File

@ -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);
}

View File

@ -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() {