From d7d243700455137500158325f36cd6061f9552a5 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Fri, 21 Sep 2018 08:39:15 -0400 Subject: [PATCH] more atari8 stuff, fixed mame; astrocade-bios preset, paddles --- doc/notes.txt | 1 + presets/{astrocade => astrocade-bios}/bios.c | 101 ++++++++------ presets/atari8-5200/hello.a | 42 ++++-- src/baseplatform.ts | 14 +- src/emu.ts | 26 ++-- src/platform/astrocade.ts | 19 ++- src/platform/atari8.ts | 135 ++++++++++++++----- src/platform/verilog.ts | 6 +- src/ui.ts | 2 + src/util.ts | 4 + src/worker/workermain.js | 36 +++-- 11 files changed, 258 insertions(+), 128 deletions(-) rename presets/{astrocade => astrocade-bios}/bios.c (79%) diff --git a/doc/notes.txt b/doc/notes.txt index f283610e..ec68c825 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -66,6 +66,7 @@ TODO: - requestInterrupt needs to be disabled after breakpoint? - verilog: when paused scope doesn't work - resize memory dump window +- C/asm formatter WEB WORKER FORMAT diff --git a/presets/astrocade/bios.c b/presets/astrocade-bios/bios.c similarity index 79% rename from presets/astrocade/bios.c rename to presets/astrocade-bios/bios.c index 523466ed..69648c9c 100644 --- a/presets/astrocade/bios.c +++ b/presets/astrocade-bios/bios.c @@ -57,44 +57,43 @@ __sfr __at(0x13) hw_p4ctrl; // player controls byte __at (0x0000) vmagic[VHEIGHT][VBWIDTH]; byte __at (0x4000) vidmem[VHEIGHT][VBWIDTH]; -// Used by MUSIC PROCESSOR: -volatile word MUZPC; // $4FCE // MUSic Program Counter -volatile word MUZSP; // $4FD0 // MUSic Stack Pointer -volatile byte PVOLAB; // $4FD2 // Preset VOLume for tones A and B -volatile byte PVOLMC; // $4FD3 // Preset VOLuMe for tone C and Noise Mode -volatile byte VOICES; // $4FD4 // music VOICES mask -// COUNTER TIMERS (used by DECCTS,ACTINT,CTIMER): -volatile byte CT[8]; -// Used by SENTRY to track controls: -volatile byte CNT; // $4FDD // Counter update & Number Tracking -volatile byte SEMI4S; // $4FDE // SEMAPHORE flag bitS -volatile byte OPOT[4]; // $4FDF // Old POT 0 tracking byte -volatile byte KEYSEX; // $4FE3 // KEYS-EX tracking byte -volatile byte OSW[4]; // $4FE4 // Old SWitch 0 tracking byte -volatile word COLLST; // $4FE8 // COLset LaST address for P.B. A -// Used by STIMER: -volatile byte DURAT; // $4FEA // note DURATion -volatile byte TMR60; // $4FEB // TiMeR for SIXTY'ths of sec -volatile byte TIMOUT; // $4FEC // TIMer for blackOUT -volatile byte GTSECS; // $4FED // Game Time SECondS -volatile byte GTMINS; // $4FEE // Game Time MINuteS -// Used by MENU: -long RANSHT; // $4FEF // RANdom number SHifT register -byte NUMPLY; // $4FF3 // NUMber of PLaYers -byte ENDSCR[3]; // $4FF4 // END SCoRe to 'play to' -byte MRLOCK; // $4FF7 // Magic Register LOCK out flag -byte GAMSTB; // $4FF8 // GAMe STatus Byte -byte PRIOR; // $4FF9 // PRIOR music protect flag -byte SENFLG; // $4FFA // SENtry control seizure FLaG -// User UPI Routines, even numbers from $80 to $FE ( + 1 for SUCK): -byte* UMARGT; // $4FFB // User Mask ARGument Table + (routine / 2) -word* USERTB; // $4FFD // USER Table Base + routine = JumP address +// start @ $4FCE +volatile word MUZPC; // music PC +volatile word MUZSP; // music SP +volatile byte PVOLAB; // channels A and B volume +volatile byte PVOLMC; // channel C volume and noise mask +volatile byte VOICES; // voice smask + +volatile byte CT[8]; // counter timers + +volatile byte CNT; +volatile byte SEMI4S; +volatile byte OPOT[4]; +volatile byte KEYSEX; +volatile byte OSW[4]; +volatile word COLLST; + +volatile byte DURAT; // note duration +volatile byte TMR60; // 1/60 sec timer +volatile byte TIMOUT; // blackout timer +volatile byte GTSECS; // seconds timer +volatile byte GTMINS; // minutes timer + +unsigned long RANSHT; // RNG +byte NUMPLY; // # players +byte ENDSCR[3]; // end score +byte MRLOCK; // magic register lock out +byte GAMSTB; // game status +byte PRIOR; // music protect +byte SENFLG; // sentry control + +byte* UMARGT; // user mask table (-64 bytes) +word* USERTB; // user routine table (-128 bytes) // start routine @ 0x0 void bios_start() __naked { __asm DI ; disable interrupts - LD SP,#0x4fce ; position stack below BIOS vars LD HL,#0x2000 LD A,(HL) ; A <- mem[0x2000] CP #0x55 ; found sentinel byte? ($55) @@ -105,6 +104,7 @@ __asm JP _main ; jump to test program #endif FoundSentinel: + LD SP,#0x4fce ; position stack below BIOS vars CALL _bios_init ; misc. bios init routines LD HL,#0x2005 ; cartridge start vector LD A,(HL) @@ -166,8 +166,8 @@ typedef struct { const byte* chartab; } FontDescriptor; -#define LOCHAR 32 -#define HICHAR 127 +#define LOCHAR 0x20 +#define HICHAR 0x63 extern const char BIGFONT[HICHAR-LOCHAR+1][7]; extern const char SMLFONT[HICHAR-LOCHAR+1][5]; @@ -335,11 +335,11 @@ void FILL(ContextBlock *ctx) { memset(dest, val, count); } -const char BIGFONT[HICHAR-LOCHAR+1][7] = { -{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00 },{ 0x00,0x20,0x20,0x20,0x00,0x20,0x00 },{ 0x50,0x50,0x50,0x00,0x00,0x00,0x00 },{ 0x00,0x50,0xF8,0x50,0xF8,0x50,0x00 },{ 0x00,0xF8,0xA0,0xF8,0x28,0xF8,0x00 },{ 0x00,0xC8,0xD0,0x20,0x58,0x98,0x00 },{ 0x00,0xE0,0xA8,0xF8,0x90,0xF8,0x00 },{ 0x40,0x40,0x40,0x00,0x00,0x00,0x00 },{ 0x30,0x20,0x20,0x20,0x20,0x20,0x30 },{ 0x60,0x20,0x20,0x20,0x20,0x20,0x60 },{ 0x00,0x20,0xA8,0x70,0xA8,0x20,0x00 },{ 0x00,0x20,0x20,0xF8,0x20,0x20,0x00 },{ 0x00,0x00,0x00,0x00,0x60,0x60,0x40 },{ 0x00,0x00,0x00,0xF8,0x00,0x00,0x00 },{ 0x00,0x00,0x00,0x00,0x60,0x60,0x00 },{ 0x00,0x08,0x10,0x20,0x40,0x80,0x00 },{ 0x00,0xF8,0x88,0xE8,0x88,0xF8,0x00 },{ 0x00,0x10,0x30,0x50,0x10,0x10,0x00 },{ 0x00,0xF8,0x08,0xF8,0x80,0xF8,0x00 },{ 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00 },{ 0x00,0x38,0x48,0x88,0xF8,0x08,0x00 },{ 0x00,0xF8,0x80,0xF8,0x08,0xF8,0x00 },{ 0x00,0xF8,0x80,0xF8,0x88,0xF8,0x00 },{ 0x00,0xF8,0x08,0x10,0x20,0x40,0x00 },{ 0x00,0xF8,0x88,0xF8,0x88,0xF8,0x00 },{ 0x00,0xF8,0x88,0xF8,0x08,0xF8,0x00 },{ 0x00,0x30,0x30,0x00,0x30,0x30,0x00 },{ 0x00,0x30,0x30,0x00,0x30,0x30,0x20 },{ 0x08,0x10,0x20,0x40,0x20,0x10,0x08 },{ 0x00,0x00,0xF8,0x00,0xF8,0x00,0x00 },{ 0x40,0x20,0x10,0x08,0x10,0x20,0x40 },{ 0x00,0xF8,0x08,0x78,0x00,0x60,0x00 },{ 0x00,0xF8,0xA8,0xB8,0x80,0xF8,0x00 },{ 0x00,0xF8,0x88,0xF8,0x88,0x88,0x00 },{ 0x00,0xF0,0x90,0xF8,0x88,0xF8,0x00 },{ 0x00,0xF8,0x80,0x80,0x80,0xF8,0x00 },{ 0x00,0xE0,0x90,0x88,0x88,0xF8,0x00 },{ 0x00,0xF8,0x80,0xF8,0x80,0xF8,0x00 },{ 0x00,0xF8,0x80,0xF8,0x80,0x80,0x00 },{ 0x00,0xF8,0x80,0xB8,0x88,0xF8,0x00 },{ 0x00,0x88,0x88,0xF8,0x88,0x88,0x00 },{ 0x00,0x40,0x40,0x40,0x40,0x40,0x00 },{ 0x00,0x08,0x08,0x88,0x88,0xF8,0x00 },{ 0x00,0x88,0x90,0xA0,0x90,0x88,0x00 },{ 0x00,0x80,0x80,0x80,0x80,0xF8,0x00 },{ 0x00,0xFE,0x92,0x92,0x92,0x92,0x00 },{ 0x00,0x88,0xC8,0xA8,0x98,0x88,0x00 },{ 0x00,0xF8,0x88,0x88,0x88,0xF8,0x00 },{ 0x00,0xF8,0x88,0x88,0xF8,0x80,0x00 },{ 0x00,0xF8,0x88,0xA8,0xA8,0xF8,0x10 },{ 0x00,0xF8,0x88,0xF8,0x90,0x88,0x00 },{ 0x00,0xF8,0x80,0xF8,0x08,0xF8,0x00 },{ 0x00,0xF8,0x20,0x20,0x20,0x20,0x00 },{ 0x00,0x88,0x88,0x88,0x88,0xF8,0x00 },{ 0x00,0x88,0x88,0x90,0xA0,0xC0,0x00 },{ 0x00,0x92,0x92,0x92,0x92,0xFE,0x00 },{ 0x00,0x88,0x50,0x20,0x50,0x88,0x00 },{ 0x00,0x88,0x88,0xF8,0x08,0xF8,0x00 },{ 0x00,0xF8,0x10,0x20,0x40,0xF8,0x00 },{ 0x38,0x20,0x20,0x20,0x20,0x20,0x38 },{ 0x00,0x80,0x40,0x20,0x10,0x08,0x00 },{ 0x70,0x10,0x10,0x10,0x10,0x10,0x70 },{ 0x00,0x20,0x50,0x88,0x00,0x00,0x00 },{ 0x00,0x00,0x00,0x00,0x00,0x00,0xF8 },{ 0x40,0x20,0x10,0x00,0x00,0x00,0x00 },{ 0x00,0xF8,0x88,0xF8,0x88,0x88,0x00 },{ 0x00,0xF0,0x90,0xF8,0x88,0xF8,0x00 },{ 0x00,0xF8,0x80,0x80,0x80,0xF8,0x00 },{ 0x00,0xE0,0x90,0x88,0x88,0xF8,0x00 },{ 0x00,0xF8,0x80,0xF8,0x80,0xF8,0x00 },{ 0x00,0xF8,0x80,0xF8,0x80,0x80,0x00 },{ 0x00,0xF8,0x80,0xB8,0x88,0xF8,0x00 },{ 0x00,0x88,0x88,0xF8,0x88,0x88,0x00 },{ 0x00,0x40,0x40,0x40,0x40,0x40,0x00 },{ 0x00,0x08,0x08,0x88,0x88,0xF8,0x00 },{ 0x00,0x88,0x90,0xA0,0x90,0x88,0x00 },{ 0x00,0x80,0x80,0x80,0x80,0xF8,0x00 },{ 0x00,0xFE,0x92,0x92,0x92,0x92,0x00 },{ 0x00,0x88,0xC8,0xA8,0x98,0x88,0x00 },{ 0x00,0xF8,0x88,0x88,0x88,0xF8,0x00 },{ 0x00,0xF8,0x88,0x88,0xF8,0x80,0x00 },{ 0x00,0xF8,0x88,0xA8,0xA8,0xF8,0x10 },{ 0x00,0xF8,0x88,0xF8,0x90,0x88,0x00 },{ 0x00,0xF8,0x80,0xF8,0x08,0xF8,0x00 },{ 0x00,0xF8,0x20,0x20,0x20,0x20,0x00 },{ 0x00,0x88,0x88,0x88,0x88,0xF8,0x00 },{ 0x00,0x88,0x88,0x90,0xA0,0xC0,0x00 },{ 0x00,0x92,0x92,0x92,0x92,0xFE,0x00 },{ 0x00,0x88,0x50,0x20,0x50,0x88,0x00 },{ 0x00,0x88,0x88,0xF8,0x08,0xF8,0x00 },{ 0x00,0xF8,0x10,0x20,0x40,0xF8,0x00 },{ 0x38,0x20,0x20,0xE0,0x20,0x20,0x38 },{ 0x20,0x20,0x20,0x20,0x20,0x20,0x20 },{ 0xE0,0x20,0x20,0x38,0x20,0x20,0xE0 },{ 0x00,0xE8,0xB8,0x00,0x00,0x00,0x00 },{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00 },}; +const char BIGFONT[HICHAR-LOCHAR+1][7] = {/*{count:68,w:8,h:7,brev:1}*/ +{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00 },{ 0x00,0x20,0x20,0x20,0x00,0x20,0x00 },{ 0x50,0x50,0x50,0x00,0x00,0x00,0x00 },{ 0x00,0x50,0xF8,0x50,0xF8,0x50,0x00 },{ 0x00,0xF8,0xA0,0xF8,0x28,0xF8,0x00 },{ 0x00,0xC8,0xD0,0x20,0x58,0x98,0x00 },{ 0x00,0xE0,0xA8,0xF8,0x90,0xF8,0x00 },{ 0x40,0x40,0x40,0x00,0x00,0x00,0x00 },{ 0x30,0x20,0x20,0x20,0x20,0x20,0x30 },{ 0x60,0x20,0x20,0x20,0x20,0x20,0x60 },{ 0x00,0x20,0xA8,0x70,0xA8,0x20,0x00 },{ 0x00,0x20,0x20,0xF8,0x20,0x20,0x00 },{ 0x00,0x00,0x00,0x00,0x60,0x60,0x40 },{ 0x00,0x00,0x00,0xF8,0x00,0x00,0x00 },{ 0x00,0x00,0x00,0x00,0x60,0x60,0x00 },{ 0x00,0x08,0x10,0x20,0x40,0x80,0x00 },{ 0x00,0xF8,0x88,0xE8,0x88,0xF8,0x00 },{ 0x00,0x10,0x30,0x50,0x10,0x10,0x00 },{ 0x00,0xF8,0x08,0xF8,0x80,0xF8,0x00 },{ 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00 },{ 0x00,0x38,0x48,0x88,0xF8,0x08,0x00 },{ 0x00,0xF8,0x80,0xF8,0x08,0xF8,0x00 },{ 0x00,0xF8,0x80,0xF8,0x88,0xF8,0x00 },{ 0x00,0xF8,0x08,0x10,0x20,0x40,0x00 },{ 0x00,0xF8,0x88,0xF8,0x88,0xF8,0x00 },{ 0x00,0xF8,0x88,0xF8,0x08,0xF8,0x00 },{ 0x00,0x30,0x30,0x00,0x30,0x30,0x00 },{ 0x00,0x30,0x30,0x00,0x30,0x30,0x20 },{ 0x08,0x10,0x20,0x40,0x20,0x10,0x08 },{ 0x00,0x00,0xF8,0x00,0xF8,0x00,0x00 },{ 0x40,0x20,0x10,0x08,0x10,0x20,0x40 },{ 0x00,0xF8,0x08,0x78,0x00,0x60,0x00 },{ 0x00,0xF8,0xA8,0xB8,0x80,0xF8,0x00 },{ 0x00,0xF8,0x88,0xF8,0x88,0x88,0x00 },{ 0x00,0xF0,0x90,0xF8,0x88,0xF8,0x00 },{ 0x00,0xF8,0x80,0x80,0x80,0xF8,0x00 },{ 0x00,0xE0,0x90,0x88,0x88,0xF8,0x00 },{ 0x00,0xF8,0x80,0xF8,0x80,0xF8,0x00 },{ 0x00,0xF8,0x80,0xF8,0x80,0x80,0x00 },{ 0x00,0xF8,0x80,0xB8,0x88,0xF8,0x00 },{ 0x00,0x88,0x88,0xF8,0x88,0x88,0x00 },{ 0x00,0x40,0x40,0x40,0x40,0x40,0x00 },{ 0x00,0x08,0x08,0x88,0x88,0xF8,0x00 },{ 0x00,0x88,0x90,0xA0,0x90,0x88,0x00 },{ 0x00,0x80,0x80,0x80,0x80,0xF8,0x00 },{ 0x00,0xFE,0x92,0x92,0x92,0x92,0x00 },{ 0x00,0x88,0xC8,0xA8,0x98,0x88,0x00 },{ 0x00,0xF8,0x88,0x88,0x88,0xF8,0x00 },{ 0x00,0xF8,0x88,0x88,0xF8,0x80,0x00 },{ 0x00,0xF8,0x88,0xA8,0xA8,0xF8,0x10 },{ 0x00,0xF8,0x88,0xF8,0x90,0x88,0x00 },{ 0x00,0xF8,0x80,0xF8,0x08,0xF8,0x00 },{ 0x00,0xF8,0x20,0x20,0x20,0x20,0x00 },{ 0x00,0x88,0x88,0x88,0x88,0xF8,0x00 },{ 0x00,0x88,0x88,0x90,0xA0,0xC0,0x00 },{ 0x00,0x92,0x92,0x92,0x92,0xFE,0x00 },{ 0x00,0x88,0x50,0x20,0x50,0x88,0x00 },{ 0x00,0x88,0x88,0xF8,0x08,0xF8,0x00 },{ 0x00,0xF8,0x10,0x20,0x40,0xF8,0x00 },{ 0x38,0x20,0x20,0x20,0x20,0x20,0x38 },{ 0x00,0x80,0x40,0x20,0x10,0x08,0x00 },{ 0x70,0x10,0x10,0x10,0x10,0x10,0x70 },{ 0x00,0x20,0x70,0xA8,0x20,0x20,0x00 },{ 0x00,0x20,0x40,0xF8,0x40,0x20,0x00 },{ 0x00,0x20,0x20,0xA8,0x70,0x20,0x00 },{ 0x00,0x20,0x10,0xF8,0x10,0x20,0x00 },{ 0x00,0x88,0x50,0x20,0x50,0x88,0x00 },{ 0x00,0x20,0x00,0xF8,0x00,0x20,0x00 }}; -const char SMLFONT[HICHAR-LOCHAR+1][5] = { -{ 0x00,0x00,0x00,0x00,0x00 },{ 0x40,0x40,0x00,0x40,0x00 },{ 0xA0,0xA0,0x00,0x00,0x00 },{ 0x60,0xF0,0xF0,0x60,0x00 },{ 0x40,0xE0,0xE0,0x40,0x00 },{ 0x90,0x20,0x40,0x90,0x00 },{ 0xC0,0xB0,0xE0,0xD0,0x00 },{ 0x20,0x40,0x00,0x00,0x00 },{ 0x20,0x40,0x40,0x20,0x00 },{ 0x40,0x20,0x20,0x40,0x00 },{ 0x40,0xE0,0x40,0xA0,0x00 },{ 0x00,0x40,0xE0,0x40,0x00 },{ 0x00,0x00,0x00,0x60,0x20 },{ 0x00,0x00,0xE0,0x00,0x00 },{ 0x00,0x00,0x00,0x40,0x00 },{ 0x20,0x20,0x40,0x40,0x00 },{ 0xE0,0xA0,0xA0,0xE0,0x00 },{ 0xC0,0x40,0x40,0xE0,0x00 },{ 0xE0,0x20,0xC0,0xE0,0x00 },{ 0xE0,0x60,0x20,0xE0,0x00 },{ 0xA0,0xA0,0xE0,0x20,0x00 },{ 0xE0,0xC0,0x20,0xE0,0x00 },{ 0xC0,0x80,0xE0,0xE0,0x00 },{ 0xE0,0x20,0x40,0x40,0x00 },{ 0x60,0xE0,0xA0,0xE0,0x00 },{ 0xE0,0xE0,0x20,0x60,0x00 },{ 0x00,0x40,0x00,0x40,0x00 },{ 0x00,0x40,0x00,0x60,0x20 },{ 0x00,0x20,0x40,0x20,0x00 },{ 0x00,0xE0,0x00,0xE0,0x00 },{ 0x00,0x40,0x20,0x40,0x00 },{ 0xE0,0x20,0x60,0x00,0x40 },{ 0xF0,0x90,0x10,0xD0,0xF0 },{ 0x60,0xA0,0xE0,0xA0,0x00 },{ 0xC0,0xE0,0xA0,0xE0,0x00 },{ 0x60,0x80,0x80,0xE0,0x00 },{ 0xC0,0xA0,0xA0,0xC0,0x00 },{ 0xE0,0xC0,0x80,0xE0,0x00 },{ 0xE0,0xC0,0x80,0x80,0x00 },{ 0x60,0x80,0xA0,0xE0,0x00 },{ 0xA0,0xA0,0xE0,0xA0,0x00 },{ 0xE0,0x40,0x40,0xE0,0x00 },{ 0x60,0x20,0xA0,0xE0,0x00 },{ 0xA0,0xC0,0xC0,0xA0,0x00 },{ 0x80,0x80,0x80,0xE0,0x00 },{ 0xE0,0xE0,0xE0,0xA0,0x00 },{ 0xE0,0xA0,0xA0,0xA0,0x00 },{ 0xE0,0xA0,0xA0,0xE0,0x00 },{ 0xE0,0xA0,0xE0,0x80,0x00 },{ 0xE0,0xA0,0xE0,0xF0,0x00 },{ 0xE0,0xA0,0xC0,0xA0,0x00 },{ 0xE0,0x80,0x60,0xE0,0x00 },{ 0xE0,0x40,0x40,0x40,0x00 },{ 0xA0,0xA0,0xA0,0xE0,0x00 },{ 0xA0,0xA0,0xC0,0x80,0x00 },{ 0xA0,0xE0,0xE0,0xE0,0x00 },{ 0xA0,0x40,0xA0,0xA0,0x00 },{ 0xA0,0xE0,0x40,0x40,0x00 },{ 0xE0,0x20,0x40,0xE0,0x00 },{ 0x60,0x40,0x40,0x60,0x00 },{ 0x40,0x40,0x20,0x20,0x00 },{ 0x60,0x20,0x20,0x60,0x00 },{ 0x40,0xA0,0x00,0x00,0x00 },{ 0x00,0x00,0x00,0x00,0xF0 },{ 0x80,0x40,0x00,0x00,0x00 },{ 0x00,0x60,0xA0,0xE0,0x00 },{ 0x80,0xE0,0xA0,0xE0,0x00 },{ 0x00,0x60,0x80,0xE0,0x00 },{ 0x20,0xE0,0xA0,0xE0,0x00 },{ 0x00,0xE0,0xA0,0xC0,0x00 },{ 0x20,0x40,0x60,0x40,0x00 },{ 0x00,0x60,0xA0,0x60,0xC0 },{ 0x80,0xE0,0xA0,0xA0,0x00 },{ 0x40,0x00,0x40,0x40,0x00 },{ 0x40,0x00,0x40,0x40,0xC0 },{ 0x80,0xA0,0xC0,0xA0,0x00 },{ 0xC0,0x40,0x40,0x60,0x00 },{ 0x00,0xE0,0xE0,0xA0,0x00 },{ 0x00,0xE0,0xA0,0xA0,0x00 },{ 0x00,0xE0,0xA0,0xE0,0x00 },{ 0x00,0xE0,0xA0,0xE0,0x80 },{ 0x00,0xE0,0xA0,0xE0,0x20 },{ 0x00,0xE0,0x80,0x80,0x00 },{ 0x00,0x60,0x40,0xC0,0x00 },{ 0x40,0x60,0x40,0x60,0x00 },{ 0x00,0xA0,0xA0,0xE0,0x00 },{ 0x00,0xA0,0xE0,0x40,0x00 },{ 0x00,0xA0,0xE0,0xE0,0x00 },{ 0x00,0xA0,0x40,0xA0,0x00 },{ 0x00,0xA0,0xE0,0x20,0xC0 },{ 0x00,0xC0,0x40,0x60,0x00 },{ 0x60,0xC0,0x40,0x60,0x00 },{ 0x40,0x40,0x40,0x40,0x40 },{ 0xC0,0x60,0x40,0xC0,0x00 },{ 0x20,0xE0,0x80,0x00,0x00 },}; +const char SMLFONT[HICHAR-LOCHAR+1][5] = {/*{count:68,w:5,h:5,brev:1}*/ +{ 0x00,0x00,0x00,0x00,0x00 },{ 0x40,0x40,0x00,0x40,0x00 },{ 0xA0,0xA0,0x00,0x00,0x00 },{ 0x60,0xF0,0xF0,0x60,0x00 },{ 0x40,0xE0,0xE0,0x40,0x00 },{ 0x90,0x20,0x40,0x90,0x00 },{ 0xC0,0xB0,0xE0,0xD0,0x00 },{ 0x20,0x40,0x00,0x00,0x00 },{ 0x20,0x40,0x40,0x20,0x00 },{ 0x40,0x20,0x20,0x40,0x00 },{ 0x40,0xE0,0x40,0xA0,0x00 },{ 0x00,0x40,0xE0,0x40,0x00 },{ 0x00,0x00,0x00,0x60,0x20 },{ 0x00,0x00,0xE0,0x00,0x00 },{ 0x00,0x00,0x00,0x40,0x00 },{ 0x20,0x20,0x40,0x40,0x00 },{ 0xE0,0xA0,0xA0,0xE0,0x00 },{ 0xC0,0x40,0x40,0xE0,0x00 },{ 0xE0,0x20,0xC0,0xE0,0x00 },{ 0xE0,0x60,0x20,0xE0,0x00 },{ 0xA0,0xA0,0xE0,0x20,0x00 },{ 0xE0,0xC0,0x20,0xE0,0x00 },{ 0xC0,0x80,0xE0,0xE0,0x00 },{ 0xE0,0x20,0x40,0x40,0x00 },{ 0x60,0xE0,0xA0,0xE0,0x00 },{ 0xE0,0xE0,0x20,0x60,0x00 },{ 0x00,0x40,0x00,0x40,0x00 },{ 0x00,0x40,0x00,0x60,0x20 },{ 0x00,0x20,0x40,0x20,0x00 },{ 0x00,0xE0,0x00,0xE0,0x00 },{ 0x00,0x40,0x20,0x40,0x00 },{ 0xE0,0x20,0x60,0x00,0x40 },{ 0xF0,0x90,0x10,0xD0,0xF0 },{ 0x60,0xA0,0xE0,0xA0,0x00 },{ 0xC0,0xE0,0xA0,0xE0,0x00 },{ 0x60,0x80,0x80,0xE0,0x00 },{ 0xC0,0xA0,0xA0,0xC0,0x00 },{ 0xE0,0xC0,0x80,0xE0,0x00 },{ 0xE0,0xC0,0x80,0x80,0x00 },{ 0x60,0x80,0xA0,0xE0,0x00 },{ 0xA0,0xA0,0xE0,0xA0,0x00 },{ 0xE0,0x40,0x40,0xE0,0x00 },{ 0x60,0x20,0xA0,0xE0,0x00 },{ 0xA0,0xC0,0xC0,0xA0,0x00 },{ 0x80,0x80,0x80,0xE0,0x00 },{ 0xE0,0xE0,0xE0,0xA0,0x00 },{ 0xE0,0xA0,0xA0,0xA0,0x00 },{ 0xE0,0xA0,0xA0,0xE0,0x00 },{ 0xE0,0xA0,0xE0,0x80,0x00 },{ 0xE0,0xA0,0xE0,0xF0,0x00 },{ 0xE0,0xA0,0xC0,0xA0,0x00 },{ 0xE0,0x80,0x60,0xE0,0x00 },{ 0xE0,0x40,0x40,0x40,0x00 },{ 0xA0,0xA0,0xA0,0xE0,0x00 },{ 0xA0,0xA0,0xC0,0x80,0x00 },{ 0xA0,0xE0,0xE0,0xE0,0x00 },{ 0xA0,0x40,0xA0,0xA0,0x00 },{ 0xA0,0xE0,0x40,0x40,0x00 },{ 0xE0,0x20,0x40,0xE0,0x00 },{ 0x60,0x40,0x40,0x60,0x00 },{ 0x40,0x40,0x20,0x20,0x00 },{ 0x60,0x20,0x20,0x60,0x00 },{ 0x40,0xA0,0x00,0x00,0x00 },{ 0x00,0x00,0x00,0x00,0xF0 },{ 0x80,0x40,0x00,0x00,0x00 },{ 0x00,0x60,0xA0,0xE0,0x00 },{ 0x80,0xE0,0xA0,0xE0,0x00 },{ 0x00,0x60,0x80,0xE0,0x00 }}; // draw a letter void draw_char(const FontDescriptor* font, byte ch, byte x, byte y, byte op) { @@ -449,6 +449,20 @@ void PAWS(ContextBlock *ctx) { } } +// MATH + +void RANGED(ContextBlock *ctx) { + /* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */ + RANSHT ^= RANSHT << 13; + RANSHT ^= RANSHT >> 17; + RANSHT ^= RANSHT << 5; + if (ctx->regs.b.a == 0) { + ctx->regs.b.a = (byte)RANSHT; + } else { + ctx->regs.b.a = (byte)(RANSHT % ctx->regs.b.a); + } +} + const SysCallEntry SYSCALL_TABLE[64] = { /* 0 */ { &INTPC, 0 }, @@ -521,7 +535,7 @@ const SysCallEntry SYSCALL_TABLE[64] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, - { 0, 0 }, + { &RANGED, REG_A }, /* 120 */ { 0, 0 }, { 0, 0 }, @@ -535,8 +549,8 @@ void SYSCALL(ContextBlock *ctx) { SysRoutine* routine; // user-defined? if (op & 0x80) { - argmask = UMARGT[op & 0x7f]; - routine = (SysRoutine*) USERTB[op & 0x7f]; + argmask = UMARGT[op>>1]; + routine = (SysRoutine*) USERTB[op>>1]; } else { const SysCallEntry* entry = &SYSCALL_TABLE[op>>1]; argmask = entry->argmask; @@ -555,6 +569,7 @@ void SYSCALL(ContextBlock *ctx) { #ifdef TEST void main() { __asm + LD SP,#0x4fce ; position stack below BIOS vars ld hl,#0x20d push hl pop ix @@ -611,6 +626,6 @@ PATERN: .DB 0,0 ; (0,0) Position .DB 0x08,0x20 ; 0000100000100000 - . . 2 . . 2 . . .DB 0x00,0x00 ; 0000000000000000 - . . . . . . . . __endasm; - while (1) CT[0]++; + while (1) ; } #endif diff --git a/presets/atari8-5200/hello.a b/presets/atari8-5200/hello.a index 92bf467d..fbcef34a 100644 --- a/presets/atari8-5200/hello.a +++ b/presets/atari8-5200/hello.a @@ -1,4 +1,4 @@ - + ; Atari 5200 "Hello World" sample code ; Written by Daniel Boris (dboris@comcast.net) ; @@ -16,8 +16,7 @@ sDLISTH equ $06 ;Display list hi shadow CHBASE equ $D409 ;Character set base CHACTL equ $D401 ;Character control NMIEN equ $D40E ;NMI Enable -COLOR1 equ $0D ;Color 1 shadow -COLOR2 equ $0E ;Color 2 shadow +COLOR0 equ $0C ;Color 0 shadow org $4000 ;Start of cartridge area sei ;Disable interrupts @@ -48,7 +47,7 @@ crloop3 cmp #$40 ;Check if end of RAM bne crloop2 ;Branch if not - ldx #$21 + ldx #$2f dlloop ;Create Display List lda dlist,x ;Get byte sta $1000,x ;Copy to RAM @@ -67,12 +66,17 @@ dlloop ;Create Display List sta $204 ;to BIOS routine lda #$FC sta $205 - lda #$03 + lda #$06 sta CHACTL ;Set Character Control lda #$84 ;Set color PF2 - sta COLOR2 + sta COLOR0+2 + sta COLOR0+4 ; bakground lda #$0F ;Set color PF1 - sta COLOR1 + sta COLOR0+1 + lda #$3f + sta COLOR0+0 + lda #$58 + sta COLOR0+3 lda #$00 ;Set Display list pointer sta sDLISTL sta DLISTL @@ -91,24 +95,36 @@ print cld prloop lda text1,y ;Get character + beq wait + cmp #$60 + bcs lower sec sbc #$20 ;Convert to ATASCII +lower sta $1800,y ;Store in video memory iny ;Next character - cpy #11 bne prloop wait + nop jmp wait ;Display list data org $b000 -dlist .byte $70,$70,$70,$42,$00,$18,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02 - .byte $02,$02,$02,$41,$00,$10 +dlist .byte $70,$70,$70 + .byte $42,$00,$18,$02 + .byte $43,$00,$18,$02 + .byte $44,$00,$18,$02 + .byte $45,$00,$18,$02 + .byte $46,$00,$18,$06 + .byte $47,$00,$18,$06 + .byte $02,$02,$02,$02 + .byte $41,$00,$10 ;Text data - org $b100 -text1 .byte "HELLO WORLD" + org $b100 +text1 .byte "Howdy Bagel! " + .byte $a1,$a2,$a3 + .byte 0 org $bffd .byte $FF ;Don't display Atari logo diff --git a/src/baseplatform.ts b/src/baseplatform.ts index bf449d33..8b51b099 100644 --- a/src/baseplatform.ts +++ b/src/baseplatform.ts @@ -677,9 +677,11 @@ export abstract class BaseMAMEPlatform { } reset() { - this.luacall('manager:machine():soft_reset()'); - this.running = true; - this.initluavars = false; + if (this.loaded) { + this.luacall('manager:machine():soft_reset()'); + this.running = true; + this.initluavars = false; + } } isRunning() { @@ -875,8 +877,10 @@ export abstract class BaseMAMEPlatform { return this.onBreakpointHit;// TODO? } setupDebug(callback) { - this.initlua(); - this.luareset(); + if (this.loaded) { // TODO? + this.initlua(); + this.luareset(); + } this.onBreakpointHit = callback; } runToPC(pc) { diff --git a/src/emu.ts b/src/emu.ts index 76d9931a..5728729c 100644 --- a/src/emu.ts +++ b/src/emu.ts @@ -1,6 +1,6 @@ "use strict"; -import { hex } from "./util"; +import { hex, clamp } from "./util"; // external modules declare var jt, Javatari, Z80_fast, CPU6809; @@ -56,7 +56,8 @@ function _setKeyboardEvents(canvas:HTMLElement, callback:KeyboardCallback) { export var RasterVideo = function(mainElement:HTMLElement, width:number, height:number, options?) { var canvas, ctx; var imageData, arraybuf, buf8, datau32; - + var vcanvas; + this.setRotate = function(rotate) { if (rotate) { // TODO: aspect ratio? @@ -71,17 +72,12 @@ export var RasterVideo = function(mainElement:HTMLElement, width:number, height: this.create = function() { this.canvas = canvas = __createCanvas(mainElement, width, height); + vcanvas = $(canvas); if (options && options.rotate) { this.setRotate(options.rotate); } ctx = canvas.getContext('2d'); imageData = ctx.createImageData(width, height); - /* - arraybuf = new ArrayBuffer(imageData.data.length); - buf8 = new Uint8Array(arraybuf); // TODO: Uint8ClampedArray - datau32 = new Uint32Array(arraybuf); - buf8 = imageData.data; - */ datau32 = new Uint32Array(imageData.data.buffer); } @@ -94,13 +90,25 @@ export var RasterVideo = function(mainElement:HTMLElement, width:number, height: this.getContext = function() { return ctx; } this.updateFrame = function(sx:number, sy:number, dx:number, dy:number, width?:number, height?:number) { - //imageData.data.set(buf8); // TODO: slow w/ partial updates if (width && height) ctx.putImageData(imageData, sx, sy, dx, dy, width, height); else ctx.putImageData(imageData, 0, 0); if (frameUpdateFunction) frameUpdateFunction(canvas); } + + this.setupMouseEvents = function(el? : HTMLElement) { + if (!el) el = canvas; + $(el).mousemove( (e) => { + // TODO: get coords right + var x = e.pageX - vcanvas.offset().left; + var y = e.pageY - vcanvas.offset().top; + var new_x = Math.floor(x * 255 / vcanvas.width() - 20); + var new_y = Math.floor(y * 255 / vcanvas.height() - 20); + this.paddle_x = clamp(0, 255, new_x); + this.paddle_y = clamp(0, 255, new_y); + }); + }; } export var VectorVideo = function(mainElement:HTMLElement, width:number, height:number) { diff --git a/src/platform/astrocade.ts b/src/platform/astrocade.ts index e6a77f8b..054d2228 100644 --- a/src/platform/astrocade.ts +++ b/src/platform/astrocade.ts @@ -2,7 +2,7 @@ import { Platform, BaseZ80Platform } from "../baseplatform"; import { PLATFORMS, RAM, newAddressDecoder, padBytes, noise, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap } from "../emu"; -import { hex, lzgmini, stringToByteArray, rgb2bgr } from "../util"; +import { hex, lzgmini, stringToByteArray, rgb2bgr, clamp } from "../util"; import { MasterAudio, AY38910_Audio } from "../audio"; const ASTROCADE_PRESETS = [ @@ -12,7 +12,11 @@ const ASTROCADE_PRESETS = [ {id:'cosmic.c', name:'Cosmic Impalas Game'}, ]; -// TODO: fix keys, more controllers, paddles, vibrato/noise, border color, full refresh, debug info +const ASTROCADE_BIOS_PRESETS = [ + {id:'bios.c', name:'BIOS'}, +]; + +// TODO: fix keys, more controllers, vibrato/noise, border color, debug info const ASTROCADE_KEYCODE_MAP = makeKeycodeMap([ // player 1 @@ -287,6 +291,7 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) { psg = new AstrocadeAudio(audio); video = new RasterVideo(mainElement,swidth,sheight,{}); video.create(); + video.setupMouseEvents(); var idata = video.getFrameData(); setKeyboardFromMap(video, inputs, ASTROCADE_KEYCODE_MAP); pixels = video.getFrameData(); @@ -297,7 +302,13 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) { return membus.read(addr); } + loadControls() { + inputs[0x1c] = video.paddle_x & 0xff; + inputs[0x1d] = video.paddle_y & 0xff; + } + advance(novideo : boolean) { + this.loadControls(); for (var sl=0; sl> 4) + 1; @@ -247,14 +255,39 @@ class ANTIC { case 8: nc -= this.startline3(); break; case 12: nc -= this.startline4(); break; default: + let mode = this.mode & 0xf; if (h >= 48 && h < 120) nc--; // steal 1 clock for memory refresh - if (h >= this.left && h < this.right) { // fetch screen byte? + if (h >= this.left && h < this.right && mode >= 2) { // fetch screen byte? if (((h>>2) & this.period) == 0) { // use period interval - if ((this.mode & 0xf) < 8) { // character mode - let ch = this.nextScreen(); + if (mode < 8) { // character mode + let ch = this.ch = this.nextScreen(); + let addrofs = this.yofs; + // modes 6 & 7 + if ((mode & 0xe) == 6) { // or 7 + ch &= 0x3f; + } else { + ch &= 0x7f; + } let addr = (ch<<3) + (this.regs[CHBASE]<<8); - this.pfbyte = this.read(addr + this.yofs); - //console.log(hex(addr), this.yofs, hex(this.scanaddr), this.h, this.v, ch); + // modes 2 & 3 + if ((mode & 0xe) == 2) { // or 3 + let chactl = this.regs[CHACTL]; + if (mode == 3 && ch >= 0x60) { + // TODO + } + if (chactl & 4) + this.pfbyte = this.read(addr + (addrofs ^ 7)); // mirror + else + this.pfbyte = this.read(addr + addrofs); + if (this.ch & 0x80) { + if (chactl & 1) + this.pfbyte = 0x0; // blank + if (chactl & 2) + this.pfbyte ^= 0xff; // invert + } + } else { + this.pfbyte = this.read(addr + addrofs); + } nc -= 2; } else { // map mode this.pfbyte = this.nextScreen(); @@ -288,6 +321,9 @@ const GRAFP0 = 0x0d; const GRAFM = 0x11; const COLPM0 = 0x12; const COLPF0 = 0x16; +const COLPF1 = 0x17; +const COLPF2 = 0x18; +const COLPF3 = 0x19; const COLBK = 0x1a; const PRIOR = 0x1b; const VDELAY = 0x1c; @@ -327,13 +363,48 @@ class GTIA { } } clockPulse() : number { - let colreg = (this.antic.pfbyte & 128) ? COLPF0 : COLBK; - if ((this.count & this.antic.period) == 0) - this.antic.pfbyte <<= 1; - let colidx = this.regs[colreg]; + let pixel = (this.antic.pfbyte & 128) ? 1 : 0; + let col = 0; + switch (this.antic.mode & 0xf) { + // blank line + case 0: + case 1: + col = this.regs[COLBK]; + break; + // normal text mode + case 2: + case 3: + default: + if (pixel) + col = (this.regs[COLPF1] & 0xf) | (this.regs[COLPF2] & 0xf0); + else + col = this.regs[COLPF2]; + if ((this.count & this.antic.period) == 0) + this.antic.pfbyte <<= 1; + break; + // 4bpp mode + case 4: + case 5: + col = (this.antic.pfbyte>>6) & 3; + if ((this.antic.ch & 0x80) && col==3) + col = 4; // 5th color + col = col ? this.regs[COLPF0-1+col] : this.regs[COLBK]; + if ((this.count & 1) == 0) + this.antic.pfbyte <<= 2; + break; + // 4 colors per 64 chars mode + case 6: + case 7: + if (pixel) + col = this.regs[COLPF0 + (this.antic.ch>>6)]; + else + col = this.regs[COLBK]; + if ((this.count & this.antic.period) == 0) + this.antic.pfbyte <<= 1; + break; + } this.count = (this.count + 1) & 0xff; - // TODO - return COLORS_RGBA[colidx]; + return COLORS_RGBA[col]; } static stateToLongString(state) : string { let s = ""; @@ -396,7 +467,7 @@ const _Atari8Platform = function(mainElement) { antic = new ANTIC(bus.read); gtia = new GTIA(antic); // create video/audio - video = new RasterVideo(mainElement, 384, 192); + video = new RasterVideo(mainElement, 352, 192); audio = newPOKEYAudio(); video.create(); video.setKeyboardEvents((key,code,flags) => { @@ -454,7 +525,7 @@ const _Atari8Platform = function(mainElement) { cpu.clockPulse(); } // 4 ANTIC pulses = 8 pixels - if (antic.h >= 32 && antic.h < 32+192) { // TODO + if (antic.v >= 24 && antic.h >= 44 && antic.h < 44+176) { // TODO: const for (var j=0; j<8; j++) { rgb = gtia.clockPulse(); idata[iofs++] = rgb; @@ -473,6 +544,7 @@ const _Atari8Platform = function(mainElement) { loadROM(title, data) { rom = padBytes(data, romLength); + rom[rom.length-3] = 0xff; // TODO this.reset(); } @@ -551,27 +623,19 @@ const _Atari5200Platform = function(mainElement) { /// MAME support -var Atari8MAMEPlatform = function(mainElement) { - var self = this; - this.__proto__ = new (BaseMAMEPlatform as any)(); - - this.loadROM = function(title, data) { +abstract class Atari8MAMEPlatform extends BaseMAMEPlatform { + loadROM(title, data) { this.loadROMFile(data); this.loadRegion(":cartleft:cart:rom", data); } - - this.getPresets = function() { return Atari8_PRESETS; } - - this.getToolForFilename = getToolForFilename_6502; - this.getDefaultExtension = function() { return ".c"; }; + getPresets() { return Atari8_PRESETS; } + getToolForFilename = getToolForFilename_6502; + getDefaultExtension() { return ".c"; }; } -var Atari800MAMEPlatform = function(mainElement) { - var self = this; - this.__proto__ = new Atari8MAMEPlatform(mainElement); - - this.start = function() { - self.startModule(mainElement, { +class Atari800MAMEPlatform extends Atari8MAMEPlatform implements Platform { + start() { + this.startModule(this.mainElement, { jsfile:'mameatari400.js', biosfile:'a400.zip', // TODO: load multiple files //cfgfile:'atari5200.cfg', @@ -586,12 +650,9 @@ var Atari800MAMEPlatform = function(mainElement) { } } -var Atari5200MAMEPlatform = function(mainElement) { - var self = this; - this.__proto__ = new (Atari8MAMEPlatform as any)(mainElement); - - this.start = function() { - self.startModule(mainElement, { +class Atari5200MAMEPlatform extends Atari8MAMEPlatform implements Platform { + start() { + this.startModule(this.mainElement, { jsfile:'mameatari400.js', biosfile:'a5200/5200.rom', //cfgfile:'atari5200.cfg', diff --git a/src/platform/verilog.ts b/src/platform/verilog.ts index 5e7874d2..e4bda4cc 100644 --- a/src/platform/verilog.ts +++ b/src/platform/verilog.ts @@ -3,7 +3,7 @@ import { Platform, BasePlatform } from "../baseplatform"; import { PLATFORMS, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap } from "../emu"; import { SampleAudio } from "../audio"; -import { safe_extend } from "../util"; +import { safe_extend, clamp } from "../util"; import { WaveformView, WaveformProvider, WaveformMeta } from "../waveform"; declare var Split; @@ -279,10 +279,6 @@ var VerilogPlatform = function(mainElement, options) { debugCond = null; } - function clamp(minv,maxv,v) { - return (v < minv) ? minv : (v > maxv) ? maxv : v; - } - function shadowText(ctx, txt, x, y) { ctx.shadowColor = "black"; ctx.shadowBlur = 0; diff --git a/src/ui.ts b/src/ui.ts index 9c1b48d9..1e8b0dd9 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -213,6 +213,7 @@ function reloadPresetNamed(id:string) { function getSkeletonFile(fileid:string, callback) { var ext = platform.getToolForFilename(fileid); + // TODO: .mame $.get( "presets/"+platform_id+"/skeleton."+ext, function( text ) { callback(null, text); }, 'text') @@ -360,6 +361,7 @@ function fixFilename(fn : string) : string { function _revertFile(e) { var fn = fixFilename(projectWindows.getActiveID()); + // TODO: .mame $.get( "presets/"+platform_id+"/"+fn, function(text) { if (confirm("Reset '" + fn + "' to default?")) { projectWindows.getActive().setText(text); diff --git a/src/util.ts b/src/util.ts index f9445070..8507f620 100644 --- a/src/util.ts +++ b/src/util.ts @@ -376,3 +376,7 @@ export function rgb2bgr(x) { return ((x&0xff)<<16) | ((x>>16)&0xff) | (x&0x00ff00); } +export function clamp(minv:number, maxv:number, v:number) { + return (v < minv) ? minv : (v > maxv) ? maxv : v; +} + diff --git a/src/worker/workermain.js b/src/worker/workermain.js index 7b901944..7caee451 100644 --- a/src/worker/workermain.js +++ b/src/worker/workermain.js @@ -142,7 +142,8 @@ var PLATFORM_PARAMS = { 'atari8-5200': { define: '__ATARI5200__', cfgfile: 'atari5200.cfg', - libargs: ['atari5200.lib'], + libargs: ['atari5200.lib', + '-D', '__CARTFLAGS__=255'], }, 'c64': { define: '__C64__', @@ -919,19 +920,26 @@ function assembleSDASZ80(step) { if (staleFiles(step, [objpath, lstpath])) { //?ASxxxx-Error- in line 1 of main.asm null // .org in REL area or directive / mnemonic error - var match_asm_re = / <\w> (.+)/; // TODO + // ?ASxxxx-Error- in line 1627 of cosmic.asm + // missing or improper operators, terminators, or delimiters + var match_asm_re1 = / in line (\d+) of (\S+)/; // TODO + var match_asm_re2 = / <\w> (.+)/; // TODO + var errline = 0; + var errpath = step.path; function match_asm_fn(s) { - var matches = match_asm_re.exec(s); - if (matches) { - //var errline = parseInt(matches[2]); - errors.push({ - line:0, // TODO - path:step.path, - msg:matches[1] - }); + var m = match_asm_re1.exec(s); + if (m) { + errline = parseInt(m[1]); + errpath = m[2]; } else { - // ?ASxxxx-Error- in line 1627 of cosmic.asm - // missing or improper operators, terminators, or delimiters + m = match_asm_re2.exec(s); + if (m) { + errors.push({ + line:errline, + path:errpath, + msg:m[1] + }); + } } } var ASZ80 = sdasz80({ @@ -1527,7 +1535,7 @@ function executeBuildSteps() { // find previous link step to combine for (var i=0; i