nes: update presets, vram cur/tmp display

This commit is contained in:
Steven Hugg 2019-05-16 13:04:27 -04:00
parent 61ffe2ae79
commit b5d0c2410b
8 changed files with 48 additions and 15 deletions

View File

@ -339,9 +339,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<h3 class="modal-title">Publish Project on GitHub</h3> <h3 class="modal-title">Publish Project on GitHub</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>This will migrate your existing files to a new GitHub repository.</p> <p>This will migrate your existing project to a new GitHub repository.</p>
<p><input id="githubRepoName" size="50" placeholder="Enter a project name"></input></p> <p>https://github.com/username/&nbsp;<input id="githubRepoName" size="35" placeholder="Enter a project name"></input></p>
<p><input id="githubRepoDesc" size="50" placeholder="Enter a project description"></input></p> <p><input id="githubRepoDesc" size="60" placeholder="Enter a project description"></input></p>
<p>Your repository will be <select id="githubRepoPrivate"> <p>Your repository will be <select id="githubRepoPrivate">
<option value="public">Public</option> <option value="public">Public</option>
<option value="private">Private</option> <option value="private">Private</option>

View File

@ -7,6 +7,9 @@
#include "apu.h" #include "apu.h"
//#link "apu.c" //#link "apu.c"
#include "vrambuf.h"
//#link "vrambuf.c"
// link the pattern table into CHR ROM // link the pattern table into CHR ROM
//#link "chr_generic.s" //#link "chr_generic.s"
@ -79,6 +82,16 @@ void play_sound() {
APU_NOISE_DECAY(vals[16]|vals[19], vals[17], vals[18]); APU_NOISE_DECAY(vals[16]|vals[19], vals[17], vals[18]);
} }
void print_status() {
byte i;
vrambuf_clear();
for (i=0; i<APU_DEFCOUNT; i++) {
char ch = APU.status & APU_DEFS[i].chmask ? '*' : ' ';
vrambuf_put(NTADR_A(29,i+1), &ch, 1);
}
}
void main(void) void main(void)
{ {
pal_col(1,0x04); pal_col(1,0x04);
@ -94,7 +107,13 @@ void main(void)
} }
print_sound(); print_sound();
play_sound(); play_sound();
ppu_on_all();//enable rendering vrambuf_clear();
while (!pad_trigger(0)) ; // wait for key set_vram_update(updbuf);
ppu_on_all();
// wait for key
while (!pad_trigger(0)) {
ppu_wait_nmi();
print_status();
}
} }
} }

View File

