1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-17 03:29:55 +00:00

atari800xl.mame platform, Alterra ROMs

This commit is contained in:
Steven Hugg 2020-07-28 15:06:49 -05:00
parent 68f19fbf11
commit b78fbe5ac4
17 changed files with 2216 additions and 59 deletions

View File

@ -199,6 +199,7 @@ TODO:
- don't include start/end line on platforms w/o raster timing
- memory map shows subroutine symbol even after RTS
- BIOS symbols
- show current tool for file
@ -484,6 +485,16 @@ class M6502_T {
@bus(16) address : Bus<16>;
}
Optimizations
- ordered/delayed assignments
- skip unused exprs
- opcode -> fn table
- bus protocols -> functions
- state -> lookup tables or switch statements
- vec[] -> bitmask
- multiclock execution?
STATE REWIND

View File

@ -218,6 +218,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<li><a class="dropdown-item" href="?platform=nes.mame">NES (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=coleco.mame">ColecoVision (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=atari8-5200.mame">Atari 5200 (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=atari8-800xl.mame">Atari 800XL (MAME)</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">

41
mame/cfg/a5200.cfg Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
<system name="a5200">
<input>
<port tag=":djoy_0_1" type="P1_JOYSTICK_UP" mask="1" defvalue="1">
<newseq type="standard">
KEYCODE_UP
</newseq>
</port>
<port tag=":djoy_0_1" type="P1_JOYSTICK_DOWN" mask="2" defvalue="2">
<newseq type="standard">
KEYCODE_DOWN
</newseq>
</port>
<port tag=":djoy_0_1" type="P1_JOYSTICK_LEFT" mask="4" defvalue="4">
<newseq type="standard">
KEYCODE_LEFT
</newseq>
</port>
<port tag=":djoy_0_1" type="P1_JOYSTICK_RIGHT" mask="8" defvalue="8">
<newseq type="standard">
KEYCODE_RIGHT
</newseq>
</port>
<port tag=":djoy_b" type="P1_BUTTON1" mask="1" defvalue="1">
<newseq type="standard">
KEYCODE_Z
</newseq>
</port>
<port tag=":djoy_b" type="P1_BUTTON2" mask="16" defvalue="16">
<newseq type="standard">
KEYCODE_X
</newseq>
</port>
</input>
<image_directories>
<device instance="cartridge" directory="/emulator" />
</image_directories>
</system>
</mameconfig>

45
mame/cfg/a800xl.cfg Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
<system name="a800xl">
<input>
<port tag=":djoy_0_1" type="P1_JOYSTICK_UP" mask="1" defvalue="1">
<newseq type="standard">
KEYCODE_UP
</newseq>
</port>
<port tag=":djoy_0_1" type="P1_JOYSTICK_DOWN" mask="2" defvalue="2">
<newseq type="standard">
KEYCODE_DOWN
</newseq>
</port>
<port tag=":djoy_0_1" type="P1_JOYSTICK_LEFT" mask="4" defvalue="4">
<newseq type="standard">
KEYCODE_LEFT
</newseq>
</port>
<port tag=":djoy_0_1" type="P1_JOYSTICK_RIGHT" mask="8" defvalue="8">
<newseq type="standard">
KEYCODE_RIGHT
</newseq>
</port>
<port tag=":djoy_b" type="P1_BUTTON1" mask="1" defvalue="1">
<newseq type="standard">
KEYCODE_Z
</newseq>
</port>
<port tag=":djoy_b" type="P1_BUTTON2" mask="16" defvalue="16">
<newseq type="standard">
KEYCODE_X
</newseq>
</port>
</input>
<image_directories>
<device instance="floppydisk1" directory="/emulator" />
<device instance="floppydisk2" directory="/emulator" />
<device instance="floppydisk3" directory="/emulator" />
<device instance="floppydisk4" directory="/emulator" />
<device instance="cartridge" directory="/emulator" />
</image_directories>
</system>
</mameconfig>

BIN
mame/roms/a800xl.zip Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
; Atari 5200 "Hello World" sample code
; Written by Daniel Boris (dboris@comcast.net)
; Written by Daniel Boris (danlb_2000@yahoo.com)
;
; Assemble with DASM
;

View File

@ -1,6 +1,6 @@
; Atari 5200 "Hello World" sample code
; Written by Daniel Boris (dboris@comcast.net)
; Written by Daniel Boris (danlb_2000@yahoo.com)
;
; Assemble with DASM
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
; Atari "Hello World" sample code
; Written by Daniel Boris (dboris@comcast.net)
; Modified by Steven Hugg @8bitworkshop
; Assemble with DASM
;
processor 6502
include "atari.inc"
org $a000 ;Start of left cartridge area
Start
ldx #(dlistend-dlist)
dlloop ;Create Display List
lda dlist,x ;Get byte
sta $1000,x ;Copy to RAM
dex ;next byte
bpl dlloop
lda #$06
sta CHACTL ;Set Character Control
lda #$84 ;Set color PF2
sta COLOR0+2
sta COLOR0+4 ; bakground
lda #$0F ;Set color PF1
sta COLOR0+1
lda #$3f
sta COLOR0+0
lda #$58
sta COLOR0+3
lda #$00 ;Set Display list pointer
sta SDLSTL ;Shadow DLISTL
lda #$10
sta SDLSTH ;Shadow DLISTH
lda #$e0 ;Set Charcter Set Base
sta CHBAS
lda #$22 ;Enable DMA
sta SDMCTL ;Shadow DMACTL
print
ldy #$00
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
bne prloop
wait
nop
jmp wait
;Display list data (starts at $1000)
dlist .byte $70,$70,$70 ;24 blank scanlines
.byte $42,$00,$18,$02 ;mode 2 @ $1800
.byte $43,$00,$18,$02 ;mode 3 @ $1800
.byte $44,$00,$18,$02 ;mode 4 @ $1800
.byte $45,$00,$18,$02 ;mode 5 @ $1800
.byte $46,$00,$18,$06 ;mode 6 @ $1800
.byte $47,$00,$18,$06 ;mode 7 @ $1800
.byte $41,$00,$10 ;JMP -> $1000
dlistend
;Text data
text1 .byte "Hello World! "
.byte $a1,$a2,$a3
.byte 0
;Cartridge footer
org CARTCS
.word Start ; cold start address
.byte $00 ; 0 == cart exists
.byte $04 ; boot cartridge
.word Start ; start

View File

@ -0,0 +1,15 @@
#include <conio.h>
#include <atari.h>
void main() {
clrscr();
// position the cursor, output text
gotoxy(0,1);
cputs("Hello Atari 8-bit World!\r\n\r\nPlease type a key...\r\n");
// read from the console
// cartridge ROMs do not exit, so loop forever
while (1) {
cprintf("You typed character code %d!\r\n", cgetc());
}
}

View File

@ -0,0 +1,89 @@
/*
This example demonstrates setting up a ANTIC display list in C.
We have two lines of text on the top, two lines on the bottom,
and a bitmap in the middle.
*/
#include <peekpoke.h>
#include <atari.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// shadow registers for the 5200
// TODO: use OS struct
#define SDLIST (*(unsigned int*) 0x230) // Display list start shadow
#define SDMCTL (*(unsigned char*)0x22f) // Antic DMA control shadow
// screen RAM structure definition
typedef struct ScreenMemoryDef {
char topStatusLine[2][40];
char bottomStatusLine[4][40];
char bitmap[80][40];
} ScreenMemoryDef;
// screen RAM variable
ScreenMemoryDef screen;
// display list definition
const void displayList = {
DL_BLK8, // 8 blank scanlines
DL_BLK8, // 8 blank scanlines
// top status line (2 lines)
DL_LMS(DL_CHR40x8x1), //Load Memory Scan (next two bytes must be the LSB/MSB of the data to load)
screen.topStatusLine, // address of frame buffer
DL_CHR40x10x1, // second line of text
// 80x2 lines of 160x2x4 bitmap
DL_LMS(DL_MAP160x2x4), // first line of bitmap
screen.bitmap, // bitmap address
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4, DL_MAP160x2x4,
// bottom status line (4 lines)
DL_LMS(DL_CHR40x8x1), //Load Memory Scan (next two bytes must be the LSB/MSB of the data to load)
screen.bottomStatusLine,
DL_CHR40x8x1, DL_CHR40x8x1, DL_CHR40x8x1, // next 3 lines of text
// wait for vertical blank
DL_JVB,
// restart display list
DL_JMP,
&displayList
};
void main(void) {
unsigned int i;
SDMCTL = 0; // turn off ANTIC
SDLIST = (unsigned int) &displayList; // set display list
SDMCTL = 0x22; // turn on ANTIC
// set screen memory
for(i=0; i<40; ++i) {
screen.topStatusLine[0][i] = i;
screen.topStatusLine[1][i] = i>>1;
screen.bottomStatusLine[0][i] = i;
screen.bottomStatusLine[1][i] = i>>1;
screen.bottomStatusLine[2][i] = i<<1;
screen.bottomStatusLine[3][i] = i<<2;
}
memset(screen.bitmap, 0x13, sizeof(screen.bitmap));
// infinite loop
while(1) {
}
}

View File

@ -0,0 +1,192 @@
; Atari 5200 "Hello World" sample code
; Written by Daniel Boris (danlb_2000@yahoo.com)
; Modified by Steven Hugg @8bitworkshop
; Assemble with DASM
;
processor 6502
include "atari.inc"
;*************** Variable ***********************
line equ $20 ;Current DLI line
pm0pos equ $21 ;Current pos of P0
;*************** Start of Code *******************
org $a000 ;Start of cartridge area
Start
;************* Setup display list *******************
ldx #$21 ;Number of bytes in list
dlloop ;Copy display list to RAM
lda dlist,x ;Get byte
sta $1000,x ;Copy to RAM
dex ;next byte
bpl dlloop
;************* Setup hardware registers *************
lda #$22 ;Set color PF0
sta COLOR0
lda #$0F ;Set color PF1
sta COLOR1
lda #$84 ;Set color PF2
sta COLOR2
lda #$00 ;Set Display list pointer
sta SDLSTL
lda #$10
sta SDLSTH
lda #$f8 ;Set Charcter Set Base
sta CHBAS
lda #$22 ;Enable DMA
sta SDMCTL
; load display list interrupt address
lda #<dli
sta VDSLST
lda #>dli
sta VDSLST+1
; activate display list interrupt and vertical blank interrupt
lda #$C0
sta NMIEN
;************ Draw display graphics *******************
ldy #$02 ;Draw bars on screen
lda #$18 ;Screen memory starts at $1800
sta $81
lda #$00
sta $80
ldx #$18
crloop5
lda #$FF ;Bar 4 pixels wide of color 3
sta ($80),y ;Store data
iny
iny ;Skip 4 pixels
lda #$55 ;Bar 4 pixels wide of color 1
sta ($80),y ;Store data
iny
iny ;Skip 4 pixels
lda #$AA ;Bar 4 pixels wide of color 2
sta ($80),y ;Store data
tya
clc
adc #$06 ;Move pointer to next line
tay
dex ;Next line
bne crloop5 ;Branch if not done
;************* Setup Player/Missile registers ***************
lda #$3A ;Enable DMA (single line resolution/
sta SDMCTL ;normal background)
lda #$20 ;Set PM base address ($200)
sta PMBASE
lda #$03 ;Enable players and missiles
sta GRACTL
lda #$16 ;Color of player 0
sta PCOLR0
ldy #$00
lda #$02 ;Size of player 0
sta SIZEP0
lda #$01 ;Give players priority over playfield
sta GPRIOR
;************ Copy player data to RAM ********************************
pmloop1
lda pm1,y ;Get data
sta $2430,y ;Write it into RAM
sta $24C0,y
iny
cpy #$08 ;Copy 8 bytes
bne pmloop1
;************ Move player ********************************************
ldx #$20 ;Starting position of player
mvloop1
jsr waitvb ;Wait for a vertical bank
lda #$00 ;Reset line counter
sta line
stx HPOSP0 ;Set position of player
stx pm0pos ;Save position for DLI
inx
cpx #$C0 ;Check for end of move
bne mvloop1 ;If not keep moving right
lda #$04 ;Give playfield priority player
sta GPRIOR
mvloop2
jsr waitvb ;Wait for a vertical blank
lda #$00 ;Reset line counter
sta line
stx HPOSP0 ;Set position of player
stx pm0pos ;Save position for DLI
dex
cpx #$30 ;Check for end of move
bne mvloop2 ;If not keep moving left
lda #$01 ;Give player priority over playfield
sta GPRIOR
jmp mvloop1 ;Continue looping
;************ Wait for vertical blank ************************
waitvb
lda RTCLOK+2 ;Read timer (this is incremented during VB)
waitvb2
cmp RTCLOK+2 ;Did it change?
beq waitvb2 ;If not keep waiting
rts
;************ Display list interrupt ************************
dli
pha ;Save A
inc line ;Increment the line counter
lda line ;Past the fifth DLI?
cmp #$05
bne done ;If not then exit DLI
lda pm0pos ;Get player 0 position
eor #$FF ;Invert it
sta HPOSP0 ;Set player 0 position
lda #$0F ;Change player color
sta COLPM0 ;
; Note: Player color is changed in hardware register not the shadow
; register so it takes effect immediatly.
done
pla ;Restore A
rti ;Done
;************* Display list data ****************************
; starts at $1000
dlist .byte $70,$70,$70 ;24 blank scanlines
.byte $48,$00,$18 ;Mode 8 and Load memory scan $1800
.byte $88,$88,$88,$88,$88,$88,$88 ;23 more line of mode 8
.byte $88,$88,$88,$88,$88,$88,$88,$88,$88,$88,$88,$88,$88
.byte $88,$88,$88
.byte $41,$00,$10 ;Jump back to start at $1000
;************* Player shape *********************************
pm1 .byte %00111100
.byte %01000010
.byte %10100101
.byte %10000001
.byte %10100101
.byte %10011001
.byte %01000010
.byte %00111100
;************** Cart reset vector **************************
;Cartridge footer
org CARTCS
.word Start ; cold start address
.byte $00 ; 0 == cart exists
.byte $04 ; boot cartridge
.word Start ; start

View File

@ -0,0 +1,243 @@
/*
Text-based version of a Blockade-style game.
For more information, see "Making Arcade Games in C".
*/
#include <stdlib.h>
#include <string.h>
#include <joystick.h>
#include <conio.h>
#include <atari.h>
#include <peekpoke.h>
#define COLS 40
#define ROWS 24
typedef unsigned char byte;
typedef signed char sbyte;
typedef unsigned short word;
// pointer to screen memory
// TODO: use OS.savmsc
static byte** SAVMSC = (byte**) 0x58;
byte getchar(byte x, byte y) {
return (*SAVMSC)[x+y*COLS]; // lookup value @ cursor address
}
void delay(byte count) {
while (count--) {
word i;
for (i=0; i<400; i++) ;
}
}
////////// GAME DATA
typedef struct {
byte x;
byte y;
byte dir;
word score;
char head_attr;
char tail_attr;
int collided:1;
int human:1;
} Player;
Player players[2];
byte credits = 0;
byte frames_per_move;
byte gameover;
#define START_SPEED 12
#define MAX_SPEED 5
#define MAX_SCORE 7
///////////
const char BOX_CHARS[8] = { '+', '+', '+', '+',
'-', '-', '!', '!'};
void draw_box(byte x, byte y, byte x2, byte y2, const char* chars) {
byte x1 = x;
cputcxy(x, y, chars[2]);
cputcxy(x2, y, chars[3]);
cputcxy(x, y2, chars[0]);
cputcxy(x2, y2, chars[1]);
while (++x < x2) {
cputcxy(x, y, chars[5]);
cputcxy(x, y2, chars[4]);
}
while (++y < y2) {
cputcxy(x1, y, chars[6]);
cputcxy(x2, y, chars[7]);
}
}
void draw_playfield() {
draw_box(0,1,COLS-1,ROWS-1,BOX_CHARS);
cputsxy( 0, 0, "Plyr1:");
cputsxy(10, 0, "Plyr2:");
cputcxy( 7, 0, players[0].score+'0');
cputcxy(17, 0, players[1].score+'0');
}
typedef enum { D_RIGHT, D_DOWN, D_LEFT, D_UP } dir_t;
const sbyte DIR_X[4] = { 1, 0, -1, 0 };
const sbyte DIR_Y[4] = { 0, 1, 0, -1 };
void init_game() {
memset(players, 0, sizeof(players));
players[0].head_attr = '1';
players[1].head_attr = '2';
players[0].tail_attr = '#';
players[1].tail_attr = '*';
frames_per_move = START_SPEED;
}
void reset_players() {
players[0].x = players[0].y = 5;
players[0].dir = D_RIGHT;
players[1].x = COLS-6;
players[1].y = ROWS-6;
players[1].dir = D_LEFT;
players[0].collided = players[1].collided = 0;
}
void draw_player(Player* p) {
cputcxy(p->x, p->y, p->head_attr);
}
void move_player(Player* p) {
cputcxy(p->x, p->y, p->tail_attr);
p->x += DIR_X[p->dir];
p->y += DIR_Y[p->dir];
if ((getchar(p->x, p->y) & 0x7f) != 0)
p->collided = 1;
draw_player(p);
}
void human_control(Player* p) {
byte dir = 0xff;
char joy;
if (!p->human) return;
joy = joy_read(0);
if (JOY_UP(joy)) dir = D_UP;
if (JOY_LEFT(joy)) dir = D_LEFT;
if (JOY_RIGHT(joy)) dir = D_RIGHT;
if (JOY_DOWN(joy)) dir = D_DOWN;
// don't let the player reverse direction
if (dir < 0x80 && dir != (p->dir ^ 2)) {
p->dir = dir;
}
}
byte ai_try_dir(Player* p, dir_t dir, byte shift) {
byte x,y;
dir &= 3;
x = p->x + (DIR_X[dir] << shift);
y = p->y + (DIR_Y[dir] << shift);
if (x < COLS && y < ROWS && (getchar(x, y) & 0x7f) == 0) {
p->dir = dir;
return 1;
} else {
return 0;
}
}
void ai_control(Player* p) {
dir_t dir;
if (p->human) return;
dir = p->dir;
if (!ai_try_dir(p, dir, 0)) {
ai_try_dir(p, dir+1, 0);
ai_try_dir(p, dir-1, 0);
} else {
ai_try_dir(p, dir-1, 0) && ai_try_dir(p, dir-1, 1+(rand() & 3));
ai_try_dir(p, dir+1, 0) && ai_try_dir(p, dir+1, 1+(rand() & 3));
ai_try_dir(p, dir, rand() & 3);
}
}
void flash_colliders() {
byte i;
// flash players that collided
for (i=0; i<56; i++) {
delay(2);
revers(players[0].collided && (i&1));
draw_player(&players[0]);
revers(players[1].collided && (i&1));
draw_player(&players[1]);
}
//revers(0);
}
void make_move() {
byte i;
for (i=0; i<frames_per_move; i++) {
human_control(&players[0]);
delay(1);
}
ai_control(&players[0]);
ai_control(&players[1]);
// if players collide, 2nd player gets the point
textcolor(COLOR_CYAN);
move_player(&players[1]);
textcolor(COLOR_YELLOW);
move_player(&players[0]);
textcolor(COLOR_WHITE);
}
void declare_winner(byte winner) {
byte i;
clrscr();
for (i=0; i<ROWS/2-3; i++) {
draw_box(i,i,COLS-1-i,ROWS-1-i,BOX_CHARS);
delay(1);
}
cputsxy(6,10,"WINNER:");
cputsxy(6,13,"PLAYER ");
cputcxy(6+7, 13, '1'+winner);
delay(200);
gameover = 1;
}
void play_round() {
reset_players();
clrscr();
//textcolor(COLOR_WHITE);
draw_playfield();
while (1) {
make_move();
if (players[0].collided || players[1].collided) break;
}
flash_colliders();
// add scores to players that didn't collide
if (players[0].collided) players[1].score++;
if (players[1].collided) players[0].score++;
// increase speed
if (frames_per_move > MAX_SPEED) frames_per_move--;
// game over?
if (players[0].score != players[1].score) {
if (players[0].score >= MAX_SCORE)
declare_winner(0);
else if (players[1].score >= MAX_SCORE)
declare_winner(1);
}
}
void play_game() {
gameover = 0;
init_game();
players[0].human = 1;
while (!gameover) {
play_round();
}
}
void main() {
joy_install (joy_static_stddrv);
play_game();
}

View File

@ -645,7 +645,7 @@ export abstract class BaseMAMEPlatform {
romdata : Uint8Array;
video;
running = false;
console_vars : {[varname:string]:string[]} = {};
console_vars : {[varname:string]:string} = {};
console_varname : string;
initluavars : boolean = false;
luadebugscript : string;
@ -698,17 +698,9 @@ export abstract class BaseMAMEPlatform {
bufferConsoleOutput(s) {
if (typeof s !== 'string') return;
if (s.startsWith(">>>")) {
this.console_varname = s.length > 3 ? s.slice(3) : null;
if (this.console_varname) this.console_vars[this.console_varname] = [];
} else if (this.console_varname) {
this.console_vars[this.console_varname].push(s);
if (this.console_varname == 'debug_stopped') {
var debugSaveState = this.preserveState();
this.pause();
if (this.onBreakpointHit) {
this.onBreakpointHit(debugSaveState);
}
}
console.log(s);
var toks = s.split(' ', 3);
this.console_vars[toks[1]] = toks[2];
} else {
console.log(s);
}
@ -850,6 +842,22 @@ export abstract class BaseMAMEPlatform {
}
}
initlua() {
if (!this.initluavars) {
this.luacall(this.luadebugscript);
this.luacall('mamedbg.init()')
this.initluavars = true;
}
}
// DEBUGGING SUPPORT
/*
readAddress(a) {
this.initlua();
this.luacall('print(">>> mem8 " .. mem:read_u8(' + a + '))');
return parseInt(this.console_vars.mem8);
}
preserveState() {
var state = {c:{}};
for (var k in this.console_vars) {
@ -862,26 +870,11 @@ export abstract class BaseMAMEPlatform {
return state;
}
initlua() {
if (!this.initluavars) {
this.luacall(this.luadebugscript);
this.luacall('mamedbg.init()')
this.initluavars = true;
}
}
// DEBUGGING SUPPORT
/*
saveState() {
this.luareset();
this.luacall('mamedbg.printstate()');
return this.preserveState();
}
readAddress(a) {
this.initlua();
this.luacall('print(">>>v"); print(mem:read_u8(' + a + '))');
return parseInt(this.console_vars.v[0]);
}
clearDebug() {
this.onBreakpointHit = null;
}

View File

@ -895,6 +895,7 @@ export class MemoryMapView implements ProjectView {
//var container = $('<div class="container"/>').append(row);
//this.maindiv.append(container);
segdiv.click(() => {
// TODO: what if memory browser does not exist?
var memview = projectWindows.createOrShow('#memory') as MemoryView;
memview.scrollToAddress(seg.start);
});

View File

@ -8,8 +8,8 @@ import { MasterAudio, POKEYDeviceChannel, newPOKEYAudio } from "../common/audio"
declare var jt; // for 6502
var Atari8_PRESETS = [
{id:'hello.a', name:'Hello World (ASM)'},
{id:'hellopm.a', name:'Hello Sprites (ASM)'},
{id:'hello.dasm', name:'Hello World (ASM)'},
{id:'hellopm.dasm', name:'Hello Sprites (ASM)'},
{id:'helloconio.c', name:'Text Mode (C)'},
{id:'siegegame.c', name:'Siege Game (C)'},
{id:'hellodlist.c', name:'Display List (C)'},
@ -779,30 +779,47 @@ for (var i=0; i<256; i++) {
/// MAME support
abstract class Atari8MAMEPlatform extends BaseMAMEPlatform {
loadROM(title, data) {
this.loadROMFile(data);
this.loadRegion(":cartleft:cart:rom", data);
}
getPresets() { return Atari8_PRESETS; }
getToolForFilename = getToolForFilename_6502;
getDefaultExtension() { return ".c"; };
getOpcodeMetadata = getOpcodeMetadata_6502;
getDefaultExtension() { return ".asm"; };
}
class Atari800MAMEPlatform extends Atari8MAMEPlatform implements Platform {
start() {
this.startModule(this.mainElement, {
jsfile:'mameatari400.js',
biosfile:'a400.zip', // TODO: load multiple files
//cfgfile:'atari5200.cfg',
driver:'a400',
width:336*2,
height:225*2,
romfn:'/emulator/cart.rom',
romsize:0x2000,
preInit:function(_self) {
},
});
loadROM(title, data) {
if (!this.started) {
this.startModule(this.mainElement, {
jsfile:'mameatari400.js',
biosfile:'a800xl.zip',
cfgfile:'a800xl.cfg',
driver:'a800xl',
width:336*2,
height:225*2,
romfn:'/emulator/cart.rom',
romdata:new Uint8Array(data),
romsize:0x2000,
preInit:function(_self) {
},
});
} else {
this.loadROMFile(data);
this.loadRegion(":cartleft:cart:rom", data);
}
}
start() {
}
getMemoryMap = function() { return { main:[
{name:'RAM',start:0x0,size:0x10000,type:'ram'},
{name:'Left Cartridge ROM',start:0xa000,size:0x2000,type:'rom'},
{name:'GTIA',start:0xd000,size:0x20,type:'io'},
{name:'POKEY',start:0xd200,size:0x10,type:'io'},
{name:'PIA',start:0xd300,size:0x04,type:'io'},
{name:'ANTIC',start:0xd400,size:0x10,type:'io'},
{name:'Cartridge Control Line',start:0xd600,size:0x100,type:'io'},
{name:'ROM',start:0xd800,size:0x800,type:'rom'},
{name:'ATARI Character Set',start:0xe000,size:0x400,type:'rom'},
{name:'ROM',start:0xe400,size:0x1c00,type:'rom'},
] } };
}
class Atari5200MAMEPlatform extends Atari8MAMEPlatform implements Platform {
@ -811,7 +828,7 @@ class Atari5200MAMEPlatform extends Atari8MAMEPlatform implements Platform {
this.startModule(this.mainElement, {
jsfile:'mameatari400.js',
biosfile:'a5200/5200.rom',
//cfgfile:'atari5200.cfg',
cfgfile:'a5200.cfg',
driver:'a5200',
width:336*2,
height:225*2,
@ -828,10 +845,15 @@ class Atari5200MAMEPlatform extends Atari8MAMEPlatform implements Platform {
}
start() {
}
getPresets() { return Atari8_PRESETS; }
getToolForFilename = getToolForFilename_6502;
getOpcodeMetadata = getOpcodeMetadata_6502;
getDefaultExtension() { return ".asm"; };
getMemoryMap = function() { return { main:[
{name:'RAM',start:0x0,size:0x4000,type:'ram'},
{name:'Cartridge ROM',start:0x4000,size:0x8000,type:'rom'},
{name:'GTIA',start:0xc000,size:0x20,type:'io'},
{name:'ANTIC',start:0xd400,size:0x10,type:'io'},
{name:'POKEY',start:0xe800,size:0x10,type:'io'},
{name:'ATARI Character Set',start:0xf800,size:0x400,type:'rom'},
{name:'ROM',start:0xfc00,size:0x400,type:'rom'},
] } };
}
///
@ -863,5 +885,5 @@ a58lHiUcJQkD/Lj8svyh/gL9svxI5gzQBBkiJhkj9SUfJR8lHiUBI/0x/QD8`;
PLATFORMS['atari8-800'] = _Atari800Platform;
PLATFORMS['atari8-5200'] = _Atari5200Platform;
PLATFORMS['atari8-800.mame'] = Atari800MAMEPlatform;
PLATFORMS['atari8-800xl.mame'] = Atari800MAMEPlatform;
PLATFORMS['atari8-5200.mame'] = Atari5200MAMEPlatform;

View File

@ -198,16 +198,15 @@ var PLATFORM_PARAMS = {
cfgfile: 'apple2.cfg',
libargs: ['apple2.lib'],
},
'atari8-800': {
'atari8-800xl': {
define: ['__ATARI__'],
cfgfile: 'atari-cart.cfg',
libargs: ['atari.lib'],
libargs: ['atari.lib', '-D', '__CARTFLAGS__=4'],
},
'atari8-5200': {
define: ['__ATARI5200__'],
cfgfile: 'atari5200.cfg',
libargs: ['atari5200.lib',
'-D', '__CARTFLAGS__=255'],
libargs: ['atari5200.lib', '-D', '__CARTFLAGS__=255'],
},
'verilog': {
},