mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-09-07 15:54:26 +00:00
8 lines
40 KiB
Plaintext
8 lines
40 KiB
Plaintext
|
{
|
||
|
"version": 3,
|
||
|
"sources": ["../src/machine/astrocade.ts", "../src/platform/astrocade.ts"],
|
||
|
"sourcesContent": ["\nimport { Z80, Z80State } from \"../common/cpu/ZilogZ80\";\nimport { BasicScanlineMachine, AcceptsPaddleInput, Bus } from \"../common/devices\";\nimport { KeyFlags, newAddressDecoder, padBytes, Keys, makeKeycodeMap, newKeyboardHandler } from \"../common/emu\";\nimport { TssChannelAdapter, MasterAudio, AY38910_Audio } from \"../common/audio\";\nimport { hex, rgb2bgr, lzgmini, stringToByteArray } from \"../common/util\";\n\n// http://metopal.com/projects/ballybook/doku.php\n\n// TODO: fix keys, more controllers, vibrato/noise, border color\n// http://atariage.com/forums/topic/251416-programming-the-bally-arcadeastrocade/\n// https://ballyalley.com/faqs/BPA%20Video%20Hardware%20FAQ/Bally_Professional_Arcade_Video_Hardware%20(2001)(Tony%20Miller).pdf\n// https://atariage.com/forums/topic/290858-notes-from-a-2019-interview-with-jamie-fenton/ (http://www.fentonia.com/bio/)\n// https://thehistoryofhowweplay.wordpress.com/2018/04/03/interview-tom-mchugh/\n// https://ballyalley.com/faqs/Programmers%20of%20the%20Astrocade%20Built-In%20Programs.txt\n\nconst ASTROCADE_KEYCODE_MAP = makeKeycodeMap([\n // player 1\n [Keys.UP, 0x10, 0x1],\n [Keys.DOWN, 0x10, 0x2],\n [Keys.LEFT, 0x10, 0x4],\n [Keys.RIGHT, 0x10, 0x8],\n [Keys.A, 0x10, 0x10],\n // player 2\n [Keys.P2_UP, 0x11, 0x1],\n [Keys.P2_DOWN, 0x11, 0x2],\n [Keys.P2_LEFT, 0x11, 0x4],\n [Keys.P2_RIGHT, 0x11, 0x8],\n [Keys.P2_A, 0x11, 0x10],\n // keypad $14\n [Keys.VK_P, 0x14, 0x1],\n [Keys.VK_SLASH, 0x14, 0x2],\n [Keys.VK_X, 0x14, 0x4],\n [Keys.VK_MINUS, 0x14, 0x8],\n [Keys.VK_COMMA, 0x14, 0x10],\n [Keys.VK_EQUALS, 0x14, 0x20],\n // keypad $15\n [Keys.VK_O, 0x15, 0x1],\n [Keys.VK_L, 0x15, 0x2],\n [Keys.VK_9, 0x15, 0x4],\n [Keys.VK_6, 0x15, 0x8],\n [Keys.VK_3, 0x15, 0x10],\n [Keys.VK_PERIOD, 0x15, 0x20],\n // keypad $16\n [Keys.VK_I, 0x16, 0x1],\n [Keys.VK_K, 0x16, 0x2],\n [Keys.VK_8, 0x16, 0x4],\n [Keys.VK_5, 0x16, 0x8],\n [Keys.VK_2, 0x16, 0x10],\n [Keys.VK_0, 0x16, 0x20],\n // keypad $17\n [Keys.VK_U, 0x17, 0x1],\n [Keys.VK_J, 0x17, 0x2],\n [Keys.VK_7, 0x17, 0x4],\n [Keys.VK_4, 0x17, 0x8],\n [Keys.VK_1, 0x17, 0x10],\n [Keys.VK_BACK_SLASH, 0x17, 0x20],\n]);\n\nconst audioOversample = 2;\n\nconst _BallyAstrocade = function(arcade:boolean) {\n\n var cpu : Z80;\n var ram : Uint8Array;\n var membus, iobus : Bus;\n var rom, bios;\n var pixels;\n var psg;\n //var watchdog_counter;\n const swidth = arcade ? 320 : 160;\n const sheight = arcade ? 204 : 102;\n const swbytes = swidth >> 2;\n const INITIAL_WATCHDOG = 256;\n const PIXEL_ON = 0xffeeeeee;\n const PIXEL_OFF = 0xff000000;\n\n // state variables\n var inputs = new Uint8Array(0x20);\n var magicop = 0;\n var xpand = 0;\n var xplower = false;\n var shift2 = 0;\n var horcb = 0;\n var inmod = 0;\n var inlin = 0;\n var infbk = 0;\n var verbl = sheight;\n var palette = new Uint32Array(8);\n var palinds = new Uint8Array(8);\n var refreshlines = 0;\n var dirtylines = new Uint8Array(arcade ? 262 : 131);\n var vidactive = false;\n var rotdata = new Uint8Array(4);\n var rotcount = 0;\n var intst = 0;\n var waitstates = 0;\n\n\n function ramwrite(a: number, v: number) {\n // set RAM\n ram[a] = v;\n waitstates++;\n // mark scanline as dirty\n dirtylines[((a & 0xfff) / swbytes) | 0] = 1;\n // this was old behavior where we updated instantly\n // but it had problems if we had mid-screen palette changes\n //ramupdate(a, v);\n }\n\n function ramupdate(a: number, v: number) {\n var ofs = a * 4 + 3; // 4 pixels per byte\n for (var i = 0; i < 4; i++) {\n var lr = ((a % swbytes) >= (horcb & 0x3f)) ? 0 : 4;\n pixels[ofs--] = palette[lr + (v & 3)];\n v >>= 2;\n }\n }\n\n function refreshline(y: number) {\n var ofs = y * swidth / 4;\n for (var i = 0; i < swidth / 4; i++)\n ramupdate(ofs + i, ram[ofs + i]);\n }\n\n function magicwrite(a: number, v: number) {\n // expand\n if (magicop & 0x8) {\n var v2 = 0;\n if (!xplower)\n v >>= 4;\n for (var i = 0; i < 4; i++) {\n
|
||
|
"mappings": "+OAgBA,GAAM,IAAwB,GAAe,CAE3C,CAAC,EAAK,GAAI,GAAM,GAChB,CAAC,EAAK,KAAM,GAAM,GAClB,CAAC,EAAK,KAAM,GAAM,GAClB,CAAC,EAAK,MAAO,GAAM,GACnB,CAAC,EAAK,EAAG,GAAM,IAEf,CAAC,EAAK,MAAO,GAAM,GACnB,CAAC,EAAK,QAAS,GAAM,GACrB,CAAC,EAAK,QAAS,GAAM,GACrB,CAAC,EAAK,SAAU,GAAM,GACtB,CAAC,EAAK,KAAM,GAAM,IAElB,CAAC,EAAK,KAAM,GAAM,GAClB,CAAC,EAAK,SAAU,GAAM,GACtB,CAAC,EAAK,KAAM,GAAM,GAClB,CAAC,EAAK,SAAU,GAAM,GACtB,CAAC,EAAK,SAAU,GAAM,IACtB,CAAC,EAAK,UAAW,GAAM,IAEvB,CAAC,EAAK,KAAM,GAAM,GAClB,CAAC,EAAK,KAAM,GAAM,GAClB,CAAC,EAAK,KAAM,GAAM,GAClB,CAAC,EAAK,KAAM,GAAM,GAClB,CAAC,EAAK,KAAM,GAAM,IAClB,CAAC,EAAK,UAAW,GA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