1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-18 03:05:35 +00:00
8bitworkshop/gen/zx-RRR4VYRO.js.map

8 lines
8.0 KiB
Plaintext

{
"version": 3,
"sources": ["../src/machine/zx.ts", "../src/platform/zx.ts"],
"sourcesContent": ["\nimport { MOS6502, MOS6502State } from \"../common/cpu/MOS6502\";\nimport { BasicMachine, RasterFrameBased, Bus, ProbeAll } from \"../common/devices\";\nimport { KeyFlags, newAddressDecoder, padBytes, Keys, makeKeycodeMap, newKeyboardHandler, EmuHalt, dumpRAM } from \"../common/emu\";\nimport { lzgmini, stringToByteArray, hex, rgb2bgr } from \"../common/util\";\n\n//// WASM Machine\n\nimport { Machine } from \"../common/baseplatform\";\nimport { TrapCondition } from \"../common/devices\";\nimport { BaseWASMMachine } from \"../common/wasmplatform\";\n\nexport class ZX_WASMMachine extends BaseWASMMachine implements Machine {\n\n numTotalScanlines = 312;\n cpuCyclesPerLine = 224;\n\n joymask0 = 0;\n\n reset() {\n super.reset();\n // advance bios\n this.exports.machine_exec(this.sys, 500000); // TODO?\n // load rom (Z80 header: https://worldofspectrum.org/faq/reference/z80format.htm)\n if (this.romptr && this.romlen) {\n // TODO\n this.exports.machine_load_rom(this.sys, this.romptr, this.romlen);\n /*\n var romstart = 0x5ccb;\n for (var i=0; i<this.romlen; i++) {\n this.exports.machine_mem_write(this.sys, romstart+i, this.romarr[i]);\n }\n */\n }\n // clear keyboard\n for (var ch=0; ch<128; ch++) {\n this.setKeyInput(ch, 0, KeyFlags.KeyUp);\n }\n }\n advanceFrame(trap: TrapCondition) : number {\n //var scanline = this.exports.machine_get_raster_line(this.sys);\n var probing = this.probe != null;\n if (probing) this.exports.machine_reset_probe_buffer();\n var clocks = super.advanceFrameClock(trap, Math.floor(1000000 / 50)); // TODO: use ticks, not msec\n if (probing) this.copyProbeData();\n return clocks;\n }\n /*\n z80_tick_t tick_cb; // 0\n uint64_t bc_de_hl_fa; // 8\n uint64_t bc_de_hl_fa_; // 16\n uint64_t wz_ix_iy_sp; // 24\n uint64_t im_ir_pc_bits; // 32\n uint64_t pins; // 48\n void* user_data;\n z80_trap_t trap_cb;\n void* trap_user_data;\n int trap_id; \n */\n getCPUState() {\n this.exports.machine_save_cpu_state(this.sys, this.cpustateptr);\n var s = this.cpustatearr;\n var af = s[9] + (s[8]<<8); // not FA\n var hl = s[10] + (s[11]<<8);\n var de = s[12] + (s[13]<<8);\n var bc = s[14] + (s[15]<<8);\n var sp = s[24] + (s[25]<<8);\n var iy = s[26] + (s[27]<<8);\n var ix = s[28] + (s[29]<<8);\n var pc = s[34] + (s[35]<<8);\n var ir = s[36] + (s[37]<<8);\n return {\n PC:pc,\n SP:sp,\n AF:af,\n BC:bc,\n DE:de,\n HL:hl,\n IX:ix,\n IY:iy,\n IR:ir,\n o:this.readConst(pc),\n }\n }\n saveState() {\n this.exports.machine_save_state(this.sys, this.stateptr);\n return {\n c:this.getCPUState(),\n state:this.statearr.slice(0),\n };\n }\n loadState(state) : void {\n this.statearr.set(state.state);\n this.exports.machine_load_state(this.sys, this.stateptr);\n }\n getVideoParams() {\n return {width:320, height:256, overscan:true, videoFrequency:50};\n }\n setKeyInput(key: number, code: number, flags: number): void {\n // TODO: handle shifted keys\n if (key == 16 || key == 17 || key == 18 || key == 224) return; // meta keys\n //console.log(key, code, flags);\n //if (flags & KeyFlags.Shift) { key += 64; }\n // convert to c64 (TODO: zx)\n var mask = 0;\n var mask2 = 0;\n if (key == 37) { key = 0x8; mask = 0x4; } // LEFT\n if (key == 38) { key = 0xb; mask = 0x1; } // UP\n if (key == 39) { key = 0x9; mask = 0x8; } // RIGHT\n if (key == 40) { key = 0xa; mask = 0x2; } // DOWN\n if (key == 32) { mask = 0x10; } // FIRE\n if (key == 65) { key = 65; mask2 = 0x4; } // LEFT\n if (key == 87) { key = 87; mask2 = 0x1; } // UP\n if (key == 68) { key = 68; mask2 = 0x8; } // RIGHT\n if (key == 83) { key = 83; mask2 = 0x2; } // DOWN\n if (key == 69) { mask2 = 0x10; } // FIRE\n if (key == 113) { key = 0xf1; } // F2\n if (key == 115) { key = 0xf3; } // F4\n if (key == 119) { key = 0xf5; } // F8\n if (key == 121) { key = 0xf7; } // F10\n if (flags & KeyFlags.KeyDown) {\n this.exports.machine_key_down(this.sys, key);\n this.joymask0 |= mask;\n } else if (flags & KeyFlags.KeyUp) {\n this.exports.machine_key_up(this.sys, key);\n this.joymask0 &= ~mask;\n }\n this.exports.zx_joystick(this.sys, this.joymask0, 0);\n }\n}\n", "\nimport { ZX_WASMMachine } from \"../machine/zx\";\nimport { Platform, BaseZ80MachinePlatform } from \"../common/baseplatform\";\nimport { PLATFORMS } from \"../common/emu\";\n\nconst ZX_PRESETS = [\n {id:'hello.asm', name:'Hello World (ASM)'},\n {id:'bios.c', name:'BIOS Routines (C)'},\n {id:'cosmic.c', name:'Cosmic Impalas (C)'},\n];\n\nconst ZX_MEMORY_MAP = { main:[\n {name:'BIOS', start:0x0000, size:0x4000, type:'rom'},\n {name:'Screen RAM', start:0x4000, size:0x1800, type:'ram'},\n {name:'Color RAM', start:0x5800, size:0x300, type:'ram'},\n //{name:'Printer Buffer', start:0x5b00, size:0x100, type:'ram'},\n {name:'System RAM', start:0x5c00, size:0xc0, type:'ram'},\n {name:'User RAM', start:0x5ccb, size:0xff58-0x5ccb, type:'ram'},\n] }\n\n// WASM ZX Spectrum platform\nclass ZXWASMPlatform extends BaseZ80MachinePlatform<ZX_WASMMachine> implements Platform {\n\n newMachine() { return new ZX_WASMMachine('zx'); }\n\n getPresets() { return ZX_PRESETS; }\n getDefaultExtension() { return \".asm\"; };\n readAddress(a) { return this.machine.readConst(a); }\n getMemoryMap() { return ZX_MEMORY_MAP; }\n showHelp() {\n window.open(\"https://worldofspectrum.org/faq/reference/reference.htm\", \"_help\");\n }\n}\n\nPLATFORMS['zx'] = ZXWASMPlatform;\n"],
"mappings": "sJAYO,mBAA6B,EAAmC,CAAhE,aAZP,CAYO,oBAEL,uBAAoB,IACpB,sBAAmB,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