mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-04-20 15:16:38 +00:00
added libcv/libcvu for coleco
This commit is contained in:
+10
-3
@@ -873,6 +873,7 @@ var BaseMAMEPlatform = function() {
|
||||
var romdata;
|
||||
var video;
|
||||
var preload_files;
|
||||
var running = false;
|
||||
|
||||
this.luacall = function(s) {
|
||||
//console.log(s);
|
||||
@@ -884,11 +885,17 @@ var BaseMAMEPlatform = function() {
|
||||
}
|
||||
|
||||
this.pause = function() {
|
||||
if (loaded) this.luacall('emu.pause()');
|
||||
if (loaded && running) {
|
||||
this.luacall('emu.pause()');
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.resume = function() {
|
||||
if (loaded) this.luacall('emu.unpause()');
|
||||
if (loaded && !running) {
|
||||
this.luacall('emu.unpause()');
|
||||
running = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.reset = function() {
|
||||
@@ -896,7 +903,7 @@ var BaseMAMEPlatform = function() {
|
||||
}
|
||||
|
||||
this.isRunning = function() {
|
||||
// TODO
|
||||
return running;
|
||||
}
|
||||
|
||||
this.startModule = function(mainElement, opts) {
|
||||
|
||||
+11
-1
@@ -5,11 +5,21 @@
|
||||
// http://www.kernelcrash.com/blog/recreating-the-colecovision/2016/01/27/
|
||||
// http://www.atarihq.com/danb/files/CV-Tech.txt
|
||||
// http://www.colecoboxart.com/faq/FAQ05.htm
|
||||
// http://www.theadamresource.com/manuals/technical/Jeffcoleco.html
|
||||
// http://bifi.msxnet.org/msxnet//tech/tms9918a.txt
|
||||
// http://www.colecovision.dk/tools.htm?refreshed
|
||||
|
||||
var ColecoVision_PRESETS = [
|
||||
{id:'minimal.c', name:'Minimal Example'},
|
||||
{id:'text.c', name:'Text Mode'},
|
||||
{id:'hello.c', name:'Scrolling Text'},
|
||||
{id:'text32.c', name:'32-Column Text'},
|
||||
{id:'stars.c', name:'Scrolling Starfield'},
|
||||
{id:'cursorsmooth.c', name:'Moving Cursor'},
|
||||
{id:'simplemusic.c', name:'Simple Music'},
|
||||
{id:'siegegame.c', name:'Siege Game'},
|
||||
];
|
||||
|
||||
// doesn't work, use MAME
|
||||
var ColecoVisionPlatform = function(mainElement) {
|
||||
var self = this;
|
||||
this.__proto__ = new BaseZ80Platform();
|
||||
|
||||
@@ -398,6 +398,7 @@ function setCompileOutput(data) {
|
||||
addr2symbol = invertMap(symbolmap);
|
||||
addr2symbol[0x10000] = '__END__';
|
||||
compparams = data.params;
|
||||
updatePreset(current_preset_id, editor.getValue()); // update persisted entry
|
||||
// errors?
|
||||
function addErrorMarker(line, msg) {
|
||||
var div = document.createElement("div");
|
||||
@@ -422,7 +423,6 @@ function setCompileOutput(data) {
|
||||
}
|
||||
current_output = null;
|
||||
} else {
|
||||
updatePreset(current_preset_id, editor.getValue()); // update persisted entry
|
||||
// load ROM
|
||||
var rom = data.output;
|
||||
var rom_changed = rom && !arrayCompare(rom, current_output);
|
||||
@@ -1112,18 +1112,28 @@ function showBookLink() {
|
||||
}
|
||||
|
||||
function addPageFocusHandlers() {
|
||||
var hidden = false;
|
||||
document.addEventListener("visibilitychange", function() {
|
||||
if (document.visibilityState == 'hidden')
|
||||
if (document.visibilityState == 'hidden' && platform.isRunning()) {
|
||||
platform.pause();
|
||||
else if (document.visibilityState == 'visible')
|
||||
hidden = true;
|
||||
} else if (document.visibilityState == 'visible' && hidden) {
|
||||
platform.resume();
|
||||
hidden = false;
|
||||
}
|
||||
});
|
||||
$(window).on("focus", function() {
|
||||
if (hidden) {
|
||||
platform.resume();
|
||||
hidden = false;
|
||||
}
|
||||
});
|
||||
$(window).on("blur", function() {
|
||||
if (platform.isRunning()) {
|
||||
platform.pause();
|
||||
hidden = true;
|
||||
}
|
||||
});
|
||||
window.onfocus = function() {
|
||||
platform.resume();
|
||||
};
|
||||
window.onblur = function() {
|
||||
platform.pause();
|
||||
};
|
||||
}
|
||||
|
||||
function startPlatform() {
|
||||
|
||||
+23025
-2856
File diff suppressed because it is too large
Load Diff
+11
-2
@@ -85,8 +85,10 @@ Module.expectedDataFileDownloads++;
|
||||
console.error('package error:', error);
|
||||
};
|
||||
|
||||
var fetched = null, fetchedCallback = null;
|
||||
fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
|
||||
var fetchedCallback = null;
|
||||
var fetched = Module['getPreloadedPackage'] ? Module['getPreloadedPackage'](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) : null;
|
||||
|
||||
if (!fetched) fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
|
||||
if (fetchedCallback) {
|
||||
fetchedCallback(data);
|
||||
fetchedCallback = null;
|
||||
@@ -101,6 +103,7 @@ Module.expectedDataFileDownloads++;
|
||||
if (!check) throw msg + new Error().stack;
|
||||
}
|
||||
Module['FS_createPath']('/', 'include', true, true);
|
||||
Module['FS_createPath']('/include', 'pic16', true, true);
|
||||
Module['FS_createPath']('/include', 'ds390', true, true);
|
||||
Module['FS_createPath']('/include', 'asm', true, true);
|
||||
Module['FS_createPath']('/include/asm', 'default', true, true);
|
||||
@@ -115,12 +118,18 @@ Module['FS_createPath']('/include/asm', 'pic14', true, true);
|
||||
Module['FS_createPath']('/include/asm', 'gbz80', true, true);
|
||||
Module['FS_createPath']('/include/asm', 'r2k', true, true);
|
||||
Module['FS_createPath']('/include/asm', 'z80', true, true);
|
||||
Module['FS_createPath']('/include', 'xa51', true, true);
|
||||
Module['FS_createPath']('/include', 'mcs51', true, true);
|
||||
Module['FS_createPath']('/include', 'hc08', true, true);
|
||||
Module['FS_createPath']('/include', 'z180', true, true);
|
||||
Module['FS_createPath']('/include', 'pic14', true, true);
|
||||
Module['FS_createPath']('/include', 'ds400', true, true);
|
||||
Module['FS_createPath']('/', 'lib', true, true);
|
||||
Module['FS_createPath']('/lib', 'z80', true, true);
|
||||
Module['FS_createPath']('/lib', 'libcv', true, true);
|
||||
Module['FS_createPath']('/lib', 'libcvu', true, true);
|
||||
Module['FS_createPath']('/include', 'libcv', true, true);
|
||||
Module['FS_createPath']('/include', 'libcvu', true, true);
|
||||
|
||||
function DataRequest(start, end, crunched, audio) {
|
||||
this.start = start;
|
||||
|
||||
File diff suppressed because one or more lines are too long
+46
-24
@@ -3,66 +3,69 @@
|
||||
var PLATFORM_PARAMS = {
|
||||
'mw8080bw': {
|
||||
code_start: 0x0,
|
||||
code_size: 0x2000,
|
||||
rom_size: 0x2000,
|
||||
data_start: 0x2000,
|
||||
data_size: 0x400,
|
||||
stack_end: 0x2400,
|
||||
},
|
||||
'vicdual': {
|
||||
code_start: 0x0,
|
||||
code_size: 0x4020,
|
||||
rom_size: 0x4020,
|
||||
data_start: 0xe400,
|
||||
data_size: 0x400,
|
||||
stack_end: 0xe800,
|
||||
},
|
||||
'galaxian': {
|
||||
code_start: 0x0,
|
||||
code_size: 0x4000,
|
||||
rom_size: 0x4000,
|
||||
data_start: 0x4000,
|
||||
data_size: 0x400,
|
||||
stack_end: 0x4800,
|
||||
},
|
||||
'galaxian-scramble': {
|
||||
code_start: 0x0,
|
||||
code_size: 0x5020,
|
||||
rom_size: 0x5020,
|
||||
data_start: 0x4000,
|
||||
data_size: 0x400,
|
||||
stack_end: 0x4800,
|
||||
},
|
||||
'williams-z80': {
|
||||
code_start: 0x0,
|
||||
code_size: 0x9800,
|
||||
rom_size: 0x9800,
|
||||
data_start: 0x9800,
|
||||
data_size: 0x2800,
|
||||
stack_end: 0xc000,
|
||||
},
|
||||
'vector-z80color': {
|
||||
code_start: 0x0,
|
||||
code_size: 0x8000,
|
||||
rom_size: 0x8000,
|
||||
data_start: 0xe000,
|
||||
data_size: 0x2000,
|
||||
stack_end: 0x0,
|
||||
},
|
||||
'sound_williams-z80': {
|
||||
code_start: 0x0,
|
||||
code_size: 0x4000,
|
||||
rom_size: 0x4000,
|
||||
data_start: 0x4000,
|
||||
data_size: 0x400,
|
||||
stack_end: 0x8000,
|
||||
},
|
||||
'base_z80': {
|
||||
code_start: 0x0,
|
||||
code_size: 0x8000,
|
||||
rom_size: 0x8000,
|
||||
data_start: 0x8000,
|
||||
data_size: 0x8000,
|
||||
stack_end: 0x0,
|
||||
},
|
||||
'coleco': {
|
||||
code_start: 0x8000,
|
||||
code_size: 0x8000,
|
||||
data_start: 0x6000,
|
||||
rom_start: 0x8000,
|
||||
code_start: 0x8100,
|
||||
rom_size: 0x8000,
|
||||
data_start: 0x7000,
|
||||
data_size: 0x400,
|
||||
stack_end: 0x8000,
|
||||
extra_preproc_args: ['-I', '/share/include/libcv', '-I', '/share/include/libcvu'],
|
||||
extra_link_args: ['-k', '/share/lib/libcv', '-l', 'libcv', '-k', '/share/lib/libcvu', '-l', 'libcvu', '/share/lib/libcv/crt0.rel', 'main.rel'],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -631,13 +634,13 @@ function hexToArray(s, ofs) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
function parseIHX(ihx, code_start, code_size) {
|
||||
var output = new Uint8Array(new ArrayBuffer(code_size));
|
||||
function parseIHX(ihx, rom_start, rom_size) {
|
||||
var output = new Uint8Array(new ArrayBuffer(rom_size));
|
||||
for (var s of ihx.split("\n")) {
|
||||
if (s[0] == ':') {
|
||||
var arr = hexToArray(s, 1);
|
||||
var count = arr[0];
|
||||
var address = (arr[1]<<8) + arr[2] - code_start;
|
||||
var address = (arr[1]<<8) + arr[2] - rom_start;
|
||||
var rectype = arr[3];
|
||||
if (rectype == 0) {
|
||||
for (var i=0; i<count; i++) {
|
||||
@@ -699,6 +702,7 @@ function assemblelinkSDASZ80(code, platform) {
|
||||
});
|
||||
}
|
||||
}
|
||||
var updateListing = !params.extra_link_args;
|
||||
var LDZ80 = sdldz80({
|
||||
noInitialRun:true,
|
||||
//logReadFiles:true,
|
||||
@@ -708,16 +712,24 @@ function assemblelinkSDASZ80(code, platform) {
|
||||
var FS = LDZ80['FS'];
|
||||
setupFS(FS, 'sdcc');
|
||||
FS.writeFile("main.rel", objout, {encoding:'utf8'});
|
||||
FS.writeFile("main.lst", lstout, {encoding:'utf8'});
|
||||
LDZ80.callMain(['-mjwxyu', '-i', 'main.ihx',
|
||||
if (updateListing) {
|
||||
FS.writeFile("main.lst", lstout, {encoding:'utf8'});
|
||||
}
|
||||
var args = ['-mjwxy'+(updateListing?'u':''),
|
||||
'-i', 'main.ihx',
|
||||
'-b', '_CODE=0x'+params.code_start.toString(16),
|
||||
'-b', '_DATA=0x'+params.data_start.toString(16),
|
||||
'-k', '/share/lib/z80',
|
||||
'-l', 'z80',
|
||||
'main.rel']);
|
||||
'-l', 'z80'];
|
||||
if (params.extra_link_args) {
|
||||
args.push.apply(args, params.extra_link_args);
|
||||
} else {
|
||||
args.push('main.rel');
|
||||
}
|
||||
LDZ80.callMain(args);
|
||||
var hexout = FS.readFile("main.ihx", {encoding:'utf8'});
|
||||
var mapout = FS.readFile("main.noi", {encoding:'utf8'});
|
||||
var rstout = FS.readFile("main.rst", {encoding:'utf8'});
|
||||
var rstout = updateListing ? FS.readFile("main.rst", {encoding:'utf8'}) : lstout;
|
||||
//var dbgout = FS.readFile("main.cdb", {encoding:'utf8'});
|
||||
// 0000 21 02 00 [10] 52 ld hl, #2
|
||||
// TODO: offset by start address?
|
||||
@@ -732,7 +744,7 @@ function assemblelinkSDASZ80(code, platform) {
|
||||
}
|
||||
}
|
||||
return {
|
||||
output:parseIHX(hexout, params.code_start, params.code_size),
|
||||
output:parseIHX(hexout, params.rom_start?params.rom_start:params.code_start, params.rom_size),
|
||||
lines:asmlines,
|
||||
srclines:srclines,
|
||||
errors:msvc_errors, // TODO?
|
||||
@@ -765,7 +777,7 @@ function compileSDCC(code, platform) {
|
||||
//FS.writeFile("main.c", code, {encoding:'utf8'});
|
||||
msvc_errors = [];
|
||||
var t1 = new Date();
|
||||
SDCC.callMain(['--vc', '--std-sdcc99', '-mz80', //'-Wall',
|
||||
var args = ['--vc', '--std-sdcc99', '-mz80', //'-Wall',
|
||||
'--c1mode', // '--debug',
|
||||
//'-S', 'main.c',
|
||||
//'--asm=z80asm',
|
||||
@@ -775,7 +787,11 @@ function compileSDCC(code, platform) {
|
||||
'--oldralloc', // TODO: does this make it fater?
|
||||
//'--cyclomatic',
|
||||
//'--nooverlay','--nogcse','--nolabelopt','--noinvariant','--noinduction','--nojtbound','--noloopreverse','--no-peep','--nolospre',
|
||||
'-o', 'main.asm']);
|
||||
'-o', 'main.asm'];
|
||||
if (params.extra_compile_args) {
|
||||
args.push.apply(args, params.extra_compile_args);
|
||||
}
|
||||
SDCC.callMain(args);
|
||||
var t2 = new Date();
|
||||
//console.profileEnd();
|
||||
//console.log(t2.getTime() - t1.getTime());
|
||||
@@ -861,6 +877,8 @@ function assembleXASM6809(code, platform) {
|
||||
|
||||
function preprocessMCPP(code, platform) {
|
||||
load("mcpp");
|
||||
var params = PLATFORM_PARAMS[platform];
|
||||
if (!params) throw Error("Platform not supported: " + platform);
|
||||
// <stdin>:2: error: Can't open include file "foo.h"
|
||||
var errors = [];
|
||||
var match_fn = makeErrorMatcher(errors, /<stdin>:(\d+): (.+)/, 1, 2);
|
||||
@@ -873,13 +891,17 @@ function preprocessMCPP(code, platform) {
|
||||
var FS = MCPP['FS'];
|
||||
setupFS(FS, 'sdcc');
|
||||
FS.writeFile("main.c", code, {encoding:'utf8'});
|
||||
MCPP.callMain([
|
||||
var args = [
|
||||
"-D", "__8BITWORKSHOP__",
|
||||
"-D", platform.toUpperCase().replace('-','_'),
|
||||
"-D", "__SDCC_z80",
|
||||
"-I", "/share/include",
|
||||
"-Q",
|
||||
"main.c", "main.i"]);
|
||||
"main.c", "main.i"];
|
||||
if (params.extra_preproc_args) {
|
||||
args.push.apply(args, params.extra_preproc_args);
|
||||
}
|
||||
MCPP.callMain(args);
|
||||
try {
|
||||
var iout = FS.readFile("main.i", {encoding:'utf8'});
|
||||
iout = iout.replace(/^#line /gm,'\n# ');
|
||||
|
||||
Reference in New Issue
Block a user