mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-10-25 15:05:25 +00:00
178 lines
6.9 KiB
JavaScript
178 lines
6.9 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const baseplatform_1 = require("../common/baseplatform");
|
|
const toolselect_1 = require("../common/toolselect");
|
|
const emu_1 = require("../common/emu");
|
|
const mameplatform_1 = require("../common/mameplatform");
|
|
const atari8_1 = require("../machine/atari8");
|
|
var Atari8_PRESETS = [
|
|
{ id: 'hello.dasm', name: 'Hello World', category: 'Assembly' },
|
|
{ id: 'hellopm.dasm', name: 'Hello Sprites' },
|
|
{ id: 'helloconio.c', name: 'Text Mode', category: 'C' },
|
|
{ id: 'siegegame.c', name: 'Siege Game' },
|
|
{ id: 'hellodlist.c', name: 'Display List' },
|
|
];
|
|
var Atari800_PRESETS = Atari8_PRESETS.concat([
|
|
//{id:'testmusic.c', name:'POKEY Music'},
|
|
{ id: 'tgidemo.c', name: 'TGI Demo' },
|
|
{ id: 'icepiano.c', name: 'Ice Piano (TGI Demo)' },
|
|
{ id: 'libdemo.c', name: 'Library Demo' },
|
|
{ id: 'scrolldemo.c', name: 'Scrolling' },
|
|
{ id: 'hello.cpp', name: 'Hello Oscar64', category: 'Oscar64' },
|
|
{ id: 'libdemo.cpp', name: 'Library Demo Oscar64' },
|
|
{ id: 'sieve.bas', name: 'Benchmark', category: 'FastBasic' },
|
|
{ id: 'pmtest.bas', name: 'Sprites Test' },
|
|
{ id: 'dli.bas', name: 'DLI Test' },
|
|
{ id: 'joyas.bas', name: 'Match-3 Game' },
|
|
]);
|
|
const Atari800_MemoryMap = { main: [
|
|
{ name: 'RAM', start: 0x0, size: 0xc000, 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: 'Character Set', start: 0xe000, size: 0x400, type: 'rom' },
|
|
{ name: 'ROM', start: 0xe400, size: 0x1c00, type: 'rom' },
|
|
] };
|
|
const Atari5200_MemoryMap = { 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' },
|
|
] };
|
|
class Atari800Platform extends baseplatform_1.Base6502MachinePlatform {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.getToolForFilename = toolselect_1.getToolForFilename_atari8;
|
|
this.showHelp = atari8_showHelp;
|
|
this.getROMExtension = atari8_getROMExtension;
|
|
this.biosPath = 'res/atari8/altirra/kernel.rom';
|
|
}
|
|
newMachine() { return new atari8_1.Atari800(); }
|
|
getPresets() { return Atari800_PRESETS; }
|
|
getDefaultExtensions() { return [...super.getDefaultExtensions(), ".bas"]; }
|
|
readAddress(a) { return this.machine.readConst(a); }
|
|
getMemoryMap() { return Atari800_MemoryMap; }
|
|
async start() {
|
|
let bios = await this.loadKernel();
|
|
await super.start();
|
|
this.machine.loadBIOS(bios);
|
|
}
|
|
async loadKernel() {
|
|
var biosResponse = await fetch(this.biosPath);
|
|
if (biosResponse.status == 200 || biosResponse.size) {
|
|
var biosBinary = await biosResponse.arrayBuffer();
|
|
return new Uint8Array(biosBinary);
|
|
}
|
|
else
|
|
throw new Error('could not load BIOS file');
|
|
}
|
|
getDebugTree() {
|
|
let tree = super.getDebugTree();
|
|
tree['display_list'] = this.machine.getDebugDisplayList();
|
|
return tree;
|
|
}
|
|
}
|
|
class Atari5200Platform extends Atari800Platform {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.biosPath = 'res/atari8/altirra/superkernel.rom';
|
|
}
|
|
getPresets() { return Atari8_PRESETS; }
|
|
newMachine() { return new atari8_1.Atari5200(); }
|
|
getMemoryMap() { return Atari5200_MemoryMap; }
|
|
}
|
|
/// MAME support
|
|
class Atari8MAMEPlatform extends mameplatform_1.BaseMAME6502Platform {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.getToolForFilename = toolselect_1.getToolForFilename_atari8;
|
|
this.getOpcodeMetadata = baseplatform_1.getOpcodeMetadata_6502;
|
|
this.showHelp = atari8_showHelp;
|
|
}
|
|
getPresets() { return Atari8_PRESETS; }
|
|
getDefaultExtensions() { return [".c", ".bas", ".cpp", ".acme", ".xa", ".ca65", ".dasm", ".ecs", ".wiz"]; }
|
|
}
|
|
class Atari800MAMEPlatform extends Atari8MAMEPlatform {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.getMemoryMap = function () { return Atari800_MemoryMap; };
|
|
}
|
|
// MAME loads cartridge ROMs; oscar64's atari target emits an XEX image, so it
|
|
// only works on the native platform.
|
|
getPresets() { return Atari800_PRESETS.filter(p => !p.id.endsWith('.cpp')); }
|
|
loadROM(title, data) {
|
|
if (!this.started) {
|
|
this.startModule(this.mainElement, {
|
|
jsfile: 'mame8bitws.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() {
|
|
}
|
|
}
|
|
class Atari5200MAMEPlatform extends Atari8MAMEPlatform {
|
|
loadROM(title, data) {
|
|
if (!this.started) {
|
|
this.startModule(this.mainElement, {
|
|
jsfile: 'mame8bitws.js',
|
|
biosfile: 'a5200/5200.rom',
|
|
cfgfile: 'a5200.cfg',
|
|
driver: 'a5200',
|
|
width: 336 * 2,
|
|
height: 225 * 2,
|
|
romfn: '/emulator/cart.rom',
|
|
romdata: new Uint8Array(data),
|
|
romsize: 0x8000,
|
|
preInit: function (_self) {
|
|
},
|
|
});
|
|
}
|
|
else {
|
|
this.loadROMFile(data);
|
|
this.loadRegion(":cartleft:cart:rom", data);
|
|
}
|
|
}
|
|
start() {
|
|
}
|
|
getMemoryMap() { return Atari5200_MemoryMap; }
|
|
}
|
|
function atari8_getROMExtension(rom) {
|
|
if (rom == null)
|
|
return ".bin";
|
|
if (rom[0] == 0x96 && rom[1] == 0x02)
|
|
return ".atr";
|
|
if (rom[0] == 0xff && rom[1] == 0xff)
|
|
return ".xex";
|
|
else
|
|
return ".rom";
|
|
}
|
|
function atari8_showHelp() {
|
|
return "https://8bitworkshop.com/docs/platforms/atari8/";
|
|
}
|
|
///
|
|
emu_1.PLATFORMS['atari8-800.xlmame'] = Atari800MAMEPlatform;
|
|
emu_1.PLATFORMS['atari8-5200.mame'] = Atari5200MAMEPlatform;
|
|
emu_1.PLATFORMS['atari8-800'] = Atari800Platform;
|
|
emu_1.PLATFORMS['atari8-5200'] = Atari5200Platform;
|
|
//# sourceMappingURL=atari8.js.map
|