mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-16 17:30:27 +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
|
||||
|
||||
;;;;; CONSTANTS
|
||||
@ -129,10 +129,9 @@ NES_MIRR_QUAD = 8
|
||||
sta PPU_DATA
|
||||
ENDM
|
||||
|
||||
;;;;; SAVE_REGS - save flags/A/X/Y registers
|
||||
;;;;; SAVE_REGS - save A/X/Y registers
|
||||
|
||||
MAC SAVE_REGS
|
||||
php
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
@ -140,7 +139,7 @@ NES_MIRR_QUAD = 8
|
||||
pha
|
||||
ENDM
|
||||
|
||||
;;;;; SAVE_REGS - restore Y/X/A/flags registers
|
||||
;;;;; SAVE_REGS - restore Y/X/A registers
|
||||
|
||||
MAC RESTORE_REGS
|
||||
pla
|
||||
@ -148,5 +147,35 @@ NES_MIRR_QUAD = 8
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
plp
|
||||
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) {
|
||||
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) {
|
||||
@ -488,7 +490,7 @@ var DVGBWStateMachine = function(bus, video, bofs) {
|
||||
if (!running) return;
|
||||
var w = readWord(pc);
|
||||
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++;
|
||||
switch (op) {
|
||||
// VEC
|
||||
|
@ -59,14 +59,15 @@ export class CodeProject {
|
||||
var re = /^\s*(`include|[.]include)\s+"(.+?)"/gm;
|
||||
var m;
|
||||
while (m = re.exec(text)) {
|
||||
files.push('local/'+m[2]);
|
||||
files.push(m[2]);
|
||||
//files.push('local/'+m[2]); // TODO: shows up 2x in interface
|
||||
}
|
||||
} else {
|
||||
// for .asm -- [.]include "file"
|
||||
// for .c -- #include "file"
|
||||
var re2 = /^\s+([.#]?include)\s+"(.+?)"/gm;
|
||||
while (m = re2.exec(text)) {
|
||||
files.push('local/'+m[2]);
|
||||
files.push(m[2]);
|
||||
}
|
||||
}
|
||||
@ -82,6 +83,7 @@ export class CodeProject {
|
||||
var re = /^\s*([;#]|[/][/][#])link\s+"(.+?)"/gm;
|
||||
var m;
|
||||
while (m = re.exec(text)) {
|
||||
files.push('local/' + m[2]);
|
||||
files.push(m[2]);
|
||||
}
|
||||
}
|
||||
@ -171,7 +173,8 @@ export class CodeProject {
|
||||
this.filedata[path] = value;
|
||||
addResult(path, value);
|
||||
loadNext();
|
||||
} else {
|
||||
} else if (!path.startsWith("local/")) {
|
||||
// don't load local/
|
||||
// found on remote fetch?
|
||||
var preset_id = this.platform_id;
|
||||
preset_id = preset_id.replace(/[.]\w+/,''); // remove .suffix from preset name
|
||||
@ -191,6 +194,9 @@ export class CodeProject {
|
||||
this.filedata[path] = null;
|
||||
loadNext();
|
||||
});
|
||||
} else {
|
||||
// not gonna find it, keep going
|
||||
loadNext();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
|
||||
// 8bitworkshop IDE user interface
|
||||
|
||||
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; }
|
||||
|
||||
// TODO: update gutter only when refreshing this window
|
||||
updateListing(_sourcefile : SourceFile) {
|
||||
this.sourcefile = _sourcefile;
|
||||
updateListing() {
|
||||
// update editor annotations
|
||||
this.editor.clearGutter("gutter-info");
|
||||
this.editor.clearGutter("gutter-bytes");
|
||||
@ -263,7 +261,7 @@ export class SourceEditor implements ProjectView {
|
||||
var state = lastDebugState;
|
||||
if (state && state.c && this.sourcefile) {
|
||||
var PC = state.c.PC;
|
||||
var line = this.sourcefile.findLineForOffset(PC);
|
||||
var line = this.sourcefile.findLineForOffset(PC, 15);
|
||||
return line;
|
||||
} else
|
||||
return -1;
|
||||
@ -279,12 +277,15 @@ export class SourceEditor implements ProjectView {
|
||||
}
|
||||
|
||||
refreshListing() {
|
||||
if (!this.dirtylisting) return;
|
||||
this.dirtylisting = false;
|
||||
// lookup corresponding sourcefile for this file, using listing
|
||||
var lst = current_project.getListingForFile(this.path);
|
||||
if (lst && lst.sourcefile) {
|
||||
this.updateListing(lst.sourcefile); // updates sourcefile variable
|
||||
if (lst && lst.sourcefile && lst.sourcefile != this.sourcefile) {
|
||||
this.sourcefile = lst.sourcefile;
|
||||
this.dirtylisting = true;
|
||||
}
|
||||
if (!this.sourcefile || !this.dirtylisting) return;
|
||||
this.dirtylisting = false;
|
||||
this.updateListing();
|
||||
}
|
||||
|
||||
refresh(moveCursor: boolean) {
|
||||
@ -501,7 +502,7 @@ export class ListingView extends DisassemblerView implements ProjectView {
|
||||
disasmview.setValue(asmtext);
|
||||
var findPC = platform.getDebugCallback() ? pc : -1;
|
||||
if (findPC >= 0 && this.assemblyfile) {
|
||||
var lineno = this.assemblyfile.findLineForOffset(findPC);
|
||||
var lineno = this.assemblyfile.findLineForOffset(findPC, 15);
|
||||
if (lineno && moveCursor) {
|
||||
// set cursor while debugging
|
||||
if (platform.getDebugCallback())
|
||||
|
@ -57,7 +57,6 @@ export class ProjectWindows {
|
||||
}
|
||||
|
||||
refresh(moveCursor:boolean) {
|
||||
// TODO: activate window that contains debug line?
|
||||
// refresh current window
|
||||
if (this.activewnd && this.activewnd.refresh)
|
||||
this.activewnd.refresh(moveCursor);
|
||||
|
@ -27,9 +27,9 @@ export class SourceFile {
|
||||
}
|
||||
}
|
||||
}
|
||||
findLineForOffset(PC:number):number {
|
||||
findLineForOffset(PC:number, lookbehind:number):number {
|
||||
if (this.offset2line) {
|
||||
for (var i=0; i<16; i++) {
|
||||
for (var i=0; i<=lookbehind; i++) {
|
||||
var line = this.offset2line[PC];
|
||||
if (line >= 0) {
|
||||
return line;
|
||||
|
@ -70,14 +70,17 @@ describe('Store', function() {
|
||||
|
||||
it('Should load local project', function(done) {
|
||||
localStorage.clear();
|
||||
localStorage.setItem('_TEST/test', 'a');
|
||||
localStorage.setItem('_TEST/local/test', 'a');
|
||||
var store = mstore.createNewPersistentStore(test_platform_id, function() {
|
||||
var worker = {};
|
||||
var platform = {};
|
||||
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.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();
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user