8bitworkshop/src/platform/coleco.ts

75 lines
2.4 KiB
TypeScript
Raw Normal View History

2019-08-25 16:15:22 +00:00
import { ColecoVision } from "../machine/coleco";
2021-07-31 14:52:25 +00:00
import { Platform, BaseZ80MachinePlatform, getToolForFilename_z80, BaseMAMEZ80Platform } from "../common/baseplatform";
import { PLATFORMS } from "../common/emu";
export var ColecoVision_PRESETS = [
2019-08-05 00:10:14 +00:00
{ id: 'text.c', name: 'Text Mode' },
{ id: 'hello.c', name: 'Scrolling 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' },
{ id: 'musicplayer.c', name: 'Multivoice Music' },
{ id: 'mode2bitmap.c', name: 'Mode 2 Bitmap' },
{ id: 'mode2compressed.c', name: 'Mode 2 Bitmap (LZG)' },
{ id: 'lines.c', name: 'Mode 2 Lines' },
{ id: 'multicolor.c', name: 'Multicolor Mode' },
{ id: 'siegegame.c', name: 'Siege Game' },
{ id: 'shoot.c', name: 'Solarian Game' },
{ id: 'climber.c', name: 'Climber Game' },
];
2019-08-25 16:15:22 +00:00
class ColecoVisionPlatform extends BaseZ80MachinePlatform<ColecoVision> implements Platform {
2018-11-19 14:10:13 +00:00
2019-08-25 16:15:22 +00:00
newMachine() { return new ColecoVision(); }
getPresets() { return ColecoVision_PRESETS; }
getDefaultExtension() { return ".c"; };
readAddress(a) { return this.machine.read(a); }
readVRAMAddress(a) { return this.machine.readVRAMAddress(a); }
2020-01-27 05:59:09 +00:00
// TODO loadBIOS(bios) { this.machine.loadBIOS(a); }
2019-08-27 16:12:56 +00:00
getMemoryMap = function() { return { main:[
{name:'BIOS',start:0x0,size:0x2000,type:'rom'},
{name:'Cartridge Header',start:0x8000,size:0x100,type:'rom'},
] } };
showHelp(tool:string, ident:string) {
window.open("https://8bitworkshop.com/docs/platforms/coleco/", "_help");
}
2018-11-19 14:10:13 +00:00
}
2019-08-25 16:35:36 +00:00
/// MAME support
2021-07-31 14:52:25 +00:00
class ColecoVisionMAMEPlatform extends BaseMAMEZ80Platform implements Platform {
2018-08-23 12:49:14 +00:00
start() {
this.startModule(this.mainElement, {
2020-07-29 20:21:28 +00:00
jsfile: 'mame8bitws.js',
2019-08-05 00:10:14 +00:00
cfgfile: 'coleco.cfg',
biosfile: 'coleco/313 10031-4005 73108a.u2',
driver: 'coleco',
width: 280 * 2,
height: 216 * 2,
romfn: '/emulator/cart.rom',
romsize: 0x8000,
preInit: function(_self) {
},
});
}
2018-08-23 12:49:14 +00:00
loadROM(title, data) {
this.loadROMFile(data);
this.loadRegion(":coleco_cart:rom", data);
}
2018-08-23 12:49:14 +00:00
getPresets() { return ColecoVision_PRESETS; }
2018-08-23 12:49:14 +00:00
getToolForFilename = getToolForFilename_z80;
getDefaultExtension() { return ".c"; };
}
2018-11-19 14:10:13 +00:00
///
2018-11-19 14:10:13 +00:00
PLATFORMS['coleco.mame'] = ColecoVisionMAMEPlatform;
2019-08-05 00:10:14 +00:00
PLATFORMS['coleco'] = ColecoVisionPlatform;