mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-04 13:34:27 +00:00
added cycles to z80 asm
This commit is contained in:
parent
e9da7aac4a
commit
a7b97ce4e1
@ -244,8 +244,10 @@ export class SourceEditor implements ProjectView {
|
||||
this.setGutter("gutter-bytes", info.line-1, insnstr);
|
||||
if (info.iscode) {
|
||||
// TODO: labels trick this part?
|
||||
var opcode = parseInt(info.insns.split(" ")[0], 16);
|
||||
if (platform.getOpcodeMetadata) {
|
||||
if (info.cycles) {
|
||||
this.setGutter("gutter-clock", info.line-1, info.cycles+"");
|
||||
} else if (platform.getOpcodeMetadata) {
|
||||
var opcode = parseInt(info.insns.split(" ")[0], 16);
|
||||
var meta = platform.getOpcodeMetadata(opcode, info.offset);
|
||||
var clockstr = meta.minCycles+"";
|
||||
this.setGutter("gutter-clock", info.line-1, clockstr);
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
import { WorkerResult, WorkerFileUpdate, WorkerBuildStep, WorkerMessage, WorkerError, Dependency } from "../workertypes";
|
||||
import { WorkerResult, WorkerFileUpdate, WorkerBuildStep, WorkerMessage, WorkerError, Dependency, SourceLine } from "../workertypes";
|
||||
|
||||
const emglobal : any = this['window'] || this['global'] || this;
|
||||
declare var WebAssembly;
|
||||
@ -598,19 +598,23 @@ function extractErrors(regex, strings:string[], path:string, iline, imsg, ifilen
|
||||
|
||||
var re_crlf = /\r?\n/;
|
||||
|
||||
function parseListing(code:string, lineMatch, iline:number, ioffset:number, iinsns:number) {
|
||||
var lines = [];
|
||||
function parseListing(code:string, lineMatch, iline:number, ioffset:number, iinsns:number, icycles?:number) : SourceLine[] {
|
||||
var lines : SourceLine[] = [];
|
||||
for (var line of code.split(re_crlf)) {
|
||||
var linem = lineMatch.exec(line);
|
||||
if (linem && linem[1]) {
|
||||
var linenum = parseInt(linem[iline]);
|
||||
var offset = parseInt(linem[ioffset], 16);
|
||||
var insns = linem[iinsns];
|
||||
var cycles : number = icycles ? parseInt(linem[icycles]) : null;
|
||||
var iscode = cycles > 0;
|
||||
if (insns) {
|
||||
lines.push({
|
||||
line:linenum,
|
||||
offset:offset,
|
||||
insns:insns,
|
||||
cycles:cycles,
|
||||
iscode:iscode
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1285,7 +1289,7 @@ function linkSDLDZ80(step:BuildStep)
|
||||
if (fn.endsWith('.lst')) {
|
||||
var rstout = FS.readFile(fn.replace('.lst','.rst'), {encoding:'utf8'});
|
||||
// 0000 21 02 00 [10] 52 ld hl, #2
|
||||
var asmlines = parseListing(rstout, /^\s*([0-9A-F]{4})\s+([0-9A-F][0-9A-F r]*[0-9A-F])\s+(\[[0-9 ]+\])?\s+(\d+) (.*)/i, 4, 1, 2);
|
||||
var asmlines = parseListing(rstout, /^\s*([0-9A-F]{4})\s+([0-9A-F][0-9A-F r]*[0-9A-F])\s+\[([0-9 ]+)\]?\s+(\d+) (.*)/i, 4, 1, 2, 3);
|
||||
var srclines = parseSourceLines(rstout, /^\s+\d+ ;<stdin>:(\d+):/i, /^\s*([0-9A-F]{4})/i);
|
||||
putWorkFile(fn, rstout);
|
||||
// TODO: you have to get rid of all source lines to get asm listing
|
||||
|
@ -6,6 +6,7 @@ export interface SourceLine {
|
||||
line:number;
|
||||
insns?:string;
|
||||
iscode?:boolean;
|
||||
cycles?:number;
|
||||
}
|
||||
|
||||
export class SourceFile {
|
||||
|
Loading…
x
Reference in New Issue
Block a user