1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-26 10:49:17 +00:00

working on mame platforms

This commit is contained in:
Steven Hugg 2018-06-22 02:24:52 -04:00
parent 0b9194bd1c
commit 2fd40ce383
6 changed files with 119 additions and 34 deletions

View File

@ -973,14 +973,16 @@ var BaseMAMEPlatform = function() {
$(video.canvas).attr('id','canvas');
// load asm.js module
console.log("loading", opts.jsfile);
var modargs = [opts.driver,
'-debug',
'-debugger', 'none',
'-verbose', '-window', '-nokeepaspect',
'-resolution', canvas.width+'x'+canvas.height
];
if (romfn) modargs.push('-cart', romfn);
window.JSMESS = {};
window.Module = {
arguments: [opts.driver,
'-debug',
'-debugger', 'none',
'-verbose', '-window', '-nokeepaspect',
'-resolution', canvas.width+'x'+canvas.height,
'-cart', romfn],
arguments: modargs,
screenIsReadOnly: true,
print: bufferConsoleOutput,
canvas:video.canvas,

View File

@ -976,11 +976,11 @@ var Apple2MAMEPlatform = function(mainElement) {
this.start = function() {
self.startModule(mainElement, {
jsfile:'mameapple2e.js',
//biosfile:['apple2/'],
biosfile:['apple2e.zip'],
//cfgfile:'nes.cfg',
driver:'apple2e',
width:256*2,
height:240*2,
width:280*2,
height:192*2,
//romfn:'/emulator/cart.nes',
//romsize:romSize,
//romdata:new lzgmini().decode(lzgRom).slice(0, romSize),
@ -997,8 +997,7 @@ var Apple2MAMEPlatform = function(mainElement) {
this.loadROM = function(title, data) {
this.loadROMFile(data);
this.loadRegion(":nes_slot:cart:prg_rom", data.slice(0x10, 0x8010));
this.loadRegion(":nes_slot:cart:chr_rom", data.slice(0x8010, 0xa010));
// TODO
}
}

View File

@ -11,22 +11,6 @@ var Atari8MAMEPlatform = function(mainElement) {
var self = this;
this.__proto__ = new BaseMAMEPlatform();
//
this.start = function() {
self.startModule(mainElement, {
jsfile:'mameatari400.js',
biosfile:'a5200/5200.rom',
//cfgfile:'atari5200.cfg',
driver:'a5200',
width:336*2,
height:225*2,
romfn:'/emulator/cart.rom',
romsize:0x4000,
preInit:function(_self) {
},
});
}
this.loadROM = function(title, data) {
this.loadROMFile(data);
this.loadRegion(":cartleft:cart:rom", data);
@ -38,6 +22,48 @@ var Atari8MAMEPlatform = function(mainElement) {
this.getDefaultExtension = function() { return ".c"; };
}
var Atari800Platform = function(mainElement) {
var self = this;
this.__proto__ = new Atari8MAMEPlatform(mainElement);
this.start = function() {
self.startModule(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) {
},
});
}
}
var Atari5200Platform = function(mainElement) {
var self = this;
this.__proto__ = new Atari8MAMEPlatform(mainElement);
this.start = function() {
self.startModule(mainElement, {
jsfile:'mameatari400.js',
biosfile:'a5200/5200.rom',
//cfgfile:'atari5200.cfg',
driver:'a5200',
width:336*2,
height:225*2,
romfn:'/emulator/cart.rom',
romsize:0x2000,
preInit:function(_self) {
},
});
}
}
///
PLATFORMS['atari8-5200'] = Atari8MAMEPlatform;
PLATFORMS['atari8-800'] = Atari800Platform;
PLATFORMS['atari8-5200'] = Atari5200Platform;

42
src/platform/c64.js Normal file
View File

@ -0,0 +1,42 @@
"use strict";
var C64_PRESETS = [
{id:'hello.a', name:'Hello World (ASM)'},
{id:'hellopm.a', name:'Hello Sprites (ASM)'},
];
/// MAME support
var C64MAMEPlatform = function(mainElement) {
var self = this;
this.__proto__ = new BaseMAMEPlatform();
this.loadROM = function(title, data) {
this.loadROMFile(data);
this.loadRegion(":basic", data);
}
this.getPresets = function() { return C64_PRESETS; }
this.getToolForFilename = getToolForFilename_6502;
this.getDefaultExtension = function() { return ".c"; };
this.start = function() {
self.startModule(mainElement, {
jsfile:'mamec64.js',
biosfile:'c64.zip', // TODO: load multiple files
//cfgfile:'atari5200.cfg',
driver:'c64',
width:336*2,
height:225*2,
romfn:'/emulator/cart.rom',
romsize:0x2000,
preInit:function(_self) {
},
});
}
}
///
PLATFORMS['c64'] = C64MAMEPlatform;

View File

@ -866,7 +866,10 @@ function resetAndDebug() {
_resume();
platform.reset();
setupBreakpoint();
platform.runEval(function(c) { return true; });
if (platform.runEval)
platform.runEval(function(c) { return true; }); // break immediately
else
; // TODO???
} else {
platform.reset();
}

View File

@ -92,11 +92,23 @@ var PLATFORM_PARAMS = {
cfgfile: 'apple2.cfg',
libargs: ['apple2.lib'],
},
'atari8-800': {
define: '__ATARI__',
cfgfile: 'atari-cart.cfg',
libargs: ['atari.lib'],
code_offset: 0xa000, // TODO
},
'atari8-5200': {
define: '__ATARI5200__',
cfgfile: 'atari5200.cfg',
libargs: ['atari5200.lib'],
//code_offset: 0x803, // TODO
code_offset: 0x4000, // TODO
},
'c64': {
define: '__C64__',
cfgfile: 'c64.cfg',
libargs: ['c64.lib'],
code_offset: 0x4000, // TODO
},
'verilog': {
},
@ -583,6 +595,7 @@ function assemblelinkCA65(code, platform) {
objout = FS.readFile("main.o", {encoding:'binary'});
lstout = FS.readFile("main.lst", {encoding:'utf8'});
} catch (e) {
errors.push({line:1, msg:e+""});
return {errors:errors}; // TODO
}
if (errors.length)
@ -603,8 +616,8 @@ function assemblelinkCA65(code, platform) {
starttime();
LD65.callMain(['--cfg-path', '/share/cfg',
'--lib-path', '/share/lib',
'--lib-path', '/share/target/apple2/drv',
'-D', '__EXEHDR__=0',
'--lib-path', '/share/target/apple2/drv', // TODO
'-D', '__EXEHDR__=0', // TODO
'-C', params.cfgfile,
'-Ln', 'main.vice',
//'--dbgfile', 'main.dbg',
@ -618,7 +631,8 @@ function assemblelinkCA65(code, platform) {
var mapout = FS.readFile("main.map", {encoding:'utf8'});
var viceout = FS.readFile("main.vice", {encoding:'utf8'});
} catch (e) {
return {errors:errors};
errors.push({line:1, msg:e+""});
return {errors:errors}; // TODO
}
var listing = parseCA65Listing(lstout, mapout);
//console.log(lstout);
@ -1156,7 +1170,6 @@ function compileCASPR(code, platform, options) {
intermediate:{listing:miffile},
lines:[]};
} catch(e) {
console.log(e);
errors.push({line:0,msg:e.message});
return {errors:errors}; // TODO
}