neslib support; nes palette

This commit is contained in:
Steven Hugg 2017-05-21 17:34:57 -04:00
parent 97a9525552
commit a087e6b7cf
24 changed files with 5347 additions and 1234 deletions

4
cc65/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.nes
*.o
*.s
*.lzg

25
cc65/Makefile Normal file
View File

@ -0,0 +1,25 @@
CC65FLAGS=-I/home/huggvey/compilers/cc65/include -I/home/huggvey/compilers/cc65/include/nes -L/home/huggvey/compilers/cc65/lib --cfg-path /home/huggvey/compilers/cc65/cfg/
all: \
default_neslib.neslib.nes default_conio.conio.nes \
default_neslib.neslib.lzg default_conio.conio.lzg
clean:
rm -f *.s *.o *.nes *.lzg
#%.s: %.c
# cc65 $*.c
# ca65 $*.s
%.neslib.nes: %.c
cl65 $(CC65FLAGS) -o $@ -t nes -C neslib.cfg $*.c neslib.lib nes.lib
%.conio.nes: %.c
cl65 $(CC65FLAGS) -o $@ -t nes $*.c nes.lib
%.rom: %.s
ld65 -o $@ -C atarivec.cfg $*.o atari2600.lib
%.lzg: %.nes
lzg $< | hexdump -v -e '"\n" 32/1 "%u,"' > $@

43
cc65/default_conio.c Normal file
View File

@ -0,0 +1,43 @@
#include "nes.h"
unsigned char index;
const unsigned char TEXT[]={"No cart loaded"};
const unsigned char PALETTE[]={0x1, 0x00, 0x10, 0x20}; //blue, gray, lt gray, white
void main (void) {
// turn off the screen
PPU.control = 0;
PPU.mask = 0;
// load the palette
PPU.vram.address = 0x3f;
PPU.vram.address = 0x0;
for(index = 0; index < sizeof(PALETTE); ++index){
PPU.vram.data = PALETTE[index];
}
// load the text
PPU.vram.address = 0x21; // set an address in the PPU of 0x21ca
PPU.vram.address = 0xc9; // about the middle of the screen
for( index = 0; index < sizeof(TEXT); ++index ){
PPU.vram.data = TEXT[index];
}
// reset the scroll position
PPU.vram.address = 0x20;
PPU.vram.address = 0x0;
PPU.scroll = 0;
PPU.scroll = 0;
// turn on screen
PPU.control = 0x80; // NMI on
PPU.mask = 0x1e; // screen on
// infinite loop
while (1) {
}
}

53
cc65/default_neslib.c Normal file
View File

@ -0,0 +1,53 @@
//this example code shows how to put some text in nametable
#include "neslib.h"
// tileset data
const unsigned char TILESET[8*128] = {/*{w:8,h:8,bpp:1,count:128,brev:1}*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x7c,0x7c,0x7c,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x6c,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0xfe,0x6c,0xfe,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xfe,0xd0,0xfe,0x16,0xfe,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xdc,0x38,0x76,0xe6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x6c,0x7c,0xec,0xee,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x70,0x70,0x70,0x70,0x70,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x38,0x38,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0xfe,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x1e,0x3c,0x78,0xf0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7c,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x78,0x38,0x38,0x38,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x0e,0x7c,0xe0,0xee,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x0e,0x3c,0x0e,0x0e,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x7e,0xee,0xee,0xfe,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xe0,0xfc,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0xfc,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xee,0x1c,0x1c,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0x7c,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0x7e,0x0e,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x38,0x70,0x70,0x38,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x1c,0x1c,0x38,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0x1c,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7c,0xee,0xee,0xee,0xe0,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xfe,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xee,0xfc,0xee,0xee,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xe0,0xe0,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xec,0xee,0xee,0xee,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xe0,0xf0,0xe0,0xe0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xe0,0xf8,0xe0,0xe0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0xee,0xee,0xee,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xfe,0xee,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x38,0x38,0x38,0x38,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x0e,0x0e,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xfc,0xf8,0xec,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0xe0,0xe0,0xee,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc6,0xee,0xfe,0xfe,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xee,0xfe,0xfe,0xee,0xe6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xfc,0xee,0xee,0xee,0xfc,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xec,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xee,0xee,0xee,0xfc,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0x7c,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x38,0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0x6c,0x38,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xfe,0xfe,0xee,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0x7c,0x38,0x7c,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0x7c,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x1c,0x38,0x70,0xe0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
//this macro is used remove need of calculation of the nametable address in runtime
#define NTADR(x,y) ((0x2000|((y)<<5)|x))
//put a string into the nametable
void put_str(unsigned int adr,const char *str)
{
vram_adr(adr);
while(1)
{
if(!*str) break;
vram_put((*str++)-0x20);//-0x20 because ASCII code 0x20 is placed in tile 0 of the CHR
}
}
void main(void)
{
//copy tileset to RAM
vram_write((unsigned char*)TILESET, 0x0, sizeof(TILESET));
//rendering is disabled at the startup, and palette is all black
pal_col(0,0x1);
pal_col(1,0x30);//set while color
//you can't put data into vram through vram_put while rendering is enabled
//so you have to disable rendering to put things like text or a level map
//into the nametable
//there is a way to update small number of nametable tiles while rendering
//is enabled, using set_vram_update and an update list
put_str(NTADR(9,15),"NO CART LOADED");
ppu_on_all();//enable rendering
while(1);//do nothing, infinite loop
}

88
cc65/longbranch.mac Normal file
View File

@ -0,0 +1,88 @@
.macro jeq Target
.if .match(Target, 0)
bne *+5
jmp Target
.elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
beq Target
.else
bne *+5
jmp Target
.endif
.endmacro
.macro jne Target
.if .match(Target, 0)
beq *+5
jmp Target
.elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
bne Target
.else
beq *+5
jmp Target
.endif
.endmacro
.macro jmi Target
.if .match(Target, 0)
bpl *+5
jmp Target
.elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
bmi Target
.else
bpl *+5
jmp Target
.endif
.endmacro
.macro jpl Target
.if .match(Target, 0)
bmi *+5
jmp Target
.elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
bpl Target
.else
bmi *+5
jmp Target
.endif
.endmacro
.macro jcs Target
.if .match(Target, 0)
bcc *+5
jmp Target
.elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
bcs Target
.else
bcc *+5
jmp Target
.endif
.endmacro
.macro jcc Target
.if .match(Target, 0)
bcs *+5
jmp Target
.elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
bcc Target
.else
bcs *+5
jmp Target
.endif
.endmacro
.macro jvs Target
.if .match(Target, 0)
bvc *+5
jmp Target
.elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
bvs Target
.else
bvc *+5
jmp Target
.endif
.endmacro
.macro jvc Target
.if .match(Target, 0)
bvs *+5
jmp Target
.elseif .def(Target) .and .const((*-2)-(Target)) .and ((*+2)-(Target) <= 127)
bvc Target
.else
bvs *+5
jmp Target
.endif
.endmacro

85
cc65/neslib.cfg Normal file
View File

@ -0,0 +1,85 @@
SYMBOLS {
__STACKSIZE__: type = weak, value = $0500; # 5 pages stack
}
MEMORY {
# First 28 bytes of the zero page are used by NES library
ZP: start = $28, size = $d8, type = rw, define = yes;
# INES Cartridge Header
HEADER: start = $0, size = $10, file = %O ,fill = yes;
# 2 16K ROM Banks
# - startup
# - code
# - rodata
# - data (load)
# PRG: start = $8000, size = $3f00, file = %O ,fill = yes, define = yes;
# NROM256
PRG: start = $8000, size = $7f00, file = %O ,fill = yes, define = yes;
# DPCM Samples at end of the ROM
DMC: start = $7f00, size = $fa, file = %O, fill = yes;
# NROM256
# DMC: start = $ff00, size = $fa, file = %O, fill = yes;
# Hardware Vectors at end of the ROM
VECTORS: start = $7ffa, size = $6, file = %O, fill = yes;
# NROM256
# VECTORS: start = $fffa, size = $6, file = %O, fill = yes;
# 1 8K CHR Bank
CHR: start = $0000, size = $2000, file = %O, fill = yes;
# standard 2K SRAM (-zeropage)
# $0100 famitone, palette, cpu stack
# $0200 oam buffer
# $0300..$800 ca65 stack
RAM: start = $0300, size = $0500, define = yes;
# Use this definition instead if you going to use extra 8K RAM
# RAM: start = $6000, size = $2000, define = yes;
}
SEGMENTS {
HEADER: load = HEADER, type = ro;
STARTUP: load = PRG, type = ro, define = yes;
LOWCODE: load = PRG, type = ro, optional = yes;
ONCE: load = PRG, type = ro, optional = yes;
INIT: load = PRG, type = ro, define = yes, optional = yes;
CODE: load = PRG, type = ro, define = yes;
RODATA: load = PRG, type = ro, define = yes;
DATA: load = PRG, run = RAM, type = rw, define = yes;
VECTORS: load = VECTORS, type = rw;
SAMPLES: load = DMC, type = rw;
CHARS: load = CHR, type = rw;
BSS: load = RAM, type = bss, define = yes;
HEAP: load = RAM, type = bss, optional = yes;
ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: segment = INIT,
type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__;
CONDES: segment = RODATA,
type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__;
CONDES: type = interruptor,
segment = RODATA,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__;
}

226
cc65/neslib.h Normal file
View File

@ -0,0 +1,226 @@
//NES hardware-dependent functions by Shiru (shiru@mail.ru)
//Feel free to do anything you want with this code, consider it Public Domain
//set bg and spr palettes, data is 32 bytes array
void __fastcall__ pal_all(const char *data);
//set bg palette only, data is 16 bytes array
void __fastcall__ pal_bg(const char *data);
//set spr palette only, data is 16 bytes array
void __fastcall__ pal_spr(const char *data);
//set a palette entry, index is 0..31
void __fastcall__ pal_col(unsigned char index,unsigned char color);
//reset palette to $0f
void __fastcall__ pal_clear(void);
//set virtual bright, 0 is black, 4 is normal, 8 is white
void __fastcall__ pal_bright(unsigned char bright);
//turn off rendering and nmi
void __fastcall__ ppu_off(void);
//turn on bg, spr, and nmi
void __fastcall__ ppu_on_all(void);
//turn on bg only and nmi
void __fastcall__ ppu_on_bg(void);
//turn on spr only and nmi
void __fastcall__ ppu_on_spr(void);
//set PPU_MASK directly
;void __fastcall__ ppu_mask(unsigned char mask);
//clear OAM buffer, all the sprites are hidden
void __fastcall__ oam_clear(void);
//set sprites size, 0 for 8x8, 1 for 8x16
void __fastcall__ oam_size(unsigned char size);
//set sprite in OAM buffer, chrnum is tile, attr is attribute, sprid is offset in OAM in bytes
//returns sprid+4, which is offset for a next sprite
unsigned char __fastcall__ oam_spr(unsigned char x,unsigned char y,unsigned char chrnum,unsigned char attr,unsigned char sprid);
//set metasprite in OAM buffer
//meta sprite is a const unsigned char array, it contains four bytes per sprite
//in order x offset, y offset, tile, attribute
//x=128 is end of a meta sprite
//returns sprid+4, which is offset for a next sprite
unsigned char __fastcall__ oam_meta_spr(unsigned char x,unsigned char y,unsigned char sprid,const unsigned char *data);
//hide all the sprites starting from given offset
void __fastcall__ oam_hide_rest(unsigned char sprid);
//wait NMI and sync to 50hz (with frameskip for NTSC)
void __fastcall__ ppu_waitnmi(void);
//play a music in FamiTone format
void __fastcall__ music_play(const unsigned char *data);
//stop music
void __fastcall__ music_stop(void);
//pause and unpause music
void __fastcall__ music_pause(unsigned char pause);
//play FamiTone sound effect on channel 0..3
void __fastcall__ sfx_play(unsigned char sound,unsigned char channel);
//poll controller and return flags like PAD_LEFT etc, input is pad number (0 or 1)
unsigned char __fastcall__ pad_poll(unsigned char pad);
//poll controller in trigger mode, a flag is set only on button down, not hold
//if you need to poll the pad in both normal and trigger mode, poll it in the
//trigger mode for first, then use pad_state
unsigned char __fastcall__ pad_trigger(unsigned char pad);
//get previous pad state without polling ports
unsigned char __fastcall__ pad_state(unsigned char pad);
//set scroll, including top bits
void __fastcall__ scroll(unsigned int x,unsigned int y);
//select current chr bank for sprites, 0..1
void __fastcall__ bank_spr(unsigned char n);
//select current chr bank for background, 0..1
void __fastcall__ bank_bg(unsigned char n);
//returns random number 0..255 or 0..65535
unsigned char __fastcall__ rand8(void);
unsigned int __fastcall__ rand16(void);
//set random seed
void __fastcall__ set_rand(unsigned int seed);
//set a pointer to update buffer, contents of the buffer is transferred to vram every frame
//buffer structure is MSB, LSB, byte to write, len is number of entries (not bytes)
//could be set during rendering, but only takes effect on a new frame
//number of transferred bytes is limited by vblank time
void __fastcall__ set_vram_update(unsigned char len,unsigned char *buf);
//set vram pointer to write operations if you need to write some data to vram
//works only when rendering is turned off
void __fastcall__ vram_adr(unsigned int adr);
//put a byte at current vram address, works only when rendering is turned off
void __fastcall__ vram_put(unsigned char n);
//fill a block with a byte at current vram address, works only when rendering is turned off
void __fastcall__ vram_fill(unsigned char n,unsigned int len);
//set vram autoincrement, 0 for +1 and not 0 for +32
void __fastcall__ vram_inc(unsigned char n);
//read a block from vram, works only when rendering is turned off
void __fastcall__ vram_read(unsigned char *dst,unsigned int adr,unsigned int size);
//write a block to vram, works only when rendering is turned off
void __fastcall__ vram_write(unsigned char *src,unsigned int adr,unsigned int size);
//unpack a nametable into vram
void __fastcall__ unrle_vram(const unsigned char *data,unsigned int vram);
//like a normal memcpy, but does not return anything
void __fastcall__ memcpy(void *dst,void *src,unsigned int len);
//like memset, but does not return anything
void __fastcall__ memfill(void *dst,unsigned char value,unsigned int len);
//delay for N frames
void __fastcall__ delay(unsigned char frames);
//initialize sound effects
void __fastcall__ FamiToneSfxInit(void* src);
void __fastcall__ FamiToneSfxInit(void* src);
#define PAD_A 0x01
#define PAD_B 0x02
#define PAD_SELECT 0x04
#define PAD_START 0x08
#define PAD_UP 0x10
#define PAD_DOWN 0x20
#define PAD_LEFT 0x40
#define PAD_RIGHT 0x80
#define OAM_FLIP_V 0x80
#define OAM_FLIP_H 0x40
#define OAM_BEHIND 0x20
#define MAX(x1,x2) (x1<x2?x2:x1)
#define MIN(x1,x2) (x1<x2?x1:x2)
#define MASK_SPR 0x10
#define MASK_BG 0x08
#define MASK_EDGE_SPR 0x04
#define MASK_EDGE_BG 0x02
#define NULL 0
#define TRUE 1
#define FALSE 0

BIN
cc65/neslib.lib Normal file

Binary file not shown.

248
cc65/threed.c Normal file
View File

@ -0,0 +1,248 @@
#include <string.h>
typedef unsigned char byte;
typedef signed char sbyte;
typedef unsigned short word;
#define inline
#define dvgram ((word*)0x1000)
#define _dvgstart (*((byte*)0x8840))
#define mathbox_sum (*((int*)0x8100))
#define mathbox_arg1 (*((sbyte*)0x8102))
#define mathbox_arg2 (*((sbyte*)0x8103))
#define mathbox_go_mul (*((byte*)0x810f))
void start() {
/*
__asm
LD SP,#0x0
DI
__endasm;
*/
}
int dvgwrofs; // write offset for DVG buffer
inline word ___swapw(word j) {
return ((j << 8) | (j >> 8));
}
inline void dvgreset() {
dvgwrofs = 0;
}
inline void dvgstart() {
_dvgstart = 0;
}
void dvgwrite(word w) {
dvgram[dvgwrofs++] = w;
}
inline void VCTR(int dx, int dy, byte bright) {
dvgwrite((dy & 0x1fff));
dvgwrite(((bright & 7) << 13) | (dx & 0x1fff));
}
inline void SVEC(sbyte dx, sbyte dy, byte bright) {
dvgwrite(0x4000 | (dx & 0x1f) | ((bright&7)<<5) | ((dy & 0x1f)<<8));
}
inline void JSRL(word offset) {
dvgwrite(0xa000 | offset);
}
inline void JMPL(word offset) {
dvgwrite(0xe000 | offset);
}
inline void RTSL() {
dvgwrite(0xc000);
}
inline void CNTR() {
dvgwrite(0x8000);
}
inline void HALT() {
dvgwrite(0x2000);
}
inline void STAT(byte rgb, byte intens) {
dvgwrite(0x6000 | ((intens & 0xf)<<4) | (rgb & 7));
}
inline void STAT_sparkle(byte intens) {
dvgwrite(0x6800 | ((intens & 0xf)<<4));
}
inline void SCAL(word scale) {
dvgwrite(0x7000 | scale);
}
enum {
BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE
} Color;
///
typedef struct {
sbyte m[3][3];
} Matrix;
typedef struct {
sbyte x,y,z;
} Vector8;
typedef struct {
int x,y,z;
} Vector16;
typedef struct {
byte numverts;
const Vector8* verts; // array of vertices
const sbyte* edges; // array of vertex indices (edges)
} Wireframe;
void mat_identity(Matrix* m) {
memset(m, 0, sizeof(*m));
m->m[0][0] = 127;
m->m[1][1] = 127;
m->m[2][2] = 127;
}
inline void mul16(sbyte a, sbyte b) {
mathbox_arg1 = a;
mathbox_arg2 = b;
mathbox_go_mul=0;
}
void vec_mat_transform(Vector16* dest, const Vector8* v, const Matrix* m) {
byte i;
int* result = &dest->x;
const sbyte* mval = &m->m[0][0];
for (i=0; i<3; i++) {
mathbox_sum = 0;
mul16(*mval++, v->x);
mul16(*mval++, v->y);
mul16(*mval++, v->z);
*result++ = mathbox_sum;
}
}
/*
void vec_mat_transform2(Vector16* dest, const Vector8* v, const Matrix* m) {
dest->x = v->x*m->m[0][0] + v->y*m->m[0][1] + v->z*m->m[0][2];
dest->y = v->x*m->m[1][0] + v->y*m->m[1][1] + v->z*m->m[1][2];
dest->z = v->x*m->m[2][0] + v->y*m->m[2][1] + v->z*m->m[2][2];
}
*/
const sbyte sintbl[64] = {
0, 3, 6, 9, 12, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46,
49, 51, 54, 57, 60, 63, 65, 68, 71, 73, 76, 78, 81, 83, 85, 88,
90, 92, 94, 96, 98, 100, 102, 104, 106, 107, 109, 111, 112, 113, 115, 116,
117, 118, 120, 121, 122, 122, 123, 124, 125, 125, 126, 126, 126, 127, 127, 127,
};
sbyte isin(byte x0) {
byte x = x0;
if (x0 & 0x40) x = 127-x;
if (x0 & 0x80) {
return -sintbl[x+128];
} else {
return sintbl[x];
}
}
sbyte icos(byte x) {
return isin(x+64);
}
void mat_rotate(Matrix* m, byte axis, byte angle) {
sbyte sin = isin(angle);
sbyte cos = icos(angle);
mat_identity(m);
switch (axis) {
case 0:
m->m[1][1] = cos;
m->m[2][1] = sin;
m->m[1][2] = -sin;
m->m[2][2] = cos;
break;
case 1:
m->m[2][2] = cos;
m->m[0][2] = sin;
m->m[2][0] = -sin;
m->m[0][0] = cos;
break;
case 2:
m->m[0][0] = cos;
m->m[1][0] = sin;
m->m[0][1] = -sin;
m->m[1][1] = cos;
break;
}
}
const Vector8 tetra_v[] = { {0,-86,86},{86,86,86},{-86,86,86},{0,0,-86} };
const signed char tetra_e[] = { 0, 1, 2, 0, 3, 1, -1, 3, 2, -2 };
const Wireframe tetra = { 4, tetra_v, tetra_e };
void xform_vertices(Vector16* dest, const Vector8* src, const Matrix* m, byte nv) {
byte i;
for (i=0; i<nv; i++) {
vec_mat_transform(dest++, src++, m);
}
}
void draw_wireframe_ortho(const Wireframe* wf, const Matrix* m) {
const signed char* e = wf->edges;
byte bright = 0;
int x1 = 0;
int y1 = 0;
Vector16 scrnverts[16];
xform_vertices(scrnverts, wf->verts, m, wf->numverts);
do {
sbyte i = *e++;
if (i == -1)
bright = 0;
else if (i == -2)
break;
else {
int x2 = scrnverts[i].x>>8;
int y2 = scrnverts[i].y>>8;
VCTR(x2-x1, y2-y1, bright);
x1 = x2;
y1 = y2;
}
bright = 2;
} while (1);
}
///
word frame;
void main() {
int x,y;
Matrix m;
mat_identity(&m);
while (1) {
dvgreset();
CNTR();
SCAL(0x1f);
STAT(RED, 5);
x = isin(frame/8);
y = icos(frame/8);
VCTR(x, y, 2);
STAT(GREEN, 15);
mat_rotate(&m, (frame>>8)&3, frame);
draw_wireframe_ortho(&tetra, &m);
HALT();
dvgstart();
frame++;
}
}

