1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-29 14:51:17 +00:00

DASM: better unresolved symbol search

This commit is contained in:
Steven Hugg 2019-05-11 09:54:09 -04:00
parent 0f292a422f
commit 31bd21ff87
4 changed files with 33 additions and 10 deletions

View File

@ -106,7 +106,6 @@ TODO:
- debug highlight doesn't go away when debugging -> running - debug highlight doesn't go away when debugging -> running
- show breakpoint of PC or highest address on stack - show breakpoint of PC or highest address on stack
- can we highlight line instead of select? - can we highlight line instead of select?
- replay doesn't work for nes (force background tile redraw)
- running profiler while replaying? grand unified replay? - running profiler while replaying? grand unified replay?
- click on profiler to step to position - click on profiler to step to position
- breakpoints stop profiler from running - breakpoints stop profiler from running
@ -126,7 +125,10 @@ TODO:
- single-stepping vector games makes screen fade - single-stepping vector games makes screen fade
- break on stack overflow, bad op, bad access, etc - break on stack overflow, bad op, bad access, etc
- PPU/TIA register write visualization - 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 - vcs sound continues when paused
- upload multiple files/zip file to subdirectory - upload multiple files/zip file to subdirectory
- allow "include graphics.asm" instead of "include project/graphics.asm" - 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 - build ca65 projects? https://github.com/pinobatch/thwaite-nes/blob/master/makefile
- switching platform of a repo? - switching platform of a repo?
- retaining repo_id in localstorage? - retaining repo_id in localstorage?
- don't like alert() after pushing
- should have a preview of commit
WEB WORKER FORMAT WEB WORKER FORMAT
@ -288,3 +292,13 @@ Pull
Push Push
Git metadata kept in local storage 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

View File

@ -374,6 +374,10 @@ class JSNESPlatform extends Base6502Platform implements Platform {
s += "\n"; s += "\n";
return s; return s;
} }
getToolForFilename = (fn:string) : string => {
if (fn.endsWith(".asm")) return "ca65"; // .asm uses ca65
else return getToolForFilename_6502(fn);
}
} }
/// MAME support /// MAME support
@ -407,8 +411,8 @@ class NESMAMEPlatform extends BaseMAMEPlatform implements Platform {
} }
getPresets() { return JSNES_PRESETS; } getPresets() { return JSNES_PRESETS; }
getOpcodeMetadata = getOpcodeMetadata_6502;
getToolForFilename = getToolForFilename_6502; getToolForFilename = getToolForFilename_6502;
getOpcodeMetadata = getOpcodeMetadata_6502;
getDefaultExtension() { return ".c"; }; getDefaultExtension() { return ".c"; };
} }

View File

@ -645,6 +645,7 @@ function parseSourceLines(code:string, lineMatch, offsetMatch) {
} }
function parseDASMListing(code:string, unresolved:{}, mainFilename:string) { function parseDASMListing(code:string, unresolved:{}, mainFilename:string) {
// TODO: this gets very slow
// 4 08ee a9 00 start lda #01workermain.js:23:5 // 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 lineMatch = /\s*(\d+)\s+(\S+)\s+([0-9a-f]+)\s+([?0-9a-f][?0-9a-f ]+)?\s+(.+)?/i;
var equMatch = /\bequ\b/i; var equMatch = /\bequ\b/i;
@ -702,13 +703,17 @@ function parseDASMListing(code:string, unresolved:{}, mainFilename:string) {
// TODO: better symbol test (word boundaries) // TODO: better symbol test (word boundaries)
// TODO: ignore IFCONST and IFNCONST usage // TODO: ignore IFCONST and IFNCONST usage
for (var key in unresolved) { 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) { if (pos >= 0) {
errors.push({ var cmt = l.indexOf(';');
path:filename, if (cmt < 0 || cmt > pos) {
line:linenum, errors.push({
msg:"Unresolved symbol '" + key + "'" path:filename,
}); line:linenum,
msg:"Unresolved symbol '" + key + "'"
});
}
} }
} }
} }

View File

@ -81,7 +81,7 @@ describe('Worker', function() {
compile('dasm', '\tprocessor 6502\n\torg $f000\nfoo lda #0\n', 'vcs', done, 2, 1); compile('dasm', '\tprocessor 6502\n\torg $f000\nfoo lda #0\n', 'vcs', done, 2, 1);
}); });
it('should NOT assemble DASM', function(done) { 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) { it('should assemble ACME', function(done) {