1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-21 23:30:58 +00:00

finished zmac asm (.z); fixed javatari submodule tag; upgraded tsc

This commit is contained in:
Steven Hugg 2018-08-28 13:59:12 -04:00
parent c7eaedf24b
commit 59469b41b8
6 changed files with 45 additions and 25 deletions

@ -1 +1 @@
Subproject commit 4cd5b798f534336d09a80e8a1fa962959f401359
Subproject commit bd17384fd2c6b020497e5e6a625a1b8130e39ea1

6
package-lock.json generated
View File

@ -1018,9 +1018,9 @@
}
},
"typescript": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz",
"integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==",
"dev": true
},
"uuid": {

View File

@ -13,7 +13,7 @@
"jsdom": "^12.0.0",
"lzg": "^1.0.0",
"mocha": "^5.2.0",
"typescript": "^2.9.2",
"typescript": "^3.0.1",
"wavedrom-cli": "^0.5.0"
},
"description": "8bitworkshop.com",

View File

@ -536,7 +536,7 @@ export function getToolForFilename_z80(fn) {
if (fn.endsWith(".s")) return "sdasz80";
if (fn.endsWith(".ns")) return "naken";
if (fn.endsWith(".scc")) return "sccz80";
if (fn.endsWith(".zmac")) return "zmac";
if (fn.endsWith(".z")) return "zmac";
return "zmac";
}

View File

@ -44,7 +44,8 @@ var TOOL_TO_SOURCE_STYLE = {
'sdasz80': 'z80',
'sdcc': 'text/x-csrc',
'verilator': 'verilog',
'jsasm': 'z80'
'jsasm': 'z80',
'zmac': 'z80',
}
function newWorker() : Worker {

View File

@ -452,10 +452,12 @@ function extractErrors(regex, strings, path) {
// TODO: "of" doesn't work in MSIE
function parseListing(code, lineMatch, iline, ioffset, iinsns, origin) {
var re_crlf = /\r?\n/;
function parseListing(code, lineMatch, iline, ioffset, iinsns) {
var lines = [];
origin |= 0;
for (var line of code.split(/\r?\n/)) {
for (var line of code.split(re_crlf)) {
var linem = lineMatch.exec(line);
if (linem && linem[1]) {
var linenum = parseInt(linem[iline]);
@ -477,7 +479,7 @@ function parseSourceLines(code, lineMatch, offsetMatch, origin) {
var lines = [];
var lastlinenum = 0;
origin |= 0;
for (var line of code.split(/\r?\n/)) {
for (var line of code.split(re_crlf)) {
var linem = lineMatch.exec(line);
if (linem && linem[1]) {
lastlinenum = parseInt(linem[1]);
@ -506,7 +508,7 @@ function parseDASMListing(code, unresolved, mainFilename) {
var macrolines = [];
var lastline = 0;
var macros = {};
for (var line of code.split(/\r?\n/)) {
for (var line of code.split(re_crlf)) {
var linem = lineMatch.exec(line);
if (linem && linem[1]) {
var linenum = parseInt(linem[1]);
@ -669,7 +671,7 @@ function parseCA65Listing(code, symbols, params, dbg) {
var insnLineMatch = /^([0-9A-F]+)([r]?)\s+(\d+)\s+([0-9A-F][0-9A-F ]*[0-9A-F])\s+/;
var lines = [];
var linenum = 0;
for (var line of code.split(/\r?\n/)) {
for (var line of code.split(re_crlf)) {
linenum++;
var segm = segLineMatch.exec(line);
if (segm) {
@ -892,6 +894,7 @@ function parseIHX(ihx, rom_start, rom_size) {
}
}
}
return output;
}
function assembleSDASZ80(step) {
@ -1361,12 +1364,13 @@ function compileYosys(step) {
function assembleZMAC(step) {
loadNative("zmac");
var objout, lstout, symout;
var hexout, lstout;
var errors = [];
var params = step.params;
gatherFiles(step, {mainFilePath:"main.asm"});
var binpath = "zout/" + step.prefix + ".cim";
var lstpath = "zout/" + step.prefix + ".lst";
if (staleFiles(step, [binpath, lstpath])) {
var hexpath = step.prefix + ".hex";
var lstpath = step.prefix + ".lst";
if (staleFiles(step, [hexpath, lstpath])) {
/*
error1.asm(4) : 'l18d4' Undeclared
JP L18D4
@ -1384,23 +1388,38 @@ error1.asm(11): warning: 'foobar' treated as label (instruction typo?)
});
var FS = ZMAC['FS'];
populateFiles(step, FS);
execMain(step, ZMAC, ['-z', '--oo', 'lst,cim', step.path]);
// TODO: don't know why CIM (hexary) doesn't work
execMain(step, ZMAC, ['-z', '--oo', 'lst,hex', step.path]);
if (errors.length) {
return {errors:errors};
}
objout = FS.readFile(binpath, {encoding:'utf8'});
lstout = FS.readFile(lstpath, {encoding:'utf8'});
putWorkFile(binpath, objout);
hexout = FS.readFile("zout/"+hexpath, {encoding:'utf8'});
lstout = FS.readFile("zout/"+lstpath, {encoding:'utf8'});
putWorkFile(hexpath, hexout);
putWorkFile(lstpath, lstout);
// 230: 1739+7 017A 1600 L017A: LD D,00h
var listing = parseListing(lstout, /\s*(\d+):\s*(\d+)[+](\d+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+(.+)/i, 1, 4, 5);
if (!anyTargetChanged(step, [hexpath, lstpath]))
return;
// 230: 1739+7+x 017A 1600 L017A: LD D,00h
var lines = parseListing(lstout, /\s*(\d+):\s*([0-9+]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+(.+)/i, 1, 3, 4);
var listings = {};
listings[lstpath] = listing;
listings[lstpath] = {lines:lines};
// parse symbol table
var symbolmap = {};
var sympos = lstout.indexOf('Symbol Table:');
if (sympos > 0) {
var symout = lstout.slice(sympos+14);
symout.split('\n').forEach(function(l) {
var m = l.match(/(\S+)\s+([= ]*)([0-9a-f]+)/i);
if (m) {
symbolmap[m[1]] = parseInt(m[3],16);
}
});
}
return {
output:binpath,
output:parseIHX(hexout, params.rom_start||params.code_start, params.rom_size),
listings:listings,
errors:errors,
//symbolmap:symbolmap
symbolmap:symbolmap
};
}
}