diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..d29a83af --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: 8bitworkshop diff --git a/.gitignore b/.gitignore index 41850320..12d7c394 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ local release gen test/output +.DS_Store diff --git a/.gitmodules b/.gitmodules index 946ca202..97e0d7cb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,15 +16,12 @@ [submodule "localForage"] path = localForage url = https://github.com/localForage/localForage -[submodule "bitmap-fonts"] - path = bitmap-fonts - url = https://github.com/Tecate/bitmap-fonts -[submodule "ibmfonts"] - path = ibmfonts - url = https://github.com/farsil/ibmfonts [submodule "jsnes"] path = jsnes url = https://github.com/sehugg/jsnes [submodule "bootstrap-tourist"] path = bootstrap-tourist url = https://github.com/IGreatlyDislikeJavascript/bootstrap-tourist +[submodule "nanoasm"] + path = nanoasm + url = https://github.com/sehugg/nanoasm diff --git a/Makefile b/Makefile index b10995d1..016d7630 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ TSC=./node_modules/typescript/bin/tsc all: + cp nanoasm/src/assembler.ts src/worker/ $(TSC) cd jsnes && npm i @@ -28,3 +29,6 @@ tsweb: ifconfig | grep inet $(TSC) -w & python3 scripts/serveit.py 2>> http.out + +astrolibre.b64.txt: astrolibre.rom + lzg -9 $< | base64 -w 0 > $@ diff --git a/README.md b/README.md index fd5d52b0..7963d03f 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ make tsweb ## Run tests ```sh -make test +npm test ``` ## Author @@ -66,5 +66,11 @@ Give a ⭐️ if this project helped you! Copyright © 2019 [Steven Hugg](https://github.com/sehugg). This project is [GPL-3.0](https://github.com/sehugg/8bitworkshop/blob/master/LICENSE) licensed. +Dependencies retain their original licenses. + +All included code samples (all files under the presets/ directory) are licensed under +[CC0](https://creativecommons.org/publicdomain/zero/1.0/) +unless otherwise licensed. + *** _This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_ diff --git a/bitmap-fonts b/bitmap-fonts deleted file mode 160000 index 6f52a7ca..00000000 --- a/bitmap-fonts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6f52a7ca0838967cc57e9a44d76c6e1f60e62842 diff --git a/bootstrap/js/bootbox.all.min.js b/bootstrap/js/bootbox.all.min.js new file mode 100644 index 00000000..feecd0a8 --- /dev/null +++ b/bootstrap/js/bootbox.all.min.js @@ -0,0 +1,6 @@ +/** + * bootbox.js 5.1.3 + * + * http://bootboxjs.com/license.txt + */ +!function(t,e){'use strict';'function'==typeof define&&define.amd?define(['jquery'],e):'object'==typeof exports?module.exports=e(require('jquery')):t.bootbox=e(t.jQuery)}(this,function e(p,u){'use strict';var r,n,i,l;Object.keys||(Object.keys=(r=Object.prototype.hasOwnProperty,n=!{toString:null}.propertyIsEnumerable('toString'),l=(i=['toString','toLocaleString','valueOf','hasOwnProperty','isPrototypeOf','propertyIsEnumerable','constructor']).length,function(t){if('function'!=typeof t&&('object'!=typeof t||null===t))throw new TypeError('Object.keys called on non-object');var e,o,a=[];for(e in t)r.call(t,e)&&a.push(e);if(n)for(o=0;o",header:"",footer:'',closeButton:'×',form:'',button:'',option:'',promptMessage:'',inputs:{text:'',textarea:'',email:'',select:'',checkbox:'',radio:'',date:'',time:'',number:'',password:'',range:''}},m={locale:'en',backdrop:'static',animate:!0,className:null,closeButton:!0,show:!0,container:'body',value:'',inputType:'text',swapButtonOrder:!1,centerVertical:!1,multiple:!1,scrollable:!1};function c(t,e,o){return p.extend(!0,{},t,function(t,e){var o=t.length,a={};if(o<1||2').attr('label',e.group)),o=i[e.group]);var a=p(f.option);a.attr('value',e.value).text(e.text),o.append(a)}),O(i,function(t,e){n.append(e)}),n.val(r.value);break;case'checkbox':var l=p.isArray(r.value)?r.value:[r.value];if(!(a=r.inputOptions||[]).length)throw new Error('prompt with "inputType" set to "checkbox" requires at least one option');n=p(''),O(a,function(t,o){if(o.value===u||o.text===u)throw new Error('each option needs a "value" property and a "text" property');var a=p(f.inputs[r.inputType]);a.find('input').attr('value',o.value),a.find('label').append('\n'+o.text),O(l,function(t,e){e===o.value&&a.find('input').prop('checked',!0)}),n.append(a)});break;case'radio':if(r.value!==u&&p.isArray(r.value))throw new Error('prompt with "inputType" set to "radio" requires a single, non-array value for "value"');if(!(a=r.inputOptions||[]).length)throw new Error('prompt with "inputType" set to "radio" requires at least one option');n=p('');var s=!0;O(a,function(t,e){if(e.value===u||e.text===u)throw new Error('each option needs a "value" property and a "text" property');var o=p(f.inputs[r.inputType]);o.find('input').attr('value',e.value),o.find('label').append('\n'+e.text),r.value!==u&&e.value===r.value&&(o.find('input').prop('checked',!0),s=!1),n.append(o)}),s&&n.find('input[type="radio"]').first().prop('checked',!0)}if(t.append(n),t.on('submit',function(t){t.preventDefault(),t.stopPropagation(),e.find('.bootbox-accept').trigger('click')}),''!==p.trim(r.message)){var c=p(f.promptMessage).html(r.message);t.prepend(c),r.message=t}else r.message=t;return(e=d.dialog(r)).off('shown.bs.modal'),e.on('shown.bs.modal',function(){n.focus()}),!0===o&&e.modal('show'),e},d.addLocale('en',{OK:'OK',CANCEL:'Cancel',CONFIRM:'OK'}),d}); \ No newline at end of file diff --git a/cc65/.gitignore b/cc65/.gitignore deleted file mode 100644 index 6754d4ff..00000000 --- a/cc65/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.nes -*.o -*.s -*.lzg diff --git a/cc65/Makefile b/cc65/Makefile deleted file mode 100644 index 98639c63..00000000 --- a/cc65/Makefile +++ /dev/null @@ -1,25 +0,0 @@ - -CC65FLAGS=-I/home/hugg/compilers/cc65/include -I/home/hugg/compilers/cc65/include/nes -L/home/hugg/compilers/cc65/lib --cfg-path /home/hugg/compilers/cc65/cfg/ -v - -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 - time ld65 -o $@ -C atarivec.cfg $*.o atari2600.lib - -%.lzg: %.nes - lzg $< | hexdump -v -e '"\n" 32/1 "%u,"' > $@ diff --git a/cc65/default_conio.c b/cc65/default_conio.c deleted file mode 100644 index 7b2721ff..00000000 --- a/cc65/default_conio.c +++ /dev/null @@ -1,43 +0,0 @@ - -#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) { - } -} diff --git a/cc65/default_neslib.c b/cc65/default_neslib.c deleted file mode 100644 index d86f7ce0..00000000 --- a/cc65/default_neslib.c +++ /dev/null @@ -1,53 +0,0 @@ - -//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 -} diff --git a/cc65/longbranch.mac b/cc65/longbranch.mac deleted file mode 100644 index d6f6cde8..00000000 --- a/cc65/longbranch.mac +++ /dev/null @@ -1,88 +0,0 @@ -.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 diff --git a/cc65/neslib.h b/cc65/neslib.h deleted file mode 100644 index 5ba0493a..00000000 --- a/cc65/neslib.h +++ /dev/null @@ -1,226 +0,0 @@ -//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 - -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; iedges; - 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++; - } -} diff --git a/css/codemirror.css b/css/codemirror.css index b93fb015..55fde9f0 100644 --- a/css/codemirror.css +++ b/css/codemirror.css @@ -2,10 +2,9 @@ .CodeMirror { /* Set height, width, borders, and global font properties here */ - border: 1px solid #eee; font-family: "Andale Mono", "Menlo", "Lucida Console", monospace; font-size: 0.8em; - height: 96vh; + height: 94vh; } /* PADDING */ diff --git a/css/ui.css b/css/ui.css index 69b4588c..efaee3f5 100644 --- a/css/ui.css +++ b/css/ui.css @@ -49,8 +49,8 @@ background-color:#000066; } #controls_top { - position: absolute; - padding: 0.5em; + position:absolute; + padding:0.5em; height:3em; width:100%; background-color:#999; @@ -111,7 +111,7 @@ div.mem_info a.selected { text-align:right; } .btn_group { - border-radius:6px; + border-radius:8px; padding:8px; margin-left:8px; background-color: #666; @@ -223,6 +223,8 @@ a.dropdown-toggle { div.emulator { background-color: #666; margin-top: 20px auto 0; + display:flex; + flex-direction:column; } div.emuoverlay { display:flex; @@ -249,6 +251,10 @@ div.emuspacer { width:90%; pointer-events:auto; } +.emuvideo:focus { + outline:none; + border-color:#888; +} canvas.pixelated { image-rendering: optimizeSpeed; /* Older versions of FF */ image-rendering: -moz-crisp-edges; /* FF 6.0+ */ @@ -277,14 +283,15 @@ canvas.pixelated { font-family: TinyFont; src: url(04B_03__.TTF); } -#booksMenuButton { - border-width:3px; - border-color:#99ff99; - background-color:#006600; +.toolbarMenuButton { + background-color:#666; border-style:solid; - font-family: "Andale Mono", "Menlo", "Lucida Console", monospace; position:relative; - top:-0.25em; + margin-left:0.5em; + margin-right:0.5em; +} +a.toolbarMenuButton { + padding:0.3em; } a.dropdown-toggle { } @@ -516,3 +523,23 @@ div.asset_toolbar { padding:8px; margin:8px; } +.control-insns { + margin-top: auto; + margin-bottom: 2em; +} +.control-key { + border: 2px solid rgba(0,0,0,0.2); + border-radius: 0.6em; + padding: 0.2em; + padding-left: 0.5em; + padding-right: 0.5em; + background-color: #eee; + margin-left: 1em; + color: #666; +} +.control-def { + color: #ccc; +} +.book-title { + font-size:12pt; +} diff --git a/doc/notes.txt b/doc/notes.txt index 9f90de7c..7fdfde0d 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -6,14 +6,8 @@ TODO: - confuse code/data in listing - show memory locations hovering over lines - don't check against ROM signatures -- support 6502 test cases - DASM: macro forward refs - asm: support macro expansion -- support narrow screens -- case sensisitvity looking for mismatch variables -- remove pulldown when no preset? -- can't step after reset (or when funky frame; TIA frame is out of sync) -- break on BRK/illegal opcode? - multiple breakpoints, expression breakpoints - watchpoints - debug inspector for variables @@ -21,95 +15,96 @@ TODO: - step over (line, instruction) - slowdown beam for all platforms? - PC x86 support + - https://bellard.org/tcc/ - show errors in list (maybe window list?) -- can't see 1st line in editor sometimes (when scrolling cursor past bottom of screen) + - click to go to error + - what if error in include file you can't edit b/c it never appears? - online help - show self-modifying code insns left of editor -- facade/kbd shortcuts for emulators, focus - update Javatari version? (and others?) -- unify versioning -- disassembler for uploaded ROMs -- compile stuck when errors unchanged - sound mute? - $error updates source editor -- go to error in include files - online tools for music etc - text log debugging script -- NES crt should mark raster pos when debugging - intro/help text for each platform - vscode/atom extension? -- VCS asm library -- better VCS single stepping, maybe also listings -- VCS skips step on lsr/lsr after run to line -- error msg when #link doesn't work -- figure out folders for projects for real - click to break on raster position - restructure src/ folders - debug bankswitching for funky formats - spaces in filename don't parse code listing (DASM, maybe more) - 'undefined' for bitmap replacer -- astrocade: run to cursor in hello world messes up emulation - requestInterrupt needs to be disabled after breakpoint? -- C/asm formatter +- C/asm source formatter - fix WebAudio (https://news.ycombinator.com/item?id=18066474) - allow download of JSASM output - update bootstrap to 4.0 - batariBasic: proper line numbers, debugging - granular control over time scrubbing, show CPU state -- error showing replay div before rom starts -- compiler flags for final ROM build -- workermain: split build functions, better msg types -- vcs: INPTx needs to be added to control state -- sdcc: can't link asm files before c files (e.g. acheader.s must be last) -- what if >1 file with same name? (local/nonlocal/directory) -- what if .c and .s names collide? +- builds: + - compiler flags for final ROM build + - workermain: split build functions, better msg types + - what if >1 file with same name? (local/nonlocal/directory) + - what if .c and .s names collide? + - maybe put stuff in examples/ dir? + - error msg when #link doesn't work + - warning when ROM too big + - detect "libcv.h" and include library automagically? +- sdcc: + - can't link asm files before c files (e.g. acheader.s must be last) + - figure out area names ordering + - debug inline asm - live coding URL -- resize memory browser when vertical div resize -- preroll the emulator so optimizer does its thing before loading rom +- resize memory browser, other windows when vertical div resize +- preroll the Z80 emulator so optimizer does its thing before loading rom - wasm dynamic linking of emulators (https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md) -- use alternate confirm/prompt dialogs - https://github.com/jvilk/BrowserFS -- what if error in include file you can't edit b/c it never appears? - markdown, verilog: can't share - https://www.crowdsupply.com/tinyfpga/tinyfpga-bx -- HTTPS warning - stego shareable images (http://pico-8.wikia.com/wiki/P8PNGFileFormat) - https://makecode.com/language? - open ROM from URL? - game starts even if switched away before first load -- vcs: break on # of lines changed (maybe using getRasterPosition?) -- profiler restarts when paused - it's pretty easy to add a new file named like a library file (bcd.c) - or have neslib.h in a subdirectory... - put globals into view/controller objects - upload binary files doesn't do what's expected, changing pulldown and whatnot -- chrome autostart audio: https://github.com/processing/p5.js-sound/issues/249 -- firefox autostart audio: https://support.mozilla.org/en-US/kb/block-autoplay -- show player controls for each platform, allow touch support, navigator.getGamepads +- autostart audio + - chrome: https://github.com/processing/p5.js-sound/issues/249 + - firefox: https://support.mozilla.org/en-US/kb/block-autoplay +- touch support - better undo/diff for mistakes? - ide bug/feature visualizer for sponsors -- optimization flags for sdcc (oldralloc) - global undo/redo at checkpoints (when rom changes) -- pulldown shows wrong file if preset not present - landscape mode for arcade ports +- symmetric load/save state types - pixel editor - persist palette/tilemap selections - more tools for editing - map editor + - arbitrary nametable editing - metasprites - throw errors when bad/no refs - per-View keyboard shortcuts - parse labels - parse .incbin directives? - can't replace in hex directives + - should maybe use same single-canvas editor for map + char editor + - undo doesn't refresh editor + - editing sometimes messes up cursor movement (CURBS) - crt0.s compiled each time? - debug highlight doesn't go away when debugging -> running - show breakpoint of PC or highest address on stack - can we highlight line instead of select? -- replay doesn't work for nes (force background tile redraw) -- running profiler while replaying? grand unified replay? -- click on profiler to step to position - - breakpoints stop profiler from running +- profiler + - profiler restarts emulator when paused + - running profiler while replaying? grand unified replay? + - click on profiler to step to position + - breakpoints stop profiler from running + - single-screen profiler + - hide labels that aren't available, like BIOS addrs + - show interrupts, other events + - sometimes interleaves two different PCs? like two profilers running simultaneously? + - ah, symbols persist across builds - https://remotestoragejs.readthedocs.io/en/latest/getting-started/how-to-add.html ? - Verilog - larger scope range, better scrolling @@ -123,29 +118,66 @@ TODO: - toolbar overlaps scope - CPU debugging - use $readmem for inline asm programs? + - can't add control instructions b/c of split - single-stepping vector games makes screen fade -- break on stack overflow, bad op, bad access, etc -- PPU/TIA register write visualization -- nes debug view toolbar -- vcs sound continues when paused +- break on stack overflow, illegal op, bad access, BRK, etc +- nes + - replay doesn't work for nes (force background tile redraw) + - nes debug view toolbar + - support NES_HEADER_16K? + - PPU/TIA register write visualization + - show cur/tmp vram addresses + - NES crt should mark raster pos when debugging + - OAMDMA in profiler? (haltCycles) + - ca65 skeleton + - neslib.cfg nesbanked.cfg ZP segment is C64-ish, should use $00-$FF +- JSNES + - doesn't support hiding >8 sprites + - doesn't do sprite zero test right + - doesn't do clip right + - doesn't do b/w tint +- vcs + - vcs sound continues when paused + - vcs: INPTx needs to be added to control state + - vcs: break on # of lines changed (maybe using getRasterPosition?) + - chrome looks blurry on vcs + - VCS asm game library + - VCS skips step on lsr/lsr after run to line + - better VCS single stepping, maybe also listings - upload multiple files/zip file to subdirectory - allow "include graphics.asm" instead of "include project/graphics.asm" -- chrome looks blurry on vcs - convert more stuff to Promises +- target ES6 - don't have to include bootstrap-tourist each time? - don't have to include firebase always? + - squelch error msgs? + - test offline? (if window.firebase) - Github + - platform_id/repo.platform mismatch (can't leave repository) - gh-pages branch with embedded - handle overwrite logic - - test edge/failure cases - what to do about included files? - - what if files already open in editor - - un-bind from repo? - can published files retain path? - what if import interrupted and partial files? - CORS for some blobs? - - confusing when examples load if file not found - don't import useless files + - support projects with subdirectories, file list? + - emulator needs reset shortcut for nes + - switching platform of a repo? + - make sure to flatten subdirs +- astrocade +- keyboard shortcuts + - ctrl+alt+l on ubuntu locks screen + - alt-D doesn't work anymore + - facade/kbd shortcuts for emulators, focus +- cookie + - list of stuff for policy + - popup +- convert binary to hex stmts +- "suggestions" (vblank overrun, variable # scanlines, etc) +- SMS + - can't step back twice? + - compiler bug in chase WEB WORKER FORMAT @@ -281,3 +313,43 @@ Pull Push Git metadata kept in local storage + +Converting from NESASM to DASM +- asl a -> asl +- subroutine keyword on labels +- [zp],y to (zp),y +- LOW(x) and HIGH(x) to <() and >() +- .db to .byte, .dw to .word +- use NES_HEADER macros +- no .bank + +Cross platform NES/SMS/GG library +- use CHR RAM + - create flipped tiles/sprites + - create alternate palette tiles +- metatiles +- cross platform music/sound +- scrolling + - row/column mask + - no nametable mirroring in SMS + - 256x240 vs 256x192 + +Emulator Lib +- move getPresets() (into presets/ dir?) +- CPU interface + - execCycle(), execInsn() + - fix/unfix PC + - interrupt +- generic raster scanline platform +- PlatformRunner + - handles rewind, intra-frame breakpoint, debugging + - profiling log, exec/read/write/intr (for each bus?) +- expose video, audio, controller interfaces +- new debugging info +- memory map interface +- "About" metadata +- auto load/save state? +- handle legacy + - VCS + - NES + - MAME diff --git a/doc/platforms.md b/doc/platforms.md new file mode 100644 index 00000000..5e8bd709 --- /dev/null +++ b/doc/platforms.md @@ -0,0 +1,265 @@ + +class Platform +-------------- + +Mandatory functions: +~~~ + start() : void; + reset() : void; + isRunning() : boolean; + pause() : void; + resume() : void; + loadROM(title:string, rom:any); +~~~ + +These are for the compiler/editor: +~~~ + getToolForFilename(s:string) : string; + getDefaultExtension() : string; + getPresets() : Preset[]; +~~~ + +Most platforms have these: +~~~ + loadState?(state : EmuState) : void; + saveState?() : EmuState; +~~~ + +... etc + + +6502 +---- + +`advance()` advances one frame. +The basic idea: iterate through all the scanlines, run a bunch of CPU cycles per scanline. +If we hit a breakpoint, exit the loop. + +~~~ + var debugCond = this.getDebugCallback(); + for (var sl=0; sl<262; sl++) { + for (var i=0; i { + }, + onAudioSample: (left:number, right:number) => { + }, + onStatusUpdate: function(s) { + }, + }); +~~~ + +We monkey-patch the code to add a debugging hook: + +~~~ + // insert debug hook + this.nes.cpu._emulate = this.nes.cpu.emulate; + this.nes.cpu.emulate = () => { + var cycles = this.nes.cpu._emulate(); + this.evalDebugCondition(); + return cycles; + } +~~~ + +NES was the first platform with an "illegal opcode" hard stop, so we added a special `EmuHalt` exception which causes a breakpoint: + +~~~ + this.nes.stop = () => { + console.log(this.nes.cpu.toJSON()); + throw new EmuHalt("CPU STOPPED @ PC $" + hex(this.nes.cpu.REG_PC)); + }; +~~~ + + +MAME +---- + +The `BaseMAMEPlatform` class implements a MAME platform. +You just have to pass it various parameters when starting, and tell it how to load the ROM file: + +~~~ +class ColecoVisionMAMEPlatform extends BaseMAMEPlatform implements Platform { + + start() { + this.startModule(this.mainElement, { + jsfile: 'mamecoleco.js', + cfgfile: 'coleco.cfg', + biosfile: 'coleco/313 10031-4005 73108a.u2', + driver: 'coleco', + width: 280 * 2, + height: 216 * 2, + romfn: '/emulator/cart.rom', + romsize: 0x8000, + preInit: function(_self) { + }, + }); + } + + loadROM(title, data) { + this.loadROMFile(data); + this.loadRegion(":coleco_cart:rom", data); + } + + getPresets() { return ColecoVision_PRESETS; } + getToolForFilename = getToolForFilename_z80; + getDefaultExtension() { return ".c"; }; +} +~~~ + +A lot of things are done via Lua scripting -- for example, loading a ROM requires we loop over the memory region and issue `rgn:write_u32` calls. +It kinda-sorta works, except debugging isn't reliable because MAME [doesn't return from the event loop](https://github.com/mamedev/mame/issues/3649) at breakpoints. + +MAME platforms don't have state load/save either. + + +Verilog +-------- + +The Verilog platform is the odd one out, since it has no fixed CPU as such. +The `loadROM` function instead loads a JavaScript function. +Some platforms do have a ROM if using assembly, so we load that into a Verilog array. +It's quite the hack, and it could be better. + +Verilog has its own debugger, logging signals in a fixed-size buffer. + + + +Profiling +---------- + +`EmuProfilerImpl` runs the profiler. +When started, it calls `setBreakpoint` to add a profiler-specific breakpoint that never hits, just records the CPU state at each clock. +It uses `getRasterScanline` to associate IPs with scanlines. +Platforms can also log their own reads, writes, interrupts, etc. + + +Future Ideas +------------ + +There should be a standard CPU interface, buses, memory map. +More like MAME configuration. + +Platforms might have different ideas of "clock" (CPU clock, pixel clock, 1 clock per instruction, etc) + +The goal is to rewind and advance to any clock cycle within a frame, and get complete introspection of events, without hurting performance. + +Unify raster platforms, they should all allow the same debugging and CPU interfaces. + +Separate UI/sim parts of platform? +A lot of platforms write into a uint32 buffer. +We might want to buffer audio the same way. +Also some way to log events, and handle input. + +Figure out how to make platform-specific type for load/save state. +(generics?) + +Separate emulators from 8bitworkshop IDE. + +Can we use WASM emulators without JS interop penalty? +Maybe using [AssemblyScript](https://docs.assemblyscript.org/)? +Startup would be faster, probably runtime too. +Drawback is that dynamic stuff (custom breakpoint functions, profiling) might be slow, slower dev too maybe. +Need proof-of-concept. diff --git a/embed.html b/embed.html index acacb1f9..e2036c3a 100644 --- a/embed.html +++ b/embed.html @@ -13,8 +13,11 @@ align-items: center; justify-content: center; } +#emuscreen { + flex-grow: 1; +} .emuvideo { - height:80%; + width:90%; border-radius:20px; border: 4px solid #222; outline-color: #666; @@ -35,6 +38,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) { + + + @@ -44,7 +50,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) { - + diff --git a/ibmfonts b/ibmfonts deleted file mode 160000 index 7a9227d4..00000000 --- a/ibmfonts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7a9227d43057b6ab6271a2577ecce47fa3360134 diff --git a/images/book_a2600.jpg b/images/book_a2600.jpg deleted file mode 100644 index 21e6353e..00000000 Binary files a/images/book_a2600.jpg and /dev/null differ diff --git a/images/book_a2600_med.jpg b/images/book_a2600_med.jpg deleted file mode 100644 index 11077bbf..00000000 Binary files a/images/book_a2600_med.jpg and /dev/null differ diff --git a/images/book_arcade.jpg b/images/book_arcade.jpg deleted file mode 100644 index ee28a40e..00000000 Binary files a/images/book_arcade.jpg and /dev/null differ diff --git a/images/book_arcade.png b/images/book_arcade.png index 20daadb9..f0c4b861 100644 Binary files a/images/book_arcade.png and b/images/book_arcade.png differ diff --git a/images/book_arcade_med.jpg b/images/book_arcade_med.jpg deleted file mode 100644 index fdb6efee..00000000 Binary files a/images/book_arcade_med.jpg and /dev/null differ diff --git a/images/book_nes.png b/images/book_nes.png new file mode 100644 index 00000000..380f93d2 Binary files /dev/null and b/images/book_nes.png differ diff --git a/images/book_verilog.jpg b/images/book_verilog.jpg deleted file mode 100644 index 595d3ba9..00000000 Binary files a/images/book_verilog.jpg and /dev/null differ diff --git a/index.html b/index.html index 55bef9d4..b633b7f7 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ 8bitworkshop IDE + @@ -27,7 +28,6 @@ window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; if (window.location.host.endsWith('8bitworkshop.com')) { ga('create', 'UA-54497476-9', 'auto'); ga('set', 'anonymizeIp', true); - ga('send', 'pageview'); } @@ -44,12 +44,14 @@ if (window.location.host.endsWith('8bitworkshop.com')) { - - - - - - + + + + + + + + New Project... Upload... @@ -62,17 +64,22 @@ if (window.location.host.endsWith('8bitworkshop.com')) { Add Include File... Add Linked File... + Switch to HTTPS... Sync - Import Project from GitHub... - Publish Project on GitHub... + Sign in to Github... + Log out + Import Project from GitHub... + Pull Latest from Repository + + Publish Project on GitHub... Push Changes to Repository... - Pull Latest from Repository + Delete Local Repository... @@ -101,7 +108,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) { Tools - Bitmap Font Generator + Bitmap Font Generator Binary File to Hex Converter Atari 2600/VCS @@ -114,57 +121,76 @@ if (window.location.host.endsWith('8bitworkshop.com')) { - Platform + About + 8bitworkshop.com + Latest News + Projects + Twitter + GitHub + Report an Issue + + + + + + + + + + PLATFORMS + + Game Consoles - Atari 2600/VCS - NES + Atari 2600/VCS + NES Computers - Apple ][+ + Apple ][+ Arcade Systems - VIC Dual - Midway 8080 - Galaxian/Scramble Hardware - Atari Color Vector (Z80) - Williams (Z80) - Williams Sound (Z80) + VIC Dual + Midway 8080 + Galaxian/Scramble + Atari Color Vector (Z80) + Williams (Z80) + Williams Sound (Z80) Hardware - Verilog - Verilog (VGA @ 25 Mhz) + Verilog + Verilog (VGA @ 25 Mhz) Other - Atari 2600/VCS (MAME) - NES (MAME) - Atari Color Vector (6502) - Markdown + Atari 2600/VCS (MAME) + NES (MAME) + Atari Color Vector (6502) + Markdown - - - + + - + @@ -177,35 +203,45 @@ if (window.location.host.endsWith('8bitworkshop.com')) { evals/clk - - 8bitworkshop - - - GET BOOKS + + + + + Books - + - Making Games For The Atari 2600 + Making Games For The Atari 2600 - Making 8-bit Arcade Games in C + Making 8-bit Arcade Games in C - + - Designing Video Game Hardware in Verilog + Designing Video Game Hardware in Verilog + + + + + + Making Games For The NES - - + + 8bitworkshop + + + + @@ -213,7 +249,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) { - + @@ -224,10 +260,61 @@ if (window.location.host.endsWith('8bitworkshop.com')) { + + + + + + ←↑↓→ Joystick + Space Button + + + ←↑↓→ Joypad + Space Button A + Shift Button B + \ Select + Enter Start + + + ←↑↓→ Joypad + Space Button A + Shift Button B + + + ←↑↓→ Joystick + Space Button 1 + Shift Button 2 + \ Coin + Enter Start + + + ← → Joystick + Space Fire + + + A W S D Move + ←↑↓→ Fire + \ Coin + Enter Start + 6 7 8 9 Extra + + + ←↑↓→ Joystick + Space Trigger + Mouse X Knob + + U I O P + J K L / + 7 8 9 X + 4 5 6 - + 1 2 3 , + \ 0 . = Keypad + + @@ -244,7 +331,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) { - + Please wait... @@ -294,8 +381,27 @@ if (window.location.host.endsWith('8bitworkshop.com')) { + + + + + Break Expression + + + Enter a break expression: + + Examples: + + + + + + - + Import Project from GitHub @@ -303,6 +409,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) { Enter the GitHub repository URL: + If the project is compatible with 8bitworkshop, it should build automatically. + Otherwise, some work may be required -- make sure you've selected the correct platform. + Source files must be in the root folder of the repository. Import Project - + Publish Project on GitHub - This will migrate your existing files to a new GitHub repository. - - + This will migrate your existing project to a new GitHub repository. + https://github.com/username/ + Your repository will be Public Private License: - Will decide later - CC Zero (public domain) - MIT (public domain, must preserve notices) + Will decide later / all rights reserved + CC Zero (public domain, remix-friendly) + MIT (must preserve notices) CC BY (must attribute) CC BY-SA (must attribute, use same license) GPL v3 (must publish source) @@ -343,7 +452,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) { - + Push Project Changes to GitHub @@ -363,7 +472,8 @@ if (window.location.host.endsWith('8bitworkshop.com')) { - + + @@ -386,7 +496,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) { --> - + diff --git a/jquery/jquery-2.2.3.min.js b/jquery/jquery-2.2.3.min.js deleted file mode 100644 index b8c4187d..00000000 --- a/jquery/jquery-2.2.3.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v2.2.3 | (c) jQuery Foundation | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.3",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c; -}catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length",""],thead:[1,"",""],col:[2,"",""],tr:[2,"",""],td:[3,"",""],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="x",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,la=/ - + diff --git a/tools/Makefile b/tools/Makefile index 7c3f2d61..234edcfd 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,5 @@ -all: binaries images/parrot.c +all: binaries %.lzg: % lzg -9 $< $@ @@ -39,6 +39,9 @@ ship1.pbm: ship1.png %.prom: cat $* | hexdump -v -e '" \n defb " 32/1 "$$%02x,"' | cut -c 2-134 +%.s: + cat $* | hexdump -v -e '" \n .byte " 32/1 "$$%02x,"' | cut -c 2-135 + %.rot.pbm: %.pbm convert $< -transpose -bordercolor white -border 4x4 $@ diff --git a/tools/bin2arr.py b/tools/bin2arr.py new file mode 100755 index 00000000..7bc1b0d7 --- /dev/null +++ b/tools/bin2arr.py @@ -0,0 +1,15 @@ +#!/usr/bin/python + +import sys + +out = sys.stdout +chr = open(sys.argv[1],'rb').read() + +out.write('const unsigned char ARRAY[%d] = {\n' % len(chr)) + +for i in range(0,len(chr)): + out.write('0x%02x, ' % ord(chr[i])) + if (i & 7) == 7: + out.write('\n') + +out.write('\n};\n') diff --git a/tools/mkztab.py b/tools/mkztab.py new file mode 100644 index 00000000..9df2d349 --- /dev/null +++ b/tools/mkztab.py @@ -0,0 +1,9 @@ + +d = 16 +s = 800 + +for n in range(0,128): + z = n/2+d + y = s/z + print("%d," % y, end='') +print() diff --git a/tools/nes/Makefile b/tools/nes/Makefile index ce974e39..4717cee2 100644 --- a/tools/nes/Makefile +++ b/tools/nes/Makefile @@ -1,4 +1,9 @@ +all: nametable.dat + +clean: + rm -f *.dat road.png + nametable.dat: road.png makechr -e error.png $< #-b 0000ff diff --git a/tools/nes2sms.py b/tools/nes2sms.py new file mode 100644 index 00000000..8db57538 --- /dev/null +++ b/tools/nes2sms.py @@ -0,0 +1,11 @@ + +import sys + +chr = open(sys.argv[1],'rb').read() +out = open('outsms.bin','wb') +for i in range(0,len(chr),16): + for y in range(0,8): + arr = [ ord(chr[i+y]), ord(chr[i+8+y]), 0, 0 ] + out.write(bytearray(arr)) +out.close() + diff --git a/tools/vicdual/Makefile b/tools/vicdual/Makefile index 4b7dd523..905eafc1 100644 --- a/tools/vicdual/Makefile +++ b/tools/vicdual/Makefile @@ -1,6 +1,9 @@ all: cp437.vicdual.c c64.vicdual.c +clean: + rm -f cp437.vicdual.c c64.vicdual.c + # convert DOS CP437 font (256 chars) cp437.vicdual.c: ../fonts/cp437-8x8.bdf python ../parsebdf8.py $< -r -C > $@ diff --git a/tools/williams/Makefile b/tools/williams/Makefile index 0a23a52c..54919892 100644 --- a/tools/williams/Makefile +++ b/tools/williams/Makefile @@ -1,12 +1,15 @@ all: baddies.c badspacerobots.tga tom-thumb.c swave.c.rom.h +clean: + rm -f baddies.[ch] *.gif *.tga *.tga.png tom-thumb.c swave.c.rom.h + %.h: % cat $* | hexdump -v -e '"\n" 128/1 "0x%02x,"' > $@ # convert PCX (or PNG) file to Williams C sprite %.c: %.pcx - python ../pcx2will.py $< > $@ + python3 ../pcx2will.py $< > $@ # convert PNG into RLE-encoded TGA bitmap %.tga: %.png @@ -23,5 +26,5 @@ all: baddies.c badspacerobots.tga tom-thumb.c swave.c.rom.h # convert BDF font file to definitions %.c: ../fonts/%.bdf - python ../parsebdf4bit.py -s 33 -e 97 $< > $@ + python3 ../parsebdf4bit.py -s 33 -e 97 $< > $@ diff --git a/tsfmt.json b/tsfmt.json new file mode 100644 index 00000000..006a03ad --- /dev/null +++ b/tsfmt.json @@ -0,0 +1,5 @@ +{ + "indentSize": 2, + "newLineCharacter": "\n", + "convertTabsToSpaces": true +} \ No newline at end of file
Enter a break expression:
Examples:
Enter the GitHub repository URL:
If the project is compatible with 8bitworkshop, it should build automatically.
Otherwise, some work may be required -- make sure you've selected the correct platform.
Source files must be in the root folder of the repository.
Import Project
This will migrate your existing files to a new GitHub repository.
This will migrate your existing project to a new GitHub repository.
https://github.com/username/
Your repository will be Public Private
License: - Will decide later - CC Zero (public domain) - MIT (public domain, must preserve notices) + Will decide later / all rights reserved + CC Zero (public domain, remix-friendly) + MIT (must preserve notices) CC BY (must attribute) CC BY-SA (must attribute, use same license) GPL v3 (must publish source) @@ -343,7 +452,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {