mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-12 03:29:31 +00:00
minor stuff
This commit is contained in:
parent
5d9a169442
commit
98ee1a2d77
|
@ -65,7 +65,8 @@ TODO:
|
||||||
- click to break on raster position
|
- click to break on raster position
|
||||||
- restructure folders
|
- restructure folders
|
||||||
- update memory browser window if view before 1st compile, update symbols
|
- update memory browser window if view before 1st compile, update symbols
|
||||||
- spinner disappears sometimes (and compiles even when not spinning...)
|
- spinner disappears sometimes (and compiles even when not spinning...) (undo?)
|
||||||
|
- z80 illegal opcode kills platform
|
||||||
|
|
||||||
|
|
||||||
WEB WORKER FORMAT
|
WEB WORKER FORMAT
|
||||||
|
|
|
@ -320,7 +320,7 @@ function require(modname) {
|
||||||
<script src="gen/ui.js"></script>
|
<script src="gen/ui.js"></script>
|
||||||
<!-- <script src="src/audio/votrax.js"></script> -->
|
<!-- <script src="src/audio/votrax.js"></script> -->
|
||||||
|
|
||||||
<!--<script src="local/lzg.js"></script>-->
|
<script src="local/lzg.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
startUI(true);
|
startUI(true);
|
||||||
|
|
|
@ -58,26 +58,26 @@ byte __at (0x0000) vmagic[VHEIGHT][VBWIDTH];
|
||||||
byte __at (0x4000) vidmem[VHEIGHT][VBWIDTH];
|
byte __at (0x4000) vidmem[VHEIGHT][VBWIDTH];
|
||||||
|
|
||||||
// Used by MUSIC PROCESSOR:
|
// Used by MUSIC PROCESSOR:
|
||||||
word MUZPC; // $4FCE // MUSic Program Counter
|
volatile word MUZPC; // $4FCE // MUSic Program Counter
|
||||||
word MUZSP; // $4FD0 // MUSic Stack Pointer
|
volatile word MUZSP; // $4FD0 // MUSic Stack Pointer
|
||||||
byte PVOLAB; // $4FD2 // Preset VOLume for tones A and B
|
volatile byte PVOLAB; // $4FD2 // Preset VOLume for tones A and B
|
||||||
byte PVOLMC; // $4FD3 // Preset VOLuMe for tone C and Noise Mode
|
volatile byte PVOLMC; // $4FD3 // Preset VOLuMe for tone C and Noise Mode
|
||||||
byte VOICES; // $4FD4 // music VOICES mask
|
volatile byte VOICES; // $4FD4 // music VOICES mask
|
||||||
// COUNTER TIMERS (used by DECCTS,ACTINT,CTIMER):
|
// COUNTER TIMERS (used by DECCTS,ACTINT,CTIMER):
|
||||||
byte CT[8];
|
volatile byte CT[8];
|
||||||
// Used by SENTRY to track controls:
|
// Used by SENTRY to track controls:
|
||||||
byte CNT; // $4FDD // Counter update & Number Tracking
|
volatile byte CNT; // $4FDD // Counter update & Number Tracking
|
||||||
byte SEMI4S; // $4FDE // SEMAPHORE flag bitS
|
volatile byte SEMI4S; // $4FDE // SEMAPHORE flag bitS
|
||||||
byte OPOT[4]; // $4FDF // Old POT 0 tracking byte
|
volatile byte OPOT[4]; // $4FDF // Old POT 0 tracking byte
|
||||||
byte KEYSEX; // $4FE3 // KEYS-EX tracking byte
|
volatile byte KEYSEX; // $4FE3 // KEYS-EX tracking byte
|
||||||
byte OSW[4]; // $4FE4 // Old SWitch 0 tracking byte
|
volatile byte OSW[4]; // $4FE4 // Old SWitch 0 tracking byte
|
||||||
word COLLST; // $4FE8 // COLset LaST address for P.B. A
|
volatile word COLLST; // $4FE8 // COLset LaST address for P.B. A
|
||||||
// Used by STIMER:
|
// Used by STIMER:
|
||||||
byte DURAT; // $4FEA // note DURATion
|
volatile byte DURAT; // $4FEA // note DURATion
|
||||||
byte TMR60; // $4FEB // TiMeR for SIXTY'ths of sec
|
volatile byte TMR60; // $4FEB // TiMeR for SIXTY'ths of sec
|
||||||
byte TIMOUT; // $4FEC // TIMer for blackOUT
|
volatile byte TIMOUT; // $4FEC // TIMer for blackOUT
|
||||||
byte GTSECS; // $4FED // Game Time SECondS
|
volatile byte GTSECS; // $4FED // Game Time SECondS
|
||||||
byte GTMINS; // $4FEE // Game Time MINuteS
|
volatile byte GTMINS; // $4FEE // Game Time MINuteS
|
||||||
// Used by MENU:
|
// Used by MENU:
|
||||||
long RANSHT; // $4FEF // RANdom number SHifT register
|
long RANSHT; // $4FEF // RANdom number SHifT register
|
||||||
byte NUMPLY; // $4FF3 // NUMber of PLaYers
|
byte NUMPLY; // $4FF3 // NUMber of PLaYers
|
||||||
|
@ -93,20 +93,26 @@ word* USERTB; // $4FFD // USER Table Base + routine = JumP address
|
||||||
// start routine @ 0x0
|
// start routine @ 0x0
|
||||||
void bios_start() __naked {
|
void bios_start() __naked {
|
||||||
__asm
|
__asm
|
||||||
DI
|
DI ; disable interrupts
|
||||||
LD SP,#0x4fce
|
LD SP,#0x4fce ; position stack below BIOS vars
|
||||||
CALL _bios_init
|
LD HL,#0x2000
|
||||||
LD HL,#0x2005
|
LD A,(HL) ; A <- mem[0x2000]
|
||||||
|
CP #0x55 ; found sentinel byte? ($55)
|
||||||
|
JP Z,FoundSentinel ; yes, load program
|
||||||
|
#ifndef TEST
|
||||||
|
JP 0x2000 ; jump to $2000
|
||||||
|
#else
|
||||||
|
JP _main ; jump to test program
|
||||||
|
#endif
|
||||||
|
FoundSentinel:
|
||||||
|
CALL _bios_init ; misc. bios init routines
|
||||||
|
LD HL,#0x2005 ; cartridge start vector
|
||||||
LD A,(HL)
|
LD A,(HL)
|
||||||
INC HL
|
INC HL
|
||||||
#ifndef TEST
|
|
||||||
LD H,(HL)
|
LD H,(HL)
|
||||||
LD L,A
|
LD L,A
|
||||||
JP (HL)
|
JP (HL) ; jump to cart start vector
|
||||||
#else
|
.ds 0x38 - 0x1b ; eat up space until 0x38
|
||||||
JP _main
|
|
||||||
#endif
|
|
||||||
.ds 0x38 - 0xf ; skip to 0x38
|
|
||||||
__endasm;
|
__endasm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,8 +126,8 @@ __asm
|
||||||
push iy
|
push iy
|
||||||
ld hl,#0
|
ld hl,#0
|
||||||
add hl,sp
|
add hl,sp
|
||||||
push hl
|
push hl ; HL points to context block
|
||||||
call _SYSCALL
|
call _SYSCALL ; syscall handler
|
||||||
pop hl
|
pop hl
|
||||||
pop iy
|
pop iy
|
||||||
pop ix
|
pop ix
|
||||||
|
@ -144,9 +150,9 @@ void DOPE() __naked {
|
||||||
__asm
|
__asm
|
||||||
JP _STIMER
|
JP _STIMER
|
||||||
JP _CTIMER
|
JP _CTIMER
|
||||||
.db 0x20, 8, 8, 1, 7
|
.db 0x20, 8, 8, 1, 7 ; Font descriptor (big font)
|
||||||
.dw _BIGFONT
|
.dw _BIGFONT
|
||||||
.db 0xa0, 4, 6, 1, 5
|
.db 0xa0, 4, 6, 1, 5 ; Font descriptor (small font)
|
||||||
.dw _SMLFONT
|
.dw _SMLFONT
|
||||||
__endasm;
|
__endasm;
|
||||||
}
|
}
|
||||||
|
@ -245,6 +251,49 @@ void RCALL(ContextBlock *ctx) {
|
||||||
((Routine*)ctx->regs.w.hl)();
|
((Routine*)ctx->regs.w.hl)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start interpreting at HL
|
||||||
|
void MCALL(ContextBlock *ctx) {
|
||||||
|
ctx; // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
// exit MCALL loop
|
||||||
|
void MRET(ContextBlock *ctx) {
|
||||||
|
ctx; // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
// jump within MCALL
|
||||||
|
void MJUMP(ContextBlock *ctx) {
|
||||||
|
ctx->params = (byte*) ctx->regs.w.hl; // TODO?
|
||||||
|
}
|
||||||
|
|
||||||
|
void suckParams(ContextBlock *ctx, byte argmask) {
|
||||||
|
byte* dest = (byte*) ctx;
|
||||||
|
byte* src = ctx->params;
|
||||||
|
if (argmask & REG_IX) {
|
||||||
|
ctx->regs.b.ixl = *src++;
|
||||||
|
ctx->regs.b.ixh = *src++;
|
||||||
|
}
|
||||||
|
if (argmask & REG_E)
|
||||||
|
ctx->regs.b.e = *src++;
|
||||||
|
if (argmask & REG_D)
|
||||||
|
ctx->regs.b.d = *src++;
|
||||||
|
if (argmask & REG_C)
|
||||||
|
ctx->regs.b.c = *src++;
|
||||||
|
if (argmask & REG_B)
|
||||||
|
ctx->regs.b.b = *src++;
|
||||||
|
if (argmask & REG_A)
|
||||||
|
ctx->regs.b.a = *src++;
|
||||||
|
if (argmask & REG_HL) {
|
||||||
|
ctx->regs.b.l = *src++;
|
||||||
|
ctx->regs.b.h = *src++;
|
||||||
|
}
|
||||||
|
ctx->params = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SUCK(ContextBlock* ctx) {
|
||||||
|
suckParams(ctx, ctx->regs.b.b);
|
||||||
|
}
|
||||||
|
|
||||||
void ACTINT(ContextBlock *ctx) {
|
void ACTINT(ContextBlock *ctx) {
|
||||||
ctx;
|
ctx;
|
||||||
hw_inlin = 200;
|
hw_inlin = 200;
|
||||||
|
@ -344,24 +393,42 @@ void draw_string(ContextBlock *ctx, const char* str, byte x, byte y, byte op) {
|
||||||
} while (1);
|
} while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// String display routine
|
// String display routine (pass pointer to string)
|
||||||
void STRDIS(ContextBlock *ctx) {
|
void STRDIS2(ContextBlock *ctx, char *str) {
|
||||||
byte opts = ctx->regs.b.c;
|
byte opts = ctx->regs.b.c;
|
||||||
byte x = ctx->regs.b.e;
|
byte x = ctx->regs.b.e;
|
||||||
byte y = ctx->regs.b.d;
|
byte y = ctx->regs.b.d;
|
||||||
char* str = (char*) ctx->regs.w.hl;
|
|
||||||
void* fontdesc = (void*) ctx->regs.w.ix;
|
void* fontdesc = (void*) ctx->regs.w.ix;
|
||||||
hw_xpand = opts & 0xf;
|
hw_xpand = opts & 0xf;
|
||||||
draw_string(ctx, str, x, y, 3&(opts>>4)); // TODO: opts
|
draw_string(ctx, str, x, y, 3&(opts>>4)); // TODO: opts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String display routine
|
||||||
|
void STRDIS(ContextBlock *ctx) {
|
||||||
|
char* str = (char*) ctx->regs.w.hl;
|
||||||
|
STRDIS2(ctx, str);
|
||||||
|
}
|
||||||
|
|
||||||
// Character display routine
|
// Character display routine
|
||||||
void CHRDIS(ContextBlock *ctx) {
|
void CHRDIS(ContextBlock *ctx) {
|
||||||
char chstr[2];
|
char chstr[2];
|
||||||
chstr[0] = ctx->regs.b.a;
|
chstr[0] = ctx->regs.b.a;
|
||||||
chstr[1] = 0;
|
chstr[1] = 0;
|
||||||
ctx->regs.w.hl = (word) &chstr;
|
STRDIS2(ctx, chstr);
|
||||||
STRDIS(ctx);
|
}
|
||||||
|
|
||||||
|
// BCD routine
|
||||||
|
const char BCDTAB[17] = "0123456789*+,-./";
|
||||||
|
|
||||||
|
void DISNUM(ContextBlock *ctx) {
|
||||||
|
// TODO: options, B
|
||||||
|
word oldhl = ctx->regs.w.hl;
|
||||||
|
byte val = *(byte*) oldhl;
|
||||||
|
char bcdstr[3];
|
||||||
|
bcdstr[0] = BCDTAB[val >> 4];
|
||||||
|
bcdstr[1] = BCDTAB[val & 15];
|
||||||
|
bcdstr[2] = 0;
|
||||||
|
STRDIS2(ctx, bcdstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -369,17 +436,29 @@ typedef struct {
|
||||||
byte xsize, ysize;
|
byte xsize, ysize;
|
||||||
byte pattern[0];
|
byte pattern[0];
|
||||||
} PatternBlock;
|
} PatternBlock;
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
void wait_vsync() {
|
||||||
|
byte x = TMR60;
|
||||||
|
while (x == TMR60) ; // wait until timer/60 changes
|
||||||
|
}
|
||||||
|
|
||||||
|
void PAWS(ContextBlock *ctx) {
|
||||||
|
while (ctx->regs.b.b--) {
|
||||||
|
wait_vsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const SysCallEntry SYSCALL_TABLE[64] = {
|
const SysCallEntry SYSCALL_TABLE[64] = {
|
||||||
/* 0 */
|
/* 0 */
|
||||||
{ &INTPC, 0 },
|
{ &INTPC, 0 },
|
||||||
{ &EXIT, 0 },
|
{ &EXIT, 0 },
|
||||||
{ &RCALL, REG_HL },
|
{ &RCALL, REG_HL },
|
||||||
{ 0, 0 },
|
{ &MCALL, REG_HL },
|
||||||
{ 0, 0 },
|
{ &MRET, 0 },
|
||||||
/* 10 */
|
/* 10 */
|
||||||
{ 0, 0 },
|
{ &MJUMP, REG_HL },
|
||||||
{ 0, 0 },
|
{ &SUCK, REG_B },
|
||||||
{ &ACTINT, 0 },
|
{ &ACTINT, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
|
@ -404,7 +483,7 @@ const SysCallEntry SYSCALL_TABLE[64] = {
|
||||||
/* 50 */
|
/* 50 */
|
||||||
{ &CHRDIS, REG_E|REG_D|REG_C|REG_A },
|
{ &CHRDIS, REG_E|REG_D|REG_C|REG_A },
|
||||||
{ &STRDIS, REG_E|REG_D|REG_C|REG_HL },
|
{ &STRDIS, REG_E|REG_D|REG_C|REG_HL },
|
||||||
{ 0, 0 },
|
{ &DISNUM, REG_E|REG_D|REG_C|REG_HL },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
/* 60 */
|
/* 60 */
|
||||||
|
@ -420,7 +499,7 @@ const SysCallEntry SYSCALL_TABLE[64] = {
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
/* 80 */
|
/* 80 */
|
||||||
{ 0, 0 },
|
{ &PAWS, REG_B },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
|
@ -450,30 +529,6 @@ const SysCallEntry SYSCALL_TABLE[64] = {
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
void suckParams(ContextBlock *ctx, byte argmask) {
|
|
||||||
byte* dest = (byte*) ctx;
|
|
||||||
byte* src = ctx->params;
|
|
||||||
if (argmask & REG_IX) {
|
|
||||||
ctx->regs.b.ixl = *src++;
|
|
||||||
ctx->regs.b.ixh = *src++;
|
|
||||||
}
|
|
||||||
if (argmask & REG_E)
|
|
||||||
ctx->regs.b.e = *src++;
|
|
||||||
if (argmask & REG_D)
|
|
||||||
ctx->regs.b.d = *src++;
|
|
||||||
if (argmask & REG_C)
|
|
||||||
ctx->regs.b.c = *src++;
|
|
||||||
if (argmask & REG_B)
|
|
||||||
ctx->regs.b.b = *src++;
|
|
||||||
if (argmask & REG_A)
|
|
||||||
ctx->regs.b.a = *src++;
|
|
||||||
if (argmask & REG_HL) {
|
|
||||||
ctx->regs.b.l = *src++;
|
|
||||||
ctx->regs.b.h = *src++;
|
|
||||||
}
|
|
||||||
ctx->params = src;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SYSCALL(ContextBlock *ctx) {
|
void SYSCALL(ContextBlock *ctx) {
|
||||||
byte op = *ctx->params++;
|
byte op = *ctx->params++;
|
||||||
byte argmask;
|
byte argmask;
|
||||||
|
|
|
@ -22,7 +22,8 @@ export class CodeProject {
|
||||||
platform: any; // TODO: use type
|
platform: any; // TODO: use type
|
||||||
store: any;
|
store: any;
|
||||||
callbackGetRemote : GetRemoteCallback;
|
callbackGetRemote : GetRemoteCallback;
|
||||||
mainPath: string;
|
mainPath : string;
|
||||||
|
isCompiling : boolean = false;
|
||||||
|
|
||||||
constructor(worker, platform_id:string, platform, store) {
|
constructor(worker, platform_id:string, platform, store) {
|
||||||
this.worker = worker;
|
this.worker = worker;
|
||||||
|
@ -36,6 +37,8 @@ export class CodeProject {
|
||||||
this.sendBuild();
|
this.sendBuild();
|
||||||
} else {
|
} else {
|
||||||
if (this.callbackBuildStatus) this.callbackBuildStatus(false);
|
if (this.callbackBuildStatus) this.callbackBuildStatus(false);
|
||||||
|
if (!this.isCompiling) { console.log(this.pendingWorkerMessages); console.trace(); } // debug compile problems
|
||||||
|
this.isCompiling = false;
|
||||||
}
|
}
|
||||||
this.pendingWorkerMessages = 0;
|
this.pendingWorkerMessages = 0;
|
||||||
if (e.data && !e.data.unchanged) {
|
if (e.data && !e.data.unchanged) {
|
||||||
|
@ -238,6 +241,7 @@ export class CodeProject {
|
||||||
var workermsg = this.buildWorkerMessage(depends);
|
var workermsg = this.buildWorkerMessage(depends);
|
||||||
this.worker.postMessage(workermsg);
|
this.worker.postMessage(workermsg);
|
||||||
}
|
}
|
||||||
|
this.isCompiling = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
src/views.ts
12
src/views.ts
|
@ -287,9 +287,9 @@ export class SourceEditor implements ProjectView {
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshDebugState(moveCursor:boolean) {
|
refreshDebugState(moveCursor:boolean) {
|
||||||
this.clearCurrentLine();
|
|
||||||
var line = this.getActiveLine();
|
var line = this.getActiveLine();
|
||||||
if (line >= 0) {
|
if (line >= 0) {
|
||||||
|
this.clearCurrentLine();
|
||||||
this.setCurrentLine(line, moveCursor);
|
this.setCurrentLine(line, moveCursor);
|
||||||
// TODO: switch to disasm?
|
// TODO: switch to disasm?
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ export class DisassemblerView implements ProjectView {
|
||||||
var a = start;
|
var a = start;
|
||||||
var s = "";
|
var s = "";
|
||||||
while (a < end) {
|
while (a < end) {
|
||||||
var disasm = platform.disassemble(a, platform.readAddress);
|
var disasm = platform.disassemble(a, platform.readAddress.bind(platform));
|
||||||
/* TODO: look thru all source files
|
/* TODO: look thru all source files
|
||||||
var srclinenum = sourcefile && this.sourcefile.offset2line[a];
|
var srclinenum = sourcefile && this.sourcefile.offset2line[a];
|
||||||
if (srclinenum) {
|
if (srclinenum) {
|
||||||
|
@ -574,14 +574,14 @@ export class MemoryView implements ProjectView {
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.setAttribute("class", "memdump");
|
div.setAttribute("class", "memdump");
|
||||||
parent.appendChild(div);
|
parent.appendChild(div);
|
||||||
this.showMemoryWindow(div);
|
this.showMemoryWindow(parent, div);
|
||||||
return this.maindiv = div;
|
return this.maindiv = div;
|
||||||
}
|
}
|
||||||
|
|
||||||
showMemoryWindow(parent : HTMLElement) {
|
showMemoryWindow(workspace:HTMLElement, parent:HTMLElement) {
|
||||||
this.memorylist = new VirtualList({
|
this.memorylist = new VirtualList({
|
||||||
w:$("#workspace").width(),
|
w: $(workspace).width(),
|
||||||
h:$("#workspace").height(),
|
h: $(workspace).height(),
|
||||||
itemHeight: getVisibleEditorLineHeight(),
|
itemHeight: getVisibleEditorLineHeight(),
|
||||||
totalRows: 0x1000,
|
totalRows: 0x1000,
|
||||||
generatorFn: (row : number) => {
|
generatorFn: (row : number) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user