diff --git a/doc/notes.txt b/doc/notes.txt index 7b3518c0..9c721d5a 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -106,7 +106,6 @@ TODO: - debug highlight doesn't go away when debugging -> running - show breakpoint of PC or highest address on stack - can we highlight line instead of select? -- replay doesn't work for nes (force background tile redraw) - running profiler while replaying? grand unified replay? - click on profiler to step to position - breakpoints stop profiler from running @@ -126,7 +125,10 @@ TODO: - single-stepping vector games makes screen fade - break on stack overflow, bad op, bad access, etc - PPU/TIA register write visualization -- nes debug view toolbar +- nes + - replay doesn't work for nes (force background tile redraw) + - nes debug view toolbar + - support NES_HEADER_16K? - vcs sound continues when paused - upload multiple files/zip file to subdirectory - allow "include graphics.asm" instead of "include project/graphics.asm" @@ -153,6 +155,8 @@ TODO: - build ca65 projects? https://github.com/pinobatch/thwaite-nes/blob/master/makefile - switching platform of a repo? - retaining repo_id in localstorage? + - don't like alert() after pushing + - should have a preview of commit WEB WORKER FORMAT @@ -288,3 +292,13 @@ Pull Push Git metadata kept in local storage + +Converting from NESASM to DASM + +- subroutine keyword on labels +- [zp],y to (zp),y +- asl a -> asl +- LOW(x) and HIGH(x) to <() and >() +- .db to .byte, .dw to .word +- use NES_HEADER macros +- no .bank diff --git a/src/platform/nes.ts b/src/platform/nes.ts index ecca5f58..34cd5416 100644 --- a/src/platform/nes.ts +++ b/src/platform/nes.ts @@ -374,6 +374,10 @@ class JSNESPlatform extends Base6502Platform implements Platform { s += "\n"; return s; } + getToolForFilename = (fn:string) : string => { + if (fn.endsWith(".asm")) return "ca65"; // .asm uses ca65 + else return getToolForFilename_6502(fn); + } } /// MAME support @@ -407,8 +411,8 @@ class NESMAMEPlatform extends BaseMAMEPlatform implements Platform { } getPresets() { return JSNES_PRESETS; } - getOpcodeMetadata = getOpcodeMetadata_6502; getToolForFilename = getToolForFilename_6502; + getOpcodeMetadata = getOpcodeMetadata_6502; getDefaultExtension() { return ".c"; }; } diff --git a/src/worker/workermain.ts b/src/worker/workermain.ts index 3dcd49f7..4f507b16 100644 --- a/src/worker/workermain.ts +++ b/src/worker/workermain.ts @@ -645,6 +645,7 @@ function parseSourceLines(code:string, lineMatch, offsetMatch) { } function parseDASMListing(code:string, unresolved:{}, mainFilename:string) { + // TODO: this gets very slow // 4 08ee a9 00 start lda #01workermain.js:23:5 var lineMatch = /\s*(\d+)\s+(\S+)\s+([0-9a-f]+)\s+([?0-9a-f][?0-9a-f ]+)?\s+(.+)?/i; var equMatch = /\bequ\b/i; @@ -702,13 +703,17 @@ function parseDASMListing(code:string, unresolved:{}, mainFilename:string) { // TODO: better symbol test (word boundaries) // TODO: ignore IFCONST and IFNCONST usage for (var key in unresolved) { - var pos = restline ? restline.indexOf(key) : line.indexOf(key); + var l = restline || line; + var pos = l.indexOf(key); if (pos >= 0) { - errors.push({ - path:filename, - line:linenum, - msg:"Unresolved symbol '" + key + "'" - }); + var cmt = l.indexOf(';'); + if (cmt < 0 || cmt > pos) { + errors.push({ + path:filename, + line:linenum, + msg:"Unresolved symbol '" + key + "'" + }); + } } } } diff --git a/test/cli/testworker.js b/test/cli/testworker.js index dccb81c3..23c531df 100644 --- a/test/cli/testworker.js +++ b/test/cli/testworker.js @@ -81,7 +81,7 @@ describe('Worker', function() { compile('dasm', '\tprocessor 6502\n\torg $f000\nfoo lda #0\n', 'vcs', done, 2, 1); }); it('should NOT assemble DASM', function(done) { - compile('dasm', '\tprocessor 6502\n\torg $f000\nfoo xxx #0\n', 'vcs', done, 0, 0, 1); + compile('dasm', '\tprocessor 6502\n\torg $f000 ; this is a comment\nfoo asl a\n', 'vcs', done, 0, 0, 1); }); /* it('should assemble ACME', function(done) {