mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-09-07 15:54:26 +00:00
8 lines
27 KiB
Plaintext
8 lines
27 KiB
Plaintext
|
{
|
||
|
"version": 3,
|
||
|
"sources": ["../src/machine/msx.ts", "../src/platform/msx.ts"],
|
||
|
"sourcesContent": ["\nimport { Z80, Z80State } from \"../common/cpu/ZilogZ80\";\nimport { BasicScanlineMachine } from \"../common/devices\";\nimport { BaseZ80VDPBasedMachine } from \"./vdp_z80\";\nimport { KeyFlags, newAddressDecoder, padBytes, Keys, makeKeycodeMap, newKeyboardHandler } from \"../common/emu\";\nimport { hex, lzgmini, stringToByteArray } from \"../common/util\";\nimport { TssChannelAdapter, MasterAudio, AY38910_Audio } from \"../common/audio\";\nimport { TMS9918A } from \"../common/video/tms9918a\";\n\n\nvar MSX_KEYCODE_MAP = makeKeycodeMap([\n [Keys.UP, 0, 0x1],\n [Keys.DOWN, 0, 0x2],\n [Keys.LEFT, 0, 0x4],\n [Keys.RIGHT, 0, 0x8],\n [Keys.A, 0, 0x10],\n [Keys.B, 0, 0x20],\n\n [Keys.P2_UP, 1, 0x1],\n [Keys.P2_DOWN, 1, 0x2],\n [Keys.P2_LEFT, 1, 0x4],\n [Keys.P2_RIGHT, 1, 0x8],\n [Keys.P2_A, 1, 0x10],\n [Keys.P2_B, 1, 0x20],\n\n [Keys.ANYKEY, 2, 0x0],\n]);\n\nconst JOY_INPUT_0 = 0;\nconst JOY_INPUT_1 = 1;\nconst KEYBOARD_ROW_0 = 16;\n\nconst MSX_KEYMATRIX_INTL_NOSHIFT = [\n Keys.VK_7, Keys.VK_6, Keys.VK_5, Keys.VK_4, Keys.VK_3, Keys.VK_2, Keys.VK_1, Keys.VK_0,\n Keys.VK_SEMICOLON, Keys.VK_CLOSE_BRACKET, Keys.VK_OPEN_BRACKET, Keys.VK_BACK_SLASH, Keys.VK_EQUALS, Keys.VK_MINUS, Keys.VK_9, Keys.VK_8,\n Keys.VK_B, Keys.VK_A, null/*DEAD*/, Keys.VK_SLASH, Keys.VK_PERIOD, Keys.VK_COMMA, Keys.VK_ACUTE, Keys.VK_QUOTE,\n Keys.VK_J, Keys.VK_I, Keys.VK_H, Keys.VK_G, Keys.VK_F, Keys.VK_E, Keys.VK_D, Keys.VK_C,\n Keys.VK_R, Keys.VK_Q, Keys.VK_P, Keys.VK_O, Keys.VK_N, Keys.VK_M, Keys.VK_L, Keys.VK_K,\n Keys.VK_Z, Keys.VK_Y, Keys.VK_X, Keys.VK_W, Keys.VK_V, Keys.VK_U, Keys.VK_T, Keys.VK_S,\n Keys.VK_F3, Keys.VK_F2, Keys.VK_F1, null, Keys.VK_CAPS_LOCK, null, Keys.VK_CONTROL, Keys.VK_SHIFT,\n Keys.VK_ENTER, null, Keys.VK_BACK_SPACE, null, Keys.VK_TAB, Keys.VK_ESCAPE, Keys.VK_F5, Keys.VK_F4,\n Keys.VK_RIGHT, Keys.VK_DOWN, Keys.VK_UP, Keys.VK_LEFT, Keys.VK_DELETE, Keys.VK_INSERT, Keys.VK_HOME, Keys.VK_SPACE,\n null, null, null, null, null, null, null, null, \n null, null, null, null, null, null, null, null, \n // TODO: null keycodes\n];\n\n/// standard emulator\n\ninterface MSXSlot {\n read(addr:number) : number;\n write(addr:number, val:number) : void;\n}\n\nexport class MSX1 extends BaseZ80VDPBasedMachine {\n\n numVisibleScanlines = 240;\n defaultROMSize = 0x8000;\n ram = new Uint8Array(0x10000);\n\n vdp : TMS9918A;\n bios : Uint8Array;\n slots : MSXSlot[];\n slotmask : number = 0;\n ppi_c : number = 0;\n \n constructor() {\n super();\n this.init(this, this.newIOBus(), new AY38910_Audio(new MasterAudio()));\n this.bios = new lzgmini().decode(stringToByteArray(atob(MSX1_BIOS_LZG)));\n // skip splash screen\n this.bios[0xdd5] = 0;\n this.bios[0xdd6] = 0;\n this.bios[0xdd7] = 0;\n // slot definitions\n this.slots = [\n // slot 0 : BIOS\n {\n read: (a) => { return this.bios[a] | 0; },\n write: (a,v) => { }\n },\n // slot 1: cartridge\n {\n read: (a) => { return this.rom[a - 0x4000] | 0; },\n write: (a,v) => { }\n },\n // slot 2: cartridge\n {\n read: (a) => { return this.rom[a - 0x4000] | 0; },\n write: (a,v) => { }\n },\n // slot 3 : RAM\n {\n read: (a) => { return this.ram[a] | 0; },\n write: (a,v) => { this.ram[a] = v; }\n },\n ];\n }\n \n \n getKeyboardMap() { return MSX_KEYCODE_MAP; }\n\n // http://map.grauw.nl/articles/keymatrix.php\n getKeyboardFunction() {\n return (o,key,code,flags) => {\n //console.log(o,key,code,flags);\n var keymap = MSX_KEYMATRIX_INTL_NOSHIFT;\n for (var i=0; i<keymap.length; i++) {\n if (keymap[i] && keymap[i].c == key) {\n let row = i >> 3;\n let bit = 7 - (i & 7);\n //console.log(key, row, bit);\n if (flags & KeyFlags.KeyDown) {\n this.inputs[KEYBOARD_ROW_0+row] |= (1<<bit);\n } else if (flags & KeyFlags.KeyUp) {\n this.inputs[KEYBOARD_ROW_0+row] &= ~(1<
|
||
|
"mappings": "iOAUA,GAAI,GAAkB,EAAe,CACnC,CAAC,EAAK,GAAU,EAAG,GACnB,CAAC,EAAK,KAAU,EAAG,GACnB,CAAC,EAAK,KAAU,EAAG,GACnB,CAAC,EAAK,MAAU,EAAG,GACnB,CAAC,EAAK,EAAU,EAAG,IACnB,CAAC,EAAK,EAAU,EAAG,IAEnB,CAAC,EAAK,MAAU,EAAG,GACnB,CAAC,EAAK,QAAU,EAAG,GACnB,CAAC,EAAK,QAAU,EAAG,GACnB,CAAC,EAAK,SAAU,EAAG,GACnB,CAAC,EAAK,KAAU,EAAG,IACnB,CAAC,EAAK,KAAU,EAAG,IAEnB,CAAC,EAAK,OAAU,EAAG,KAGf,EAAc,EAEpB,GAAM,GAAiB,GAEjB,EAA6B,CACjC,EAAK,KAAM,EAAK,KAAM,EAAK,KAAM,EAAK,KAAM,EAAK,KAAM,EAAK,KAAM,EAAK,KAAM,EAAK,KAClF,EAAK,aAAc,EAAK,iBAAkB,EAAK,gBAAiB,EA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