added nes rle preset

This commit is contained in:
Steven Hugg 2018-07-29 15:53:50 -04:00
parent b321bd808f
commit 8cb3c0a0dc
5 changed files with 57 additions and 16 deletions

View File

@ -76,18 +76,6 @@ div.memdump {
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
font-size: 10pt;
}
div.debugwindow {
position:absolute;
left:50%;
top:0;
width:50%;
background-color: #333;
color: #66ff66;
white-space: pre;
margin-top: 20px auto 0;
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
font-size: 10pt;
}
div.mem_info {
position: fixed;
left: 51%;

53
presets/nes/neslib5.c Normal file
View File

@ -0,0 +1,53 @@
//this example code unpacks a RLE'd nametable into the VRAM
//you can create the source data using NES Screen Tool
#include "neslib.h"
const unsigned char test[308]={
0x01,0x00,0x01,0xa3,0x10,0x01,0x04,0x00,0x10,0x01,0x04,0x00,0x10,0x01,0x04,0x00,
0x10,0x01,0x04,0x00,0x01,0x0a,0x10,0x00,0x01,0x02,0x10,0x00,0x01,0x04,0x10,0x00,
0x01,0x06,0x10,0x00,0x01,0x0c,0x10,0x00,0x01,0x02,0x10,0x01,0x02,0x00,0x01,0x02,
0x10,0x01,0x04,0x00,0x01,0x02,0x10,0x00,0x01,0x0c,0x10,0x00,0x01,0x02,0x10,0x00,
0x01,0x08,0x10,0x00,0x01,0x02,0x10,0x00,0x01,0x0c,0x10,0x00,0x01,0x02,0x10,0x01,
0x04,0x00,0x10,0x01,0x04,0x00,0x01,0x02,0x10,0x00,0x01,0x42,0x10,0x00,0x01,0x06,
0x10,0x01,0x04,0x00,0x10,0x00,0x01,0x04,0x10,0x01,0x04,0x00,0x10,0x00,0x01,0x04,
0x10,0x00,0x01,0x06,0x10,0x00,0x01,0x02,0x10,0x00,0x10,0x00,0x01,0x04,0x10,0x00,
0x01,0x06,0x10,0x01,0x04,0x00,0x01,0x06,0x10,0x00,0x01,0x02,0x10,0x00,0x10,0x00,
0x01,0x04,0x10,0x01,0x02,0x00,0x01,0x04,0x10,0x00,0x01,0x02,0x10,0x00,0x01,0x06,
0x10,0x01,0x03,0x00,0x00,0x10,0x00,0x01,0x04,0x10,0x00,0x01,0x06,0x10,0x00,0x01,
0x02,0x10,0x00,0x01,0x06,0x10,0x00,0x01,0x02,0x10,0x00,0x10,0x01,0x04,0x00,0x10,
0x01,0x04,0x00,0x01,0x02,0x10,0x01,0x04,0x00,0x01,0x46,0x10,0x00,0x01,0x02,0x10,
0x00,0x10,0x01,0x04,0x00,0x10,0x01,0x04,0x00,0x01,0x0e,0x10,0x10,0x00,0x10,0x10,
0x00,0x10,0x00,0x01,0x02,0x10,0x00,0x10,0x00,0x01,0x02,0x10,0x00,0x01,0x0e,0x10,
0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x01,0x02,0x10,0x00,0x10,0x00,0x01,0x02,0x10,
0x00,0x01,0x0e,0x10,0x00,0x01,0x02,0x10,0x00,0x10,0x01,0x04,0x00,0x10,0x01,0x04,
0x00,0x01,0x0e,0x10,0x00,0x01,0x02,0x10,0x00,0x10,0x00,0x01,0x02,0x10,0x00,0x10,
0x00,0x01,0xde,0x50,0x01,0x07,0x55,0x01,0x07,0xa5,0x01,0x07,0xaa,0x01,0x0f,0x0a,
0x01,0x07,0x01,0x00
};
const unsigned char palette[16]={ 0x0f,0x21,0x10,0x30,0x0f,0x14,0x21,0x31,0x0f,0x29,0x16,0x26,0x0f,0x09,0x19,0x29 }; //palette data
//#link "tileset1.c"
// tile set, two planes for 4 colors
extern unsigned char TILESET[8*256];
void main(void)
{
//rendering is disabled at the startup, and palette is all black
pal_bg(palette);//set background palette from an array
//copy tileset to RAM
vram_write((unsigned char*)TILESET, 0x0, sizeof(TILESET));
//unpack nametable into the VRAM
unrle_vram(test,0x2000);
//enable rendering
ppu_on_all();
while(1);//do nothing, infinite loop
}

View File

@ -1000,7 +1000,6 @@ var Apple2MAMEPlatform = function(mainElement) {
}
this.getOpcodeMetadata = Javatari.getOpcodeMetadata;
this.getToolForFilename = getToolForFilename_6502;
this.getDefaultExtension = function() { return ".c"; };
this.getPresets = function() { return APPLE2_PRESETS; }

View File

@ -10,6 +10,7 @@ var JSNES_PRESETS = [
{id:'neslib2.c', name:'Sprites (C)'},
{id:'neslib3.c', name:'Cursor (C)'},
{id:'neslib4.c', name:'Metasprites (C)'},
{id:'neslib5.c', name:'RLE Unpack (C)'},
];
var NES_NESLIB_PRESETS = [
@ -114,7 +115,6 @@ var JSNESPlatform = function(mainElement) {
}
this.getOpcodeMetadata = Javatari.getOpcodeMetadata;
this.getToolForFilename = getToolForFilename_6502;
this.getDefaultExtension = function() { return ".c"; };
this.reset = function() {

View File

@ -414,6 +414,7 @@ function setCompileOutput(data: WorkerResult) {
}
function showMemory(state?) {
var meminfo = $("#mem_info");
var s = state && platform.cpuStateToLongString && platform.cpuStateToLongString(state.c);
if (s) {
if (platform.getRasterPosition) {
@ -424,10 +425,10 @@ function showMemory(state?) {
s += platform.ramStateToLongString(state);
}
var hs = lastDebugInfo ? highlightDifferences(lastDebugInfo, s) : s;
$("#mem_info").show().html(hs);
meminfo.show().html(hs);
lastDebugInfo = s;
} else {
$("#mem_info").hide();
meminfo.hide();
lastDebugInfo = null;
}
}