mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-26 22:29:56 +00:00
clearBreakpoint before loadRom() to refresh memory; refresh listing view
This commit is contained in:
parent
c43ecf046c
commit
e964bd26be
@ -50,6 +50,10 @@ TODO:
|
||||
- BOM in upload/download?
|
||||
- stack view for Z80 platforms using memory map
|
||||
- online tools for music etc
|
||||
- tools (memory, disasm) use debugging state
|
||||
- loadROM needs to stop debugging before loading
|
||||
- text log debugging script
|
||||
- update listing when recompiling
|
||||
|
||||
FYI: Image links for the books on http://8bitworkshop.com/ are broken
|
||||
On the website the additional grey spacing next to the program line numbers is not dynamically resized when the web browser window size is changed. Intentional?
|
||||
|
@ -404,6 +404,14 @@ const byte SINTBL[32] = {
|
||||
-127, -125, -117, -106, -90, -71, -49, -25,
|
||||
};
|
||||
|
||||
// pre-multiplied by 2
|
||||
const int SINTBL2[32] = {
|
||||
0, 25*2, 49*2, 71*2, 90*2, 106*2, 117*2, 125*2,
|
||||
127*2, 125*2, 117*2, 106*2, 90*2, 71*2, 49*2, 25*2,
|
||||
0*2, -25*2, -49*2, -71*2, -90*2, -106*2, -117*2, -125*2,
|
||||
-127*2, -125*2, -117*2, -106*2, -90*2, -71*2, -49*2, -25*2,
|
||||
};
|
||||
|
||||
signed char isin(byte dir) {
|
||||
return SINTBL[dir & 31];
|
||||
}
|
||||
@ -412,6 +420,29 @@ signed char icos(byte dir) {
|
||||
return isin(dir+8);
|
||||
}
|
||||
|
||||
// Fast 8-bit table lookup macro
|
||||
// dest: destination
|
||||
// ident: table identifier
|
||||
// index: 8-bit index
|
||||
#define FASTLUT8(dest,ident,index) \
|
||||
__AX__ = (index); \
|
||||
asm ("tax"); \
|
||||
asm ("lda %v,x", ident); \
|
||||
(dest) = __AX__;
|
||||
|
||||
// Fast 16-bit table lookup (single table of 2-byte words, 128 entries max)
|
||||
// dest: destination (16 bits)
|
||||
// ident: table identifier
|
||||
// index: 8-bit index
|
||||
#define FASTLUT16(dest,ident,index) \
|
||||
__AX__ = (index); \
|
||||
asm ("asl"); \
|
||||
asm ("tay"); \
|
||||
asm ("lda %v+1,y", ident); \
|
||||
asm ("tax"); \
|
||||
asm ("lda %v,y", ident); \
|
||||
(dest) = __AX__;
|
||||
|
||||
#define FORMATION_X0 0
|
||||
#define FORMATION_Y0 19
|
||||
#define FORMATION_XSPACE 24
|
||||
@ -467,8 +498,11 @@ void return_attacker(register AttackingEnemy* a) {
|
||||
void fly_attacker(register AttackingEnemy* a) {
|
||||
byte dir = a->dir;
|
||||
#if 1
|
||||
a->x += SINTBL[dir & 31] * 2;
|
||||
a->y += SINTBL[(dir+8) & 31] * 2;
|
||||
int sincos;
|
||||
sincos = FASTLUT16(sincos, SINTBL2, dir&31);
|
||||
a->x += sincos;
|
||||
sincos = FASTLUT16(sincos, SINTBL2, (dir+8)&31);
|
||||
a->y += sincos;
|
||||
#else
|
||||
a->x += isin(dir) * 2;
|
||||
a->y += icos(dir) * 2;
|
||||
@ -660,7 +694,7 @@ void does_missile_hit_player() {
|
||||
return;
|
||||
for (i=0; i<MAX_ATTACKERS; i++) {
|
||||
if (missiles[i].ypos != YOFFSCREEN &&
|
||||
in_rect(missiles[i].xpos + 8, missiles[i].ypos + 16,
|
||||
in_rect(missiles[i].xpos, missiles[i].ypos + 16,
|
||||
player_x, player_y, 16, 16)) {
|
||||
player_exploding = 1;
|
||||
break;
|
||||
|
@ -202,6 +202,8 @@ export function getToolForFilename_6502(fn:string) : string {
|
||||
if (fn.endsWith(".pla")) return "plasm";
|
||||
if (fn.endsWith(".c")) return "cc65";
|
||||
if (fn.endsWith(".s")) return "ca65";
|
||||
if (fn.endsWith(".ca65")) return "ca65";
|
||||
if (fn.endsWith(".dasm")) return "dasm";
|
||||
if (fn.endsWith(".acme")) return "acme";
|
||||
return "dasm"; // .a
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ var DVGBWStateMachine = function(bus, video, bofs) {
|
||||
if (!running) return;
|
||||
var w = readWord(pc);
|
||||
var op = w >> 12;
|
||||
//console.log(hex(pc*2+bofs), hex(w), hex(x>>2), hex(y>>2));
|
||||
//console.log(hex(pc*2+bofs), hex(w), hex(x>>2), hex(y>>2), hex(32-pcstack.length*2));
|
||||
pc++;
|
||||
switch (op) {
|
||||
// VEC
|
||||
|
@ -148,13 +148,14 @@ function refreshWindowList() {
|
||||
});
|
||||
|
||||
// add listings
|
||||
// TODO: update listing when recompiling
|
||||
var listings = current_project.getListings();
|
||||
if (listings) {
|
||||
for (var lstfn in listings) {
|
||||
var lst = listings[lstfn];
|
||||
if (lst.assemblyfile) {
|
||||
addWindowItem(lstfn, getFilenameForPath(lstfn), function(path) {
|
||||
return new Views.ListingView(lst.assemblyfile);
|
||||
return new Views.ListingView(lstfn);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -309,6 +310,7 @@ function _shareFile(e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: reset file, not project
|
||||
function _resetPreset(e) {
|
||||
if (!current_preset_entry) {
|
||||
alert("Can only reset built-in file examples.")
|
||||
@ -399,8 +401,9 @@ function setCompileOutput(data: WorkerResult) {
|
||||
var rom = data.output;
|
||||
if (rom) { // TODO instanceof Uint8Array) {
|
||||
try {
|
||||
clearBreakpoint(); // so we can replace memory (TODO: change toolbar btn)
|
||||
platform.loadROM(getCurrentPresetTitle(), rom);
|
||||
if (!userPaused) resume();
|
||||
if (!userPaused) _resume();
|
||||
current_output = rom;
|
||||
// TODO: reset profiler etc? (Tell views?)
|
||||
} catch (e) {
|
||||
|
27
src/views.ts
27
src/views.ts
@ -279,7 +279,7 @@ export class SourceEditor implements ProjectView {
|
||||
refreshListing() {
|
||||
// lookup corresponding sourcefile for this file, using listing
|
||||
var lst = current_project.getListingForFile(this.path);
|
||||
if (lst && lst.sourcefile && lst.sourcefile != this.sourcefile) {
|
||||
if (lst && lst.sourcefile && lst.sourcefile !== this.sourcefile) {
|
||||
this.sourcefile = lst.sourcefile;
|
||||
this.dirtylisting = true;
|
||||
}
|
||||
@ -484,13 +484,24 @@ export class DisassemblerView implements ProjectView {
|
||||
|
||||
export class ListingView extends DisassemblerView implements ProjectView {
|
||||
assemblyfile : SourceFile;
|
||||
path : string;
|
||||
|
||||
constructor(assemblyfile : SourceFile) {
|
||||
constructor(lstfn : string) {
|
||||
super();
|
||||
this.assemblyfile = assemblyfile;
|
||||
this.path = lstfn;
|
||||
}
|
||||
|
||||
refreshListing() {
|
||||
// lookup corresponding assemblyfile for this file, using listing
|
||||
var lst = current_project.getListingForFile(this.path);
|
||||
if (lst && lst.assemblyfile && lst.assemblyfile !== this.assemblyfile) {
|
||||
this.assemblyfile = lst.assemblyfile;
|
||||
}
|
||||
}
|
||||
|
||||
refresh(moveCursor: boolean) {
|
||||
this.refreshListing();
|
||||
if (!this.assemblyfile) return; // TODO?
|
||||
var state = lastDebugState || platform.saveState();
|
||||
var pc = state.c ? state.c.PC : 0;
|
||||
var asmtext = this.assemblyfile.text;
|
||||
@ -515,11 +526,21 @@ export class ListingView extends DisassemblerView implements ProjectView {
|
||||
|
||||
///
|
||||
|
||||
// TODO: make it use debug state
|
||||
export class MemoryView implements ProjectView {
|
||||
memorylist;
|
||||
dumplines;
|
||||
maindiv : HTMLElement;
|
||||
static IGNORE_SYMS = {s__INITIALIZER:true, /* s__GSINIT:true, */ _color_prom:true};
|
||||
/*
|
||||
read(addr:number) {
|
||||
// TODO: b offset ?
|
||||
if (lastDebugState && lastDebugState.b && addr < lastDebugState.b.length)
|
||||
return lastDebugState.b[addr];
|
||||
else
|
||||
return this.platform.readMemory(addr);
|
||||
}
|
||||
*/
|
||||
|
||||
createDiv(parent : HTMLElement) {
|
||||
var div = document.createElement('div');
|
||||
|
@ -146,9 +146,10 @@ describe('Store', function() {
|
||||
assert.deepEqual([false], msgs);
|
||||
var lst = buildresult.listings.test;
|
||||
console.log(lst);
|
||||
assert.equal(3, lst.sourcefile.findLineForOffset(61440+15));
|
||||
assert.equal(null, lst.sourcefile.findLineForOffset(61440+16));
|
||||
assert.equal(null, lst.sourcefile.findLineForOffset(61440-1));
|
||||
assert.equal(3, lst.sourcefile.findLineForOffset(61440+15, 15));
|
||||
assert.equal(null, lst.sourcefile.findLineForOffset(61440+16, 15));
|
||||
assert.equal(null, lst.sourcefile.findLineForOffset(61440+1, 0));
|
||||
assert.equal(null, lst.sourcefile.findLineForOffset(61440-1, 16));
|
||||
assert.equal(1, lst.sourcefile.lineCount());
|
||||
done();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user