mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-22 14:33:51 +00:00
trying to get MAME debugging and WASM working to no avail
This commit is contained in:
parent
8d7ffa3c12
commit
00d6b8aefa
@ -2,7 +2,7 @@
|
||||
rm -fr /tmp/boost
|
||||
mkdir /tmp/boost
|
||||
cd /tmp/boost
|
||||
tar xjf ~/PuzzlingPlans/8bitworkshop/emsrc/sdcc/boost*
|
||||
tar xjf ~/PuzzlingPlans/8bitworkshop/emsrc/sdcc/boost*.bz2
|
||||
cd boost_1_63_0
|
||||
emconfigure ./bootstrap.sh
|
||||
emmake ./b2 install --prefix=/home/huggvey/emsdk-portable/emscripten/1.37.9/system --with-graph link=static variant=release threading=single runtime-link=static
|
||||
emmake ./b2 install --prefix=$EMSCRIPTEN/system --with-graph link=static variant=release threading=single runtime-link=static
|
||||
|
@ -45,7 +45,7 @@ emmake make
|
||||
|
||||
echo Making JS files...
|
||||
popd
|
||||
mkdir -p ./js
|
||||
mkdir -p ./js ./wasm
|
||||
cp /tmp/sdcc/sdcc/bin/sdcc js/sdcc.bc
|
||||
cp /tmp/sdcc/sdcc/bin/sdasz80 js/sdasz80.bc
|
||||
cp /tmp/sdcc/sdcc/bin/sdldz80 js/sdldz80.bc
|
||||
|
6
emsrc/sdcc/howto.txt
Normal file
6
emsrc/sdcc/howto.txt
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
1. Install Emscripten
|
||||
a. bash boost.sh
|
||||
2. Install texinfo
|
||||
3. cp Makefile.local and emcc-local.sh to ~/sdcc
|
||||
4. bash emcc-local.sh
|
16
src/emu.js
16
src/emu.js
@ -946,7 +946,7 @@ var BaseMAMEPlatform = function() {
|
||||
var script = document.createElement('script');
|
||||
window.JSMESS = {};
|
||||
window.Module = {
|
||||
arguments: [opts.driver, '-verbose', '-window', '-nokeepaspect', '-resolution', canvas.width+'x'+canvas.height, '-cart', romfn],
|
||||
arguments: [opts.driver, '-debug', '-verbose', '-window', '-nokeepaspect', '-resolution', canvas.width+'x'+canvas.height, '-cart', romfn],
|
||||
screenIsReadOnly: true,
|
||||
print: bufferConsoleOutput,
|
||||
canvas:video.canvas,
|
||||
@ -966,6 +966,7 @@ var BaseMAMEPlatform = function() {
|
||||
}
|
||||
FS.mkdir('/emulator');
|
||||
FS.writeFile(romfn, romdata, {encoding:'binary'});
|
||||
FS.writeFile('/debug.ini', 'debugger none\n', {encoding:'utf8'});
|
||||
if (opts.preInit) {
|
||||
opts.preInit(self);
|
||||
}
|
||||
@ -1042,8 +1043,21 @@ var BaseMAMEPlatform = function() {
|
||||
return parseInt(console_vars.v[0]);
|
||||
}
|
||||
|
||||
// DEBUGGING SUPPORT
|
||||
|
||||
var onBreakpointHit;
|
||||
|
||||
this.getDebugCallback = function() {
|
||||
// TODO
|
||||
}
|
||||
this.setupDebug = function(callback) {
|
||||
onBreakpointHit = callback;
|
||||
}
|
||||
this.step = function() {
|
||||
self.readAddress(0);
|
||||
//self.luacall('cpu.debug()\n')
|
||||
self.luacall('debugger = manager:machine().debugger()')
|
||||
self.luacall('print(debugger)') // TODO
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,13 +82,6 @@ var PLATFORM_PARAMS = {
|
||||
},
|
||||
};
|
||||
|
||||
var loaded = {}
|
||||
function load(modulename, debug) {
|
||||
if (!loaded[modulename]) {
|
||||
importScripts(modulename+(debug?"."+debug+".js":".js"));
|
||||
loaded[modulename] = 1;
|
||||
}
|
||||
}
|
||||
// shim out window and document objects for security
|
||||
// https://github.com/mbostock/d3/issues/1053
|
||||
var noop = function() { return new Function(); };
|
||||
@ -105,6 +98,7 @@ document.documentElement.style = noop();
|
||||
|
||||
var fsMeta = {};
|
||||
var fsBlob = {};
|
||||
var wasmBlob = {};
|
||||
|
||||
// load filesystems for CC65 and others asynchronously
|
||||
function loadFilesystem(name) {
|
||||
@ -121,6 +115,30 @@ function loadFilesystem(name) {
|
||||
console.log("Loaded "+name+" filesystem", fsMeta[name].files.length, 'files', fsBlob[name].size, 'bytes');
|
||||
}
|
||||
|
||||
var loaded = {}
|
||||
function load(modulename, debug) {
|
||||
if (!loaded[modulename]) {
|
||||
importScripts(modulename+(debug?"."+debug+".js":".js"));
|
||||
loaded[modulename] = 1;
|
||||
}
|
||||
}
|
||||
function loadWASM(modulename, debug) {
|
||||
if (!loaded[modulename]) {
|
||||
importScripts("wasm/" + modulename+(debug?"."+debug+".js":".js"));
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.open("GET", "wasm/"+modulename+".wasm", false); // synchronous request
|
||||
xhr.send(null);
|
||||
if (xhr.response) {
|
||||
wasmBlob[modulename] = xhr.response; //new Uint8Array(xhr.response);
|
||||
console.log("Loaded " + modulename + ".wasm");
|
||||
loaded[modulename] = 1;
|
||||
} else {
|
||||
throw Error("Could not load WASM file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ATARI_CFG =
|
||||
"FEATURES {\nSTARTADDRESS: default = $9000;\n}\n"
|
||||
+ "MEMORY {\n"
|
||||
@ -781,21 +799,31 @@ function assemblelinkSDASZ80(code, platform) {
|
||||
}
|
||||
}
|
||||
|
||||
var sdcc;
|
||||
function compileSDCC(code, platform) {
|
||||
var preproc = preprocessMCPP(code, platform);
|
||||
if (preproc.errors) return preproc;
|
||||
else code = preproc.code;
|
||||
|
||||
load("sdcc");
|
||||
//load("wasm/sdcc");
|
||||
//console.profile("sdcc");
|
||||
var params = PLATFORM_PARAMS[platform];
|
||||
if (!params) throw Error("Platform not supported: " + platform);
|
||||
|
||||
load("sdcc");
|
||||
//loadWASM("sdcc");
|
||||
//var wasmmod = new WebAssembly.Module(wasmBlob['sdcc']);
|
||||
//var wasminst = new WebAssembly.Instance(wasmmod);
|
||||
//var webasm = WebAssembly.instantiate(wasmBlob['sdcc']).then(foo => console.log(foo));
|
||||
var SDCC = sdcc({
|
||||
instantiateWasm: function(info, recv) {
|
||||
var inst = new WebAssembly.Instance(wasmmod, info);
|
||||
recv(inst);
|
||||
return true;
|
||||
},
|
||||
//wasmBinary: wasmBlob['sdcc'],
|
||||
noInitialRun:true,
|
||||
noFSInit:true,
|
||||
print:print_fn,
|
||||
printErr:match_msvc,
|
||||
printErr:match_msvc, // console.log
|
||||
TOTAL_MEMORY:256*1024*1024,
|
||||
});
|
||||
var FS = SDCC['FS'];
|
||||
|
Loading…
Reference in New Issue
Block a user