mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-08-07 12:25:55 +00:00
more atari8 stuff, fixed mame; astrocade-bios preset, paddles
This commit is contained in:
@@ -66,6 +66,7 @@ TODO:
|
|||||||
- requestInterrupt needs to be disabled after breakpoint?
|
- requestInterrupt needs to be disabled after breakpoint?
|
||||||
- verilog: when paused scope doesn't work
|
- verilog: when paused scope doesn't work
|
||||||
- resize memory dump window
|
- resize memory dump window
|
||||||
|
- C/asm formatter
|
||||||
|
|
||||||
|
|
||||||
WEB WORKER FORMAT
|
WEB WORKER FORMAT
|
||||||
|
@@ -57,44 +57,43 @@ __sfr __at(0x13) hw_p4ctrl; // player controls
|
|||||||
byte __at (0x0000) vmagic[VHEIGHT][VBWIDTH];
|
byte __at (0x0000) vmagic[VHEIGHT][VBWIDTH];
|
||||||
byte __at (0x4000) vidmem[VHEIGHT][VBWIDTH];
|
byte __at (0x4000) vidmem[VHEIGHT][VBWIDTH];
|
||||||
|
|
||||||
// Used by MUSIC PROCESSOR:
|
// start @ $4FCE
|
||||||
volatile word MUZPC; // $4FCE // MUSic Program Counter
|
volatile word MUZPC; // music PC
|
||||||
volatile word MUZSP; // $4FD0 // MUSic Stack Pointer
|
volatile word MUZSP; // music SP
|
||||||
volatile byte PVOLAB; // $4FD2 // Preset VOLume for tones A and B
|
volatile byte PVOLAB; // channels A and B volume
|
||||||
volatile byte PVOLMC; // $4FD3 // Preset VOLuMe for tone C and Noise Mode
|
volatile byte PVOLMC; // channel C volume and noise mask
|
||||||
volatile byte VOICES; // $4FD4 // music VOICES mask
|
volatile byte VOICES; // voice smask
|
||||||
// COUNTER TIMERS (used by DECCTS,ACTINT,CTIMER):
|
|
||||||
volatile byte CT[8];
|
volatile byte CT[8]; // counter timers
|
||||||
// Used by SENTRY to track controls:
|
|
||||||
volatile byte CNT; // $4FDD // Counter update & Number Tracking
|
volatile byte CNT;
|
||||||
volatile byte SEMI4S; // $4FDE // SEMAPHORE flag bitS
|
volatile byte SEMI4S;
|
||||||
volatile byte OPOT[4]; // $4FDF // Old POT 0 tracking byte
|
volatile byte OPOT[4];
|
||||||
volatile byte KEYSEX; // $4FE3 // KEYS-EX tracking byte
|
volatile byte KEYSEX;
|
||||||
volatile byte OSW[4]; // $4FE4 // Old SWitch 0 tracking byte
|
volatile byte OSW[4];
|
||||||
volatile word COLLST; // $4FE8 // COLset LaST address for P.B. A
|
volatile word COLLST;
|
||||||
// Used by STIMER:
|
|
||||||
volatile byte DURAT; // $4FEA // note DURATion
|
volatile byte DURAT; // note duration
|
||||||
volatile byte TMR60; // $4FEB // TiMeR for SIXTY'ths of sec
|
volatile byte TMR60; // 1/60 sec timer
|
||||||
volatile byte TIMOUT; // $4FEC // TIMer for blackOUT
|
volatile byte TIMOUT; // blackout timer
|
||||||
volatile byte GTSECS; // $4FED // Game Time SECondS
|
volatile byte GTSECS; // seconds timer
|
||||||
volatile byte GTMINS; // $4FEE // Game Time MINuteS
|
volatile byte GTMINS; // minutes timer
|
||||||
// Used by MENU:
|
|
||||||
long RANSHT; // $4FEF // RANdom number SHifT register
|
unsigned long RANSHT; // RNG
|
||||||
byte NUMPLY; // $4FF3 // NUMber of PLaYers
|
byte NUMPLY; // # players
|
||||||
byte ENDSCR[3]; // $4FF4 // END SCoRe to 'play to'
|
byte ENDSCR[3]; // end score
|
||||||
byte MRLOCK; // $4FF7 // Magic Register LOCK out flag
|
byte MRLOCK; // magic register lock out
|
||||||
byte GAMSTB; // $4FF8 // GAMe STatus Byte
|
byte GAMSTB; // game status
|
||||||
byte PRIOR; // $4FF9 // PRIOR music protect flag
|
byte PRIOR; // music protect
|
||||||
byte SENFLG; // $4FFA // SENtry control seizure FLaG
|
byte SENFLG; // sentry control
|
||||||
// User UPI Routines, even numbers from $80 to $FE ( + 1 for SUCK):
|
|
||||||
byte* UMARGT; // $4FFB // User Mask ARGument Table + (routine / 2)
|
byte* UMARGT; // user mask table (-64 bytes)
|
||||||
word* USERTB; // $4FFD // USER Table Base + routine = JumP address
|
word* USERTB; // user routine table (-128 bytes)
|
||||||
|
|
||||||
// start routine @ 0x0
|
// start routine @ 0x0
|
||||||
void bios_start() __naked {
|
void bios_start() __naked {
|
||||||
__asm
|
__asm
|
||||||
DI ; disable interrupts
|
DI ; disable interrupts
|
||||||
LD SP,#0x4fce ; position stack below BIOS vars
|
|
||||||
LD HL,#0x2000
|
LD HL,#0x2000
|
||||||
LD A,(HL) ; A <- mem[0x2000]
|
LD A,(HL) ; A <- mem[0x2000]
|
||||||
CP #0x55 ; found sentinel byte? ($55)
|
CP #0x55 ; found sentinel byte? ($55)
|
||||||
@@ -105,6 +104,7 @@ __asm
|
|||||||
JP _main ; jump to test program
|
JP _main ; jump to test program
|
||||||
#endif
|
#endif
|
||||||
FoundSentinel:
|
FoundSentinel:
|
||||||
|
LD SP,#0x4fce ; position stack below BIOS vars
|
||||||
CALL _bios_init ; misc. bios init routines
|
CALL _bios_init ; misc. bios init routines
|
||||||
LD HL,#0x2005 ; cartridge start vector
|
LD HL,#0x2005 ; cartridge start vector
|
||||||
LD A,(HL)
|
LD A,(HL)
|
||||||
@@ -166,8 +166,8 @@ typedef struct {
|
|||||||
const byte* chartab;
|
const byte* chartab;
|
||||||
} FontDescriptor;
|
} FontDescriptor;
|
||||||
|
|
||||||
#define LOCHAR 32
|
#define LOCHAR 0x20
|
||||||
#define HICHAR 127
|
#define HICHAR 0x63
|
||||||
|
|
||||||
extern const char BIGFONT[HICHAR-LOCHAR+1][7];
|
extern const char BIGFONT[HICHAR-LOCHAR+1][7];
|
||||||
extern const char SMLFONT[HICHAR-LOCHAR+1][5];
|
extern const char SMLFONT[HICHAR-LOCHAR+1][5];
|
||||||
@@ -335,11 +335,11 @@ void FILL(ContextBlock *ctx) {
|
|||||||
memset(dest, val, count);
|
memset(dest, val, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char BIGFONT[HICHAR-LOCHAR+1][7] = {
|
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,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 },};
|
{ 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] = {
|
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 },{ 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 },};
|
{ 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
|
// draw a letter
|
||||||
void draw_char(const FontDescriptor* font, byte ch, byte x, byte y, byte op) {
|
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] = {
|
const SysCallEntry SYSCALL_TABLE[64] = {
|
||||||
/* 0 */
|
/* 0 */
|
||||||
{ &INTPC, 0 },
|
{ &INTPC, 0 },
|
||||||
@@ -521,7 +535,7 @@ const SysCallEntry SYSCALL_TABLE[64] = {
|
|||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ &RANGED, REG_A },
|
||||||
/* 120 */
|
/* 120 */
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
@@ -535,8 +549,8 @@ void SYSCALL(ContextBlock *ctx) {
|
|||||||
SysRoutine* routine;
|
SysRoutine* routine;
|
||||||
// user-defined?
|
// user-defined?
|
||||||
if (op & 0x80) {
|
if (op & 0x80) {
|
||||||
argmask = UMARGT[op & 0x7f];
|
argmask = UMARGT[op>>1];
|
||||||
routine = (SysRoutine*) USERTB[op & 0x7f];
|
routine = (SysRoutine*) USERTB[op>>1];
|
||||||
} else {
|
} else {
|
||||||
const SysCallEntry* entry = &SYSCALL_TABLE[op>>1];
|
const SysCallEntry* entry = &SYSCALL_TABLE[op>>1];
|
||||||
argmask = entry->argmask;
|
argmask = entry->argmask;
|
||||||
@@ -555,6 +569,7 @@ void SYSCALL(ContextBlock *ctx) {
|
|||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
void main() {
|
void main() {
|
||||||
__asm
|
__asm
|
||||||
|
LD SP,#0x4fce ; position stack below BIOS vars
|
||||||
ld hl,#0x20d
|
ld hl,#0x20d
|
||||||
push hl
|
push hl
|
||||||
pop ix
|
pop ix
|
||||||
@@ -611,6 +626,6 @@ PATERN: .DB 0,0 ; (0,0) Position
|
|||||||
.DB 0x08,0x20 ; 0000100000100000 - . . 2 . . 2 . .
|
.DB 0x08,0x20 ; 0000100000100000 - . . 2 . . 2 . .
|
||||||
.DB 0x00,0x00 ; 0000000000000000 - . . . . . . . .
|
.DB 0x00,0x00 ; 0000000000000000 - . . . . . . . .
|
||||||
__endasm;
|
__endasm;
|
||||||
while (1) CT[0]++;
|
while (1) ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
; Atari 5200 "Hello World" sample code
|
; Atari 5200 "Hello World" sample code
|
||||||
; Written by Daniel Boris (dboris@comcast.net)
|
; Written by Daniel Boris (dboris@comcast.net)
|
||||||
;
|
;
|
||||||
@@ -16,8 +16,7 @@ sDLISTH equ $06 ;Display list hi shadow
|
|||||||
CHBASE equ $D409 ;Character set base
|
CHBASE equ $D409 ;Character set base
|
||||||
CHACTL equ $D401 ;Character control
|
CHACTL equ $D401 ;Character control
|
||||||
NMIEN equ $D40E ;NMI Enable
|
NMIEN equ $D40E ;NMI Enable
|
||||||
COLOR1 equ $0D ;Color 1 shadow
|
COLOR0 equ $0C ;Color 0 shadow
|
||||||
COLOR2 equ $0E ;Color 2 shadow
|
|
||||||
|
|
||||||
org $4000 ;Start of cartridge area
|
org $4000 ;Start of cartridge area
|
||||||
sei ;Disable interrupts
|
sei ;Disable interrupts
|
||||||
@@ -48,7 +47,7 @@ crloop3
|
|||||||
cmp #$40 ;Check if end of RAM
|
cmp #$40 ;Check if end of RAM
|
||||||
bne crloop2 ;Branch if not
|
bne crloop2 ;Branch if not
|
||||||
|
|
||||||
ldx #$21
|
ldx #$2f
|
||||||
dlloop ;Create Display List
|
dlloop ;Create Display List
|
||||||
lda dlist,x ;Get byte
|
lda dlist,x ;Get byte
|
||||||
sta $1000,x ;Copy to RAM
|
sta $1000,x ;Copy to RAM
|
||||||
@@ -67,12 +66,17 @@ dlloop ;Create Display List
|
|||||||
sta $204 ;to BIOS routine
|
sta $204 ;to BIOS routine
|
||||||
lda #$FC
|
lda #$FC
|
||||||
sta $205
|
sta $205
|
||||||
lda #$03
|
lda #$06
|
||||||
sta CHACTL ;Set Character Control
|
sta CHACTL ;Set Character Control
|
||||||
lda #$84 ;Set color PF2
|
lda #$84 ;Set color PF2
|
||||||
sta COLOR2
|
sta COLOR0+2
|
||||||
|
sta COLOR0+4 ; bakground
|
||||||
lda #$0F ;Set color PF1
|
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
|
lda #$00 ;Set Display list pointer
|
||||||
sta sDLISTL
|
sta sDLISTL
|
||||||
sta DLISTL
|
sta DLISTL
|
||||||
@@ -91,24 +95,36 @@ print
|
|||||||
cld
|
cld
|
||||||
prloop
|
prloop
|
||||||
lda text1,y ;Get character
|
lda text1,y ;Get character
|
||||||
|
beq wait
|
||||||
|
cmp #$60
|
||||||
|
bcs lower
|
||||||
sec
|
sec
|
||||||
sbc #$20 ;Convert to ATASCII
|
sbc #$20 ;Convert to ATASCII
|
||||||
|
lower
|
||||||
sta $1800,y ;Store in video memory
|
sta $1800,y ;Store in video memory
|
||||||
iny ;Next character
|
iny ;Next character
|
||||||
cpy #11
|
|
||||||
bne prloop
|
bne prloop
|
||||||
wait
|
wait
|
||||||
|
nop
|
||||||
jmp wait
|
jmp wait
|
||||||
|
|
||||||
;Display list data
|
;Display list data
|
||||||
org $b000
|
org $b000
|
||||||
dlist .byte $70,$70,$70,$42,$00,$18,$02,$02,$02,$02,$02,$02,$02
|
dlist .byte $70,$70,$70
|
||||||
.byte $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02
|
.byte $42,$00,$18,$02
|
||||||
.byte $02,$02,$02,$41,$00,$10
|
.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
|
;Text data
|
||||||
org $b100
|
org $b100
|
||||||
text1 .byte "HELLO WORLD"
|
text1 .byte "Howdy Bagel! "
|
||||||
|
.byte $a1,$a2,$a3
|
||||||
|
.byte 0
|
||||||
|
|
||||||
org $bffd
|
org $bffd
|
||||||
.byte $FF ;Don't display Atari logo
|
.byte $FF ;Don't display Atari logo
|
||||||
|
@@ -677,9 +677,11 @@ export abstract class BaseMAMEPlatform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
this.luacall('manager:machine():soft_reset()');
|
if (this.loaded) {
|
||||||
this.running = true;
|
this.luacall('manager:machine():soft_reset()');
|
||||||
this.initluavars = false;
|
this.running = true;
|
||||||
|
this.initluavars = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isRunning() {
|
isRunning() {
|
||||||
@@ -875,8 +877,10 @@ export abstract class BaseMAMEPlatform {
|
|||||||
return this.onBreakpointHit;// TODO?
|
return this.onBreakpointHit;// TODO?
|
||||||
}
|
}
|
||||||
setupDebug(callback) {
|
setupDebug(callback) {
|
||||||
this.initlua();
|
if (this.loaded) { // TODO?
|
||||||
this.luareset();
|
this.initlua();
|
||||||
|
this.luareset();
|
||||||
|
}
|
||||||
this.onBreakpointHit = callback;
|
this.onBreakpointHit = callback;
|
||||||
}
|
}
|
||||||
runToPC(pc) {
|
runToPC(pc) {
|
||||||
|
26
src/emu.ts
26
src/emu.ts
@@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
import { hex } from "./util";
|
import { hex, clamp } from "./util";
|
||||||
|
|
||||||
// external modules
|
// external modules
|
||||||
declare var jt, Javatari, Z80_fast, CPU6809;
|
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?) {
|
export var RasterVideo = function(mainElement:HTMLElement, width:number, height:number, options?) {
|
||||||
var canvas, ctx;
|
var canvas, ctx;
|
||||||
var imageData, arraybuf, buf8, datau32;
|
var imageData, arraybuf, buf8, datau32;
|
||||||
|
var vcanvas;
|
||||||
|
|
||||||
this.setRotate = function(rotate) {
|
this.setRotate = function(rotate) {
|
||||||
if (rotate) {
|
if (rotate) {
|
||||||
// TODO: aspect ratio?
|
// TODO: aspect ratio?
|
||||||
@@ -71,17 +72,12 @@ export var RasterVideo = function(mainElement:HTMLElement, width:number, height:
|
|||||||
|
|
||||||
this.create = function() {
|
this.create = function() {
|
||||||
this.canvas = canvas = __createCanvas(mainElement, width, height);
|
this.canvas = canvas = __createCanvas(mainElement, width, height);
|
||||||
|
vcanvas = $(canvas);
|
||||||
if (options && options.rotate) {
|
if (options && options.rotate) {
|
||||||
this.setRotate(options.rotate);
|
this.setRotate(options.rotate);
|
||||||
}
|
}
|
||||||
ctx = canvas.getContext('2d');
|
ctx = canvas.getContext('2d');
|
||||||
imageData = ctx.createImageData(width, height);
|
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);
|
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.getContext = function() { return ctx; }
|
||||||
|
|
||||||
this.updateFrame = function(sx:number, sy:number, dx:number, dy:number, width?:number, height?:number) {
|
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)
|
if (width && height)
|
||||||
ctx.putImageData(imageData, sx, sy, dx, dy, width, height);
|
ctx.putImageData(imageData, sx, sy, dx, dy, width, height);
|
||||||
else
|
else
|
||||||
ctx.putImageData(imageData, 0, 0);
|
ctx.putImageData(imageData, 0, 0);
|
||||||
if (frameUpdateFunction) frameUpdateFunction(canvas);
|
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) {
|
export var VectorVideo = function(mainElement:HTMLElement, width:number, height:number) {
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { Platform, BaseZ80Platform } from "../baseplatform";
|
import { Platform, BaseZ80Platform } from "../baseplatform";
|
||||||
import { PLATFORMS, RAM, newAddressDecoder, padBytes, noise, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap } from "../emu";
|
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";
|
import { MasterAudio, AY38910_Audio } from "../audio";
|
||||||
|
|
||||||
const ASTROCADE_PRESETS = [
|
const ASTROCADE_PRESETS = [
|
||||||
@@ -12,7 +12,11 @@ const ASTROCADE_PRESETS = [
|
|||||||
{id:'cosmic.c', name:'Cosmic Impalas Game'},
|
{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([
|
const ASTROCADE_KEYCODE_MAP = makeKeycodeMap([
|
||||||
// player 1
|
// player 1
|
||||||
@@ -287,6 +291,7 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) {
|
|||||||
psg = new AstrocadeAudio(audio);
|
psg = new AstrocadeAudio(audio);
|
||||||
video = new RasterVideo(mainElement,swidth,sheight,{});
|
video = new RasterVideo(mainElement,swidth,sheight,{});
|
||||||
video.create();
|
video.create();
|
||||||
|
video.setupMouseEvents();
|
||||||
var idata = video.getFrameData();
|
var idata = video.getFrameData();
|
||||||
setKeyboardFromMap(video, inputs, ASTROCADE_KEYCODE_MAP);
|
setKeyboardFromMap(video, inputs, ASTROCADE_KEYCODE_MAP);
|
||||||
pixels = video.getFrameData();
|
pixels = video.getFrameData();
|
||||||
@@ -297,7 +302,13 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) {
|
|||||||
return membus.read(addr);
|
return membus.read(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadControls() {
|
||||||
|
inputs[0x1c] = video.paddle_x & 0xff;
|
||||||
|
inputs[0x1d] = video.paddle_y & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
advance(novideo : boolean) {
|
advance(novideo : boolean) {
|
||||||
|
this.loadControls();
|
||||||
for (var sl=0; sl<sheight; sl++) {
|
for (var sl=0; sl<sheight; sl++) {
|
||||||
//console.log(sl, hex(cpu.getPC(),4), cpu.saveState());
|
//console.log(sl, hex(cpu.getPC(),4), cpu.saveState());
|
||||||
this.runCPU(cpu, cpuCyclesPerLine);
|
this.runCPU(cpu, cpuCyclesPerLine);
|
||||||
@@ -439,6 +450,10 @@ const _BallyArcadePlatform = function(mainElement) {
|
|||||||
const _BallyAstrocadeBIOSPlatform = function(mainElement) {
|
const _BallyAstrocadeBIOSPlatform = function(mainElement) {
|
||||||
this.__proto__ = new (_BallyAstrocadePlatform as any)(mainElement);
|
this.__proto__ = new (_BallyAstrocadePlatform as any)(mainElement);
|
||||||
|
|
||||||
|
this.getPresets = function() {
|
||||||
|
return ASTROCADE_BIOS_PRESETS;
|
||||||
|
}
|
||||||
|
|
||||||
this.loadROM = this.loadBIOS;
|
this.loadROM = this.loadBIOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,6 +75,7 @@ class ANTIC {
|
|||||||
scanaddr : number = 0; // Scan Address (via LMS)
|
scanaddr : number = 0; // Scan Address (via LMS)
|
||||||
startaddr: number = 0; // Start of line Address
|
startaddr: number = 0; // Start of line Address
|
||||||
pfbyte : number = 0; // playfield byte fetched
|
pfbyte : number = 0; // playfield byte fetched
|
||||||
|
ch : number = 0; // char read
|
||||||
linesleft : number = 0; // # of lines left in mode
|
linesleft : number = 0; // # of lines left in mode
|
||||||
yofs : number = 0; // yofs fine
|
yofs : number = 0; // yofs fine
|
||||||
v : number = 0; // vertical scanline #
|
v : number = 0; // vertical scanline #
|
||||||
@@ -96,6 +97,7 @@ class ANTIC {
|
|||||||
scanaddr: this.scanaddr,
|
scanaddr: this.scanaddr,
|
||||||
startaddr: this.startaddr,
|
startaddr: this.startaddr,
|
||||||
pfbyte: this.pfbyte,
|
pfbyte: this.pfbyte,
|
||||||
|
ch: this.ch,
|
||||||
linesleft: this.linesleft,
|
linesleft: this.linesleft,
|
||||||
yofs: this.yofs,
|
yofs: this.yofs,
|
||||||
v: this.v,
|
v: this.v,
|
||||||
@@ -111,6 +113,7 @@ class ANTIC {
|
|||||||
this.scanaddr = s.scanaddr;
|
this.scanaddr = s.scanaddr;
|
||||||
this.startaddr = s.startaddr;
|
this.startaddr = s.startaddr;
|
||||||
this.pfbyte = s.pfbyte;
|
this.pfbyte = s.pfbyte;
|
||||||
|
this.ch = s.ch;
|
||||||
this.linesleft = s.linesleft;
|
this.linesleft = s.linesleft;
|
||||||
this.yofs = s.yofs;
|
this.yofs = s.yofs;
|
||||||
this.v = s.v;
|
this.v = s.v;
|
||||||
@@ -129,14 +132,18 @@ class ANTIC {
|
|||||||
switch (a) {
|
switch (a) {
|
||||||
case DMACTL:
|
case DMACTL:
|
||||||
this.pfwidth = this.regs[DMACTL] & 3;
|
this.pfwidth = this.regs[DMACTL] & 3;
|
||||||
this.left = PF_LEFT[this.pfwidth]-4; // TODO
|
this.setLeftRight();
|
||||||
this.right = PF_RIGHT[this.pfwidth]-4; // TODO
|
|
||||||
break;
|
break;
|
||||||
case NMIRES:
|
case NMIRES:
|
||||||
this.regs[NMIST] = 0;
|
this.regs[NMIST] = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setLeftRight() {
|
||||||
|
let offset = 4 << MODE_PERIOD[this.mode & 0xf];
|
||||||
|
this.left = PF_LEFT[this.pfwidth];
|
||||||
|
this.right = PF_RIGHT[this.pfwidth];
|
||||||
|
}
|
||||||
readReg(a:number) {
|
readReg(a:number) {
|
||||||
switch (a) {
|
switch (a) {
|
||||||
case NMIST: return this.regs[NMIST];
|
case NMIST: return this.regs[NMIST];
|
||||||
@@ -154,6 +161,7 @@ class ANTIC {
|
|||||||
if (this.mode & 0x80)
|
if (this.mode & 0x80)
|
||||||
this.triggerInterrupt(0x80); // Display List Interrupt (DLI)
|
this.triggerInterrupt(0x80); // Display List Interrupt (DLI)
|
||||||
this.mode = this.nextInsn();
|
this.mode = this.nextInsn();
|
||||||
|
this.setLeftRight();
|
||||||
stolen++;
|
stolen++;
|
||||||
if ((this.mode & 0xf) == 0) { // N Blank Lines
|
if ((this.mode & 0xf) == 0) { // N Blank Lines
|
||||||
this.linesleft = (this.mode >> 4) + 1;
|
this.linesleft = (this.mode >> 4) + 1;
|
||||||
@@ -247,14 +255,39 @@ class ANTIC {
|
|||||||
case 8: nc -= this.startline3(); break;
|
case 8: nc -= this.startline3(); break;
|
||||||
case 12: nc -= this.startline4(); break;
|
case 12: nc -= this.startline4(); break;
|
||||||
default:
|
default:
|
||||||
|
let mode = this.mode & 0xf;
|
||||||
if (h >= 48 && h < 120) nc--; // steal 1 clock for memory refresh
|
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 (((h>>2) & this.period) == 0) { // use period interval
|
||||||
if ((this.mode & 0xf) < 8) { // character mode
|
if (mode < 8) { // character mode
|
||||||
let ch = this.nextScreen();
|
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);
|
let addr = (ch<<3) + (this.regs[CHBASE]<<8);
|
||||||
this.pfbyte = this.read(addr + this.yofs);
|
// modes 2 & 3
|
||||||
//console.log(hex(addr), this.yofs, hex(this.scanaddr), this.h, this.v, ch);
|
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;
|
nc -= 2;
|
||||||
} else { // map mode
|
} else { // map mode
|
||||||
this.pfbyte = this.nextScreen();
|
this.pfbyte = this.nextScreen();
|
||||||
@@ -288,6 +321,9 @@ const GRAFP0 = 0x0d;
|
|||||||
const GRAFM = 0x11;
|
const GRAFM = 0x11;
|
||||||
const COLPM0 = 0x12;
|
const COLPM0 = 0x12;
|
||||||
const COLPF0 = 0x16;
|
const COLPF0 = 0x16;
|
||||||
|
const COLPF1 = 0x17;
|
||||||
|
const COLPF2 = 0x18;
|
||||||
|
const COLPF3 = 0x19;
|
||||||
const COLBK = 0x1a;
|
const COLBK = 0x1a;
|
||||||
const PRIOR = 0x1b;
|
const PRIOR = 0x1b;
|
||||||
const VDELAY = 0x1c;
|
const VDELAY = 0x1c;
|
||||||
@@ -327,13 +363,48 @@ class GTIA {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
clockPulse() : number {
|
clockPulse() : number {
|
||||||
let colreg = (this.antic.pfbyte & 128) ? COLPF0 : COLBK;
|
let pixel = (this.antic.pfbyte & 128) ? 1 : 0;
|
||||||
if ((this.count & this.antic.period) == 0)
|
let col = 0;
|
||||||
this.antic.pfbyte <<= 1;
|
switch (this.antic.mode & 0xf) {
|
||||||
let colidx = this.regs[colreg];
|
// 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;
|
this.count = (this.count + 1) & 0xff;
|
||||||
// TODO
|
return COLORS_RGBA[col];
|
||||||
return COLORS_RGBA[colidx];
|
|
||||||
}
|
}
|
||||||
static stateToLongString(state) : string {
|
static stateToLongString(state) : string {
|
||||||
let s = "";
|
let s = "";
|
||||||
@@ -396,7 +467,7 @@ const _Atari8Platform = function(mainElement) {
|
|||||||
antic = new ANTIC(bus.read);
|
antic = new ANTIC(bus.read);
|
||||||
gtia = new GTIA(antic);
|
gtia = new GTIA(antic);
|
||||||
// create video/audio
|
// create video/audio
|
||||||
video = new RasterVideo(mainElement, 384, 192);
|
video = new RasterVideo(mainElement, 352, 192);
|
||||||
audio = newPOKEYAudio();
|
audio = newPOKEYAudio();
|
||||||
video.create();
|
video.create();
|
||||||
video.setKeyboardEvents((key,code,flags) => {
|
video.setKeyboardEvents((key,code,flags) => {
|
||||||
@@ -454,7 +525,7 @@ const _Atari8Platform = function(mainElement) {
|
|||||||
cpu.clockPulse();
|
cpu.clockPulse();
|
||||||
}
|
}
|
||||||
// 4 ANTIC pulses = 8 pixels
|
// 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++) {
|
for (var j=0; j<8; j++) {
|
||||||
rgb = gtia.clockPulse();
|
rgb = gtia.clockPulse();
|
||||||
idata[iofs++] = rgb;
|
idata[iofs++] = rgb;
|
||||||
@@ -473,6 +544,7 @@ const _Atari8Platform = function(mainElement) {
|
|||||||
|
|
||||||
loadROM(title, data) {
|
loadROM(title, data) {
|
||||||
rom = padBytes(data, romLength);
|
rom = padBytes(data, romLength);
|
||||||
|
rom[rom.length-3] = 0xff; // TODO
|
||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,27 +623,19 @@ const _Atari5200Platform = function(mainElement) {
|
|||||||
|
|
||||||
/// MAME support
|
/// MAME support
|
||||||
|
|
||||||
var Atari8MAMEPlatform = function(mainElement) {
|
abstract class Atari8MAMEPlatform extends BaseMAMEPlatform {
|
||||||
var self = this;
|
loadROM(title, data) {
|
||||||
this.__proto__ = new (BaseMAMEPlatform as any)();
|
|
||||||
|
|
||||||
this.loadROM = function(title, data) {
|
|
||||||
this.loadROMFile(data);
|
this.loadROMFile(data);
|
||||||
this.loadRegion(":cartleft:cart:rom", data);
|
this.loadRegion(":cartleft:cart:rom", data);
|
||||||
}
|
}
|
||||||
|
getPresets() { return Atari8_PRESETS; }
|
||||||
this.getPresets = function() { return Atari8_PRESETS; }
|
getToolForFilename = getToolForFilename_6502;
|
||||||
|
getDefaultExtension() { return ".c"; };
|
||||||
this.getToolForFilename = getToolForFilename_6502;
|
|
||||||
this.getDefaultExtension = function() { return ".c"; };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var Atari800MAMEPlatform = function(mainElement) {
|
class Atari800MAMEPlatform extends Atari8MAMEPlatform implements Platform {
|
||||||
var self = this;
|
start() {
|
||||||
this.__proto__ = new Atari8MAMEPlatform(mainElement);
|
this.startModule(this.mainElement, {
|
||||||
|
|
||||||
this.start = function() {
|
|
||||||
self.startModule(mainElement, {
|
|
||||||
jsfile:'mameatari400.js',
|
jsfile:'mameatari400.js',
|
||||||
biosfile:'a400.zip', // TODO: load multiple files
|
biosfile:'a400.zip', // TODO: load multiple files
|
||||||
//cfgfile:'atari5200.cfg',
|
//cfgfile:'atari5200.cfg',
|
||||||
@@ -586,12 +650,9 @@ var Atari800MAMEPlatform = function(mainElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var Atari5200MAMEPlatform = function(mainElement) {
|
class Atari5200MAMEPlatform extends Atari8MAMEPlatform implements Platform {
|
||||||
var self = this;
|
start() {
|
||||||
this.__proto__ = new (Atari8MAMEPlatform as any)(mainElement);
|
this.startModule(this.mainElement, {
|
||||||
|
|
||||||
this.start = function() {
|
|
||||||
self.startModule(mainElement, {
|
|
||||||
jsfile:'mameatari400.js',
|
jsfile:'mameatari400.js',
|
||||||
biosfile:'a5200/5200.rom',
|
biosfile:'a5200/5200.rom',
|
||||||
//cfgfile:'atari5200.cfg',
|
//cfgfile:'atari5200.cfg',
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
import { Platform, BasePlatform } from "../baseplatform";
|
import { Platform, BasePlatform } from "../baseplatform";
|
||||||
import { PLATFORMS, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap } from "../emu";
|
import { PLATFORMS, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap } from "../emu";
|
||||||
import { SampleAudio } from "../audio";
|
import { SampleAudio } from "../audio";
|
||||||
import { safe_extend } from "../util";
|
import { safe_extend, clamp } from "../util";
|
||||||
import { WaveformView, WaveformProvider, WaveformMeta } from "../waveform";
|
import { WaveformView, WaveformProvider, WaveformMeta } from "../waveform";
|
||||||
|
|
||||||
declare var Split;
|
declare var Split;
|
||||||
@@ -279,10 +279,6 @@ var VerilogPlatform = function(mainElement, options) {
|
|||||||
debugCond = null;
|
debugCond = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clamp(minv,maxv,v) {
|
|
||||||
return (v < minv) ? minv : (v > maxv) ? maxv : v;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shadowText(ctx, txt, x, y) {
|
function shadowText(ctx, txt, x, y) {
|
||||||
ctx.shadowColor = "black";
|
ctx.shadowColor = "black";
|
||||||
ctx.shadowBlur = 0;
|
ctx.shadowBlur = 0;
|
||||||
|
@@ -213,6 +213,7 @@ function reloadPresetNamed(id:string) {
|
|||||||
|
|
||||||
function getSkeletonFile(fileid:string, callback) {
|
function getSkeletonFile(fileid:string, callback) {
|
||||||
var ext = platform.getToolForFilename(fileid);
|
var ext = platform.getToolForFilename(fileid);
|
||||||
|
// TODO: .mame
|
||||||
$.get( "presets/"+platform_id+"/skeleton."+ext, function( text ) {
|
$.get( "presets/"+platform_id+"/skeleton."+ext, function( text ) {
|
||||||
callback(null, text);
|
callback(null, text);
|
||||||
}, 'text')
|
}, 'text')
|
||||||
@@ -360,6 +361,7 @@ function fixFilename(fn : string) : string {
|
|||||||
|
|
||||||
function _revertFile(e) {
|
function _revertFile(e) {
|
||||||
var fn = fixFilename(projectWindows.getActiveID());
|
var fn = fixFilename(projectWindows.getActiveID());
|
||||||
|
// TODO: .mame
|
||||||
$.get( "presets/"+platform_id+"/"+fn, function(text) {
|
$.get( "presets/"+platform_id+"/"+fn, function(text) {
|
||||||
if (confirm("Reset '" + fn + "' to default?")) {
|
if (confirm("Reset '" + fn + "' to default?")) {
|
||||||
projectWindows.getActive().setText(text);
|
projectWindows.getActive().setText(text);
|
||||||
|
@@ -376,3 +376,7 @@ export function rgb2bgr(x) {
|
|||||||
return ((x&0xff)<<16) | ((x>>16)&0xff) | (x&0x00ff00);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -142,7 +142,8 @@ var PLATFORM_PARAMS = {
|
|||||||
'atari8-5200': {
|
'atari8-5200': {
|
||||||
define: '__ATARI5200__',
|
define: '__ATARI5200__',
|
||||||
cfgfile: 'atari5200.cfg',
|
cfgfile: 'atari5200.cfg',
|
||||||
libargs: ['atari5200.lib'],
|
libargs: ['atari5200.lib',
|
||||||
|
'-D', '__CARTFLAGS__=255'],
|
||||||
},
|
},
|
||||||
'c64': {
|
'c64': {
|
||||||
define: '__C64__',
|
define: '__C64__',
|
||||||
@@ -919,19 +920,26 @@ function assembleSDASZ80(step) {
|
|||||||
if (staleFiles(step, [objpath, lstpath])) {
|
if (staleFiles(step, [objpath, lstpath])) {
|
||||||
//?ASxxxx-Error-<o> in line 1 of main.asm null
|
//?ASxxxx-Error-<o> in line 1 of main.asm null
|
||||||
// <o> .org in REL area or directive / mnemonic error
|
// <o> .org in REL area or directive / mnemonic error
|
||||||
var match_asm_re = / <\w> (.+)/; // TODO
|
// ?ASxxxx-Error-<q> in line 1627 of cosmic.asm
|
||||||
|
// <q> 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) {
|
function match_asm_fn(s) {
|
||||||
var matches = match_asm_re.exec(s);
|
var m = match_asm_re1.exec(s);
|
||||||
if (matches) {
|
if (m) {
|
||||||
//var errline = parseInt(matches[2]);
|
errline = parseInt(m[1]);
|
||||||
errors.push({
|
errpath = m[2];
|
||||||
line:0, // TODO
|
|
||||||
path:step.path,
|
|
||||||
msg:matches[1]
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// ?ASxxxx-Error-<q> in line 1627 of cosmic.asm
|
m = match_asm_re2.exec(s);
|
||||||
// <q> missing or improper operators, terminators, or delimiters
|
if (m) {
|
||||||
|
errors.push({
|
||||||
|
line:errline,
|
||||||
|
path:errpath,
|
||||||
|
msg:m[1]
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var ASZ80 = sdasz80({
|
var ASZ80 = sdasz80({
|
||||||
@@ -1527,7 +1535,7 @@ function executeBuildSteps() {
|
|||||||
// find previous link step to combine
|
// find previous link step to combine
|
||||||
for (var i=0; i<buildsteps.length; i++) {
|
for (var i=0; i<buildsteps.length; i++) {
|
||||||
var ls = buildsteps[i];
|
var ls = buildsteps[i];
|
||||||
if (ls.tool == linkstep.tool && ls.platform == linkstep.platform && ls.files) {
|
if (ls.tool == linkstep.tool && ls.platform == linkstep.platform && ls.files && ls.args) {
|
||||||
ls.files = ls.files.concat(linkstep.files);
|
ls.files = ls.files.concat(linkstep.files);
|
||||||
ls.args = ls.args.concat(linkstep.args);
|
ls.args = ls.args.concat(linkstep.args);
|
||||||
linkstep = null;
|
linkstep = null;
|
||||||
@@ -1545,7 +1553,7 @@ function executeBuildSteps() {
|
|||||||
path:step.result.path,
|
path:step.result.path,
|
||||||
args:step.result.args
|
args:step.result.args
|
||||||
};
|
};
|
||||||
buildsteps.push(asmstep);
|
buildsteps.push(asmstep); // TODO: unshift changes order
|
||||||
step.generated = asmstep.files;
|
step.generated = asmstep.files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user