152
presets/nes-conio/ex1.asm Normal file
View File

@ -0,0 +1,152 @@
;;;;; CONSTANTS
PPU_CTRL equ $2000
PPU_MASK equ $2001
PPU_STATUS equ $2002
PPU_OAM_ADDR equ $2003
PPU_OAM_DATA equ $2004
PPU_SCROLL equ $2005
PPU_ADDR equ $2006
PPU_DATA equ $2007
PPU_OAM_DMA equ $4014
PPU_FRAMECNT equ $4017
DMC_FREQ equ $4010
CTRL_PORT1 equ $4016
CTRL_PORT2 equ $4017
;;;;; ZERO-PAGE VARIABLES
seg.u ZPVars
org $0
ScrollPos byte ; used during NMI
;;;;; CARTRIDGE FILE HEADER
processor 6502
seg Header
org $7FF0
NES_MAPPER equ 0 ;mapper number
NES_PRG_BANKS equ 2 ;number of 16K PRG banks, change to 2 for NROM256
NES_CHR_BANKS equ 1 ;number of 8K CHR banks (0 = RAM)
NES_MIRRORING equ 1 ;0 horizontal, 1 vertical, 8 four screen
.byte $4e,$45,$53,$1a ; header
.byte NES_PRG_BANKS
.byte NES_CHR_BANKS
.byte NES_MIRRORING|(NES_MAPPER<<4)
.byte NES_MAPPER&$f0
;;;;; CODE
seg Code
org $8000
start:
_exit:
sei
ldx #$ff
txs
inx ;X=0
stx PPU_MASK ;disable rendering
stx DMC_FREQ ;disable DMC (samples)
stx PPU_CTRL ;disable NMI (interrupts)
jsr WaitSync ;wait for VSYNC
jsr SetPalette ;set colors
jsr ClearVRAM ;clear VRAM
lda #0
sta PPU_ADDR
sta PPU_ADDR ;PPU addr = 0
sta PPU_SCROLL
sta PPU_SCROLL ;scroll = 0
lda #$90
sta PPU_CTRL ;enable NMI
lda #$1e
sta PPU_MASK ;enable rendering
.endless
jmp .endless ;endless loop
;;;;; SUBROUTINES
; set palette colors
SetPalette: subroutine
ldy #$0
lda #$3f
sta PPU_ADDR
sty PPU_ADDR
ldx #4
.loop:
lda Palette,y
sta PPU_DATA
iny
dex
bne .loop
rts
; clear video RAM
ClearVRAM: subroutine
txa
ldy #$20
sty PPU_ADDR
sta PPU_ADDR
ldy #$10
.loop:
sta PPU_DATA
adc #1
inx
bne .loop
dey
bne .loop
rts
; wait for VSYNC to start
WaitSync: subroutine
bit PPU_STATUS
.1:
bit PPU_STATUS
bpl .1
rts
;;;;; INTERRUPT HANDLERS
nmi:
irq:
; save registers
pha ; save A
; update scroll position
inc ScrollPos
lda ScrollPos
sta PPU_SCROLL
sta PPU_SCROLL
; reload registers
pla ; reload A
rti
;;;;; CONSTANT DATA
Palette:
hex 1f001020 ; black, gray, lt gray, white
TextString:
byte "HELLO WORLD!"
byte 0
;;;;; CPU VECTORS
org $fffa
.word nmi ;$fffa vblank nmi
.word start ;$fffc reset
.word irq ;$fffe irq / brk
;;;;; TILE SETS
REPEAT 64
hex 003c6666766e663c007e181818381818
hex 007e60300c06663c003c66061c06663c
hex 0006067f661e0e06003c6606067c607e
hex 003c66667c60663c00181818180c667e
hex 003c66663c66663c003c66063e66663c
hex 01010101010101010000000000000000
hex ff000000000000000000000000000000
hex 01020408102040800000000000000000
REPEND

3071
presets/nes-lib/crypto.c Normal file

File diff suppressed because it is too large Load Diff

58
presets/nes-lib/neslib1.c Normal file
View File

