2020-07-02 17:33:22 +00:00
|
|
|
|
|
|
|
import { ZX_WASMMachine } from "../machine/zx";
|
|
|
|
import { Platform, BaseZ80MachinePlatform } from "../common/baseplatform";
|
|
|
|
import { PLATFORMS } from "../common/emu";
|
|
|
|
|
|
|
|
const ZX_PRESETS = [
|
|
|
|
{id:'hello.asm', name:'Hello World (ASM)'},
|
|
|
|
{id:'bios.c', name:'BIOS Routines (C)'},
|
|
|
|
{id:'cosmic.c', name:'Cosmic Impalas (C)'},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ZX_MEMORY_MAP = { main:[
|
|
|
|
{name:'BIOS', start:0x0000, size:0x4000, type:'rom'},
|
|
|
|
{name:'Screen RAM', start:0x4000, size:0x1800, type:'ram'},
|
2021-05-03 18:09:11 +00:00
|
|
|
{name:'Color RAM', start:0x5800, size:0x300, type:'ram'},
|
2020-07-02 17:33:22 +00:00
|
|
|
//{name:'Printer Buffer', start:0x5b00, size:0x100, type:'ram'},
|
|
|
|
{name:'System RAM', start:0x5c00, size:0xc0, type:'ram'},
|
|
|
|
{name:'User RAM', start:0x5ccb, size:0xff58-0x5ccb, type:'ram'},
|
|
|
|
] }
|
|
|
|
|
2021-05-03 18:09:11 +00:00
|
|
|
// WASM ZX Spectrum platform
|
2020-07-02 17:33:22 +00:00
|
|
|
class ZXWASMPlatform extends BaseZ80MachinePlatform<ZX_WASMMachine> implements Platform {
|
|
|
|
|
|
|
|
newMachine() { return new ZX_WASMMachine('zx'); }
|
|
|
|
|
|
|
|
getPresets() { return ZX_PRESETS; }
|
|
|
|
getDefaultExtension() { return ".asm"; };
|
|
|
|
readAddress(a) { return this.machine.readConst(a); }
|
|
|
|
getMemoryMap() { return ZX_MEMORY_MAP; }
|
|
|
|
showHelp() {
|
2022-09-15 17:05:54 +00:00
|
|
|
return "https://worldofspectrum.org/faq/reference/reference.htm"; // TODO
|
2020-07-02 17:33:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PLATFORMS['zx'] = ZXWASMPlatform;
|