mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-19 07:30:55 +00:00
try to load local/ paths in include dependencies; don't update gutters of nonactive windows
This commit is contained in:
parent
6b1e09a835
commit
ba12e481f7
@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
processor 6502
|
processor 6502
|
||||||
|
|
||||||
;;;;; CONSTANTS
|
;;;;; CONSTANTS
|
||||||
@ -129,10 +129,9 @@ NES_MIRR_QUAD = 8
|
|||||||
sta PPU_DATA
|
sta PPU_DATA
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
;;;;; SAVE_REGS - save flags/A/X/Y registers
|
;;;;; SAVE_REGS - save A/X/Y registers
|
||||||
|
|
||||||
MAC SAVE_REGS
|
MAC SAVE_REGS
|
||||||
php
|
|
||||||
pha
|
pha
|
||||||
txa
|
txa
|
||||||
pha
|
pha
|
||||||
@ -140,7 +139,7 @@ NES_MIRR_QUAD = 8
|
|||||||
pha
|
pha
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
;;;;; SAVE_REGS - restore Y/X/A/flags registers
|
;;;;; SAVE_REGS - restore Y/X/A registers
|
||||||
|
|
||||||
MAC RESTORE_REGS
|
MAC RESTORE_REGS
|
||||||
pla
|
pla
|
||||||
@ -148,5 +147,35 @@ NES_MIRR_QUAD = 8
|
|||||||
pla
|
pla
|
||||||
tax
|
tax
|
||||||
pla
|
pla
|
||||||
plp
|
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------
|
||||||
|
; SLEEP clockcycles
|
||||||
|
; Original author: Thomas Jentzsch
|
||||||
|
; Inserts code which takes the specified number of cycles to execute. This is
|
||||||
|
; useful for code where precise timing is required.
|
||||||
|
; LEGAL OPCODE VERSION MAY AFFECT FLAGS (uses 'bit' opcode)
|
||||||
|
|
||||||
|
NO_ILLEGAL_OPCODES = 1
|
||||||
|
|
||||||
|
MAC SLEEP ;usage: SLEEP n (n>1)
|
||||||
|
.CYCLES SET {1}
|
||||||
|
|
||||||
|
IF .CYCLES < 2
|
||||||
|
ECHO "MACRO ERROR: 'SLEEP': Duration must be > 1"
|
||||||
|
ERR
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF .CYCLES & 1
|
||||||
|
IFNCONST NO_ILLEGAL_OPCODES
|
||||||
|
nop 0
|
||||||
|
ELSE
|
||||||
|
bit $00
|
||||||
|
ENDIF
|
||||||
|
.CYCLES SET .CYCLES - 3
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
REPEAT .CYCLES / 2
|
||||||
|
nop
|
||||||
|
REPEND
|
||||||
|
ENDM
|
||||||
|
@ -449,7 +449,9 @@ var DVGBWStateMachine = function(bus, video, bofs) {
|
|||||||
|
|
||||||
function readWord(a) {
|
function readWord(a) {
|
||||||
a &= 0xfff;
|
a &= 0xfff;
|
||||||
return bus.read(a*2+bofs) + (bus.read(a*2+bofs+1) << 8);
|
var v = bus.read(a*2+bofs) + (bus.read(a*2+bofs+1) << 8);
|
||||||
|
//console.log(hex(a*2+bofs,4), hex(v,4), hex(x>>2), hex(y>>2));
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
function decodeSigned(w, o2) {
|
function decodeSigned(w, o2) {
|
||||||
@ -488,7 +490,7 @@ var DVGBWStateMachine = function(bus, video, bofs) {
|
|||||||
if (!running) return;
|
if (!running) return;
|
||||||
var w = readWord(pc);
|
var w = readWord(pc);
|
||||||
var op = w >> 12;
|
var op = w >> 12;
|
||||||
//console.log(hex(pc), hex(w));
|
//console.log(hex(pc*2+bofs), hex(w), hex(x>>2), hex(y>>2));
|
||||||
pc++;
|
pc++;
|
||||||
switch (op) {
|
switch (op) {
|
||||||
// VEC
|
// VEC
|
||||||
|
@ -59,14 +59,15 @@ export class CodeProject {
|
|||||||
var re = /^\s*(`include|[.]include)\s+"(.+?)"/gm;
|
var re = /^\s*(`include|[.]include)\s+"(.+?)"/gm;
|
||||||
var m;
|
var m;
|
||||||
while (m = re.exec(text)) {
|
while (m = re.exec(text)) {
|
||||||
|
files.push('local/'+m[2]);
|
||||||
files.push(m[2]);
|
files.push(m[2]);
|
||||||
//files.push('local/'+m[2]); // TODO: shows up 2x in interface
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// for .asm -- [.]include "file"
|
// for .asm -- [.]include "file"
|
||||||
// for .c -- #include "file"
|
// for .c -- #include "file"
|
||||||
var re2 = /^\s+([.#]?include)\s+"(.+?)"/gm;
|
var re2 = /^\s+([.#]?include)\s+"(.+?)"/gm;
|
||||||
while (m = re2.exec(text)) {
|
while (m = re2.exec(text)) {
|
||||||
|
files.push('local/'+m[2]);
|
||||||
files.push(m[2]);
|
files.push(m[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,6 +83,7 @@ export class CodeProject {
|
|||||||
var re = /^\s*([;#]|[/][/][#])link\s+"(.+?)"/gm;
|
var re = /^\s*([;#]|[/][/][#])link\s+"(.+?)"/gm;
|
||||||
var m;
|
var m;
|
||||||
while (m = re.exec(text)) {
|
while (m = re.exec(text)) {
|
||||||
|
files.push('local/' + m[2]);
|
||||||
files.push(m[2]);
|
files.push(m[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,7 +173,8 @@ export class CodeProject {
|
|||||||
this.filedata[path] = value;
|
this.filedata[path] = value;
|
||||||
addResult(path, value);
|
addResult(path, value);
|
||||||
loadNext();
|
loadNext();
|
||||||
} else {
|
} else if (!path.startsWith("local/")) {
|
||||||
|
// don't load local/
|
||||||
// found on remote fetch?
|
// found on remote fetch?
|
||||||
var preset_id = this.platform_id;
|
var preset_id = this.platform_id;
|
||||||
preset_id = preset_id.replace(/[.]\w+/,''); // remove .suffix from preset name
|
preset_id = preset_id.replace(/[.]\w+/,''); // remove .suffix from preset name
|
||||||
@ -191,6 +194,9 @@ export class CodeProject {
|
|||||||
this.filedata[path] = null;
|
this.filedata[path] = null;
|
||||||
loadNext();
|
loadNext();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// not gonna find it, keep going
|
||||||
|
loadNext();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
||||||
// 8bitworkshop IDE user interface
|
// 8bitworkshop IDE user interface
|
||||||
|
|
||||||
import $ = require("jquery");
|
import $ = require("jquery");
|
||||||
|
19
src/views.ts
19
src/views.ts
@ -170,9 +170,7 @@ export class SourceEditor implements ProjectView {
|
|||||||
|
|
||||||
getSourceFile() : SourceFile { return this.sourcefile; }
|
getSourceFile() : SourceFile { return this.sourcefile; }
|
||||||
|
|
||||||
// TODO: update gutter only when refreshing this window
|
updateListing() {
|
||||||
updateListing(_sourcefile : SourceFile) {
|
|
||||||
this.sourcefile = _sourcefile;
|
|
||||||
// update editor annotations
|
// update editor annotations
|
||||||
this.editor.clearGutter("gutter-info");
|
this.editor.clearGutter("gutter-info");
|
||||||
this.editor.clearGutter("gutter-bytes");
|
this.editor.clearGutter("gutter-bytes");
|
||||||
@ -263,7 +261,7 @@ export class SourceEditor implements ProjectView {
|
|||||||
var state = lastDebugState;
|
var state = lastDebugState;
|
||||||
if (state && state.c && this.sourcefile) {
|
if (state && state.c && this.sourcefile) {
|
||||||
var PC = state.c.PC;
|
var PC = state.c.PC;
|
||||||
var line = this.sourcefile.findLineForOffset(PC);
|
var line = this.sourcefile.findLineForOffset(PC, 15);
|
||||||
return line;
|
return line;
|
||||||
} else
|
} else
|
||||||
return -1;
|
return -1;
|
||||||
@ -279,12 +277,15 @@ export class SourceEditor implements ProjectView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshListing() {
|
refreshListing() {
|
||||||
if (!this.dirtylisting) return;
|
// lookup corresponding sourcefile for this file, using listing
|
||||||
this.dirtylisting = false;
|
|
||||||
var lst = current_project.getListingForFile(this.path);
|
var lst = current_project.getListingForFile(this.path);
|
||||||
if (lst && lst.sourcefile) {
|
if (lst && lst.sourcefile && lst.sourcefile != this.sourcefile) {
|
||||||
this.updateListing(lst.sourcefile); // updates sourcefile variable
|
this.sourcefile = lst.sourcefile;
|
||||||
|
this.dirtylisting = true;
|
||||||
}
|
}
|
||||||
|
if (!this.sourcefile || !this.dirtylisting) return;
|
||||||
|
this.dirtylisting = false;
|
||||||
|
this.updateListing();
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(moveCursor: boolean) {
|
refresh(moveCursor: boolean) {
|
||||||
@ -501,7 +502,7 @@ export class ListingView extends DisassemblerView implements ProjectView {
|
|||||||
disasmview.setValue(asmtext);
|
disasmview.setValue(asmtext);
|
||||||
var findPC = platform.getDebugCallback() ? pc : -1;
|
var findPC = platform.getDebugCallback() ? pc : -1;
|
||||||
if (findPC >= 0 && this.assemblyfile) {
|
if (findPC >= 0 && this.assemblyfile) {
|
||||||
var lineno = this.assemblyfile.findLineForOffset(findPC);
|
var lineno = this.assemblyfile.findLineForOffset(findPC, 15);
|
||||||
if (lineno && moveCursor) {
|
if (lineno && moveCursor) {
|
||||||
// set cursor while debugging
|
// set cursor while debugging
|
||||||
if (platform.getDebugCallback())
|
if (platform.getDebugCallback())
|
||||||
|
@ -57,7 +57,6 @@ export class ProjectWindows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
refresh(moveCursor:boolean) {
|
refresh(moveCursor:boolean) {
|
||||||
// TODO: activate window that contains debug line?
|
|
||||||
// refresh current window
|
// refresh current window
|
||||||
if (this.activewnd && this.activewnd.refresh)
|
if (this.activewnd && this.activewnd.refresh)
|
||||||
this.activewnd.refresh(moveCursor);
|
this.activewnd.refresh(moveCursor);
|
||||||
|
@ -27,9 +27,9 @@ export class SourceFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
findLineForOffset(PC:number):number {
|
findLineForOffset(PC:number, lookbehind:number):number {
|
||||||
if (this.offset2line) {
|
if (this.offset2line) {
|
||||||
for (var i=0; i<16; i++) {
|
for (var i=0; i<=lookbehind; i++) {
|
||||||
var line = this.offset2line[PC];
|
var line = this.offset2line[PC];
|
||||||
if (line >= 0) {
|
if (line >= 0) {
|
||||||
return line;
|
return line;
|
||||||
|
@ -70,14 +70,17 @@ describe('Store', function() {
|
|||||||
|
|
||||||
it('Should load local project', function(done) {
|
it('Should load local project', function(done) {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
localStorage.setItem('_TEST/test', 'a');
|
localStorage.setItem('_TEST/local/test', 'a');
|
||||||
var store = mstore.createNewPersistentStore(test_platform_id, function() {
|
var store = mstore.createNewPersistentStore(test_platform_id, function() {
|
||||||
var worker = {};
|
var worker = {};
|
||||||
var platform = {};
|
var platform = {};
|
||||||
var project = new prj.CodeProject(worker, test_platform_id, platform, store);
|
var project = new prj.CodeProject(worker, test_platform_id, platform, store);
|
||||||
project.loadFiles(['test'], function(err, result) {
|
var remote = [];
|
||||||
|
project.callbackGetRemote = function(path) { remote.push(path); return {fail:function(failfn){failfn({status:404})}} };
|
||||||
|
project.loadFiles(['local/test','test'], function(err, result) {
|
||||||
assert.equal(null, err);
|
assert.equal(null, err);
|
||||||
assert.deepEqual([ { path: 'test', filename: 'test', data: 'a', link:true } ], result);
|
assert.deepEqual(["presets/_TEST/test"], remote);
|
||||||
|
assert.deepEqual([ { path: 'local/test', filename: 'test', data: 'a', link:true } ], result);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user