diff --git a/src/ide/project.ts b/src/ide/project.ts index 19692c74..fb7b1aa1 100644 --- a/src/ide/project.ts +++ b/src/ide/project.ts @@ -92,9 +92,9 @@ export class CodeProject { this.pushAllFiles(files, m[1]); } } else { - // for .asm -- [.]include "file" + // for .asm -- [.%]include "file" // for .c -- #include "file" - let re2 = /^\s*[.#]?(include|incbin)\s+"(.+?)"/gmi; + let re2 = /^\s*[.#%]?(include|incbin)\s+"(.+?)"/gmi; while (m = re2.exec(text)) { this.pushAllFiles(files, m[2]); } diff --git a/src/platform/x86.ts b/src/platform/x86.ts index a7213b3f..f2b09304 100644 --- a/src/platform/x86.ts +++ b/src/platform/x86.ts @@ -52,8 +52,9 @@ class FATFSArrayBufferDriver { class X86PCPlatform implements Platform { - mainElement; - video; + mainElement : HTMLElement; + video : RasterVideo; + console_div : HTMLElement; emulator; v86; @@ -99,10 +100,13 @@ class X86PCPlatform implements Platform { this.video = new RasterVideo(this.mainElement,640,480,{overscan:false}); this.video.create(); + var div = document.createElement('div'); div.classList.add('pc-console'); div.classList.add('emuvideo'); this.mainElement.appendChild(div); + this.console_div = div; + this.resize(); // set font size this.emulator = new V86Starter({ memory_size: 2 * 1024 * 1024, @@ -133,6 +137,12 @@ class X86PCPlatform implements Platform { }); } + resize() { + // set font size proportional to window width + var charwidth = $(this.console_div).width() * 1.7 / 80; + $(this.console_div).css('font-size', charwidth+'px'); + } + getDebugTree() { return this.v86; } diff --git a/src/platform/zmachine.ts b/src/platform/zmachine.ts index 2602f68c..86eee7ba 100644 --- a/src/platform/zmachine.ts +++ b/src/platform/zmachine.ts @@ -46,7 +46,7 @@ interface IFZVM { class GlkWindow { page: HTMLElement; stream: number; - + curline: HTMLElement; curstyle: number; reverse: boolean; @@ -102,8 +102,8 @@ class GlkWindow { move_cursor(col, row) { // TODO if (row == this.row && col > this.col) { - for (var i=this.col; i { inputline.focus(); }); + this.resize = () => { + // set font size proportional to window width + var charwidth = $(gameport).width() * 1.6 / STATUS_NUM_COLS; + $(upperwnd).css('font-size', charwidth + 'px'); + } + this.resize(); } + resize : () => void; + loadROM(title, data) { this.zfile = data; this.reset(); diff --git a/src/worker/workermain.ts b/src/worker/workermain.ts index 1dd737e0..7ddd9ff4 100644 --- a/src/worker/workermain.ts +++ b/src/worker/workermain.ts @@ -614,9 +614,12 @@ function extractErrors(regex, strings:string[], path:string, iline, imsg, ifilen // TODO: "of" doesn't work in MSIE var re_crlf = /\r?\n/; +// 1 %line 16+1 hello.asm +var re_lineoffset = /\s*(\d+)\s+[%]line\s+(\d+)\+(\d+)\s+(.+)/; function parseListing(code:string, lineMatch, iline:number, ioffset:number, iinsns:number, icycles?:number) : SourceLine[] { var lines : SourceLine[] = []; + var lineofs = 0; code.split(re_crlf).forEach((line, lineindex) => { var linem = lineMatch.exec(line); if (linem && linem[1]) { @@ -627,13 +630,19 @@ function parseListing(code:string, lineMatch, iline:number, ioffset:number, iins var iscode = cycles > 0; if (insns) { lines.push({ - line:linenum, + line:linenum + lineofs, offset:offset, insns:insns, cycles:cycles, iscode:iscode }); } + } else { + let m = re_lineoffset.exec(line); + // TODO: check filename too + if (m) { + lineofs = parseInt(m[2]) - parseInt(m[1]) - parseInt(m[3]); + } } }); return lines;