@ -311,7 +311,9 @@ export function dumpRAM(ram:Uint8Array|number[], ramofs:number, ramlen:number) :
return s; return s;
} }
export const Keys = { interface KeyDef {c:number, n:string};
export const Keys : {[keycode:string]:KeyDef} = {
VK_ESCAPE: {c: 27, n: "Esc"}, VK_ESCAPE: {c: 27, n: "Esc"},
VK_F1: {c: 112, n: "F1"}, VK_F1: {c: 112, n: "F1"},
VK_F2: {c: 113, n: "F2"}, VK_F2: {c: 113, n: "F2"},
@ -445,7 +447,7 @@ export function setKeyboardFromMap(video, switches, map, func?) {
}); });
} }
export function makeKeycodeMap(table) { export function makeKeycodeMap(table : [KeyDef,number,number][]) {
var map = {}; var map = {};
for (var i=0; i<table.length; i++) { for (var i=0; i<table.length; i++) {
var entry = table[i]; var entry = table[i];
@ -454,7 +456,7 @@ export function makeKeycodeMap(table) {
return map; return map;
} }
export function padBytes(data, len) { export function padBytes(data:Uint8Array|number[], len:number) : Uint8Array {
if (data.length > len) { if (data.length > len) {
throw Error("Data too long, " + data.length + " > " + len); throw Error("Data too long, " + data.length + " > " + len);
} }
@ -547,7 +549,7 @@ export class Toolbar {
} }
// https://stackoverflow.com/questions/17130395/real-mouse-position-in-canvas // https://stackoverflow.com/questions/17130395/real-mouse-position-in-canvas
export function getMousePos(canvas : HTMLCanvasElement, evt) { export function getMousePos(canvas : HTMLCanvasElement, evt) : {x:number,y:number} {
var rect = canvas.getBoundingClientRect(), // abs. size of element var rect = canvas.getBoundingClientRect(), // abs. size of element
scaleX = canvas.width / rect.width, // relationship bitmap vs. element for X scaleX = canvas.width / rect.width, // relationship bitmap vs. element for X
scaleY = canvas.height / rect.height; // relationship bitmap vs. element for Y scaleY = canvas.height / rect.height; // relationship bitmap vs. element for Y

View File

@ -55,8 +55,8 @@ const JSNES_KEYCODE_MAP = makeKeycodeMap([
[Keys.VK_RIGHT, 0, 7], [Keys.VK_RIGHT, 0, 7],
[Keys.VK_Q, 1, 0], [Keys.VK_Q, 1, 0],
[Keys.VK_E, 1, 1], [Keys.VK_E, 1, 1],
[Keys.VK_4, 1, 2], [Keys.VK_1, 1, 2],
[Keys.VK_3, 1, 3], [Keys.VK_2, 1, 3],
[Keys.VK_W, 1, 4], [Keys.VK_W, 1, 4],
[Keys.VK_S, 1, 5], [Keys.VK_S, 1, 5],
[Keys.VK_A, 1, 6], [Keys.VK_A, 1, 6],
@ -335,10 +335,10 @@ class JSNESPlatform extends Base6502Platform implements Platform {
var scrollY = ppu.regFV + ppu.regVT*8; var scrollY = ppu.regFV + ppu.regVT*8;
s += "ScrollX $" + hex(scrollX) + " (" + ppu.regHT + " * 8 + " + ppu.regFH + " = " + scrollX + ")\n"; s += "ScrollX $" + hex(scrollX) + " (" + ppu.regHT + " * 8 + " + ppu.regFH + " = " + scrollX + ")\n";
s += "ScrollY $" + hex(scrollY) + " (" + ppu.regVT + " * 8 + " + ppu.regFV + " = " + scrollY + ")\n"; s += "ScrollY $" + hex(scrollY) + " (" + ppu.regVT + " * 8 + " + ppu.regFV + " = " + scrollY + ")\n";
s += " Vstart $" + hex(ppu.vramTmpAddress,4) + "\n";
s += "\n"; s += "\n";
s += " Scan Y: " + ppu.scanline + " X: " + ppu.curX + "\n"; s += " Scan Y: " + ppu.scanline + " X: " + ppu.curX + "\n";
s += " VRAM " + (ppu.firstWrite?"@":"?") + " $" + hex(ppu.vramAddress,4) + "\n"; s += "VramCur" + (ppu.firstWrite?" ":"?") + "$" + hex(ppu.vramAddress,4) + "\n";
s += "VramTmp $" + hex(ppu.vramTmpAddress,4) + "\n";
/* /*
var PPUREGS = [ var PPUREGS = [
'cntFV', 'cntFV',

View File

@ -249,7 +249,7 @@ export class GithubService {
var s = README_md_template; var s = README_md_template;
s = s.replace(/\$NAME/g, encodeURIComponent(reponame)); s = s.replace(/\$NAME/g, encodeURIComponent(reponame));
s = s.replace(/\$PLATFORM/g, encodeURIComponent(platform_id)); s = s.replace(/\$PLATFORM/g, encodeURIComponent(platform_id));
s = s.replace(/\$GITHUBURL/g, encodeURIComponent(repo.html_url)); s = s.replace(/\$GITHUBURL/g, encodeURIComponent(repo.htmlUrl));
s = s.replace(/\$MAINFILE/g, encodeURIComponent(mainPath)); s = s.replace(/\$MAINFILE/g, encodeURIComponent(mainPath));
var config = { var config = {
message: '8bitworkshop: updated metadata in README.md', message: '8bitworkshop: updated metadata in README.md',

View File

@ -468,6 +468,7 @@ function _publishProjectToGithub(e) {
} }
var modal = $("#publishGithubModal"); var modal = $("#publishGithubModal");
var btn = $("#publishGithubButton"); var btn = $("#publishGithubButton");
$("#githubRepoName").val(getFilenamePrefix(current_project.mainPath));
modal.modal('show'); modal.modal('show');
btn.off('click').on('click', () => { btn.off('click').on('click', () => {
var name = $("#githubRepoName").val()+""; var name = $("#githubRepoName").val()+"";
@ -475,6 +476,10 @@ function _publishProjectToGithub(e) {
var priv = $("#githubRepoPrivate").val() == 'private'; var priv = $("#githubRepoPrivate").val() == 'private';
var license = $("#githubRepoLicense").val()+""; var license = $("#githubRepoLicense").val()+"";
var sess; var sess;
if (!name) {
alertError("You did not enter a project name.");
return;
}
modal.modal('hide'); modal.modal('hide');
setWaitDialog(true); setWaitDialog(true);
getGithubService().login().then( () => { getGithubService().login().then( () => {

View File

@ -637,7 +637,8 @@ export class MemoryView implements ProjectView {
var nextofs = parseInt(_nextofs); // convert from string (stupid JS) var nextofs = parseInt(_nextofs); // convert from string (stupid JS)
var nextsym = addr2sym[nextofs]; var nextsym = addr2sym[nextofs];
if (sym) { if (sym) {
if (sym.endsWith('_SIZE__') || sym.endsWith('_LAST__') || sym.endsWith('STACKSIZE__') || sym.endsWith('FILEOFFS__')) // ignore certain symbols
if (sym.endsWith('_SIZE__') || sym.endsWith('_LAST__') || sym.endsWith('STACKSIZE__') || sym.endsWith('FILEOFFS__') || sym.startsWith('l__'))
sym = ''; sym = '';
if (MemoryView.IGNORE_SYMS[sym]) { if (MemoryView.IGNORE_SYMS[sym]) {
ofs = nextofs; ofs = nextofs;

View File

@ -242,6 +242,12 @@ var PLATFORM_PARAMS = {
data_start: 0x4e10, data_start: 0x4e10,
data_size: 0x1f0, data_size: 0x1f0,
stack_end: 0x5000, stack_end: 0x5000,
extra_segments:[
{name:'BIOS',start:0x0,size:0x2000,type:'rom'},
//{name:'Cart ROM',start:0x2000,size:0x2000,type:'rom'},
//{name:'Magic RAM',start:0x0,size:0x4000,type:'ram'},
{name:'Screen RAM',start:0x4000,size:0x1000,type:'ram'},
],
}, },
'astrocade-arcade': { 'astrocade-arcade': {
code_start: 0x0000, code_start: 0x0000,