@ -0,0 +1,58 @@
//this example code shows how to put some text in nametable
#include "neslib.h"
// tileset data
const unsigned char TILESET[8*128] = {/*{w:8,h:8,bpp:1,count:128,brev:1}*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x7c,0x7c,0x7c,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x6c,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0xfe,0x6c,0xfe,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xfe,0xd0,0xfe,0x16,0xfe,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xdc,0x38,0x76,0xe6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x6c,0x7c,0xec,0xee,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x70,0x70,0x70,0x70,0x70,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x38,0x38,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0xfe,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x1e,0x3c,0x78,0xf0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7c,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x78,0x38,0x38,0x38,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x0e,0x7c,0xe0,0xee,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x0e,0x3c,0x0e,0x0e,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x7e,0xee,0xee,0xfe,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xe0,0xfc,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0xfc,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xee,0x1c,0x1c,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0x7c,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0x7e,0x0e,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x38,0x70,0x70,0x38,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x1c,0x1c,0x38,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0x1c,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7c,0xee,0xee,0xee,0xe0,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xfe,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xee,0xfc,0xee,0xee,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xe0,0xe0,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xec,0xee,0xee,0xee,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xe0,0xf0,0xe0,0xe0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xe0,0xf8,0xe0,0xe0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0xee,0xee,0xee,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xfe,0xee,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x38,0x38,0x38,0x38,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x0e,0x0e,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xfc,0xf8,0xec,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0xe0,0xe0,0xee,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc6,0xee,0xfe,0xfe,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xee,0xfe,0xfe,0xee,0xe6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xfc,0xee,0xee,0xee,0xfc,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xec,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xee,0xee,0xee,0xfc,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0x7c,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x38,0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0x6c,0x38,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xfe,0xfe,0xee,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0x7c,0x38,0x7c,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0x7c,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x1c,0x38,0x70,0xe0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
//this macro is used remove need of calculation of the nametable address in runtime
#define NTADR(x,y) ((0x2000|((y)<<5)|x))
//put a string into the nametable
void put_str(unsigned int adr,const char *str)
{
vram_adr(adr);
while(1)
{
if(!*str) break;
vram_put((*str++)-0x20);//-0x20 because ASCII code 0x20 is placed in tile 0 of the CHR
}
}
void main(void)
{
//copy tileset to RAM
vram_write((unsigned char*)TILESET, 0x0, sizeof(TILESET));
//rendering is disabled at the startup, and palette is all black
pal_col(1,0x30);//set while color
//you can't put data into vram through vram_put while rendering is enabled
//so you have to disable rendering to put things like text or a level map
//into the nametable
//there is a way to update small number of nametable tiles while rendering
//is enabled, using set_vram_update and an update list
put_str(NTADR(2,2),"HELLO, WORLD!");
put_str(NTADR(2,4),"THIS CODE PRINTS SOME TEXT");
put_str(NTADR(2,5),"USING ASCII-ENCODED CHARACTER");
put_str(NTADR(2,6),"SET WITH CAPITAL LETTERS ONLY");
put_str(NTADR(2,8),"TO USE CHR MORE EFFICIENTLY");
put_str(NTADR(2,9),"YOU'D NEED A CUSTOM ENCODING");
put_str(NTADR(2,10),"AND A CONVERSION TABLE");
ppu_on_all();//enable rendering
while(1);//do nothing, infinite loop
}

105
presets/nes-lib/neslib2.c Normal file
View File

@ -0,0 +1,105 @@
//this example shows how to set up a palette and use 8x8 HW sprites
//also shows how fast (or slow) C code is
#include "neslib.h"
// palette for balls, there are four sets for different ball colors
const unsigned char palSprites[16]={/*{pal:"nes",n:4,sets:4}*/
0x0f,0x17,0x27,0x37,
0x0f,0x11,0x21,0x31,
0x0f,0x15,0x25,0x35,
0x0f,0x19,0x29,0x39
};
// tile set, two planes for 4 colors
const unsigned char TILESET[8*256] = {/*{w:8,h:8,bpp:1,count:256,brev:1,np:2,pofs:8,remap:[0,1,2,4,5,6,7,8,9,10,11,12]}*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x7C,0x7C,0x7C,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x6C,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xFE,0x6C,0xFE,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xFE,0xD0,0xFE,0x16,0xFE,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCE,0xDC,0x38,0x76,0xE6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x6C,0x7C,0xEC,0xEE,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x70,0x70,0x70,0x70,0x70,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x38,0x38,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x38,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0xFE,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x1E,0x3C,0x78,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7C,0xEE,0xEE,0xEE,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x78,0x38,0x38,0x38,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x0E,0x7C,0xE0,0xEE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x0E,0x3C,0x0E,0x0E,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x7E,0xEE,0xEE,0xFE,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xE0,0xFC,0x0E,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xE0,0xFC,0xEE,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xEE,0x1C,0x1C,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xEE,0x7C,0xEE,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xEE,0xEE,0x7E,0x0E,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x38,0x70,0x70,0x38,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x1C,0x1C,0x38,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xEE,0x1C,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7C,0xEE,0xEE,0xEE,0xE0,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xEE,0xEE,0xEE,0xFE,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xEE,0xFC,0xEE,0xEE,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xEE,0xE0,0xE0,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xEC,0xEE,0xEE,0xEE,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xE0,0xF0,0xE0,0xE0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xE0,0xF8,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xE0,0xEE,0xEE,0xEE,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xEE,0xFE,0xEE,0xEE,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x38,0x38,0x38,0x38,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x0E,0x0E,0x0E,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xFC,0xF8,0xEC,0xEE,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,0xE0,0xEE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0xEE,0xFE,0xFE,0xEE,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCE,0xEE,0xFE,0xFE,0xEE,0xE6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xEE,0xEE,0xEE,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xFC,0xEE,0xEE,0xEE,0xFC,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xEE,0xEE,0xEE,0xEC,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xEE,0xEE,0xEE,0xFC,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xE0,0x7C,0x0E,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x38,0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xEE,0xEE,0xEE,0xEE,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xEE,0xEE,0x6C,0x38,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xEE,0xFE,0xFE,0xEE,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x7C,0x38,0x7C,0xEE,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xEE,0xEE,0x7C,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x1C,0x38,0x70,0xE0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x04,0x32,0x73,0x63,0x03,0x87,0x7E,0x3C,0x38,0x7C,0xFC,0xFC,0xFC,0x78,0x00,0x00,0xFE,0x84,0x88,0x84,0xA2,0xD1,0x8A,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x60,0x70,0x78,0x7C,0x3E,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x0E,0x1E,0x3E,0x7C,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x1F,0x1C,0x18,0x39,0x39,0x39,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x7E,0x3C,0x3C,0x3C,0x3C,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0x38,0x18,0x9C,0x9C,0x9C,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x3F,0x1F,0x1F,0x0F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC3,0xE7,0xFF,0xDB,0x3C,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xF8,0xF8,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
//general purpose vars
static unsigned char i,j;
static unsigned char spr;
//total number of balls on the screen
//since there are 64 HW sprites, it is absolute max
#define BALLS_MAX 64
//balls parameters
static unsigned char ball_x[BALLS_MAX];
static unsigned char ball_y[BALLS_MAX];
static unsigned char ball_dx[BALLS_MAX];
static unsigned char ball_dy[BALLS_MAX];
void main(void)
{
//copy tileset to RAM
vram_write((unsigned char*)TILESET, 0x0, sizeof(TILESET));
pal_spr(palSprites);//set palette for sprites
oam_size(1);
ppu_on_all();//enable rendering
//initialize balls parameters
for(i=0;i<BALLS_MAX;++i)
{
//starting coordinates
ball_x[i]=rand8();
ball_y[i]=rand8();
//direction bits
j=rand8();
//horizontal speed -3..-3, excluding 0
spr=1+(rand8()%3);
ball_dx[i]=j&1?-spr:spr;
//vertical speed
spr=1+(rand8()%3);
ball_dy[i]=j&2?-spr:spr;
}
//now the main loop
while(1)
{
ppu_waitnmi();//wait for next TV frame
spr=0;
for(i=0;i<BALLS_MAX;++i)
{
//set a sprite for current ball
spr=oam_spr(ball_x[i],ball_y[i],0x40,i&3,spr);//0x40 is tile number, i&3 is palette
//move the ball
ball_x[i]+=ball_dx[i];
ball_y[i]+=ball_dy[i];
//bounce the ball off the edges
if(ball_x[i]>=(256-8)) ball_dx[i]=-ball_dx[i];
if(ball_y[i]>=(240-8)) ball_dy[i]=-ball_dy[i];
}
}
}

99
presets/nes-lib/neslib3.c Normal file
View File

@ -0,0 +1,99 @@
//this example shows how to set up a palette and use 8x8 HW sprites
//also shows how fast (or slow) C code is
#include "neslib.h"
const unsigned char TILESET[8*256] = {/*{w:8,h:8,bpp:1,count:256,brev:1,np:2,pofs:8,remap:[0,1,2,4,5,6,7,8,9,10,11,12]}*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x7c,0x7c,0x7c,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x6c,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0xfe,0x6c,0xfe,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xfe,0xd0,0xfe,0x16,0xfe,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xdc,0x38,0x76,0xe6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x6c,0x7c,0xec,0xee,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x70,0x70,0x70,0x70,0x70,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x38,0x38,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0xfe,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x1e,0x3c,0x78,0xf0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7c,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x78,0x38,0x38,0x38,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x0e,0x7c,0xe0,0xee,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x0e,0x3c,0x0e,0x0e,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x7e,0xee,0xee,0xfe,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xe0,0xfc,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0xfc,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xee,0x1c,0x1c,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0x7c,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0x7e,0x0e,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x38,0x70,0x70,0x38,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x1c,0x1c,0x38,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0x1c,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7c,0xee,0xee,0xee,0xe0,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xfe,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xee,0xfc,0xee,0xee,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xe0,0xe0,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xec,0xee,0xee,0xee,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xe0,0xf0,0xe0,0xe0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xe0,0xf8,0xe0,0xe0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0xee,0xee,0xee,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xfe,0xee,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x38,0x38,0x38,0x38,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x0e,0x0e,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xfc,0xf8,0xec,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0xe0,0xe0,0xee,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc6,0xee,0xfe,0xfe,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xee,0xfe,0xfe,0xee,0xe6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xfc,0xee,0xee,0xee,0xfc,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xec,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xee,0xee,0xee,0xfc,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0x7c,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x38,0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0x6c,0x38,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xfe,0xfe,0xee,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0x7c,0x38,0x7c,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0x7c,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x1c,0x38,0x70,0xe0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x04,0x32,0x73,0x63,0x03,0x87,0x7e,0x3c,0x38,0x7c,0xfc,0xfc,0xfc,0x78,0x00,0x00,0xfe,0x84,0x88,0x84,0xa2,0xd1,0x8a,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x60,0x70,0x78,0x7c,0x3e,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x0e,0x1e,0x3e,0x7c,0xfc,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3f,0x1f,0x1c,0x18,0x39,0x39,0x39,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x7e,0x3c,0x3c,0x3c,0x3c,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xf8,0x38,0x18,0x9c,0x9c,0x9c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3f,0x3f,0x1f,0x1f,0x0f,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc3,0xe7,0xff,0xdb,0x3c,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xfc,0xf8,0xf8,0xf0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
//this example shows how to poll the gamepad
//and how to use nametable update system that allows to modify nametable
//while rendering is enabled
#include "neslib.h"
//these macro are needed to simplify defining update list constants
#define NTADR(x,y) ((0x2000|((y)<<5)|x))
#define MSB(x) (((x)>>8))
#define LSB(x) (((x)&0xff))
//variables
static unsigned char i;
static unsigned char x,y;
//the update list, it is for 6 tiles, 3 bytes per tile
static unsigned char list[6*3];
//init data for the update list, it contains MSB and LSB of a tile address
//in the nametable, then the tile number
const unsigned char list_init[6*3]={
MSB(NTADR(2,2)),LSB(NTADR(2,2)),0,
MSB(NTADR(3,2)),LSB(NTADR(3,2)),0,
MSB(NTADR(4,2)),LSB(NTADR(4,2)),0,
MSB(NTADR(6,2)),LSB(NTADR(6,2)),0,
MSB(NTADR(7,2)),LSB(NTADR(7,2)),0,
MSB(NTADR(8,2)),LSB(NTADR(8,2)),0
};
void main(void)
{
//copy tileset to RAM
vram_write((unsigned char*)TILESET, 0x0, sizeof(TILESET));
pal_col(1,0x21);//blue color for text
pal_col(17,0x30);//white color for sprite
memcpy(list,list_init,sizeof(list_init));
set_vram_update(6,list);
ppu_on_all();//enable rendering
x=124;
y=116;
//now the main loop
while(1)
{
ppu_waitnmi();//wait for next TV frame
oam_spr(x,y,0x41,0,0);//put sprite
//poll the pad and change coordinates according to pressed buttons
i=pad_poll(0);
if(i&PAD_LEFT &&x> 0) x-=2;
if(i&PAD_RIGHT&&x<248) x+=2;
if(i&PAD_UP &&y> 0) y-=2;
if(i&PAD_DOWN &&y<232) y+=2;
//put x 3-digit number into the update list
list[2]=0x10+x/100;
list[5]=0x10+x/10%10;
list[8]=0x10+x%10;
//put y 3-digit number into the update list
list[11]=0x10+y/100;
list[14]=0x10+y/10%10;
list[17]=0x10+y%10;
}
}

122
presets/nes-lib/neslib4.c Normal file
View File

@ -0,0 +1,122 @@
#include "neslib.h"
const unsigned char TILESET[8*256] = {/*{w:8,h:8,bpp:1,count:256,brev:1,np:2,pofs:8,remap:[0,1,2,4,5,6,7,8,9,10,11,12]}*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x7c,0x7c,0x7c,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x6c,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0xfe,0x6c,0xfe,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xfe,0xd0,0xfe,0x16,0xfe,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xdc,0x38,0x76,0xe6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x6c,0x7c,0xec,0xee,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x70,0x70,0x70,0x70,0x70,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x38,0x38,0x38,0x38,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x38,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0xfe,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x1e,0x3c,0x78,0xf0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7c,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x78,0x38,0x38,0x38,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x0e,0x7c,0xe0,0xee,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x0e,0x3c,0x0e,0x0e,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x7e,0xee,0xee,0xfe,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xe0,0xfc,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0xfc,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xee,0x1c,0x1c,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0x7c,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0x7e,0x0e,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x60,0x60,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x38,0x70,0x70,0x38,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x38,0x1c,0x1c,0x38,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0x1c,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x7c,0xee,0xee,0xee,0xe0,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xfe,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xee,0xfc,0xee,0xee,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xe0,0xe0,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xec,0xee,0xee,0xee,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xe0,0xf0,0xe0,0xe0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xe0,0xf8,0xe0,0xe0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0xee,0xee,0xee,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xfe,0xee,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x38,0x38,0x38,0x38,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x0e,0x0e,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xfc,0xf8,0xec,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0xe0,0xe0,0xee,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc6,0xee,0xfe,0xfe,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xee,0xfe,0xfe,0xee,0xe6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xfc,0xee,0xee,0xee,0xfc,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xee,0xee,0xee,0xec,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xee,0xee,0xee,0xfc,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0xe0,0x7c,0x0e,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x38,0x38,0x38,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0xee,0xee,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0x6c,0x38,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xfe,0xfe,0xee,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0x7c,0x38,0x7c,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xee,0xee,0xee,0x7c,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x1c,0x38,0x70,0xe0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x04,0x32,0x73,0x63,0x03,0x87,0x7e,0x3c,0x38,0x7c,0xfc,0xfc,0xfc,0x78,0x00,0x00,0xfe,0x84,0x88,0x84,0xa2,0xd1,0x8a,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x60,0x70,0x78,0x7c,0x3e,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x0e,0x1e,0x3e,0x7c,0xfc,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3f,0x1f,0x1c,0x18,0x39,0x39,0x39,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x7e,0x3c,0x3c,0x3c,0x3c,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xf8,0x38,0x18,0x9c,0x9c,0x9c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3f,0x3f,0x1f,0x1f,0x0f,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc3,0xe7,0xff,0xdb,0x3c,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xfc,0xf8,0xf8,0xf0,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
//variables
static unsigned char i;
static unsigned char pad,spr;
static unsigned char touch;
static unsigned char frame;
//two players coords
static unsigned char cat_x[2];
static unsigned char cat_y[2];
//first player metasprite, data structure explained in neslib.h
const unsigned char metaCat1[]={
0, 0, 0x50, 0,
8, 0, 0x51, 1,
16, 0, 0x52, 0,
0, 8, 0x60, 0,
8, 8, 0x61, 0,
16, 8, 0x62, 0,
0, 16, 0x70, 0,
8, 16, 0x71, 0,
16, 16, 0x72, 0,
128
};
//second player metasprite, the only difference is palette number
const unsigned char metaCat2[]={
0, 0, 0x50, 0,
8, 0, 0x51, 1,
16, 0, 0x52, 0,
0, 8, 0x60, 1,
8, 8, 0x61, 1,
16, 8, 0x62, 1,
0, 16, 0x70, 1,
8, 16, 0x71, 1,
16, 16, 0x72, 1,
128
};
void main(void)
{
//copy tileset to RAM
vram_write((unsigned char*)TILESET, 0x0, sizeof(TILESET));
ppu_on_all();//enable rendering
//set initial coords
cat_x[0]=52;
cat_y[0]=100;
cat_x[1]=180;
cat_y[1]=100;
//init other vars
touch=0;//collision flag
frame=0;//frame counter
//now the main loop
while(1)
{
ppu_waitnmi();//wait for next TV frame
//flashing color for touch
i=frame&1?0x30:0x2a;
pal_col(17,touch?i:0x21);//set first sprite color
pal_col(21,touch?i:0x26);//set second sprite color
//process players
spr=0;
for(i=0;i<2;++i)
{
//display metasprite
spr=oam_meta_spr(cat_x[i],cat_y[i],spr,!i?metaCat1:metaCat2);
//poll pad and change coordinates
pad=pad_poll(i);
if(pad&PAD_LEFT &&cat_x[i]> 0) cat_x[i]-=2;
if(pad&PAD_RIGHT&&cat_x[i]<232) cat_x[i]+=2;
if(pad&PAD_UP &&cat_y[i]> 0) cat_y[i]-=2;
if(pad&PAD_DOWN &&cat_y[i]<212) cat_y[i]+=2;
}
//check for collision for a smaller bounding box
//metasprite is 24x24, collision box is 20x20
if(!(cat_x[0]+22< cat_x[1]+2 ||
cat_x[0]+ 2>=cat_x[1]+22||
cat_y[0]+22< cat_y[1]+2 ||
cat_y[0]+ 2>=cat_y[1]+22)) touch=1; else touch=0;
frame++;
}
}

View File

@ -346,14 +346,24 @@ function pixelEditorDecodeMessage(e) {
palette = [0xff000000, 0xffffffff]; // TODO
if (currentPaletteStr) {
var palbytes = parseHexBytes(e.data.palstr);
var rr = Math.floor(Math.abs(currentPaletteFmt.pal/100) % 10);
var gg = Math.floor(Math.abs(currentPaletteFmt.pal/10) % 10);
var bb = Math.floor(Math.abs(currentPaletteFmt.pal) % 10);
// TODO: n
if (currentPaletteFmt.pal >= 0)
palette = convertPaletteBytes(palbytes, 0, rr, rr, gg, rr+gg, bb);
else
palette = convertPaletteBytes(palbytes, rr+gg, bb, rr, gg, 0, rr);
var pal = currentPaletteFmt.pal;
if (pal > 0) {
var rr = Math.floor(Math.abs(pal/100) % 10);
var gg = Math.floor(Math.abs(pal/10) % 10);
var bb = Math.floor(Math.abs(pal) % 10);
// TODO: n
if (currentPaletteFmt.pal >= 0)
palette = convertPaletteBytes(palbytes, 0, rr, rr, gg, rr+gg, bb);
else
palette = convertPaletteBytes(palbytes, rr+gg, bb, rr, gg, 0, rr);
} else {
var paltable = PREDEF_PALETTES[pal];
if (paltable) {
palette = palbytes.map(function(i) { return paltable[i]; });
} else {
alert("No palette named " + pal);
}
}
if (currentPaletteFmt.n) {
paletteSets = [];
for (var i=0; i<palette.length; i+=currentPaletteFmt.n) {
@ -363,6 +373,13 @@ function pixelEditorDecodeMessage(e) {
// TODO: swap palettes
}
} else {
var ncols = (currentFormat.bpp || 1) * (currentFormat.np || 2);
switch (ncols) {
case 2:
palette = [0xff000000, 0xffff0000, 0xffffff00, 0xffffffff];
break;
// TODO
}
// TODO: default palette?
}
palette = new Uint32Array(palette);
@ -450,3 +467,16 @@ function pixelEditorKeypress(e) {
}
}
}
var PREDEF_PALETTES = {
'nes':[
0xFF7C7C7C ,0xFF0000FC ,0xFF0000BC ,0xFF4428BC ,0xFF940084 ,0xFFA80020 ,0xFFA81000 ,0xFF881400
,0xFF503000 ,0xFF007800 ,0xFF006800 ,0xFF005800 ,0xFF004058 ,0xFF000000 ,0xFF000000 ,0xFF000000
,0xFFBCBCBC ,0xFF0078F8 ,0xFF0058F8 ,0xFF6844FC ,0xFFD800CC ,0xFFE40058 ,0xFFF83800 ,0xFFE45C10
,0xFFAC7C00 ,0xFF00B800 ,0xFF00A800 ,0xFF00A844 ,0xFF008888 ,0xFF000000 ,0xFF000000 ,0xFF000000
,0xFFF8F8F8 ,0xFF3CBCFC ,0xFF6888FC ,0xFF9878F8 ,0xFFF878F8 ,0xFFF85898 ,0xFFF87858 ,0xFFFCA044
,0xFFF8B800 ,0xFFB8F818 ,0xFF58D854 ,0xFF58F898 ,0xFF00E8D8 ,0xFF787878 ,0xFF000000 ,0xFF000000
,0xFFFCFCFC ,0xFFA4E4FC ,0xFFB8B8F8 ,0xFFD8B8F8 ,0xFFF8B8F8 ,0xFFF8A4C0 ,0xFFF0D0B0 ,0xFFFCE0A8
,0xFFF8D878 ,0xFFD8F878 ,0xFFB8F8B8 ,0xFFB8F8D8 ,0xFF00FCFC ,0xFFF8D8F8 ,0xFF000000 ,0xFF000000
]
};

View File

@ -1,9 +1,17 @@
"use strict";
var NES_PRESETS = [
var NES_NESLIB_PRESETS = [
{id:'neslib1.c', name:'Text'},
{id:'neslib2.c', name:'Sprites'},
{id:'neslib3.c', name:'Cursor'},
{id:'neslib4.c', name:'Metasprites'},
];
var NES_CONIO_PRESETS = [
{id:'hello.c', name:'Hello PPU'},
{id:'conio.c', name:'Hello Console I/O'},
{id:'siegegame.c', name:'Siege Game'},
{id:'ex1.asm', name:'Assembly Example'},
];
/// JSNES
@ -38,7 +46,7 @@ var JSNESPlatform = function(mainElement) {
/// MAME support
var NESMAMEPlatform = function(mainElement) {
var NESMAMEPlatform = function(mainElement, lzgRom, romSize) {
var self = this;
this.__proto__ = new BaseMAMEPlatform();
@ -51,359 +59,254 @@ var NESMAMEPlatform = function(mainElement) {
width:256*2,
height:240*2,
romfn:'/emulator/cart.nes',
romsize:0xa000,
romdata:NES_DEFAULT_ROM,
romsize:romSize,
romdata:new lzgmini().decode(lzgRom).slice(0, romSize),
preInit:function(_self) {
},
});
}
this.getToolForFilename = getToolForFilename_6502;
this.getDefaultExtension = function() { return ".c"; };
}
var NESConIOPlatform = function(mainElement) {
var self = this;
this.__proto__ = new NESMAMEPlatform(mainElement, NES_CONIO_ROM_LZG, 0xa010);
this.getPresets = function() { return NES_CONIO_PRESETS; }
this.loadROM = function(title, data) {
this.loadROMFile(data);
this.loadRegion(":nes_slot:cart:prg_rom", data.slice(0x10, 0x8010));
this.loadRegion(":nes_slot:cart:chr_rom", data.slice(0x8010, 0xa010));
}
}
var NESLibPlatform = function(mainElement) {
var self = this;
this.__proto__ = new NESMAMEPlatform(mainElement, NES_NESLIB_ROM_LZG, 0x8010);
this.getPresets = function() { return NES_PRESETS; }
this.getPresets = function() { return NES_NESLIB_PRESETS; }
this.getToolForFilename = getToolForFilename_6502;
this.getDefaultExtension = function() { return ".c"; };
this.loadROM = function(title, data) {
this.loadROMFile(data);
this.loadRegion(":nes_slot:cart:prg_rom", data.slice(0x10, 0x8010));
}
}
///
//PLATFORMS['nes'] = JSNESPlatform;
PLATFORMS['nes'] = NESMAMEPlatform;
PLATFORMS['nes-lib'] = NESLibPlatform;
PLATFORMS['nes-conio'] = NESConIOPlatform;
///
var NES_DEFAULT_ROM_LZG = [
76,90,71,0,0,160,16,0,0,40,189,23,128,224,255,1,188,206,237,180,78,69,83,26,2,1,1,0,180,6,70,108,
117,66,66,97,32,89,97,68,180,132,216,120,173,2,32,133,24,173,22,64,133,25,237,2,16,251,162,0,142,0,32,134,
88,142,1,32,202,154,160,7,132,1,160,0,132,0,169,0,145,0,136,208,251,198,1,16,247,32,60,173,169,0,32,96,
173,169,2,133,89,169,13,32,78,174,169,154,133,0,169,129,133,1,237,14,111,237,19,141,3,32,169,78,141,0,7,169,
1,141,1,7,237,7,2,7,169,102,141,3,7,173,56,129,141,4,7,169,2,141,5,237,82,6,7,169,64,141,7,237,
87,5,32,180,65,133,0,133,1,133,2,133,82,133,3,133,6,169,136,141,0,32,169,30,141,1,32,165,82,240,252,173,
2,32,48,251,180,129,41,64,208,249,169,0,133,82,166,0,237,69,16,208,249,165,16,41,16,240,3,76,27,149,230,2,
165,2,201,2,208,22,237,22,2,189,61,129,141,5,32,206,3,78,232,224,64,208,2,162,237,166,64,240,203,206,6,97,
237,46,32,240,37,165,6,208,46,169,1,133,6,230,3,166,3,189,206,3,144,165,3,201,5,208,10,237,59,3,206,4,
160,76,53,129,237,5,6,237,39,208,206,3,93,76,170,128,96,112,128,144,160,1,3,7,13,20,30,40,50,60,70,80,
90,95,100,101,102,103,103,104,103,100,90,85,80,74,67,59,49,36,2,1,2,3,3,4,4,3,3,2,2,1,1,1,
2,180,1,180,193,237,12,4,5,180,1,4,3,237,6,0,237,73,206,7,13,6,5,5,237,13,0,0,237,35,180,163,
48,49,50,51,52,32,180,3,70,105,114,115,116,32,108,105,110,101,237,200,55,56,57,48,49,48,237,196,180,6,73,206,
12,7,32,49,32,65,65,65,68,237,196,237,194,180,161,180,5,206,5,24,32,32,206,6,24,237,130,237,143,180,2,237,
142,206,5,24,237,179,206,8,24,68,180,131,206,8,24,237,172,180,162,206,22,56,206,12,88,68,180,1,206,10,24,237,
138,180,228,206,10,30,206,8,24,237,131,206,5,1,206,15,24,206,3,69,206,9,216,237,136,206,6,14,206,42,24,48,
180,17,206,46,56,180,14,206,8,24,80,80,85,32,84,101,115,116,32,40,71,114,97,112,104,105,99,115,41,206,13,88,
206,27,56,32,112,65,206,7,57,83,111,117,110,100,237,118,206,28,56,206,7,24,67,206,7,55,67,111,100,101,237,246,
206,28,56,206,7,24,73,79,45,80,111,114,116,115,237,120,110,116,114,111,108,108,101,114,115,41,206,28,56,180,5,69,
120,105,116,206,26,24,206,27,56,206,26,24,45,180,25,206,29,88,206,30,24,206,28,24,206,6,24,206,104,152,32,76,
97,115,116,32,76,206,108,152,206,167,91,180,29,180,9,1,0,2,3,4,206,7,6,5,6,7,8,9,206,9,22,10,
11,12,13,14,15,16,206,6,7,17,18,19,20,21,22,23,206,8,24,24,25,26,27,28,29,0,30,31,32,33,34,35,
36,0,37,38,39,40,41,42,43,206,6,7,0,0,44,45,46,47,48,49,0,50,51,52,53,54,55,56,0,57,58,59,
60,61,62,206,7,7,180,2,63,64,65,0,0,66,67,68,69,70,71,46,0,72,0,0,73,74,75,206,7,7,180,2,
76,77,206,11,167,78,79,80,206,11,8,81,82,206,11,7,83,84,85,206,11,8,0,86,206,7,2,87,180,97,88,89,
90,206,12,23,180,1,91,180,130,92,93,94,95,96,97,98,99,206,162,90,104,237,73,105,206,12,29,106,107,108,109,110,
111,112,113,114,115,116,117,118,206,13,57,105,237,59,119,120,121,122,123,124,125,126,127,128,129,130,131,0,0,132,206,11,
85,180,1,133,134,135,136,137,138,139,140,141,142,143,144,145,206,15,123,206,18,138,146,237,196,180,197,147,148,149,150,151,
152,0,153,151,152,148,154,237,72,155,206,16,41,180,9,206,3,119,237,77,156,157,180,194,158,206,7,67,237,5,132,237,
135,206,5,42,159,160,180,228,149,161,162,0,163,149,161,164,152,149,150,150,162,152,206,11,68,206,35,1,164,153,149,206,
9,24,148,105,237,183,237,82,206,2,151,206,10,167,206,6,16,156,157,206,9,144,146,237,1,158,206,5,55,148,237,204,
206,3,113,237,3,105,206,2,134,206,17,183,206,6,84,206,5,71,180,97,163,152,162,165,166,164,148,206,3,82,206,6,
101,155,206,4,211,237,75,237,91,237,143,206,5,203,158,237,9,237,136,146,0,105,237,11,132,237,4,206,35,14,237,223,
206,6,106,167,168,169,170,237,124,171,172,173,173,173,0,163,174,163,0,175,151,174,162,148,206,4,180,105,0,105,176,177,
178,179,237,41,163,163,149,180,0,162,150,150,181,165,166,152,162,163,164,182,163,151,0,0,158,206,3,109,183,184,185,186,
0,105,237,3,146,206,36,80,146,206,3,133,158,132,0,146,91,159,160,146,206,4,214,105,158,237,67,0,187,237,21,180,
193,237,5,105,0,146,146,0,158,237,86,64,80,16,0,80,80,0,0,4,85,85,85,5,85,85,21,4,33,0,3,5,
1,192,0,196,8,129,160,160,96,192,16,170,46,86,84,82,94,164,130,78,104,42,85,85,234,164,200,94,158,87,90,88,
94,150,186,6,13,7,14,10,9,11,7,206,154,214,180,2,10,32,42,206,200,83,49,58,32,36,50,48,48,53,47,54,
47,55,46,206,131,60,42,32,10,206,27,55,237,122,10,237,185,78,111,114,109,97,108,32,119,114,105,116,101,47,114,101,
97,100,58,237,208,87,237,73,44,32,237,74,44,237,214,206,5,17,188,4,0,71,237,80,32,116,104,101,110,206,22,20,
99,111,114,114,101,99,116,206,5,17,77,105,120,101,100,32,97,100,114,47,100,97,116,97,206,11,44,36,51,48,48,48,
237,25,114,114,111,114,105,110,103,206,7,14,70,70,70,45,36,237,19,48,32,98,206,194,240,97,114,121,237,19,77,105,
120,237,245,115,32,116,111,206,6,237,237,16,82,206,2,107,237,71,50,237,80,114,101,115,101,116,32,108,97,116,99,104,
237,20,85,115,101,237,211,47,53,237,85,237,83,97,100,114,206,5,96,80,97,108,101,116,116,101,206,11,248,10,32,83,
99,111,114,101,58,32,32,32,47,49,49,237,7,180,7,80,114,101,115,115,32,83,116,97,114,116,0,206,60,154,206,40,
154,50,58,32,83,112,206,3,176,206,36,152,206,60,154,206,35,154,237,237,32,67,111,108,108,105,115,105,111,110,58,206,
7,11,76,105,109,180,193,206,2,191,206,226,218,206,3,183,237,130,206,37,187,68,77,65,206,17,13,105,102,46,206,19,
18,180,12,206,10,247,51,206,29,247,206,19,247,51,58,32,86,66,108,32,40,206,35,127,41,206,2,251,206,28,247,10,
10,32,66,105,116,32,55,32,99,108,101,97,114,206,66,55,102,116,101,114,206,19,170,206,14,174,52,206,29,174,206,10,
174,188,8,1,106,206,98,80,52,48,48,48,45,180,162,51,46,206,28,174,237,58,180,18,206,9,148,48,206,29,147,206,
10,147,188,7,1,197,49,58,32,65,114,105,116,109,101,116,104,105,99,32,111,112,115,206,28,147,206,34,73,237,121,65,
68,67,206,69,46,83,66,206,6,2,67,77,80,206,6,2,80,88,206,7,2,89,206,5,2,73,78,206,6,32,68,69,
206,6,2,73,78,206,6,32,68,69,206,6,2,73,78,206,6,42,68,69,206,6,2,65,83,76,206,5,2,76,83,82,
206,5,2,82,79,206,6,12,82,79,237,12,206,46,182,53,206,61,27,206,51,27,50,58,32,76,111,103,206,37,22,206,
124,107,206,42,27,76,68,65,206,6,173,68,206,6,213,76,68,206,6,203,84,65,206,6,12,84,65,206,7,12,83,206,
7,12,88,206,6,52,84,88,83,206,6,2,89,206,6,12,80,76,206,6,2,65,78,68,206,5,2,69,206,2,253,237,
130,79,82,206,6,22,66,73,84,206,69,221,206,41,18,50,57,206,61,18,206,51,18,51,58,32,65,100,100,237,118,101,
206,60,18,206,40,18,65,100,114,32,73,109,109,101,100,105,97,206,163,182,237,72,90,101,114,111,32,80,97,103,206,15,
8,44,206,34,8,237,74,65,98,115,111,108,117,206,7,41,206,6,7,206,15,24,44,206,34,67,237,73,40,73,110,100,
105,206,194,52,44,88,41,206,14,11,41,237,158,74,206,67,166,180,161,40,237,89,74,206,67,80,82,84,206,34,101,82,
84,73,206,134,20,206,41,48,52,50,206,61,48,206,51,48,52,58,32,77,105,115,99,206,8,66,206,60,48,206,34,48,
206,227,67,32,47,206,228,16,206,3,165,66,82,75,32,102,108,97,103,115,206,5,4,114,101,116,117,114,110,206,197,143,
83,116,97,99,107,206,5,4,206,99,28,65,77,206,8,2,206,229,33,206,141,249,206,10,228,56,206,29,228,206,10,228,
73,79,206,138,242,49,54,44,180,195,188,3,0,77,206,28,228,206,2,130,237,175,206,229,137,49,45,56,206,230,148,57,
45,49,206,231,160,49,55,45,50,52,206,226,95,237,100,55,206,28,36,206,9,230,206,178,66,206,5,221,101,108,101,99,
116,32,38,206,5,230,188,18,6,24,10,32,124,32,32,94,206,41,184,180,1,124,237,77,60,111,62,206,16,13,32,118,
237,2,83,101,32,83,116,32,32,66,32,65,237,77,206,19,76,206,31,97,206,31,97,206,29,97,180,7,206,60,200,206,
40,200,49,76,97,116,0,50,180,130,68,80,106,114,0,70,97,109,105,0,78,69,83,0,89,101,115,0,78,111,0,79,
107,0,69,206,98,17,180,164,32,105,110,32,90,45,70,108,97,103,206,8,8,78,206,13,8,86,206,13,8,67,206,13,
8,68,206,10,8,73,206,10,5,66,206,13,34,114,101,115,117,108,116,206,8,8,119,114,97,112,0,165,3,201,0,240,
18,201,1,240,11,201,2,240,13,201,3,240,12,76,20,173,76,84,166,76,140,166,76,125,150,188,8,13,21,142,1,32,
32,60,173,169,173,133,0,169,145,133,1,169,32,133,2,169,64,133,3,32,23,174,188,8,12,180,169,0,133,7,165,82,
240,252,24,169,33,141,6,32,165,7,10,10,201,96,48,2,105,64,105,12,237,135,24,105,8,170,160,8,202,189,0,5,
74,180,1,24,105,48,141,7,32,237,5,41,15,237,130,136,208,229,24,165,7,105,8,201,48,208,2,206,2,65,76,182,
149,180,193,82,188,6,12,187,73,48,208,164,162,35,160,40,32,231,172,32,37,173,206,15,143,155,133,0,169,146,206,21,
143,206,2,139,169,32,141,6,32,169,100,180,129,162,94,173,3,5,41,1,240,2,162,1,142,7,32,237,208,131,237,80,
60,173,1,206,14,16,133,237,80,62,173,0,206,14,16,164,237,80,86,173,2,206,9,16,206,12,163,140,32,37,173,165,
16,41,208,208,250,76,16,128,188,13,14,89,206,2,167,76,133,0,169,141,206,12,167,206,35,57,33,237,8,9,133,3,
237,12,6,184,169,130,201,4,240,51,48,55,112,59,144,63,36,6,169,126,201,126,208,37,48,41,80,45,144,49,201,127,
240,27,16,31,80,35,176,39,184,169,255,237,29,14,16,18,112,22,144,26,32,141,173,230,48,76,2,151,32,163,173,180,
162,174,180,163,185,180,163,196,173,206,3,83,41,133,3,24,184,169,130,162,130,224,4,240,52,48,56,112,60,144,64,162,
126,233,4,224,126,208,38,48,42,80,46,144,50,224,127,240,28,16,32,80,36,176,40,162,255,233,126,237,30,206,11,83,
93,206,3,83,180,161,174,180,163,185,180,163,206,5,83,73,206,4,83,160,130,192,206,7,83,160,126,233,4,192,206,7,
83,192,206,7,83,160,255,233,126,237,30,206,11,83,184,206,3,83,180,161,174,180,163,185,180,163,196,173,206,35,25,201,
133,3,24,169,122,105,4,240,73,48,77,112,81,176,85,237,2,63,16,67,80,71,176,75,105,112,240,53,16,57,112,61,
176,65,105,14,208,43,48,47,112,51,144,55,169,148,105,127,240,31,48,35,112,39,144,43,105,14,201,35,208,43,24,248,
169,8,105,8,201,16,216,208,38,206,4,101,49,152,206,2,101,180,161,174,180,163,185,180,163,196,180,163,240,180,163,207,
206,4,113,233,206,2,113,130,233,129,208,110,56,169,58,233,58,208,103,237,70,4,240,72,48,76,80,80,144,84,233,125,
208,62,48,66,112,70,144,74,233,7,240,52,16,56,112,60,176,64,233,121,240,42,48,46,80,50,144,54,201,127,208,56,
24,169,126,233,127,240,25,16,29,112,33,176,37,56,248,169,16,233,8,201,8,206,7,126,183,206,3,126,180,161,174,180,
163,185,180,163,196,180,163,240,180,163,207,206,36,82,105,133,3,36,6,56,169,254,133,4,169,0,230,4,240,45,16,49,
80,53,144,57,24,169,1,230,4,208,32,48,36,80,40,176,44,56,184,169,127,206,5,23,206,43,78,14,153,206,2,91,
180,161,174,180,163,185,180,163,206,37,169,137,206,4,79,1,237,48,254,198,4,206,34,54,80,51,144,55,24,198,4,240,
32,16,206,6,77,128,237,21,0,237,10,14,48,206,9,77,99,206,3,77,180,161,174,180,163,185,180,163,206,5,77,169,
206,3,77,162,254,169,0,232,240,41,16,45,80,49,144,53,24,169,1,232,208,29,48,33,80,37,176,41,56,184,162,127,
237,83,206,11,157,179,206,3,72,180,161,174,180,163,185,180,163,206,5,72,201,206,4,72,1,169,254,202,208,39,48,43,
80,47,144,51,24,202,240,29,16,206,6,70,128,169,0,202,206,12,150,1,154,206,2,70,180,161,174,180,163,185,180,163,
206,5,70,233,206,3,70,160,254,169,0,200,206,9,150,200,206,8,150,160,127,237,83,206,11,150,81,206,3,72,180,161,
174,180,163,185,180,163,196,173,169,34,206,100,162,206,2,72,1,169,254,136,206,7,150,136,206,8,150,160,128,169,0,136,
206,12,150,159,206,3,70,180,161,174,180,163,185,180,163,206,5,70,41,206,36,137,64,10,240,24,16,28,80,32,176,36,
184,10,208,206,5,53,230,48,237,55,76,220,237,181,180,161,237,53,180,161,237,53,180,161,206,5,53,73,237,245,2,74,
240,35,48,39,80,43,176,47,184,74,208,25,48,29,112,33,144,37,169,194,74,206,4,125,176,206,5,125,36,155,206,2,
64,180,161,174,180,163,185,180,163,206,5,64,206,69,101,0,42,240,48,48,52,80,56,176,60,169,85,42,240,37,16,41,
80,45,176,49,184,169,128,42,206,8,77,42,206,44,32,121,206,3,77,180,161,174,180,163,185,180,163,206,5,77,206,69,
99,14,106,206,68,181,176,57,106,240,36,48,40,80,44,144,48,24,184,169,1,106,208,23,48,27,112,31,144,35,106,206,
4,74,206,6,159,203,206,3,74,180,161,174,180,163,185,180,163,196,173,206,185,253,111,133,0,169,142,206,177,78,206,133,
61,206,3,124,240,46,48,50,80,54,144,58,169,0,208,206,5,124,184,24,169,170,206,34,107,112,32,176,36,169,206,37,
246,206,6,124,79,156,206,2,124,180,161,174,180,163,185,180,163,206,133,143,206,68,70,162,153,240,46,16,206,3,74,162,
206,9,74,162,234,206,6,74,162,69,206,44,117,161,206,3,74,180,161,174,180,163,185,180,163,206,69,152,206,69,72,178,
206,6,74,160,206,9,74,160,206,7,156,160,56,206,12,74,243,206,3,74,180,161,174,180,163,185,180,163,206,168,233,206,
3,238,162,144,170,240,55,48,59,80,63,144,67,169,0,162,255,170,208,206,133,158,206,2,244,162,0,170,206,194,71,112,
35,176,39,169,200,162,50,170,206,12,250,81,157,206,67,248,157,206,67,248,157,206,67,248,157,206,169,236,206,3,86,160,
144,168,206,8,86,160,255,168,206,10,86,160,0,168,206,8,86,160,50,168,206,12,86,175,206,3,86,180,161,174,180,163,
185,180,163,206,5,86,105,133,3,186,138,168,206,34,91,37,154,162,147,186,240,61,48,68,80,75,144,82,162,0,154,162,
255,186,208,47,48,54,80,61,144,68,184,24,162,250,154,162,0,186,240,31,16,38,112,45,176,52,162,185,154,162,127,186,
240,17,16,24,112,31,176,38,152,170,154,206,4,96,35,158,237,67,163,173,206,5,1,174,206,6,1,185,206,6,1,206,
171,13,162,14,169,144,138,206,6,202,162,0,169,255,138,206,8,202,162,170,169,0,138,206,6,202,162,200,169,50,138,206,
12,202,129,158,206,2,95,180,161,174,180,163,185,180,163,206,168,22,206,5,202,144,169,14,154,240,58,48,65,80,72,144,
79,162,255,169,0,154,208,45,48,52,80,59,144,66,184,24,162,0,169,170,154,240,30,16,37,112,44,176,51,162,50,169,
200,154,206,15,198,241,206,6,198,237,193,174,206,6,1,185,206,6,1,206,171,54,160,14,169,144,152,206,6,198,160,0,
169,255,152,206,8,198,160,170,169,0,152,206,6,198,160,200,169,50,152,206,77,248,159,206,67,248,159,206,67,248,159,206,
67,248,159,206,172,70,169,14,72,162,144,104,240,58,48,62,80,66,144,70,169,0,72,162,255,104,208,44,48,48,80,52,
144,56,206,34,248,72,162,0,104,206,226,241,112,36,176,40,169,200,72,162,50,104,206,12,90,177,206,3,90,180,161,174,
180,163,185,180,163,206,171,88,169,200,162,89,41,159,240,62,16,66,80,70,144,74,206,66,183,41,197,208,206,131,150,144,
60,184,24,237,22,131,41,55,206,226,1,112,40,176,44,206,66,198,41,143,240,18,16,22,112,26,176,30,201,138,208,32,
206,4,94,29,160,206,2,94,180,161,174,180,163,185,180,163,196,180,163,240,206,171,118,158,162,144,73,129,240,62,48,206,
4,100,1,162,255,73,1,206,9,100,170,162,0,73,113,206,226,24,206,3,100,200,162,50,73,102,206,7,100,174,206,6,
100,137,206,3,100,180,161,174,180,163,185,180,163,196,180,163,206,5,100,206,102,48,162,144,9,32,206,7,100,0,162,255,
9,0,206,9,100,10,162,0,9,160,206,7,100,8,162,50,9,192,206,7,100,200,206,6,100,245,206,3,100,180,161,174,
180,163,185,180,163,196,180,163,206,5,100,105,133,3,56,169,94,133,5,169,151,36,5,240,63,48,67,80,71,144,75,169,
5,237,8,240,36,5,208,47,48,51,112,55,144,59,24,169,197,237,9,58,237,9,30,16,34,80,38,176,42,169,153,237,
8,109,237,41,206,43,163,92,161,206,2,101,180,161,174,180,163,185,180,163,206,187,137,137,133,0,169,143,206,181,137,210,
133,3,169,94,240,24,48,22,201,35,240,18,201,94,208,14,169,130,240,10,16,8,206,4,99,181,161,32,152,206,164,94,
242,237,31,0,133,5,169,147,133,6,169,69,133,7,165,5,208,22,48,20,165,6,240,16,16,14,165,7,240,10,48,206,
5,41,230,237,169,206,66,143,18,237,105,141,6,1,206,8,44,162,4,181,1,208,59,48,57,181,2,201,147,208,51,162,
8,181,254,180,225,37,162,254,181,8,240,31,16,29,197,6,208,25,205,6,1,240,20,162,0,181,7,240,20,48,18,201,
69,208,14,206,4,77,65,162,32,251,173,180,162,206,5,83,50,206,2,171,141,0,2,173,254,254,201,170,208,29,173,0,
2,201,94,208,22,173,255,254,201,85,208,15,173,0,254,201,255,208,206,5,135,117,206,7,44,82,237,44,17,133,5,237,
48,25,2,162,25,189,237,171,46,189,230,237,107,39,189,231,254,201,34,208,26,162,37,189,224,255,201,17,208,17,162,217,
189,37,206,2,82,206,5,119,192,206,3,119,180,161,206,5,67,114,206,9,67,160,25,185,206,4,67,185,206,4,67,185,
206,4,67,160,38,185,223,206,3,67,160,218,185,36,206,9,67,11,163,206,2,67,180,161,206,5,67,146,206,35,78,6,
169,254,133,7,180,97,8,180,97,9,162,0,161,6,201,255,208,36,162,1,193,5,208,30,162,4,161,4,237,55,22,162,
39,161,225,180,225,206,5,207,82,237,191,180,161,206,5,63,178,206,16,63,160,0,177,237,127,46,160,3,180,225,187,208,
38,160,254,180,225,170,208,30,160,2,177,8,201,34,208,22,160,1,180,225,85,206,6,73,163,206,3,73,180,161,206,5,
73,210,133,3,76,178,163,169,0,240,206,5,24,189,206,7,18,206,66,0,214,141,0,2,169,163,141,1,2,108,180,225,
0,240,32,169,253,237,73,0,141,255,2,169,252,141,0,3,108,255,2,237,238,249,206,3,78,180,161,237,52,206,66,252,
18,133,3,184,32,8,164,80,57,234,104,168,104,201,164,208,49,152,201,4,208,44,237,228,31,164,206,6,30,206,34,214,
164,72,169,50,72,169,1,96,234,234,173,208,3,76,64,164,237,220,67,206,7,28,206,34,198,237,28,85,72,8,64,237,
91,206,5,158,99,237,88,206,89,255,193,133,0,169,144,206,85,255,209,133,3,169,255,72,40,8,104,201,255,208,25,169,
4,237,2,120,104,201,52,206,38,176,195,164,32,229,173,180,162,206,101,6,241,237,38,4,133,7,72,40,0,234,8,104,
41,16,240,60,165,7,180,161,54,180,161,4,240,42,169,0,133,7,237,122,237,84,168,237,9,25,152,237,20,26,237,154,
20,237,154,206,5,167,30,165,32,218,173,180,162,229,180,163,206,37,89,17,133,3,0,206,2,237,53,165,237,222,56,206,
7,18,49,133,3,169,85,186,72,221,0,1,208,43,104,169,170,237,194,33,169,170,141,0,1,169,85,141,0,2,162,254,
154,104,104,206,72,29,119,165,206,34,118,180,161,206,5,55,81,133,3,162,6,160,7,132,5,160,0,132,4,169,85,145,
4,136,208,251,198,5,202,208,246,206,10,14,209,4,208,62,136,208,249,237,80,244,206,9,16,170,206,19,38,170,237,38,
16,206,6,38,206,101,248,206,7,103,113,206,2,166,206,66,16,170,141,1,206,66,21,2,2,169,255,141,3,2,206,98,
165,85,208,53,173,0,10,180,193,46,173,3,10,201,255,208,39,173,1,18,201,170,208,32,173,2,26,201,0,208,25,173,
3,26,237,13,18,237,44,0,18,237,39,206,6,200,65,166,206,43,214,188,26,7,207,177,133,0,169,140,206,43,225,206,
28,48,237,48,90,237,48,137,237,48,206,2,184,32,237,176,169,0,133,48,188,4,8,100,33,180,129,162,48,142,7,32,
232,224,58,208,248,206,10,12,134,4,160,10,173,7,188,4,8,45,187,133,3,237,3,197,4,208,13,230,4,136,206,38,
13,251,206,2,178,237,234,65,206,8,62,53,208,248,237,35,232,206,12,74,70,180,130,206,2,65,219,133,3,162,54,134,
4,160,4,237,28,180,65,201,0,208,20,206,16,81,84,167,206,7,81,96,180,129,237,25,206,14,154,97,206,6,154,9,
206,6,154,251,206,18,154,157,206,8,65,129,206,8,154,57,208,248,174,188,6,9,99,138,180,129,188,7,9,112,237,220,
206,6,240,206,98,137,27,206,18,78,243,206,8,78,161,206,10,240,5,169,38,237,7,224,58,208,239,169,1,237,85,206,
9,26,206,10,76,59,206,18,76,71,168,206,2,76,48,237,106,193,206,49,138,237,204,206,10,62,91,206,18,62,141,237,
190,62,237,106,225,180,130,4,141,0,32,162,136,206,36,99,202,208,247,206,66,115,206,15,83,237,97,206,12,83,123,206,
18,83,232,206,3,83,36,237,106,37,237,106,99,237,190,115,237,62,237,71,206,3,67,188,3,10,162,232,224,17,206,6,
12,237,165,0,141,5,206,6,22,134,4,160,16,206,3,89,155,206,3,89,206,16,92,121,169,237,167,162,99,237,162,237,
124,206,7,31,19,237,159,169,112,133,0,169,148,133,1,32,23,174,237,37,206,7,137,5,180,129,162,51,206,3,117,67,
208,248,237,204,180,130,206,9,137,237,71,173,2,237,207,206,5,40,134,4,160,7,206,3,135,206,68,213,206,16,135,224,
206,2,135,6,32,206,7,95,2,206,40,145,176,208,248,237,148,180,132,40,206,2,220,2,180,130,1,141,0,206,5,7,
206,7,92,206,4,235,219,206,21,92,76,170,206,6,64,5,206,2,152,206,2,100,63,206,13,203,206,34,162,237,140,206,
35,112,206,8,175,206,71,234,21,206,36,20,117,206,39,20,230,48,76,179,170,206,11,20,127,206,12,20,206,219,72,169,
252,237,37,138,206,204,72,255,32,96,206,196,26,212,133,3,169,200,141,0,7,169,7,141,20,64,169,24,141,1,32,188,
3,34,8,16,251,142,5,32,180,66,6,180,66,188,6,34,89,10,48,81,144,248,169,80,206,6,39,206,20,27,35,144,
248,76,107,171,169,8,141,1,237,150,206,16,25,13,144,248,206,2,145,206,35,39,113,171,237,67,206,197,166,244,133,3,
162,0,206,3,124,206,3,122,206,6,42,168,41,32,208,69,152,16,245,169,80,141,4,7,141,8,7,141,12,7,141,16,
7,141,20,7,141,24,7,141,28,7,141,32,206,4,134,206,15,44,6,237,44,76,215,206,3,89,206,3,100,221,206,6,
100,206,130,87,20,206,2,100,142,3,32,142,4,32,232,208,250,134,4,237,3,173,4,206,37,197,232,206,38,197,12,172,
206,6,39,52,206,5,39,138,24,157,0,5,105,1,232,208,248,169,5,141,20,64,206,21,48,68,206,7,48,84,133,3,
169,36,141,3,32,162,0,206,15,50,237,144,206,16,52,128,237,116,206,57,197,251,133,0,169,139,206,44,197,206,34,99,
237,136,218,133,3,237,168,169,0,206,36,60,188,6,2,230,212,206,12,76,206,199,83,134,2,132,3,237,49,50,165,48,
201,10,48,15,169,48,237,66,230,50,56,233,10,201,10,16,247,24,105,48,133,51,169,50,133,0,169,0,133,1,76,6,
188,13,15,25,76,34,173,206,9,9,206,3,73,180,162,240,250,96,206,132,126,206,66,253,162,0,160,16,141,206,130,161,
250,136,206,131,164,3,32,168,141,4,32,136,208,250,96,162,8,142,3,32,157,0,7,237,7,232,208,247,96,10,10,105,
206,7,45,160,0,162,4,177,0,237,47,200,208,248,230,1,202,208,243,96,169,138,206,68,229,206,2,124,141,206,8,3,
147,206,8,3,163,206,8,3,179,206,8,3,195,206,8,3,211,206,8,3,227,206,8,3,240,206,8,3,253,206,8,3,
13,237,3,149,237,131,206,35,68,206,227,85,188,4,15,163,96,165,206,130,42,165,3,206,3,158,177,0,240,14,201,10,
240,11,206,3,162,242,230,1,208,238,96,24,165,3,105,32,144,2,230,2,41,224,166,2,142,6,32,133,237,98,76,46,
174,170,169,134,133,36,169,174,133,37,224,0,240,16,165,36,24,105,32,133,36,165,37,105,0,133,37,202,208,240,162,63,
237,34,162,0,180,129,160,0,162,32,177,36,141,7,32,153,0,6,200,202,208,244,96,13,39,55,2,13,23,39,18,13,
7,23,34,13,6,39,56,13,10,26,42,45,5,38,55,13,0,0,0,180,99,6,16,30,13,7,0,46,13,8,45,29,
206,19,24,22,38,3,13,6,22,4,13,7,6,5,206,19,24,32,50,48,13,40,42,55,13,22,40,39,206,19,24,40,
56,6,13,23,40,48,13,23,39,22,206,19,24,60,32,48,13,59,60,60,13,43,59,44,206,19,24,33,49,44,13,17,
33,28,13,1,17,12,206,11,24,44,60,48,237,220,16,30,13,45,0,47,13,11,206,21,184,19,35,22,13,3,19,39,
13,1,3,56,206,6,24,13,206,10,24,206,2,144,7,23,40,13,12,27,41,206,19,24,45,16,32,13,180,10,6,22,
54,13,10,42,58,13,0,206,5,16,2,39,32,13,8,39,55,13,17,33,49,13,7,22,40,13,28,60,237,8,0,16,
13,3,19,180,97,6,22,13,6,26,56,13,1,0,48,13,1,17,33,13,33,49,48,13,7,23,39,13,22,38,55,13,
18,60,48,206,3,104,16,16,16,13,22,40,57,13,45,16,48,13,29,1,17,13,29,40,23,237,188,25,48,48,206,5,
104,38,237,172,8,24,40,13,9,25,41,206,11,132,180,1,141,0,1,152,72,173,0,1,160,255,56,200,233,10,176,251,
105,10,237,74,10,180,1,13,0,1,237,3,104,168,237,21,96,206,196,36,206,100,72,142,237,37,32,174,0,1,189,0,
6,170,189,202,176,141,7,237,69,157,0,6,238,0,1,136,208,231,198,27,206,70,162,169,136,5,88,133,88,141,0,32,
96,45,29,1,2,5,6,29,6,9,29,9,12,29,13,13,13,0,188,3,39,79,6,7,8,9,10,11,12,46,14,14,
61,188,5,35,24,188,4,35,14,30,30,188,3,34,254,188,5,35,12,44,16,46,46,8,72,138,72,152,72,169,1,133,
82,165,83,73,1,133,83,162,1,142,22,64,202,180,97,134,16,134,17,134,18,134,19,134,20,134,21,160,5,188,4,3,
98,160,7,173,22,64,145,4,106,181,16,42,149,16,136,16,242,165,4,105,8,133,4,232,232,224,6,208,228,165,27,240,
16,165,81,208,10,32,140,176,169,4,133,81,76,103,177,198,81,165,89,201,1,208,25,165,80,240,2,198,80,165,90,240,
4,169,0,133,90,206,6,187,76,192,177,201,2,208,37,237,11,206,226,129,180,65,230,1,165,1,237,10,16,237,10,1,
230,0,165,0,201,64,208,237,105,0,237,33,169,64,169,137,141,0,32,133,88,206,7,248,206,194,9,104,168,104,170,104,
40,64,120,72,8,104,133,7,104,64,188,13,33,170,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,
180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,27,76,240,163,206,30,67,180,31,
180,29,180,3,76,232,206,31,248,180,30,180,29,206,36,244,255,136,68,187,206,30,72,180,31,180,29,0,0,170,85,34,
51,206,30,68,180,31,180,29,10,177,16,128,204,177,206,14,14,255,180,5,206,22,16,180,14,237,213,180,33,206,5,1,
10,180,1,11,251,0,255,7,180,3,255,0,247,251,247,47,223,255,1,255,14,6,14,222,254,254,254,0,208,224,210,225,
180,97,246,255,255,253,254,180,97,0,245,250,181,120,245,250,180,0,208,0,0,64,128,180,97,0,175,95,173,30,175,95,
45,11,0,0,2,1,180,97,0,11,7,75,135,180,97,111,255,255,191,127,180,97,0,0,7,31,63,114,64,144,2,180,
226,125,127,239,253,0,192,240,248,28,68,14,62,0,192,176,248,252,188,0,242,192,128,236,254,126,124,57,28,7,127,19,
1,1,3,6,3,0,30,138,20,0,80,0,112,192,224,116,234,252,172,248,128,206,60,16,180,31,180,30,180,29,180,4,
8,0,8,8,180,162,180,193,180,129,0,0,36,180,33,180,3,36,180,228,36,0,126,36,126,237,76,36,180,225,180,193,
8,0,40,28,10,237,104,30,180,225,60,237,90,100,8,16,0,70,0,0,98,180,225,38,0,0,48,0,72,48,74,0,
58,0,0,72,180,225,68,0,0,4,0,188,5,116,168,237,30,180,2,237,8,16,16,180,161,237,8,16,16,237,63,32,
206,3,113,32,0,0,16,180,225,237,27,8,0,28,62,28,180,161,0,42,180,225,42,237,177,62,206,3,145,8,180,225,
237,129,206,9,69,237,200,206,70,180,206,73,188,24,180,201,4,237,37,64,0,0,2,180,225,32,0,0,60,0,78,78,
78,180,161,180,194,237,1,0,12,0,60,28,28,0,28,0,0,28,180,225,180,193,237,24,12,24,0,126,237,88,12,24,
54,237,72,14,28,14,237,168,180,225,237,232,92,92,237,232,92,92,237,31,126,0,124,14,237,152,64,180,225,237,24,60,
237,1,206,4,88,180,225,237,8,126,0,14,12,24,206,2,129,78,180,225,180,193,60,0,78,60,237,216,180,225,237,168,
78,62,237,184,78,180,225,237,8,206,6,205,180,227,237,131,180,130,206,36,18,180,66,14,0,48,96,48,180,161,0,24,
180,225,206,3,216,126,180,33,180,232,112,0,12,6,12,180,161,0,24,180,225,206,3,104,2,12,16,206,34,124,66,180,
226,0,0,28,0,74,86,76,0,30,0,0,34,180,225,32,237,31,0,114,98,98,0,98,237,33,180,225,237,57,124,0,
98,124,102,180,161,0,102,180,225,237,79,0,96,96,96,180,161,0,102,180,225,102,237,88,50,50,50,237,88,180,193,237,
1,0,126,0,96,124,96,180,161,0,98,180,225,237,40,237,8,120,96,0,96,237,72,120,237,49,237,120,110,98,237,248,
110,98,237,24,98,0,98,126,206,3,104,98,180,225,206,3,88,24,24,24,237,88,180,193,237,1,0,30,0,12,12,12,
0,56,0,180,194,12,108,237,104,104,120,108,237,104,100,180,225,102,206,2,216,206,2,136,126,0,180,194,206,2,104,98,
0,126,106,206,3,72,118,180,225,237,136,122,110,102,237,72,114,180,225,206,3,88,98,237,15,60,237,17,180,2,206,3,
216,98,124,206,3,152,180,225,206,3,152,98,98,106,206,66,168,237,8,106,100,237,152,124,206,3,104,237,23,206,2,104,
60,0,96,60,6,206,4,184,60,6,237,8,126,206,3,168,24,206,7,168,98,206,13,88,237,8,52,52,237,88,98,180,
225,237,216,106,126,0,34,237,72,106,126,118,237,72,52,24,44,206,99,40,180,225,180,194,0,98,60,206,3,72,98,180,
225,180,193,126,0,4,24,48,206,35,72,180,225,206,3,184,32,32,32,180,161,180,194,237,1,237,2,153,161,161,0,66,
60,0,66,180,225,153,237,72,4,4,4,237,88,180,193,237,1,0,8,206,2,100,180,2,20,180,228,188,12,76,21,126,
206,98,114,180,4,206,162,103,180,4,4,60,206,2,248,0,60,4,60,68,237,168,98,66,0,92,237,1,92,98,66,98,
237,152,66,64,206,2,88,0,60,66,64,66,237,47,0,0,70,66,237,104,2,58,70,66,70,237,216,126,206,5,24,126,
237,53,12,0,0,124,206,67,104,18,16,124,16,206,100,158,70,70,0,2,237,25,58,70,70,237,47,206,4,88,66,206,
4,88,180,193,206,131,114,206,98,72,0,24,206,131,122,4,180,65,4,0,68,206,34,249,206,3,200,237,40,72,80,0,
206,2,145,68,72,80,104,206,99,203,237,232,237,38,206,133,8,73,73,0,73,180,193,118,73,237,1,180,2,206,4,88,
0,206,4,88,180,1,180,193,206,4,152,206,5,8,98,98,0,64,64,237,88,98,92,206,7,152,2,206,6,152,237,88,
64,206,35,46,92,98,237,94,180,1,64,60,206,66,232,0,62,64,60,237,30,16,180,65,16,206,2,222,206,2,215,18,
206,6,88,237,113,66,66,206,38,8,66,206,131,113,237,8,206,164,59,73,73,0,54,180,193,65,206,6,152,36,24,206,
3,152,66,36,24,237,216,237,47,206,34,24,237,55,206,4,120,4,206,131,120,0,126,4,24,32,206,98,232,0,32,16,
180,162,16,16,32,206,34,72,206,4,235,206,133,20,180,97,112,237,40,8,180,162,8,8,4,206,34,8,48,237,152,180,
1,73,6,206,6,2,51,188,3,0,235,255,180,226,255,0,7,39,46,102,112,112,243,99,72,200,192,128,128,128,0,0,
254,253,241,239,219,184,176,10,255,254,254,240,224,192,198,132,127,191,191,207,55,107,97,194,255,127,127,63,79,135,143,13,
206,226,236,254,245,203,51,180,226,255,254,244,192,255,252,243,174,16,242,38,130,255,255,252,240,224,0,0,24,127,159,199,
56,59,120,48,10,255,127,63,71,64,0,6,4,237,95,63,95,97,195,237,168,191,159,12,155,68,185,19,32,96,99,195,
255,187,2,0,64,134,140,12,255,207,195,191,185,185,237,40,255,255,195,195,193,135,237,104,102,241,63,211,99,255,255,247,
102,96,160,206,167,217,180,23,206,14,184,75,6,22,16,48,114,38,130,4,48,96,96,64,0,0,24,5,5,73,59,206,
2,136,2,50,50,64,206,2,136,136,154,206,4,120,48,33,206,4,120,0,0,131,70,60,242,33,103,255,255,124,185,195,
1,30,24,255,253,243,230,220,178,161,0,254,254,252,249,227,193,222,255,127,191,63,47,7,15,125,71,255,127,127,223,255,
243,3,128,206,3,239,246,225,188,4,1,8,253,222,180,97,242,161,5,15,124,71,255,254,252,240,248,240,0,128,255,63,
199,225,64,129,199,126,127,223,31,14,63,126,56,237,160,191,223,1,231,180,226,127,63,127,24,187,18,1,16,92,166,64,
74,223,100,252,239,3,0,184,16,255,207,199,195,139,155,249,142,255,255,251,191,245,229,2,1,255,255,247,124,122,51,174,
125,180,225,100,97,164,80,188,27,0,169,180,2,25,37,131,6,28,242,33,0,0,24,124,249,227,1,30,127,12,135,34,
33,206,2,136,240,120,28,192,206,2,136,192,63,198,206,3,136,63,128,0,206,3,136,232,192,0,163,136,194,1,231,7,
31,63,28,0,60,126,24,4,34,128,209,171,119,30,76,251,221,127,46,20,8,206,34,248,242,234,192,146,129,52,206,2,
200,224,204,158,139,127,191,191,79,247,235,249,153,255,127,63,63,15,23,3,206,3,200,254,244,202,76,180,226,255,255,245,
131,255,253,242,170,0,146,1,237,168,160,12,237,40,159,167,120,242,232,237,104,31,7,12,20,188,4,2,48,63,159,193,
100,237,167,127,63,27,223,206,2,104,114,26,76,187,206,2,104,12,4,0,255,207,211,187,161,147,237,56,255,207,195,131,
141,158,139,206,34,240,240,171,237,56,180,225,108,52,206,27,243,180,3,68,206,2,72,112,26,76,8,28,127,46,20,15,
5,3,24,235,86,58,32,146,1,52,7,206,130,209,12,158,139,34,128,178,121,206,2,136,129,206,226,0,20,0,0,139,
110,85,19,137,133,194,100,4,1,34,96,112,120,60,26,64,192,225,112,20,24,147,195,62,60,28,12,206,66,102,255,255,
240,241,252,242,193,147,254,252,252,236,192,128,128,237,8,255,63,63,215,147,227,206,2,247,7,35,97,28,206,3,248,254,
247,206,67,200,254,244,192,237,24,248,252,186,49,9,156,255,252,240,160,4,14,54,2,127,63,103,243,252,240,65,3,127,
223,159,12,206,2,152,237,96,127,223,151,225,180,226,63,63,237,56,6,99,243,253,240,65,19,155,217,156,237,216,239,227,
243,255,241,193,3,255,223,223,143,129,129,237,104,247,102,115,241,144,224,180,225,103,96,32,96,206,162,1,180,27,66,206,
3,184,19,3,48,56,206,4,184,212,104,48,140,26,49,9,156,40,16,0,0,206,2,136,1,5,96,240,206,2,136,0,
216,206,4,104,143,198,193,2,51,209,144,224,237,3,1,0,32,96,28,228,172,242,173,194,97,148,130,0,83,13,82,53,
158,106,53,254,252,240,225,202,129,213,242,206,99,223,254,170,5,127,63,127,95,191,111,147,101,255,255,191,175,71,131,69,
16,206,4,240,205,125,206,36,248,242,128,255,252,240,161,2,45,85,138,237,79,253,210,170,84,127,63,95,108,191,111,189,
250,255,223,167,147,64,144,64,206,69,248,165,82,206,37,247,5,155,54,29,6,142,91,205,166,255,201,226,249,113,164,18,
206,66,248,139,191,175,253,90,255,255,251,247,193,209,0,128,255,255,247,238,244,108,176,193,180,225,102,97,33,3,14,206,
27,245,180,1,228,208,160,1,130,1,5,2,0,3,15,30,61,62,122,125,11,55,95,127,190,126,253,252,116,200,160,128,
64,128,0,0,5,11,5,11,63,47,253,122,122,244,250,244,192,208,0,128,189,122,244,232,144,64,32,129,237,84,1,1,
3,14,227,57,86,170,85,234,118,220,28,198,129,206,34,11,35,254,253,250,242,245,238,213,43,255,254,253,252,248,240,224,
192,127,159,15,231,127,179,113,242,255,127,255,31,7,15,15,206,132,248,248,133,43,206,132,248,248,128,255,250,229,143,124,
177,115,243,255,253,248,240,131,14,12,12,255,175,115,0,30,107,213,170,255,95,143,255,225,128,206,69,248,207,241,220,237,
168,63,15,35,240,1,85,254,215,109,85,170,255,254,170,0,32,18,206,66,88,211,237,0,253,49,237,56,231,239,147,131,
206,0,140,12,237,30,102,126,237,120,255,247,255,225,160,206,27,243,180,3,85,171,126,2,117,254,213,171,0,0,129,252,
136,237,8,182,186,21,239,206,2,136,65,64,224,16,3,14,12,12,87,171,126,206,3,136,237,24,206,3,136,227,57,86,
43,85,235,246,206,2,232,128,128,0,1,35,210,129,1,153,25,1,129,1,255,254,254,246,230,254,254,254,0,254,254,186,
152,212,234,230,255,255,255,187,187,215,239,239,0,255,255,193,221,221,190,221,237,8,255,227,227,193,227,0,255,192,160,180,
2,237,7,192,180,2,188,7,5,242,188,6,6,43,255,7,11,11,11,10,11,237,8,188,3,5,250,1,255,255,223,175,
119,251,119,254,180,1,222,142,6,142,237,33,163,209,224,204,200,237,24,131,161,153,153,129,237,8,239,199,231,231,206,162,
24,143,175,207,207,207,237,8,227,209,160,158,193,237,8,195,161,157,131,193,206,35,57,207,167,71,180,194,255,143,79,63,
0,255,128,206,13,120,1,5,180,2,237,8,3,180,2,237,40,211,169,160,200,248,237,120,145,153,249,243,1,180,5,206,
2,120,180,2,230,230,246,180,161,186,152,239,239,237,26,255,187,187,235,247,255,255,0,255,247,232,180,195,255,255,247,160,
160,160,192,32,180,130,192,192,0,180,97,192,11,11,11,7,8,11,11,10,7,7,7,0,180,97,7,119,7,255,255,1,
255,223,47,142,206,35,35,254,222,192,129,143,207,237,48,194,131,159,159,206,195,10,231,199,199,206,2,196,90,207,207,237,
79,255,165,228,138,196,206,99,244,185,133,206,131,43,0,31,59,132,196,237,65,63,13,137,237,136,206,3,197,128,206,5,
197,237,8,206,3,197,1,206,5,197,237,8,1,1,1,25,25,1,1,91,254,206,36,152,164,206,5,104,90,206,5,104,
165,241,225,237,111,255,79,231,193,129,237,72,191,212,234,214,170,152,220,254,255,215,239,215,187,187,237,56,222,190,222,232,
247,255,0,255,225,193,225,247,206,7,104,191,0,206,4,104,192,188,15,7,223,0,254,254,206,13,9,188,5,2,41,64,
224,206,5,1,0,60,60,188,3,5,223,0,188,5,4,95,180,31,180,29,180,13,56,0,198,198,198,180,161,0,76,180,
225,100,0,0,24,188,3,3,200,126,237,17,188,4,3,200,124,0,14,60,120,0,254,0,0,198,180,225,224,206,2,237,
24,60,6,237,14,0,12,180,225,198,0,0,28,0,108,204,254,0,12,0,0,60,180,225,180,193,252,0,252,6,237,152,
192,180,225,237,24,60,237,1,198,237,72,96,180,225,237,8,237,36,24,48,0,48,0,0,198,180,225,180,193,120,0,228,
120,134,237,88,196,180,225,134,206,2,104,198,126,6,237,14,0,198,180,225,12,206,4,152,254,0,237,49,108,180,225,180,
193,252,0,198,252,198,180,161,237,15,206,3,72,60,206,66,158,180,161,0,102,180,225,102,0,0,248,206,3,200,248,0,
0,204,180,225,204,206,2,104,192,252,192,180,161,237,31,252,237,33,206,5,8,237,1,206,5,8,0,4,10,7,48,117,
21,0,0,3,7,127,127,31,10,0,0,16,128,224,0,84,88,0,0,240,0,248,252,248,160,0,16,32,12,91,123,47,
144,29,180,225,95,119,55,62,124,20,231,25,125,213,18,98,96,20,255,255,11,171,109,254,254,28,105,42,16,222,12,42,
4,43,55,52,63,122,58,30,10,64,2,8,4,32,0,4,0,64,0,8,4,0,32,188,3,7,210,21,71,10,158,3,
180,225,53,77,180,225,16,0,0,34,160,208,24,64,16,16,180,225,240,156,64,74,0,136,25,12,4,13,7,74,5,172,
25,15,19,10,5,4,114,0,52,0,224,96,176,20,118,168,228,100,232,240,240,0,1,0,8,16,132,0,0,0,1,66,
40,180,225,1,0,2,33,237,5,32,0,0,26,36,64,180,227,180,29,180,14,52,90,126,62,90,52,0,0,8,60,60,
124,60,8,0,52,94,189,127,254,189,90,60,8,60,126,254,127,126,60,0,40,180,226,254,62,16,20,126,255,127,254,127,
124,44,8,60,110,194,71,230,60,32,52,126,247,103,226,127,126,28,52,82,165,65,128,165,66,44,0,44,66,2,66,66,
60,0,52,66,129,129,128,129,237,1,180,5,36,2,128,1,128,1,66,40,206,29,143,180,31,180,31,180,31,180,31,180,
31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,31,180,
31,180,31,180,31,180,31,180,30,180,27,180,1
]
var NES_DEFAULT_ROM = new lzgmini().decode(NES_DEFAULT_ROM_LZG).slice(0, 0xa000);
var NES_CONIO_ROM_LZG = [
76,90,71,0,0,160,16,0,0,11,158,107,131,223,83,1,9,17,21,22,78,69,83,26,2,1,3,0,22,6,120,216,
162,0,134,112,134,114,134,113,134,115,154,169,32,157,0,2,157,0,3,157,0,4,232,208,244,32,134,130,32,85,129,169,
0,162,8,133,2,134,3,32,93,128,32,50,129,32,73,129,76,0,128,72,152,72,138,72,169,1,133,112,230,107,208,2,
230,108,32,232,129,169,32,141,6,32,169,0,22,129,141,5,22,66,104,170,104,168,104,64,160,0,240,7,169,105,162,128,
76,4,96,96,162,0,21,23,0,32,22,195,1,22,194,63,21,37,21,134,22,197,41,21,27,173,41,96,201,4,32,169,
129,240,3,76,158,128,76,188,128,169,184,162,130,24,109,41,96,144,1,232,160,0,32,130,129,141,7,21,36,238,41,96,
21,32,76,140,128,21,47,33,21,246,201,17,14,61,15,21,253,227,128,76,1,129,169,169,17,24,61,209,21,125,17,2,
180,17,10,130,5,22,201,128,17,4,172,30,141,1,32,76,46,129,22,65,96,173,0,96,174,1,96,32,112,130,173,2,
96,174,3,21,65,160,4,76,105,128,17,3,228,188,162,130,17,2,228,169,188,133,10,169,130,133,11,169,0,133,12,169,
96,133,13,162,214,169,255,133,18,160,0,232,240,13,177,10,145,12,200,208,246,230,11,230,13,208,240,230,18,208,239,96,
133,10,134,11,162,0,177,10,96,208,42,162,0,138,96,240,36,22,163,30,48,28,22,227,2,16,20,22,227,14,144,12,
21,200,176,4,22,226,162,0,169,1,96,165,115,208,252,96,169,255,197,115,240,252,96,133,118,132,116,134,117,32,193,129,
164,113,165,116,153,0,2,165,117,153,0,3,165,118,153,0,4,200,132,113,230,115,96,164,115,208,1,96,166,114,169,14,
141,42,96,189,0,2,141,6,32,189,0,3,22,163,4,141,7,32,232,136,240,93,17,19,14,71,17,19,14,49,17,19,
14,27,17,19,14,5,206,42,96,208,141,134,114,132,115,96,169,0,162,0,72,165,2,56,233,2,133,2,176,2,198,3,
160,1,138,145,2,104,136,145,2,96,169,41,133,10,169,96,17,34,41,168,162,0,240,10,145,10,200,208,251,230,11,202,
208,246,192,2,240,5,21,70,247,96,78,111,32,99,97,114,116,32,108,111,97,100,101,100,0,1,0,16,32,17,66,184,
141,18,96,142,19,96,141,25,96,142,26,96,136,185,255,255,141,35,22,196,34,96,140,37,96,32,255,255,160,255,208,232,
96,17,71,230,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,10,53,128,0,128,92,128,
17,14,14,204,204,51,51,22,106,0,24,60,126,24,22,1,22,231,16,48,127,127,48,16,0,22,230,12,18,48,124,48,
98,252,22,231,0,0,3,62,118,54,54,22,231,127,127,17,4,80,22,230,224,224,96,22,3,22,230,24,24,24,248,248,
21,16,22,230,204,153,51,102,22,106,51,153,204,22,107,21,27,255,255,17,4,67,22,227,3,22,13,17,6,188,22,230,
17,2,172,22,13,31,31,22,236,255,255,22,236,31,31,17,4,136,22,227,22,1,248,248,21,5,22,233,17,14,123,17,
3,64,22,230,17,3,64,21,248,17,8,29,21,216,17,6,88,17,3,64,22,230,240,22,13,21,233,21,243,22,230,17,
6,16,22,226,192,192,48,48,22,106,15,22,1,21,84,22,230,17,10,4,22,226,17,10,52,22,230,17,6,16,17,10,
44,22,6,17,35,220,0,24,22,231,102,102,17,34,107,0,22,233,255,22,33,102,22,231,24,62,96,60,6,124,21,40,
22,229,0,102,12,24,48,102,70,22,231,60,102,60,56,103,102,63,22,231,6,12,17,36,59,22,230,21,30,48,48,24,
12,22,231,22,97,12,21,4,22,231,0,102,60,255,60,17,2,115,22,230,24,24,126,17,35,70,22,230,17,4,173,21,
33,22,231,126,21,205,22,231,21,80,22,232,3,6,12,24,48,96,22,231,60,102,110,118,102,102,60,22,231,24,24,56,
24,24,24,126,22,231,60,102,6,12,48,96,22,235,28,6,21,168,22,228,6,14,30,102,127,6,6,22,231,126,96,124,
6,21,80,22,230,60,102,96,124,17,4,88,22,228,126,102,12,17,35,83,22,230,60,21,13,21,216,22,231,62,21,240,
22,228,17,34,124,22,66,22,236,17,2,224,22,228,14,24,48,96,48,24,14,0,22,230,17,2,239,17,4,241,22,228,
112,24,12,6,12,24,112,22,231,17,2,192,24,21,52,22,232,110,110,96,98,17,3,248,22,227,24,60,102,126,17,34,
228,22,230,124,102,102,22,66,22,231,60,102,96,96,96,17,4,200,22,227,120,108,21,30,108,120,22,231,126,96,96,120,
96,96,126,22,237,96,22,231,21,48,110,17,37,8,22,227,21,46,17,3,96,22,230,60,17,99,19,21,24,22,229,30,
12,22,1,108,56,22,231,102,108,120,112,120,108,21,40,22,229,17,132,62,126,22,231,99,119,127,107,99,99,99,22,231,
102,118,126,126,110,17,2,88,22,229,60,102,22,2,17,35,88,22,227,17,2,205,21,49,22,231,21,144,60,14,22,231,
21,80,17,2,96,22,230,60,102,96,60,17,37,208,22,227,17,163,13,17,34,200,22,229,21,111,17,5,208,22,232,60,
17,5,16,22,225,99,99,99,107,127,119,99,22,231,21,77,60,17,3,248,22,230,21,1,17,4,64,22,227,126,17,67,
159,126,22,231,60,48,22,2,60,22,231,96,48,24,12,6,3,0,22,231,60,17,34,32,12,21,24,22,229,17,34,193,
17,68,244,22,229,22,3,17,165,133,22,225,17,134,203,22,230,21,58,6,62,102,62,22,232,96,17,66,176,124,22,232,
0,60,96,96,96,17,66,144,22,229,6,21,31,21,96,22,230,0,60,102,126,21,216,22,228,14,24,62,17,3,84,22,
230,0,21,95,6,124,22,231,17,3,80,102,17,5,88,22,225,24,0,56,17,34,240,22,231,6,0,6,22,1,60,22,
231,96,96,108,17,34,128,22,231,21,30,21,160,22,230,0,102,127,127,107,99,22,233,17,2,79,21,32,22,231,17,34,
210,17,4,152,22,228,17,36,242,22,232,17,3,144,6,22,232,124,17,66,226,21,160,22,228,17,131,225,22,232,17,130,
127,17,98,112,22,230,17,35,226,17,34,0,22,233,60,17,2,240,22,230,99,107,127,62,17,226,24,22,230,17,35,241,
22,234,21,47,12,120,22,232,126,12,24,48,17,98,194,22,228,28,48,24,112,24,48,28,22,231,17,164,159,22,3,22,
227,56,12,24,14,24,12,56,0,22,230,51,255,204,17,35,206,22,230,22,14,17,194,92,22,10,17,236,246,204,204,255,
231,195,129,231,22,1,22,231,239,207,128,128,207,239,255,22,230,243,237,207,131,207,157,3,22,231,255,255,252,193,137,201,
201,22,231,128,128,17,4,80,22,230,31,31,159,22,3,22,230,231,231,231,7,7,21,16,22,230,17,236,246,204,17,237,
246,51,153,17,227,11,17,4,67,22,227,252,22,13,17,6,188,22,230,17,2,172,22,13,224,224,22,236,0,0,22,236,
224,224,17,4,136,22,227,22,1,7,7,21,5,22,233,17,14,123,17,3,64,22,230,17,3,64,21,248,17,8,29,21,
216,17,6,88,17,3,64,22,230,17,226,124,22,10,17,238,244,22,226,17,6,16,22,226,63,63,207,207,22,106,17,226,
192,21,84,22,230,17,10,4,17,230,220,17,14,60,17,234,252,17,6,44,22,6,17,35,220,255,231,22,231,153,153,17,
34,107,255,22,233,0,22,33,153,22,231,231,193,159,195,249,131,21,40,22,229,255,153,243,231,207,153,185,22,231,195,153,
195,199,152,153,192,22,231,249,243,17,36,59,22,230,21,30,207,207,231,243,22,231,22,97,243,21,4,22,231,255,153,195,
0,195,17,2,115,22,230,231,231,129,17,35,70,22,230,17,4,173,21,33,22,231,129,21,205,22,231,21,80,22,232,252,
249,243,231,207,159,22,231,195,153,145,137,153,153,195,22,231,231,231,199,231,231,231,129,22,231,195,153,249,243,207,159,22,
235,227,249,21,168,22,228,249,241,225,153,128,249,249,22,231,129,159,131,249,21,80,22,230,195,153,159,131,17,4,88,22,
228,129,153,243,17,35,83,22,230,195,21,13,21,216,22,231,193,21,240,22,228,17,34,124,22,66,22,236,17,2,224,22,
228,241,231,207,159,207,231,241,255,22,230,17,2,239,17,4,241,22,228,143,231,243,249,243,231,143,22,231,17,2,192,231,
21,52,22,232,145,145,159,157,17,3,248,22,227,231,195,153,129,17,34,228,22,230,131,153,153,22,66,22,231,195,153,159,
159,159,17,4,200,22,227,135,147,21,30,147,135,22,231,129,159,159,135,159,159,129,22,237,159,22,231,21,48,145,17,37,
8,22,227,21,46,17,3,96,22,230,195,17,99,19,21,24,22,229,225,243,22,1,147,199,22,231,153,147,135,143,135,147,
21,40,22,229,17,132,62,129,22,231,156,136,128,148,156,156,156,22,231,153,137,129,129,145,17,2,88,22,229,195,153,22,
2,17,35,88,22,227,17,2,205,21,49,22,231,21,144,195,241,22,231,21,80,17,2,96,22,230,195,153,159,195,17,37,
208,22,227,17,163,13,17,34,200,22,229,21,111,17,5,208,22,232,195,17,5,16,22,225,156,156,156,148,128,136,156,22,
231,21,77,195,17,3,248,22,230,21,1,17,4,64,22,227,129,17,67,159,129,22,231,195,207,22,2,195,22,231,159,207,
231,243,249,252,255,22,231,195,17,34,32,243,21,24,22,229,17,34,193,17,68,244,22,229,22,3,17,165,133,22,225,17,
134,203,22,230,21,58,249,193,153,193,22,232,159,17,66,176,131,22,232,255,195,159,159,159,17,66,144,22,229,249,21,31,
21,96,22,230,255,195,153,129,21,216,22,228,241,231,193,17,3,84,22,230,255,21,95,249,131,22,231,17,3,80,153,17,
5,88,22,225,231,255,199,17,34,240,22,231,249,255,249,22,1,195,22,231,159,159,147,17,34,128,22,231,21,30,21,160,
22,230,255,153,128,128,148,156,22,233,17,2,79,21,32,22,231,17,34,210,17,4,152,22,228,17,36,242,22,232,17,3,
144,249,22,232,131,17,66,226,21,160,22,228,17,131,225,22,232,17,130,127,17,98,112,22,230,17,35,226,17,34,0,22,
233,195,17,2,240,22,230,156,148,128,193,17,226,24,22,230,17,35,241,22,234,21,47,243,135,22,232,129,243,231,207,17,
98,194,22,228,227,207,231,143,231,207,227,22,231,17,164,159,22,3,22,227,199,243,231,241,231,243,199,255,22,230,204,0,
51,17,35,206,22,230,22,14,9,19,0,13,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,22,31,
22,31,22,31,22,31,22,31,22,31,22,30,22,28
];
var NES_NESLIB_ROM_LZG = [
76,90,71,0,0,160,16,0,0,13,157,107,195,144,97,1,47,75,80,90,78,69,83,26,2,0,1,0,90,6,120,162,
255,154,232,142,1,32,142,16,64,142,0,32,44,2,90,66,16,251,160,63,140,6,32,142,6,32,169,15,162,32,141,7,
32,202,208,250,138,160,32,80,11,141,6,32,160,16,80,9,232,208,250,136,208,247,138,149,0,157,0,1,157,0,2,157,
0,3,157,0,4,157,0,5,157,0,6,157,0,7,232,208,230,169,4,32,77,130,32,62,130,32,182,130,32,74,141,32,
153,140,169,0,133,40,169,8,133,41,32,214,139,75,6,93,169,128,133,19,141,0,32,169,6,133,20,165,0,197,0,240,
252,162,52,160,24,202,208,253,136,208,250,173,2,32,41,128,133,2,32,109,130,165,2,32,218,135,169,253,133,26,133,27,
169,0,141,5,32,90,65,76,48,140,72,138,72,152,72,165,3,208,3,76,213,129,162,0,142,3,32,169,2,141,20,64,
165,28,80,9,186,129,169,63,133,28,141,75,3,183,172,192,1,177,24,141,7,32,172,193,90,229,194,90,229,195,90,228,
173,80,3,197,80,195,172,198,90,229,199,75,8,19,201,80,195,172,202,90,229,203,75,8,19,205,80,195,172,206,90,229,
207,75,8,19,209,80,195,172,210,90,229,211,75,8,19,213,80,195,172,214,90,229,215,75,8,19,217,80,195,172,218,90,
229,219,75,8,19,221,80,195,172,222,90,229,223,90,228,166,23,240,23,160,0,177,21,200,141,6,32,90,168,75,34,165,
235,142,75,3,246,165,17,141,5,32,165,18,90,130,75,34,96,230,0,230,1,165,1,201,6,208,4,169,0,133,1,32,
198,136,104,168,104,170,104,64,133,29,134,30,162,0,169,32,133,31,160,0,177,29,157,192,1,232,200,198,31,208,245,230,
28,96,75,5,18,16,208,228,80,130,16,138,208,219,133,29,32,3,141,41,31,170,165,80,97,80,27,169,15,162,0,80,
107,224,32,208,248,134,28,96,10,90,1,133,24,6,24,38,25,90,98,165,24,24,105,154,133,24,165,25,41,3,105,133,
133,25,80,39,165,20,41,24,240,3,32,85,131,80,1,231,133,20,141,1,32,169,0,141,0,32,80,16,9,24,80,199,
128,80,7,80,24,80,15,75,67,101,75,3,177,80,87,8,208,223,90,161,16,208,217,80,159,96,162,0,169,255,157,0,
2,232,90,1,208,247,75,3,111,10,41,32,133,29,165,19,41,223,5,29,133,19,96,170,160,0,177,40,200,157,2,2,
90,162,1,90,163,0,90,161,157,3,2,165,40,24,105,4,133,40,144,2,230,41,138,80,2,75,3,221,160,80,19,136,
133,34,90,130,35,177,40,170,177,29,201,128,240,35,200,24,101,34,80,40,177,29,80,1,35,80,118,29,75,3,66,90,
161,2,75,3,112,76,19,131,165,40,105,2,75,5,67,96,170,169,240,75,8,137,169,1,133,3,75,68,203,165,2,240,
6,165,1,201,5,240,250,169,0,133,3,96,142,75,3,206,32,214,140,168,134,30,80,9,29,177,29,133,31,200,208,2,
230,30,177,29,90,195,197,31,240,7,141,7,32,133,32,208,238,177,29,240,16,80,140,170,165,75,101,123,240,218,96,133,
29,138,208,14,165,29,201,240,176,8,133,18,80,121,240,11,56,165,29,233,240,80,5,2,133,29,32,214,140,133,17,138,
41,1,5,29,75,35,3,252,75,35,3,41,1,75,34,141,80,72,247,75,8,8,80,201,239,80,137,75,2,250,80,50,
75,4,147,173,7,75,2,150,133,31,134,32,160,0,80,4,145,31,230,31,208,2,230,32,165,29,208,2,198,30,198,29,
165,29,5,30,208,231,75,12,43,75,7,40,177,31,141,7,32,75,19,40,134,29,170,164,29,76,71,136,96,0,15,30,
45,168,162,0,169,1,141,22,64,169,0,90,130,8,133,29,185,22,64,74,118,80,37,208,246,232,224,3,208,227,165,75,
2,254,6,197,32,240,2,165,31,153,4,0,170,89,6,0,57,4,0,153,8,0,138,153,6,0,96,72,32,114,132,104,
170,181,8,96,170,181,4,96,165,26,10,144,2,73,207,133,26,96,165,27,80,66,215,133,27,96,32,189,132,32,199,132,
101,26,80,65,170,80,2,96,133,26,134,27,96,133,21,134,22,32,3,141,133,23,75,37,123,96,141,7,32,96,75,2,
175,80,13,166,32,240,12,162,0,75,36,92,198,32,208,246,166,31,240,6,80,198,96,240,2,169,4,75,35,35,251,75,
34,35,75,66,132,80,172,214,140,133,36,134,37,90,194,38,134,39,162,0,165,80,57,32,88,133,198,32,230,37,230,39,
76,68,133,80,57,10,160,0,177,36,145,38,200,202,208,248,75,6,95,75,36,152,75,6,41,10,32,135,80,105,39,76,
117,75,5,39,165,29,80,167,250,96,170,32,85,131,90,226,15,90,30,90,28,90,2,0,1,2,3,4,5,6,7,8,
9,10,11,12,15,14,75,29,40,15,16,17,18,19,20,21,22,23,24,25,26,27,28,31,30,75,29,40,15,32,33,34,
35,36,37,38,39,40,41,42,43,44,45,46,75,29,40,15,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,75,
14,40,45,75,13,40,45,75,13,40,45,48,90,12,75,14,40,0,75,13,40,0,75,13,40,75,16,8,75,12,40,16,
75,13,24,75,29,8,90,29,48,201,0,240,2,169,255,141,111,1,169,15,141,21,64,169,129,141,8,64,169,1,141,15,
64,169,48,141,0,64,141,4,64,141,12,64,169,8,141,1,64,141,5,64,80,31,4,1,141,5,1,162,6,160,5,169,
0,157,4,1,157,5,1,75,226,210,8,1,157,2,1,169,63,157,1,1,169,48,157,3,1,138,24,105,9,170,136,208,
221,140,51,1,140,66,1,140,81,1,140,96,1,140,108,1,140,1,1,96,169,0,141,1,1,134,10,132,11,168,174,111,
1,48,3,141,111,1,162,6,169,5,133,12,177,10,157,4,1,200,90,161,5,1,200,169,47,3,0,38,75,18,76,198,
12,208,214,177,10,200,141,2,1,90,162,3,90,161,72,169,4,133,16,169,51,72,170,169,0,32,55,138,104,105,15,198,
16,208,242,104,141,1,1,141,0,1,96,170,173,1,1,224,0,240,4,9,128,208,2,41,127,80,13,96,165,10,72,165,
11,72,75,2,115,10,232,224,5,208,2,162,0,142,111,1,80,30,240,95,48,93,173,0,1,240,4,48,2,208,64,169,
6,133,14,169,51,133,15,75,2,83,160,0,166,14,32,119,138,176,15,166,14,189,2,1,166,15,32,55,138,166,14,157,
3,1,165,14,24,105,9,133,14,165,15,24,105,15,133,75,2,109,216,80,55,24,109,75,3,112,169,11,133,12,162,51,
138,72,32,28,139,104,24,105,5,75,2,174,242,173,1,1,16,19,75,42,74,128,141,8,64,76,48,138,173,7,1,201,
63,208,5,169,0,76,139,137,24,109,56,1,10,170,173,61,1,72,125,86,139,141,2,64,104,9,127,48,2,169,0,125,
87,139,205,4,1,240,6,75,34,115,3,64,173,51,1,13,9,1,141,0,64,173,16,75,6,50,197,80,50,71,80,114,
76,80,242,6,75,10,50,5,80,114,5,1,141,7,64,173,66,1,13,18,1,141,4,64,173,25,75,6,50,247,80,50,
86,80,114,91,80,242,10,75,9,50,141,11,64,173,81,1,9,75,2,160,173,34,75,6,41,32,138,24,109,101,1,41,
15,73,15,133,10,173,36,1,10,41,128,5,10,141,14,64,173,96,1,9,240,141,12,64,206,0,1,173,111,1,208,3,
90,225,104,133,11,104,133,10,75,226,107,24,109,2,1,133,10,169,0,109,3,1,133,11,169,3,224,96,208,2,169,2,
133,12,160,0,24,177,10,157,2,75,35,237,3,75,35,237,1,1,157,4,1,138,75,36,41,228,160,6,177,10,160,0,
96,189,8,1,240,18,222,8,1,208,13,189,6,80,62,189,7,80,60,76,162,138,189,0,1,240,5,222,0,1,56,96,
189,4,80,79,5,80,15,177,10,230,10,208,2,230,11,201,64,176,14,157,1,1,165,75,66,74,165,11,157,5,1,96,
201,192,176,20,201,128,144,8,41,63,157,0,1,76,177,138,90,225,2,1,80,62,201,255,208,39,24,165,10,105,3,157,
6,80,34,105,0,157,7,1,177,10,157,8,75,2,139,133,12,90,130,11,165,12,133,10,160,0,80,99,254,208,17,75,
5,14,136,80,207,80,13,41,63,141,1,75,2,64,189,1,1,240,4,222,1,1,96,189,75,2,226,189,75,2,224,188,
4,75,66,155,9,0,16,11,24,105,64,157,0,1,152,157,4,1,96,201,127,240,8,157,1,80,196,177,10,168,76,50,
139,173,6,77,6,242,5,157,5,76,5,0,5,184,4,116,4,52,4,247,3,190,3,136,3,86,3,38,3,248,2,206,
2,165,2,127,2,91,2,57,2,25,2,251,1,222,1,195,1,170,1,146,1,123,1,102,1,82,1,63,1,45,1,28,
1,12,1,253,0,238,0,225,0,212,0,200,0,189,0,178,0,168,0,159,0,150,0,141,0,133,0,126,0,118,0,112,
0,105,0,99,0,94,0,88,0,83,0,79,0,74,0,70,0,66,0,62,0,58,0,55,47,7,3,206,160,0,240,7,
169,226,162,139,76,0,3,96,32,41,141,160,3,32,252,140,32,241,132,76,41,140,160,1,80,3,160,0,32,241,140,32,
131,140,208,3,76,5,140,76,44,80,205,133,44,134,45,32,207,80,84,65,141,165,44,166,45,80,157,160,32,32,198,140,
162,0,32,248,132,76,240,139,32,236,140,96,169,109,162,141,32,41,141,162,0,169,0,90,194,4,90,193,53,132,90,129,
19,141,169,1,32,46,130,90,129,80,2,48,80,2,162,33,169,233,80,26,80,40,145,32,226,139,32,133,130,76,109,140,
90,65,96,200,72,24,152,101,40,47,4,1,47,104,96,224,0,208,6,170,208,3,169,1,96,162,0,138,96,75,3,175,
124,162,145,75,2,175,169,124,133,48,169,145,133,49,169,0,133,50,169,3,133,51,162,218,169,255,133,56,160,0,232,240,
13,177,48,145,50,200,208,246,230,49,230,51,208,240,230,56,208,239,96,132,56,56,229,56,176,1,202,96,24,105,1,144,
1,232,96,160,1,177,40,170,136,177,40,230,40,240,5,90,97,3,96,230,40,230,41,96,160,4,76,114,140,133,48,134,
49,162,0,177,48,75,7,28,96,160,0,80,161,1,96,80,91,80,4,164,40,240,7,198,40,160,0,145,40,96,198,41,
198,40,90,193,169,0,162,0,72,165,40,56,233,2,133,40,176,2,198,41,160,1,138,145,40,104,136,80,18,80,94,200,
72,80,70,96,169,37,133,48,169,3,75,2,169,168,162,0,240,10,145,48,200,208,251,230,49,202,208,246,192,0,240,5,
80,70,247,96,75,39,152,90,5,56,124,124,124,56,0,56,75,7,8,108,108,72,75,12,25,108,254,90,33,75,8,7,
16,254,208,254,22,254,16,75,8,9,206,220,56,118,230,75,10,73,108,124,236,238,126,75,8,7,56,48,75,12,104,112,
90,2,75,8,104,112,56,90,2,75,10,28,108,56,75,9,103,80,121,254,56,75,8,39,90,4,48,48,75,11,192,124,
75,13,23,0,0,96,75,8,24,14,30,60,120,240,224,75,9,37,238,90,1,75,9,42,56,120,56,56,56,75,9,8,
124,14,124,224,238,254,75,8,8,252,14,60,14,14,252,75,8,8,62,126,238,238,254,14,75,9,24,224,252,14,75,10,
72,124,224,252,75,11,88,254,238,28,28,75,10,185,124,238,124,75,11,24,80,6,126,14,60,75,8,8,75,2,179,75,
9,183,75,5,8,192,75,7,8,28,56,112,112,56,28,75,8,24,75,2,246,75,10,249,80,21,80,27,75,10,88,28,
75,42,216,75,3,248,224,75,12,120,238,254,238,75,8,8,252,238,252,238,238,75,9,232,124,238,224,224,75,10,168,248,
236,80,41,75,9,24,254,224,240,224,224,75,41,40,254,224,248,224,224,75,42,104,224,80,40,75,72,8,0,75,2,102,
238,75,9,104,124,75,34,248,75,9,88,14,90,1,75,10,104,238,252,75,2,106,75,8,8,224,90,1,75,42,152,198,
238,254,254,75,10,24,206,80,72,75,73,137,75,46,232,252,80,7,252,75,77,8,236,75,9,152,80,152,75,10,152,224,
124,75,11,136,254,75,67,169,75,8,8,80,39,75,11,88,80,6,108,56,75,105,24,238,75,2,136,198,75,9,8,124,
56,124,75,10,168,80,118,75,10,72,254,28,56,112,75,42,72,90,30,90,5,78,79,32,67,65,82,84,32,76,79,65,
68,69,68,0,141,14,3,142,15,3,141,21,3,142,22,3,136,185,255,255,141,31,90,196,30,3,140,33,3,32,255,255,
160,255,208,232,75,143,44,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
30,0,182,128,0,128,0,130,75,30,70,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,31,90,
31,90,31,90,31,90,31,90,31,90,29,90,6,
];

File diff suppressed because one or more lines are too long

View File

@ -125,7 +125,6 @@ Module['FS_createPath']('/target', 'nes', true, true);
Module['FS_createPath']('/target/nes', 'drv', true, true);
Module['FS_createPath']('/target/nes/drv', 'tgi', true, true);
Module['FS_createPath']('/target/nes/drv', 'joy', true, true);
Module['FS_createPath']('/', 'neslib', true, true);
function DataRequest(start, end, crunched, audio) {
this.start = start;

File diff suppressed because one or more lines are too long

View File

@ -66,10 +66,20 @@ var PLATFORM_PARAMS = {
stack_end: 0x8000,
extra_preproc_args: ['-I', '/share/include/coleco'],
extra_link_args: ['-k', '/share/lib/coleco',
'-l', 'libcv', '-l', 'libcvu',
'/share/lib/coleco/crt0.rel',
'-l', 'libcv', '-l', 'libcvu', '/share/lib/coleco/crt0.rel',
//'-l', 'comp.lib', '-l', 'cvlib.lib', '-l', 'getput.lib', '/share/lib/coleco/crtcv.rel',
'main.rel'],
},
'nes-conio': {
define: '__NES__',
cfgfile: 'nes.cfg',
libargs: ['nes.lib'],
},
'nes-lib': {
define: '__NES__',
cfgfile: 'neslib.cfg',
libargs: ['neslib.lib', 'nes.lib'],
},
};
var loaded = {}
@ -486,6 +496,8 @@ function parseCA65Listing(code, mapfile) {
}
function assemblelinkCA65(code, platform, warnings) {
var params = PLATFORM_PARAMS[platform];
if (!params) throw Error("Platform not supported: " + platform);
var errors = "";
function error_fn(s) {
errors += s + "\n";
@ -517,11 +529,11 @@ function assemblelinkCA65(code, platform, warnings) {
var cfgfile = '/' + platform + '.cfg';
setupFS(FS, '65');
FS.writeFile("main.o", objout, {encoding:'binary'});
var libargs = params.libargs;
LD65.callMain(['--cfg-path', '/share/cfg', '--lib-path', '/share/lib',
'-C', cfgfile,
'-C', params.cfgfile,
//'--dbgfile', 'main.dbg',
'-o', 'main', '-m', 'main.map', 'main.o',
platform+'.lib']);
'-o', 'main', '-m', 'main.map', 'main.o'].concat(libargs));
if (errors.length) {
return {errors:[{line:1,msg:errors}]};
}
@ -542,6 +554,8 @@ function assemblelinkCA65(code, platform, warnings) {
}
function compileCC65(code, platform) {
var params = PLATFORM_PARAMS[platform];
if (!params) throw Error("Platform not supported: " + platform);
load("cc65");
// stderr
var re_err1 = /.*?(\d+).*?: (.+)/;
@ -567,10 +581,10 @@ function compileCC65(code, platform) {
var FS = CC65['FS'];
setupFS(FS, '65');
FS.writeFile("main.c", code, {encoding:'utf8'});
CC65.callMain(['-v', '-T', '-g', /*'-Cl',*/
CC65.callMain(['-T', '-g', /*'-Cl',*/
'-Oirs',
'-I', '/share/include',
'-D__' + platform.toUpperCase() + '__',
'-D' + params.define,
"main.c"]);
try {
var asmout = FS.readFile("main.s", {encoding:'utf8'});