mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-01-26 17:33:36 +00:00
nes: update presets, vram browser
This commit is contained in:
parent
fd992338a6
commit
783bad07af
@ -109,11 +109,11 @@ NES_MIRR_QUAD = 8
|
||||
;;;;; NES_VECTORS - CPU vectors at end of address space
|
||||
|
||||
MAC NES_VECTORS
|
||||
seg Vectors
|
||||
org $fffa
|
||||
.word NMIHandler ;$fffa vblank nmi
|
||||
.word Start ;$fffc reset
|
||||
.word NMIHandler ;$fffe irq / brk (not used)
|
||||
seg Vectors ; segment "Vectors"
|
||||
org $fffa ; start at address $fffa
|
||||
.word NMIHandler ; $fffa vblank nmi
|
||||
.word Start ; $fffc reset
|
||||
.word NMIHandler ; $fffe irq / brk
|
||||
ENDM
|
||||
|
||||
;;;;; PPU_SETADDR <address> - set 16-bit PPU address
|
||||
|
@ -2,22 +2,22 @@
|
||||
;;;;; SUBROUTINES
|
||||
|
||||
ClearRAM: subroutine
|
||||
lda #0
|
||||
tax
|
||||
lda #0 ; A = 0
|
||||
tax ; X = 0
|
||||
.clearRAM
|
||||
sta $0,x
|
||||
cpx #$fe ; don't clear last 2 bytes of stack
|
||||
bcs .skipStack
|
||||
sta $100,x
|
||||
sta $0,x ; clear $0-$ff
|
||||
cpx #$fe ; last 2 bytes of stack?
|
||||
bcs .skipStack ; don't clear it
|
||||
sta $100,x ; clear $100-$1fd
|
||||
.skipStack
|
||||
; skip $200-$2FF, used for OAM display list
|
||||
sta $300,x
|
||||
sta $400,x
|
||||
sta $500,x
|
||||
sta $600,x
|
||||
sta $700,x
|
||||
inx
|
||||
bne .clearRAM
|
||||
sta $200,x ; clear $200-$2ff
|
||||
sta $300,x ; clear $300-$3ff
|
||||
sta $400,x ; clear $400-$4ff
|
||||
sta $500,x ; clear $500-$5ff
|
||||
sta $600,x ; clear $600-$6ff
|
||||
sta $700,x ; clear $700-$7ff
|
||||
inx ; X = X + 1
|
||||
bne .clearRAM ; loop 256 times
|
||||
rts
|
||||
|
||||
; wait for VSYNC to start
|
||||
|
@ -8,17 +8,11 @@
|
||||
#define VBUFSIZE 128
|
||||
|
||||
// update buffer starts at $100 (stack page)
|
||||
#define updbuf ((byte* const)0x100)
|
||||
#define updbuf ((byte*)0x100)
|
||||
|
||||
// index to end of buffer
|
||||
extern byte updptr;
|
||||
|
||||
// macro to add a multibyte header
|
||||
#define VRAMBUF_PUT(addr,len,flags)\
|
||||
VRAMBUF_ADD(((addr) >> 8) | (flags));\
|
||||
VRAMBUF_ADD(addr);\
|
||||
VRAMBUF_ADD(len);
|
||||
|
||||
// macro to set a single byte in buffer
|
||||
#define VRAMBUF_SET(b)\
|
||||
__A__ = (b);\
|
||||
@ -30,6 +24,9 @@ extern byte updptr;
|
||||
VRAMBUF_SET(b)\
|
||||
asm("inc %v", updptr);
|
||||
|
||||
//#define VRAMBUF_SET(b) updbuf[updptr] = (b);
|
||||
//#define VRAMBUF_ADD(b) VRAMBUF_SET(b); ++updptr
|
||||
|
||||
// add EOF marker to buffer (but don't increment pointer)
|
||||
void cendbuf(void);
|
||||
|
||||
|
@ -73,6 +73,7 @@ export interface Platform {
|
||||
inspect?(ident:string) : string;
|
||||
disassemble?(addr:number, readfn:(addr:number)=>number) : DisasmLine;
|
||||
readAddress?(addr:number) : number;
|
||||
readVRAMAddress?(addr:number) : number;
|
||||
setFrameRate?(fps:number) : void;
|
||||
getFrameRate?() : number;
|
||||
|
||||
|
@ -233,6 +233,9 @@ const _JSNESPlatform = function(mainElement) {
|
||||
getRasterScanline() : number {
|
||||
return nes.ppu.scanline;
|
||||
}
|
||||
readVRAMAddress(addr : number) : number {
|
||||
return nes.ppu.vramMem[addr & 0x7fff];
|
||||
}
|
||||
|
||||
getCPUState() {
|
||||
var c = nes.cpu.toJSON();
|
||||
|
@ -210,6 +210,11 @@ function refreshWindowList() {
|
||||
return new Views.MemoryView();
|
||||
});
|
||||
}
|
||||
if (platform.readVRAMAddress) {
|
||||
addWindowItem("#memvram", "VRAM Browser", function() {
|
||||
return new Views.VRAMMemoryView();
|
||||
});
|
||||
}
|
||||
if (current_project.segments) {
|
||||
addWindowItem("#memmap", "Memory Map", function() {
|
||||
return new Views.MemoryMapView();
|
||||
|
18
src/views.ts
18
src/views.ts
@ -659,7 +659,7 @@ export class MemoryView implements ProjectView {
|
||||
for (var i=0; i<n1; i++) s += ' ';
|
||||
if (n1 > 8) s += ' ';
|
||||
for (var i=n1; i<n2; i++) {
|
||||
var read = platform.readAddress(offset+i);
|
||||
var read = this.readAddress(offset+i);
|
||||
if (i==8) s += ' ';
|
||||
s += ' ' + (read!==null?hex(read,2):'??');
|
||||
}
|
||||
@ -667,6 +667,10 @@ export class MemoryView implements ProjectView {
|
||||
if (sym) s += ' ' + sym;
|
||||
return s;
|
||||
}
|
||||
|
||||
readAddress(n : number) {
|
||||
return platform.readAddress(n);
|
||||
}
|
||||
|
||||
getDumpLineAt(line : number) {
|
||||
var d = this.dumplines[line];
|
||||
@ -726,6 +730,18 @@ export class MemoryView implements ProjectView {
|
||||
}
|
||||
}
|
||||
|
||||
export class VRAMMemoryView extends MemoryView {
|
||||
readAddress(n : number) {
|
||||
return platform.readVRAMAddress(n);
|
||||
}
|
||||
getMemorySegment(a:number) : string {
|
||||
return 'video';
|
||||
}
|
||||
getDumpLines() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
export class BinaryFileView implements ProjectView {
|
||||
|
Loading…
x
Reference in New Issue
Block a user