minor tweaks
This commit is contained in:
parent
fe89e577ac
commit
517605d7da
|
@ -1,9 +1,7 @@
|
|||
|
||||
/*
|
||||
Setting the attribute table, which controls palette selection
|
||||
for the nametable. We copy it from an array in ROM to video RAM.
|
||||
*/
|
||||
|
||||
#include "neslib.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -11,16 +9,6 @@ for the nametable. We copy it from an array in ROM to video RAM.
|
|||
// link the pattern table into CHR ROM
|
||||
//#link "chr_generic.s"
|
||||
|
||||
/*{pal:"nes",layout:"nes"}*/
|
||||
const char PALETTE[16] = {
|
||||
0x03, // screen color
|
||||
|
||||
0x11,0x30,0x27,0x0, // background palette 0
|
||||
0x1c,0x20,0x2c,0x0, // background palette 1
|
||||
0x00,0x10,0x20,0x0, // background palette 2
|
||||
0x06,0x16,0x26 // background palette 3
|
||||
};
|
||||
|
||||
// attribute table in PRG ROM
|
||||
const char ATTRIBUTE_TABLE[0x40] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // rows 0-3
|
||||
|
@ -33,6 +21,16 @@ const char ATTRIBUTE_TABLE[0x40] = {
|
|||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f // rows 28-29
|
||||
};
|
||||
|
||||
/*{pal:"nes",layout:"nes"}*/
|
||||
const char PALETTE[16] = {
|
||||
0x03, // screen color
|
||||
|
||||
0x11,0x30,0x27,0x0, // background palette 0
|
||||
0x1c,0x20,0x2c,0x0, // background palette 1
|
||||
0x00,0x10,0x20,0x0, // background palette 2
|
||||
0x06,0x16,0x26 // background palette 3
|
||||
};
|
||||
|
||||
// main function, run after console reset
|
||||
void main(void) {
|
||||
// set background palette colors
|
||||
|
|
|
@ -59,7 +59,7 @@ void new_building() {
|
|||
void update_nametable() {
|
||||
register word addr;
|
||||
// a buffer drawn to the nametable vertically
|
||||
char buf[32];
|
||||
char buf[PLAYROWS];
|
||||
// divide x_scroll by 8
|
||||
// to get nametable X position
|
||||
byte x = (x_scroll/8 + 32) & 63;
|
||||
|
@ -68,9 +68,9 @@ void update_nametable() {
|
|||
else
|
||||
addr = NTADR_B(x&31, 4);
|
||||
// clear empty space
|
||||
memset(buf, 0, PLAYROWS-bldg_height);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
// draw a random star
|
||||
buf[rand8() & 31] = '.';
|
||||
buf[rand8() & 15] = '.';
|
||||
// draw roof
|
||||
buf[PLAYROWS-bldg_height-1] = bldg_char & 3;
|
||||
// draw rest of building
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
/*
|
||||
A character-based surround-the-opponent game.
|
||||
Reads from nametable RAM to determine collisions, and also
|
||||
to help the AI avoid walls.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <nes.h>
|
||||
|
@ -30,10 +28,11 @@ to help the AI avoid walls.
|
|||
byte getchar(byte x, byte y) {
|
||||
// compute VRAM read address
|
||||
word addr = NTADR_A(x,y);
|
||||
// result goes into rd
|
||||
byte rd;
|
||||
// wait for VBLANK to start
|
||||
ppu_wait_nmi();
|
||||
// set vram address and read byte
|
||||
// set vram address and read byte into rd
|
||||
vram_adr(addr);
|
||||
vram_read(&rd, 1);
|
||||
// scroll registers are corrupt
|
||||
|
|
|
@ -17,15 +17,15 @@ const JSNES_PRESETS = [
|
|||
{id:'flicker.c', name:'Flickering Sprites'},
|
||||
{id:'metacursor.c', name:'Controllers'},
|
||||
{id:'vrambuffer.c', name:'VRAM Buffer'},
|
||||
{id:'tint.c', name:'Color Emphasis'},
|
||||
{id:'rletitle.c', name:'Title Screen RLE'},
|
||||
{id:'statusbar.c', name:'Split Status Bar'},
|
||||
{id:'horizmask.c', name:'Offscreen Scrolling'},
|
||||
{id:'monobitmap.c', name:'Monochrome Bitmap'},
|
||||
{id:'siegegame.c', name:'Siege Game'},
|
||||
{id:'tint.c', name:'Color Emphasis'},
|
||||
{id:'rletitle.c', name:'Title Screen RLE'},
|
||||
{id:'aputest.c', name:'Sound Tester'},
|
||||
{id:'music.c', name:'Music Player'},
|
||||
{id:'monobitmap.c', name:'Monochrome Bitmap'},
|
||||
{id:'fami.c', name:'Famitone Demo'},
|
||||
{id:'siegegame.c', name:'Siege Game'},
|
||||
{id:'shoot2.c', name:'Solarian Game'},
|
||||
{id:'climber.c', name:'Platform Game'},
|
||||
{id:'bankswitch.c', name:'Bank Switching'},
|
||||
|
@ -114,7 +114,7 @@ class JSNESPlatform extends Base6502Platform implements Platform {
|
|||
if (this.frameindex < 10)
|
||||
this.audio.feedSample(0, 1); // avoid popping at powerup
|
||||
else
|
||||
this.audio.feedSample(left+right, 1);
|
||||
this.audio.feedSample((left+right)*0.5, 1);
|
||||
},
|
||||
onStatusUpdate: function(s) {
|
||||
console.log(s);
|
||||
|
|
Loading…
Reference in New Issue