mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-08 23:29:42 +00:00
nes preset updates; switched to Toolbar class for main ui
This commit is contained in:
parent
361f39714b
commit
4fc52a11f2
|
@ -138,7 +138,7 @@ div.mem_info a.selected {
|
||||||
color: #ff9933 !important;
|
color: #ff9933 !important;
|
||||||
}
|
}
|
||||||
.btn_recording {
|
.btn_recording {
|
||||||
color: #ff3333;
|
color: #ff6666 !important;
|
||||||
}
|
}
|
||||||
.btn_toolbar {
|
.btn_toolbar {
|
||||||
margin:4px;
|
margin:4px;
|
||||||
|
|
|
@ -110,10 +110,11 @@ TODO:
|
||||||
- throw errors when bad/no refs
|
- throw errors when bad/no refs
|
||||||
- capture so we get mouseUp() out of frame
|
- capture so we get mouseUp() out of frame
|
||||||
- per-View keyboard shortcuts
|
- per-View keyboard shortcuts
|
||||||
- crt0.s compiled each time?
|
|
||||||
- debug highlight doesn't go away when debugging -> running
|
|
||||||
- parse labels
|
- parse labels
|
||||||
- editing too fast refreshes kills the editor
|
- editing too fast refreshes kills the editor
|
||||||
|
- crt0.s compiled each time?
|
||||||
|
- debug highlight doesn't go away when debugging -> running
|
||||||
|
- replay doesn't work for nes
|
||||||
|
|
||||||
WEB WORKER FORMAT
|
WEB WORKER FORMAT
|
||||||
|
|
||||||
|
|
19
index.html
19
index.html
|
@ -137,24 +137,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<img id="compile_spinner" src="images/spinner.gif" height="20em" style="visibility:hidden;margin-left:8px;margin-right:8px">
|
<img id="compile_spinner" src="images/spinner.gif" height="20em" style="visibility:hidden;margin-left:8px;margin-right:8px">
|
||||||
<span class="btn_group debug_group hidden-xs" id="debug_bar">
|
<span id="toolbar" class="hidden-xs"></span>
|
||||||
<button id="dbg_reset" class="btn" title="Reset and Break"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_pause" class="btn" title="Pause"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_go" class="btn" title="Run"><span class="glyphicon glyphicon-play" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_step" class="btn" title="Step"><span class="glyphicon glyphicon-step-forward" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_tovsync" class="btn" title="Next Frame/Interrupt"><span class="glyphicon glyphicon-forward" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_toline" class="btn" title="Run To Line"><span class="glyphicon glyphicon-save" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_stepout" class="btn" title="Step Out of Subroutine"><span class="glyphicon glyphicon-hand-up" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_stepback" class="btn" title="Step Backwards"><span class="glyphicon glyphicon-step-backward" aria-hidden="true"></span></button>
|
|
||||||
</span>
|
|
||||||
<span class="btn_group view_group hidden-sm hidden-xs" id="extra_bar">
|
|
||||||
<button id="dbg_timing" class="btn" title="Analyze CPU Timing" style="display:none"><span class="glyphicon glyphicon-time" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_disasm" class="btn" title="Show Disassembly" style="display:none"><span class="glyphicon glyphicon-list" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_memory" class="btn" title="Show Memory" style="display:none"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_profile" class="btn" title="Show Profile" style="display:none"><span class="glyphicon glyphicon-stats" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_record" class="btn" title="Start/Stop Replay Recording" style="display:none"><span class="glyphicon glyphicon-record" aria-hidden="true"></span></button>
|
|
||||||
<button id="dbg_help" class="btn" title="Help" style="display:none"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></button>
|
|
||||||
</span>
|
|
||||||
<span class="btn_group view_group hidden-sm hidden-xs" id="speed_bar" style="display:none">
|
<span class="btn_group view_group hidden-sm hidden-xs" id="speed_bar" style="display:none">
|
||||||
<button id="dbg_slowest" class="btn" title="Slowest"><span class="glyphicon glyphicon-fast-backward" aria-hidden="true"></span></button>
|
<button id="dbg_slowest" class="btn" title="Slowest"><span class="glyphicon glyphicon-fast-backward" aria-hidden="true"></span></button>
|
||||||
<button id="dbg_slower" class="btn" title="Slower"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
|
<button id="dbg_slower" class="btn" title="Slower"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
|
||||||
|
|
|
@ -84,7 +84,7 @@ void setup_graphics() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// number of actors (4 h/w sprites each)
|
// number of actors (4 h/w sprites each)
|
||||||
#define NUM_ACTORS 48
|
#define NUM_ACTORS 24
|
||||||
|
|
||||||
// actor x/y positions
|
// actor x/y positions
|
||||||
char actor_x[NUM_ACTORS];
|
char actor_x[NUM_ACTORS];
|
||||||
|
@ -113,14 +113,14 @@ void main() {
|
||||||
oam_id = 0;
|
oam_id = 0;
|
||||||
// draw and move all actors
|
// draw and move all actors
|
||||||
// (note we don't reset i each loop iteration)
|
// (note we don't reset i each loop iteration)
|
||||||
while (oam_id < 252) {
|
while (oam_id < 256-4*4) {
|
||||||
// wrap around actor array
|
// wrap around actor array
|
||||||
if (i >= NUM_ACTORS)
|
if (i >= NUM_ACTORS)
|
||||||
i -= NUM_ACTORS;
|
i -= NUM_ACTORS;
|
||||||
oam_id = oam_meta_spr(actor_x[i], actor_y[i], oam_id, playerRunSeq[i&15]);
|
oam_id = oam_meta_spr(actor_x[i], actor_y[i], oam_id, playerRunSeq[i&15]);
|
||||||
actor_x[i] += actor_dx[i];
|
actor_x[i] += actor_dx[i];
|
||||||
actor_y[i] += actor_dy[i];
|
actor_y[i] += actor_dy[i];
|
||||||
i++;
|
++i;
|
||||||
}
|
}
|
||||||
// hide rest of sprites
|
// hide rest of sprites
|
||||||
oam_hide_rest(oam_id);
|
oam_hide_rest(oam_id);
|
||||||
|
|
|
@ -25,14 +25,15 @@ void draw_text(word addr, const char* text) {
|
||||||
vram_write(text, strlen(text));
|
vram_write(text, strlen(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
byte counters[128];
|
word counters[128];
|
||||||
byte irqcount = 0;
|
byte irqcount = 0;
|
||||||
|
|
||||||
void __fastcall__ irq_nmi_callback(void) {
|
void __fastcall__ irq_nmi_callback(void) {
|
||||||
// is this an IRQ? (A == 0xff)
|
// check high bit of A to see if this is an IRQ
|
||||||
if (__A__ & 0x80) {
|
if (__A__ & 0x80) {
|
||||||
// set PPU scroll value
|
// it's an IRQ from the MMC3 mapper
|
||||||
PPU.scroll = counters[irqcount] >> 5;
|
// change PPU scroll registers
|
||||||
|
PPU.scroll = counters[irqcount & 0x7f] >> 8;
|
||||||
PPU.scroll = 0;
|
PPU.scroll = 0;
|
||||||
// advance to next scroll value
|
// advance to next scroll value
|
||||||
++irqcount;
|
++irqcount;
|
||||||
|
@ -40,7 +41,8 @@ void __fastcall__ irq_nmi_callback(void) {
|
||||||
MMC3_IRQ_DISABLE();
|
MMC3_IRQ_DISABLE();
|
||||||
MMC3_IRQ_ENABLE();
|
MMC3_IRQ_ENABLE();
|
||||||
} else {
|
} else {
|
||||||
// this is a NMI, reset IRQ counter
|
// this is a NMI
|
||||||
|
// reload IRQ counter
|
||||||
MMC3_IRQ_RELOAD();
|
MMC3_IRQ_RELOAD();
|
||||||
// reset scroll counter
|
// reset scroll counter
|
||||||
irqcount = 0;
|
irqcount = 0;
|
||||||
|
@ -53,8 +55,9 @@ void main(void)
|
||||||
MMC3_IRQ_SET_VALUE(7);
|
MMC3_IRQ_SET_VALUE(7);
|
||||||
MMC3_IRQ_RELOAD();
|
MMC3_IRQ_RELOAD();
|
||||||
MMC3_IRQ_ENABLE();
|
MMC3_IRQ_ENABLE();
|
||||||
__asm__ ("cli"); // enable IRQ
|
// enable CPU IRQ
|
||||||
// set IRQ
|
__asm__ ("cli");
|
||||||
|
// set IRQ callback
|
||||||
nmi_set_callback(irq_nmi_callback);
|
nmi_set_callback(irq_nmi_callback);
|
||||||
// set palette colors
|
// set palette colors
|
||||||
pal_col(1,0x04);
|
pal_col(1,0x04);
|
||||||
|
@ -63,12 +66,13 @@ void main(void)
|
||||||
// fill vram
|
// fill vram
|
||||||
vram_adr(NTADR_A(0,0));
|
vram_adr(NTADR_A(0,0));
|
||||||
vram_fill('A', 32*28);
|
vram_fill('A', 32*28);
|
||||||
|
// turn on PPU/interrupts
|
||||||
ppu_on_all();
|
ppu_on_all();
|
||||||
// loop forever, updating each counter at a different rate
|
// loop forever, updating each counter at a different rate
|
||||||
while(1) {
|
while(1) {
|
||||||
byte i;
|
byte i;
|
||||||
for (i=0; i<128; i++) {
|
for (i=0; i<128; i++) {
|
||||||
counters[i] += i;
|
counters[i] += i*16;
|
||||||
}
|
}
|
||||||
ppu_wait_frame();
|
ppu_wait_frame();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
FT_TEMP ds 3 ;3 bytes in zeropage used by the library as a scratchpad
|
FT_TEMP ds 3 ;3 bytes in zeropage used by the library as a scratchpad
|
||||||
|
|
||||||
FT_BASE_ADR = $0500 ;page in the RAM used for FT2 variables, should be $xx00
|
FT_BASE_ADR = $0500 ;page in the RAM used for FT2 variables, should be $xx00
|
||||||
FT_DPCM_OFF = DMCSamples ;$c000..$ffc0, 64-byte steps
|
|
||||||
FT_SFX_STREAMS = 4 ;number of sound effects played at once, 1..4
|
FT_SFX_STREAMS = 4 ;number of sound effects played at once, 1..4
|
||||||
;FT_DPCM_ENABLE = 1 ;undefine to exclude all DMC code
|
|
||||||
FT_SFX_ENABLE = 1 ;undefine to exclude all sound effects code
|
FT_SFX_ENABLE = 1 ;undefine to exclude all sound effects code
|
||||||
;FT_THREAD = 1 ;undefine if you are calling sound effects from the same thread as the sound update call
|
;FT_THREAD = 1 ;undefine if you are calling sound effects from the same thread as the sound update call
|
||||||
FT_PAL_SUPPORT = 1 ;undefine to exclude PAL support
|
FT_PAL_SUPPORT = 1 ;undefine to exclude PAL support
|
||||||
FT_NTSC_SUPPORT = 1 ;undefine to exclude NTSC support
|
FT_NTSC_SUPPORT = 1 ;undefine to exclude NTSC support
|
||||||
|
FT_DPCM_OFF = DMCSamples ;$c000..$ffc0, 64-byte steps
|
||||||
|
FT_DPCM_ENABLE = 1 ;undefine to exclude all DMC code
|
||||||
|
|
||||||
;;;;; NES CARTRIDGE HEADER
|
;;;;; NES CARTRIDGE HEADER
|
||||||
|
|
||||||
|
@ -95,9 +95,6 @@ NMIHandler:
|
||||||
|
|
||||||
;this file for FamiTone2 library generated by text2data tool
|
;this file for FamiTone2 library generated by text2data tool
|
||||||
|
|
||||||
FT_DPCM_OFF = $c000
|
|
||||||
FT_DPCM_PTR = (FT_DPCM_OFF&$3fff)>>6
|
|
||||||
|
|
||||||
music_data: subroutine
|
music_data: subroutine
|
||||||
_after_the_rain_music_data:
|
_after_the_rain_music_data:
|
||||||
.byte 1
|
.byte 1
|
||||||
|
@ -1204,7 +1201,7 @@ sounds: subroutine
|
||||||
|
|
||||||
;;;;; SAMPLES
|
;;;;; SAMPLES
|
||||||
|
|
||||||
org $c000
|
org $f000
|
||||||
DMCSamples
|
DMCSamples
|
||||||
hex a97ee93ffc3ff00f0700000000000000
|
hex a97ee93ffc3ff00f0700000000000000
|
||||||
hex 00000000f8ffffffffffffffabaaaaaa
|
hex 00000000f8ffffffffffffffabaaaaaa
|
||||||
|
|
|
@ -257,7 +257,7 @@ void __fastcall__ oam_clear_fast(void);
|
||||||
void __fastcall__ oam_meta_spr_pal(unsigned char x,unsigned char y,unsigned char pal,const unsigned char *metasprite);
|
void __fastcall__ oam_meta_spr_pal(unsigned char x,unsigned char y,unsigned char pal,const unsigned char *metasprite);
|
||||||
void __fastcall__ oam_meta_spr_clip(signed int x,unsigned char y,const unsigned char *metasprite);
|
void __fastcall__ oam_meta_spr_clip(signed int x,unsigned char y,const unsigned char *metasprite);
|
||||||
|
|
||||||
// set NMI callback
|
// set NMI/IRQ callback
|
||||||
void __fastcall__ nmi_set_callback(void (*callback)(void));
|
void __fastcall__ nmi_set_callback(void (*callback)(void));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -338,14 +338,7 @@ const byte DIR_TO_CODE[32] = {
|
||||||
6|FLIPY, 6|FLIPY, 5|FLIPY, 4|FLIPY, 3|FLIPY, 2|FLIPY, 1|FLIPY, 0|FLIPY,
|
6|FLIPY, 6|FLIPY, 5|FLIPY, 4|FLIPY, 3|FLIPY, 2|FLIPY, 1|FLIPY, 0|FLIPY,
|
||||||
};
|
};
|
||||||
|
|
||||||
const byte SINTBL[32] = {
|
// sine table, pre-multiplied by 2
|
||||||
0, 25, 49, 71, 90, 106, 117, 125,
|
|
||||||
127, 125, 117, 106, 90, 71, 49, 25,
|
|
||||||
0, -25, -49, -71, -90, -106, -117, -125,
|
|
||||||
-127, -125, -117, -106, -90, -71, -49, -25,
|
|
||||||
};
|
|
||||||
|
|
||||||
// pre-multiplied by 2
|
|
||||||
const int SINTBL2[32] = {
|
const int SINTBL2[32] = {
|
||||||
0, 25*2, 49*2, 71*2, 90*2, 106*2, 117*2, 125*2,
|
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,
|
127*2, 125*2, 117*2, 106*2, 90*2, 71*2, 49*2, 25*2,
|
||||||
|
@ -356,29 +349,6 @@ const int SINTBL2[32] = {
|
||||||
#define ISIN(x) (SINTBL2[(x) & 31])
|
#define ISIN(x) (SINTBL2[(x) & 31])
|
||||||
#define ICOS(x) ISIN(x+8)
|
#define ICOS(x) ISIN(x+8)
|
||||||
|
|
||||||
// Fast 8-bit table lookup macro
|
|
||||||
// dest: destination
|
|
||||||
// ident: table identifier
|
|
||||||
// index: 8-bit index
|
|
||||||
#define FASTLUT8(dest,ident,index) \
|
|
||||||
__A__ = (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) \
|
|
||||||
__A__ = (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_X0 0
|
||||||
#define FORMATION_Y0 19
|
#define FORMATION_Y0 19
|
||||||
#define FORMATION_XSPACE 24
|
#define FORMATION_XSPACE 24
|
||||||
|
@ -432,16 +402,8 @@ void return_attacker(register AttackingEnemy* a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void fly_attacker(register AttackingEnemy* a) {
|
void fly_attacker(register AttackingEnemy* a) {
|
||||||
#ifdef USE_FASTLUT
|
|
||||||
static int sincos;
|
|
||||||
sincos = FASTLUT16(sincos, SINTBL2, a->dir&31);
|
|
||||||
a->x += sincos;
|
|
||||||
sincos = FASTLUT16(sincos, SINTBL2, (a->dir+8)&31);
|
|
||||||
a->y += sincos;
|
|
||||||
#else
|
|
||||||
a->x += ISIN(a->dir);
|
a->x += ISIN(a->dir);
|
||||||
a->y += ICOS(a->dir);
|
a->y += ICOS(a->dir);
|
||||||
#endif
|
|
||||||
if ((a->y >> 8) == 0) {
|
if ((a->y >> 8) == 0) {
|
||||||
a->returning = 1;
|
a->returning = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ void main(void) {
|
||||||
|
|
||||||
// set sprite 0
|
// set sprite 0
|
||||||
oam_clear();
|
oam_clear();
|
||||||
oam_spr(0, 30, 1, 1, 0);
|
oam_spr(1, 30, 0xa0, 1, 0);
|
||||||
|
|
||||||
// enable PPU rendering (turn on screen)
|
// enable PPU rendering (turn on screen)
|
||||||
ppu_on_all();
|
ppu_on_all();
|
||||||
|
|
25
src/emu.ts
25
src/emu.ts
|
@ -501,21 +501,21 @@ export function newAddressDecoder(table : AddressDecoderEntry[], options?:Addres
|
||||||
/// TOOLBAR
|
/// TOOLBAR
|
||||||
|
|
||||||
export class Toolbar {
|
export class Toolbar {
|
||||||
div : JQuery;
|
span : JQuery;
|
||||||
grp : JQuery;
|
grp : JQuery;
|
||||||
mousetrap;
|
mousetrap;
|
||||||
boundkeys = [];
|
boundkeys = [];
|
||||||
|
|
||||||
constructor(parentDiv:HTMLElement) {
|
constructor(parentDiv:HTMLElement) {
|
||||||
this.mousetrap = new Mousetrap(parentDiv);
|
this.mousetrap = new Mousetrap(parentDiv);
|
||||||
this.div = $(document.createElement("div")).addClass("btn_toolbar");
|
this.span = $(document.createElement("span")).addClass("btn_toolbar");
|
||||||
parentDiv.appendChild(this.div[0]);
|
parentDiv.appendChild(this.span[0]);
|
||||||
this.newGroup();
|
this.newGroup();
|
||||||
}
|
}
|
||||||
destroy() {
|
destroy() {
|
||||||
if (this.div) {
|
if (this.span) {
|
||||||
this.div.remove();
|
this.span.remove();
|
||||||
this.div = null;
|
this.span = null;
|
||||||
}
|
}
|
||||||
if (this.mousetrap) {
|
if (this.mousetrap) {
|
||||||
for (var key of this.boundkeys) {
|
for (var key of this.boundkeys) {
|
||||||
|
@ -525,11 +525,12 @@ export class Toolbar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newGroup() {
|
newGroup() {
|
||||||
this.grp = $(document.createElement("span")).addClass("btn_group").appendTo(this.div);
|
return this.grp = $(document.createElement("span")).addClass("btn_group").appendTo(this.span);
|
||||||
}
|
}
|
||||||
add(key:string, alttext:string, icon:string, fn:(e,combo) => void) {
|
add(key:string, alttext:string, icon:string, fn:(e,combo) => void) {
|
||||||
|
var btn = null;
|
||||||
if (icon) {
|
if (icon) {
|
||||||
var btn = $(document.createElement("button")).addClass("btn");
|
btn = $(document.createElement("button")).addClass("btn");
|
||||||
if (icon.startsWith('glyphicon')) {
|
if (icon.startsWith('glyphicon')) {
|
||||||
icon = '<span class="glyphicon ' + icon + '" aria-hidden="true"></span>';
|
icon = '<span class="glyphicon ' + icon + '" aria-hidden="true"></span>';
|
||||||
}
|
}
|
||||||
|
@ -538,8 +539,12 @@ export class Toolbar {
|
||||||
btn.click(fn);
|
btn.click(fn);
|
||||||
this.grp.append(btn);
|
this.grp.append(btn);
|
||||||
}
|
}
|
||||||
this.mousetrap.bind(key, fn);
|
if (key) {
|
||||||
this.boundkeys.push(key);
|
this.mousetrap.bind(key, fn);
|
||||||
|
this.boundkeys.push(key);
|
||||||
|
}
|
||||||
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
91
src/ui.ts
91
src/ui.ts
|
@ -8,7 +8,7 @@ import { CodeProject } from "./project";
|
||||||
import { WorkerResult, WorkerOutput, VerilogOutput, SourceFile, WorkerError, FileData } from "./workertypes";
|
import { WorkerResult, WorkerOutput, VerilogOutput, SourceFile, WorkerError, FileData } from "./workertypes";
|
||||||
import { ProjectWindows } from "./windows";
|
import { ProjectWindows } from "./windows";
|
||||||
import { Platform, Preset, DebugSymbols, DebugEvalCondition } from "./baseplatform";
|
import { Platform, Preset, DebugSymbols, DebugEvalCondition } from "./baseplatform";
|
||||||
import { PLATFORMS, EmuHalt } from "./emu";
|
import { PLATFORMS, EmuHalt, Toolbar } from "./emu";
|
||||||
import * as Views from "./views";
|
import * as Views from "./views";
|
||||||
import { createNewPersistentStore } from "./store";
|
import { createNewPersistentStore } from "./store";
|
||||||
import { getFilenameForPath, getFilenamePrefix, highlightDifferences, invertMap, byteArrayToString, compressLZG,
|
import { getFilenameForPath, getFilenamePrefix, highlightDifferences, invertMap, byteArrayToString, compressLZG,
|
||||||
|
@ -30,6 +30,8 @@ export var platform : Platform; // platform object
|
||||||
|
|
||||||
var toolbar = $("#controls_top");
|
var toolbar = $("#controls_top");
|
||||||
|
|
||||||
|
var uitoolbar : Toolbar;
|
||||||
|
|
||||||
export var current_project : CodeProject; // current CodeProject object
|
export var current_project : CodeProject; // current CodeProject object
|
||||||
|
|
||||||
export var projectWindows : ProjectWindows; // window manager
|
export var projectWindows : ProjectWindows; // window manager
|
||||||
|
@ -478,7 +480,7 @@ function _revertFile(e) {
|
||||||
if (wnd && wnd.setText) {
|
if (wnd && wnd.setText) {
|
||||||
var fn = fixFilename(projectWindows.getActiveID());
|
var fn = fixFilename(projectWindows.getActiveID());
|
||||||
// TODO: .mame
|
// TODO: .mame
|
||||||
$.get( "presets/"+platform_id+"/"+fn, function(text) {
|
$.get( "presets/"+getFilenamePrefix(platform_id)+"/"+fn, function(text) {
|
||||||
if (confirm("Reset '" + fn + "' to default?")) {
|
if (confirm("Reset '" + fn + "' to default?")) {
|
||||||
wnd.setText(text);
|
wnd.setText(text);
|
||||||
}
|
}
|
||||||
|
@ -488,7 +490,7 @@ function _revertFile(e) {
|
||||||
alert("Can only revert built-in files.");
|
alert("Can only revert built-in files.");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
alert("Cannot revert the active window.");
|
alert("Cannot revert the active window. Please choose a text file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,49 +1069,33 @@ function _addLinkFile() {
|
||||||
alert("Can't add linked file to this project type (" + tool + ")");
|
alert("Can't add linked file to this project type (" + tool + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupDebugControls(){
|
function setupDebugControls() {
|
||||||
|
// create toolbar buttons
|
||||||
$("#dbg_reset").click(resetAndDebug);
|
uitoolbar = new Toolbar($("#toolbar")[0]);
|
||||||
$("#dbg_pause").click(pause);
|
uitoolbar.grp.prop('id','debug_bar');
|
||||||
$("#dbg_go").click(resume);
|
uitoolbar.add('ctrl+alt+.', 'Reset', 'glyphicon-refresh', resetAndDebug).prop('id','dbg_reset');
|
||||||
Mousetrap.bindGlobal('ctrl+alt+p', pause);
|
uitoolbar.add('ctrl+alt+P', 'Pause', 'glyphicon-pause', pause).prop('id','dbg_pause');
|
||||||
Mousetrap.bindGlobal('ctrl+alt+r', resume);
|
uitoolbar.add('ctrl+alt+R', 'Resume', 'glyphicon-play', resume).prop('id','dbg_go');
|
||||||
Mousetrap.bindGlobal('ctrl+alt+.', resetAndDebug);
|
|
||||||
|
|
||||||
if (platform.step) {
|
if (platform.step) {
|
||||||
$("#dbg_step").click(singleStep).show();
|
uitoolbar.add('ctrl+alt+S', 'Single Step', 'glyphicon-step-forward', singleStep).prop('id','dbg_step');
|
||||||
Mousetrap.bindGlobal('ctrl+alt+s', singleStep);
|
|
||||||
} else
|
|
||||||
$("#dbg_step").hide();
|
|
||||||
|
|
||||||
if (platform.runToVsync) {
|
|
||||||
$("#dbg_tovsync").click(singleFrameStep).show();
|
|
||||||
Mousetrap.bindGlobal('ctrl+alt+v', singleFrameStep);
|
|
||||||
} else
|
|
||||||
$("#dbg_tovsync").hide();
|
|
||||||
|
|
||||||
if ((platform.runEval || platform.runToPC) && !platform_id.startsWith('verilog')) {
|
|
||||||
$("#dbg_toline").click(runToCursor).show();
|
|
||||||
Mousetrap.bindGlobal('ctrl+alt+l', runToCursor);
|
|
||||||
} else
|
|
||||||
$("#dbg_toline").hide();
|
|
||||||
|
|
||||||
if (platform.runUntilReturn) {
|
|
||||||
$("#dbg_stepout").click(runUntilReturn).show();
|
|
||||||
Mousetrap.bindGlobal('ctrl+alt+o', runUntilReturn);
|
|
||||||
} else
|
|
||||||
$("#dbg_stepout").hide();
|
|
||||||
|
|
||||||
if (platform.stepBack) {
|
|
||||||
$("#dbg_stepback").click(runStepBackwards).show();
|
|
||||||
Mousetrap.bindGlobal('ctrl+alt+b', runStepBackwards);
|
|
||||||
} else
|
|
||||||
$("#dbg_stepback").hide();
|
|
||||||
|
|
||||||
if (platform.newCodeAnalyzer) {
|
|
||||||
$("#dbg_timing").click(traceTiming).show();
|
|
||||||
}
|
}
|
||||||
$("#disassembly").hide();
|
if (platform.runToVsync) {
|
||||||
|
uitoolbar.add('ctrl+alt+V', 'Next Frame', 'glyphicon-forward', singleFrameStep).prop('id','dbg_tovsync');
|
||||||
|
}
|
||||||
|
if ((platform.runEval || platform.runToPC) && !platform_id.startsWith('verilog')) {
|
||||||
|
uitoolbar.add('ctrl+alt+L', 'Run To Line', 'glyphicon-save', runToCursor).prop('id','dbg_toline');
|
||||||
|
}
|
||||||
|
if (platform.runUntilReturn) {
|
||||||
|
uitoolbar.add('ctrl+alt+O', 'Step Out of Subroutine', 'glyphicon-hand-up', runUntilReturn).prop('id','dbg_stepout');
|
||||||
|
}
|
||||||
|
if (platform.stepBack) {
|
||||||
|
uitoolbar.add('ctrl+alt+B', 'Step Backwards', 'glyphicon-step-backward', runStepBackwards).prop('id','dbg_stepback');
|
||||||
|
}
|
||||||
|
uitoolbar.newGroup();
|
||||||
|
if (platform.newCodeAnalyzer) {
|
||||||
|
uitoolbar.add(null, 'Analyze CPU Timing', 'glyphicon-time', traceTiming);
|
||||||
|
}
|
||||||
|
// add menu clicks
|
||||||
$(".dropdown-menu").collapse({toggle: false});
|
$(".dropdown-menu").collapse({toggle: false});
|
||||||
$("#item_new_file").click(_createNewFile);
|
$("#item_new_file").click(_createNewFile);
|
||||||
$("#item_upload_file").click(_uploadNewFile);
|
$("#item_upload_file").click(_uploadNewFile);
|
||||||
|
@ -1137,12 +1123,13 @@ function setupDebugControls(){
|
||||||
$("#dbg_slowest").click(_slowestFrameRate);
|
$("#dbg_slowest").click(_slowestFrameRate);
|
||||||
$("#dbg_fastest").click(_fastestFrameRate);
|
$("#dbg_fastest").click(_fastestFrameRate);
|
||||||
}
|
}
|
||||||
if (platform.showHelp) {
|
|
||||||
$("#dbg_help").show().click(_lookupHelp);
|
|
||||||
}
|
|
||||||
$("#item_addfile_include").click(_addIncludeFile);
|
$("#item_addfile_include").click(_addIncludeFile);
|
||||||
$("#item_addfile_link").click(_addLinkFile);
|
$("#item_addfile_link").click(_addLinkFile);
|
||||||
updateDebugWindows();
|
updateDebugWindows();
|
||||||
|
// show help button?
|
||||||
|
if (platform.showHelp) {
|
||||||
|
uitoolbar.add('ctrl+alt+?', 'Show Help', 'glyphicon-question-sign', _lookupHelp);
|
||||||
|
}
|
||||||
// setup replay slider
|
// setup replay slider
|
||||||
if (platform.setRecorder && platform.advance) {
|
if (platform.setRecorder && platform.advance) {
|
||||||
setupReplaySlider();
|
setupReplaySlider();
|
||||||
|
@ -1183,7 +1170,7 @@ function setupReplaySlider() {
|
||||||
$("#replay_back").click(() => { setFrameTo(parseInt(replayslider.val().toString()) - 1); });
|
$("#replay_back").click(() => { setFrameTo(parseInt(replayslider.val().toString()) - 1); });
|
||||||
$("#replay_fwd").click(() => { setFrameTo(parseInt(replayslider.val().toString()) + 1); });
|
$("#replay_fwd").click(() => { setFrameTo(parseInt(replayslider.val().toString()) + 1); });
|
||||||
$("#replay_bar").show();
|
$("#replay_bar").show();
|
||||||
$("#dbg_record").click(_toggleRecording).show();
|
uitoolbar.add('ctrl+alt+0', 'Start/Stop Replay Recording', 'glyphicon-record', _toggleRecording).prop('id','dbg_record');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1322,13 +1309,6 @@ function replaceURLState() {
|
||||||
history.replaceState({}, "", "?" + $.param(qs));
|
history.replaceState({}, "", "?" + $.param(qs));
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBookLink() {
|
|
||||||
if (platform_id == 'vcs')
|
|
||||||
$("#booklink_vcs").show();
|
|
||||||
else if (platform_id == 'mw8080bw' || platform_id == 'vicdual' || platform_id == 'galaxian-scramble' || platform_id == 'vector-z80color' || platform_id == 'williams-z80')
|
|
||||||
$("#booklink_arcade").show();
|
|
||||||
}
|
|
||||||
|
|
||||||
function addPageFocusHandlers() {
|
function addPageFocusHandlers() {
|
||||||
var hidden = false;
|
var hidden = false;
|
||||||
document.addEventListener("visibilitychange", function() {
|
document.addEventListener("visibilitychange", function() {
|
||||||
|
@ -1375,7 +1355,6 @@ function startPlatform() {
|
||||||
loadProject(qs['file']);
|
loadProject(qs['file']);
|
||||||
setupDebugControls();
|
setupDebugControls();
|
||||||
updateSelector();
|
updateSelector();
|
||||||
showBookLink();
|
|
||||||
addPageFocusHandlers();
|
addPageFocusHandlers();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user