2019-08-19 17:42:32 +00:00
|
|
|
|
2020-01-06 18:16:00 +00:00
|
|
|
import { C64, C64_WASMMachine } from "../machine/c64";
|
|
|
|
import { Platform, Base6502MachinePlatform, getToolForFilename_6502, getOpcodeMetadata_6502 } from "../common/baseplatform";
|
2019-10-26 01:55:50 +00:00
|
|
|
import { PLATFORMS } from "../common/emu";
|
2019-08-19 17:42:32 +00:00
|
|
|
|
2019-12-18 01:30:42 +00:00
|
|
|
const C64_PRESETS = [
|
2019-08-19 17:42:32 +00:00
|
|
|
{id:'hello.dasm', name:'Hello World (ASM)'},
|
2019-12-19 01:06:00 +00:00
|
|
|
{id:'eliza.c', name:'Eliza (C)'},
|
|
|
|
{id:'tgidemo.c', name:'TGI Graphics Demo (C)'},
|
2019-12-21 21:06:25 +00:00
|
|
|
{id:'upandaway.c', name:'Up, Up and Away (C)'},
|
|
|
|
{id:'joymove.c', name:'Joystick Movement (C)'},
|
2020-05-24 17:18:27 +00:00
|
|
|
{id:'siegegame.c', name:'Siege Game (C)'},
|
2020-02-04 17:58:46 +00:00
|
|
|
{id:'scroll1.c', name:'Scrolling 1 (C)'},
|
|
|
|
{id:'scroll2.c', name:'Scrolling 2 (C)'},
|
|
|
|
{id:'scroll3.c', name:'Scrolling 3 (C)'},
|
|
|
|
{id:'scroll4.c', name:'Scrolling 4 (C)'},
|
|
|
|
{id:'scroll5.c', name:'Scrolling 5 (C)'},
|
|
|
|
{id:'climber.c', name:'Climber Game (C)'},
|
2020-06-02 15:22:01 +00:00
|
|
|
{id:'multilines.c', name:'Multicolor Lines+Flood Fill (C)'},
|
|
|
|
{id:'sidtune.dasm', name:'SID Tune (ASM)'},
|
2020-05-25 18:04:04 +00:00
|
|
|
{id:'musicplayer.c', name:'Music Player (C)'},
|
2019-08-19 17:42:32 +00:00
|
|
|
];
|
|
|
|
|
2019-12-18 01:30:42 +00:00
|
|
|
const C64_MEMORY_MAP = { main:[
|
|
|
|
{name:'6510 Registers',start:0x0, size:0x2,type:'io'},
|
2020-02-04 17:58:46 +00:00
|
|
|
//{name:'RAM', start:0x2, size:0x7ffe,type:'ram'},
|
2019-12-18 01:30:42 +00:00
|
|
|
{name:'Cartridge ROM',start:0x8000,size:0x2000,type:'rom'},
|
|
|
|
{name:'BASIC ROM', start:0xa000,size:0x2000,type:'rom'},
|
|
|
|
{name:'RAM', start:0xc000,size:0x1000,type:'ram'},
|
|
|
|
{name:'VIC-II I/O', start:0xd000,size:0x0400,type:'io'},
|
2020-05-25 18:04:04 +00:00
|
|
|
{name:'SID', start:0xd400,size:0x0400,type:'io'},
|
2019-12-18 01:30:42 +00:00
|
|
|
{name:'Color RAM', start:0xd800,size:0x0400,type:'io'},
|
|
|
|
{name:'CIA 1', start:0xdc00,size:0x0100,type:'io'},
|
|
|
|
{name:'CIA 2', start:0xdd00,size:0x0100,type:'io'},
|
2020-05-25 18:04:04 +00:00
|
|
|
{name:'I/O 1', start:0xde00,size:0x0100,type:'io'},
|
|
|
|
{name:'I/O 2', start:0xdf00,size:0x0100,type:'io'},
|
2019-12-18 01:30:42 +00:00
|
|
|
{name:'KERNAL ROM', start:0xe000,size:0x2000,type:'rom'},
|
|
|
|
] }
|
|
|
|
|
2020-05-25 18:04:04 +00:00
|
|
|
// native C64 platform (NOT USED)
|
2019-09-08 17:36:26 +00:00
|
|
|
class C64Platform extends Base6502MachinePlatform<C64> implements Platform {
|
2019-08-19 17:42:32 +00:00
|
|
|
|
2019-09-08 17:36:26 +00:00
|
|
|
newMachine() { return new C64(); }
|
|
|
|
getPresets() { return C64_PRESETS; }
|
|
|
|
getDefaultExtension() { return ".c"; };
|
|
|
|
readAddress(a) { return this.machine.readConst(a); }
|
2020-01-27 05:59:09 +00:00
|
|
|
loadBIOS(bios) { this.machine.loadBIOS(bios); }
|
2019-12-18 01:30:42 +00:00
|
|
|
getMemoryMap() { return C64_MEMORY_MAP; }
|
2019-08-19 17:42:32 +00:00
|
|
|
}
|
|
|
|
|
2020-05-25 18:04:04 +00:00
|
|
|
// WASM C64 platform
|
2020-01-06 18:16:00 +00:00
|
|
|
class C64WASMPlatform extends Base6502MachinePlatform<C64_WASMMachine> implements Platform {
|
2019-12-18 01:30:42 +00:00
|
|
|
|
2020-01-06 18:16:00 +00:00
|
|
|
newMachine() { return new C64_WASMMachine('c64'); }
|
2019-12-18 01:30:42 +00:00
|
|
|
|
|
|
|
async start() {
|
|
|
|
// TODO: start() needs to block
|
|
|
|
await this.machine.loadWASM();
|
|
|
|
super.start();
|
|
|
|
}
|
|
|
|
getPresets() { return C64_PRESETS; }
|
|
|
|
getDefaultExtension() { return ".c"; };
|
|
|
|
readAddress(a) { return this.machine.readConst(a); }
|
|
|
|
getMemoryMap() { return C64_MEMORY_MAP; }
|
2020-05-25 18:04:04 +00:00
|
|
|
showHelp() {
|
|
|
|
window.open("https://sta.c64.org/cbm64mem.html", "_help");
|
|
|
|
}
|
2019-12-18 01:30:42 +00:00
|
|
|
}
|
|
|
|
|
2019-12-21 18:10:08 +00:00
|
|
|
PLATFORMS['c64'] = C64WASMPlatform;
|
2019-12-18 01:30:42 +00:00
|
|
|
PLATFORMS['c64.wasm'] = C64WASMPlatform;
|
2019-12-21 18:10:08 +00:00
|
|
|
PLATFORMS['c64.js'] = C64Platform;
|