updated tests, intro page

This commit is contained in:
Steven Hugg 2019-03-16 22:02:35 -04:00
parent daa6acbac8
commit f190bf2d58
6 changed files with 73 additions and 41 deletions

View File

@ -29,9 +29,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<div class="container">
<div class="navbar-header">
<span class="navbar-brand"><a target="_new" href="https://twitter.com/8bitworkshop" class="twitter-follow-button" data-show-count="false">Follow @8bitworkshop</a></span>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<a class="navbar-brand" href="./blog/">Blog</a>
<a class="navbar-brand" href="https://www.amazon.com/default/e/B01N7J10NF/ref=dp_byline_cont_pop_book_1" target="_blank" onclick="ga('send', 'event', 'books', 'click');">Books</a>
<a class="navbar-brand" href="https://www.amazon.com/default/e/B01N7J10NF/ref=dp_byline_cont_pop_book_1" onclick="ga('send', 'event', 'books', 'click');">Books</a>
</div>
<div id="navbar" class="hidden-sm hidden-xs">
<form class="navbar-form navbar-right">
@ -46,6 +46,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<div class="jumbotron">
<div class="container">
<div class="col-md-6">
<br>
<h1>Write 8-bit code in your browser.</h1>
<p>
Ever wanted to be an old-school game programmer?<br>
@ -68,9 +69,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<div class="col-md-4">
<h2><a href="redir.html?platform=vcs">Atari 2600</a></h2>
<p>
Learn how to program the
<a href="redir.html?platform=vcs">Atari 2600</a>
with dozens of fully commented examples.
Learn how to program the Atari 2600 with
<a href="redir.html?platform=vcs">dozens of fully commented
examples</a>.
Our 6502 assembler runs as you type and flags any errors.
We've got debugging tools too; single step through your code and use our CPU Cycle Analyzer to
develop that perfect Stella kernel.
@ -95,12 +96,12 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<h2><a href="redir.html?platform=verilog">Hardware Design</a></h2>
<p>
Use our
<a href="redir.html?platform=verilog">Verilog</a>
compiler to design a 8-bit game platform from scratch.
<a href="redir.html?platform=verilog">Verilog IDE</a>
to design a 8-bit game platform from scratch.
We'll run your design in real time in the browser, displaying the output on a simulated CRT.
Plenty of examples are included to teach logic programming.
The book even shows you how to synthesize your code to the
<a target="_blank" href="https://www.amazon.com/gp/product/B00R3QU9K0/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00R3QU9K0&linkCode=as2&tag=pzp-20&linkId=5e51c89e29bec87dfb4d81f89fdec3fe">Lattice iCE Stick FPGA</a><img src="//ir-na.amazon-adsystem.com/e/ir?t=pzp-20&l=am2&o=1&a=B00R3QU9K0" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
<a href="https://www.amazon.com/gp/product/B00R3QU9K0/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00R3QU9K0&linkCode=as2&tag=pzp-20&linkId=5e51c89e29bec87dfb4d81f89fdec3fe">Lattice iCE Stick FPGA</a><img src="//ir-na.amazon-adsystem.com/e/ir?t=pzp-20&l=am2&o=1&a=B00R3QU9K0" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
and connect to a legacy CRT or TV.
</p>
<img class="img-responsive" src="images/fpga.jpg">
@ -112,23 +113,21 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<div class="container">
<div class="row">
<div class="col-md-2">
<a target="_blank" href="https://www.amazon.com/gp/product/1541021304/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1541021304&linkCode=as2&tag=pzp-20&linkId=c149f6365c0a676065eb6d7c5f8dd6ae" onclick="ga('send', 'event', 'books', 'click', 'vcs');">
<a href="https://www.amazon.com/gp/product/1541021304/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1541021304&linkCode=as2&tag=pzp-20&linkId=c149f6365c0a676065eb6d7c5f8dd6ae" onclick="ga('send', 'event', 'books', 'click', 'vcs');">
<img class="img-responsive" border="0" src="./images/book_a2600_med.jpg" ></a>
<img src="//ir-na.amazon-adsystem.com/e/ir?t=pzp-20&l=am2&o=1&a=1541021304" />
</div>
<div class="col-md-4">
<a target="_blank" href="https://www.amazon.com/gp/product/1541021304/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1541021304&linkCode=as2&tag=pzp-20&linkId=c149f6365c0a676065eb6d7c5f8dd6ae" onclick="ga('send', 'event', 'books', 'click', 'vcs');">
<a href="https://www.amazon.com/gp/product/1541021304/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1541021304&linkCode=as2&tag=pzp-20&linkId=c149f6365c0a676065eb6d7c5f8dd6ae" onclick="ga('send', 'event', 'books', 'click', 'vcs');">
<h3>Making Games For The Atari 2600</h3>
</a>
<p>The Atari 2600 was released in 1977, and now there's finally a book about how to write games for it! You'll learn about the 6502 CPU, NTSC frames, scanlines, cycle counting, players, missiles, collisions, procedural generation, pseudo-3D, and more. While using the manual, take advantage of our Web-based IDE to write 6502 assembly code, and see your code run instantly in the browser. We'll cover the same programming tricks that master programmers used to make classic games. Create your own graphics and sound, and share your games with friends!</p>
</div>
<div class="col-md-2">
<a target="_blank" href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2&tag=pzp-20&linkId=2f3c42111bffe3466830939fff4053fc" onclick="ga('send', 'event', 'books', 'click', 'arcade');">
<a href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2&tag=pzp-20&linkId=2f3c42111bffe3466830939fff4053fc" onclick="ga('send', 'event', 'books', 'click', 'arcade');">
<img class="img-responsive" border="0" src="./images/book_arcade_med.jpg" ></a>
<img src="//ir-na.amazon-adsystem.com/e/ir?t=pzp-20&l=am2&o=1&a=1545484759" />
</div>
<div class="col-md-4">
<a target="_blank" href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2&tag=pzp-20&linkId=2f3c42111bffe3466830939fff4053fc" onclick="ga('send', 'event', 'books', 'click', 'arcade');">
<a href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2&tag=pzp-20&linkId=2f3c42111bffe3466830939fff4053fc" onclick="ga('send', 'event', 'books', 'click', 'arcade');">
<h3>Making 8-Bit Arcade Games in C</h3>
</a>
<p>With this book, you'll learn all about the hardware of Golden Age 8-bit arcade games produced in the late 1970s to early 1980s. We'll learn how to use the C programming language to write code for the Z80 CPU. The following arcade platforms are covered: * Midway 8080 (Space Invaders) * VIC Dual (Carnival) * Galaxian/Scramble (Namco) * Atari Color Vector * Williams (Defender, Robotron) We'll describe how to create video and sound for each platform. Use the online 8bitworkshop IDE to compile your C programs and play them right in the browser!</p>
@ -138,12 +137,11 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<div class="container">
<div class="row">
<div class="col-md-2">
<a target="_blank" href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2&tag=pzp-20&linkId=c149f6365c0a676065eb6d7c5f8dd6ae" onclick="ga('send', 'event', 'books', 'click', 'verilog');">
<a href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2&tag=pzp-20&linkId=c149f6365c0a676065eb6d7c5f8dd6ae" onclick="ga('send', 'event', 'books', 'click', 'verilog');">
<img class="img-responsive" border="0" src="./images/book_verilog.jpg" ></a>
<img src="//ir-na.amazon-adsystem.com/e/ir?t=pzp-20&l=am2&o=1&a=1728619440" />
</div>
<div class="col-md-4">
<a target="_blank" href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2&tag=pzp-20&linkId=c149f6365c0a676065eb6d7c5f8dd6ae" onclick="ga('send', 'event', 'books', 'click', 'verilog');">
<a href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2&tag=pzp-20&linkId=c149f6365c0a676065eb6d7c5f8dd6ae" onclick="ga('send', 'event', 'books', 'click', 'verilog');">
<h3>Designing Video Game Hardware in Verilog</h3>
</a>
<p>
@ -251,7 +249,7 @@ At the end of this adventure, you should be well-equipped to begin exploring the
<footer>
<p>
&copy; 2018 Puzzling Plans LLC.
<a href="privacy.html" target="_blank">Privacy Policy.</a>
<a href="privacy.html">Privacy Policy.</a>
</p>
<p>
Some brands and product names mentioned are trademarks or service marks of their respective companies. Use of a term in this work should not be regarded as affecting the validity of any trademark or service mark.
@ -259,9 +257,31 @@ Some brands and product names mentioned are trademarks or service marks of their
</footer>
</div> <!-- /container -->
<img src="//ir-na.amazon-adsystem.com/e/ir?t=pzp-20&l=am2&o=1&a=1541021304" />
<img src="//ir-na.amazon-adsystem.com/e/ir?t=pzp-20&l=am2&o=1&a=1545484759" />
<img src="//ir-na.amazon-adsystem.com/e/ir?t=pzp-20&l=am2&o=1&a=1728619440" />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<script>
// make external links GA-able
function _COBL(url) {
ga('send', 'event', 'outbound', 'click', url, {
'transport': 'beacon',
'hitCallback': function() { document.location = url; }
});
setTimeout(function() { document.location = url; }, 500);
return false;
}
$('a').each(function() {
if (location.hostname !== this.hostname && location.hostname.length > 0) {
var fntext = "return _COBL('" + this.href + "');";
console.log(fntext);
$(this).attr('onclick', fntext);
}
});
</script>
</body>
</html>

View File

@ -87,12 +87,13 @@ TODO:
- recording video indicator
- stego shareable images (http://pico-8.wikia.com/wiki/P8PNGFileFormat)
- https://makecode.com/language?
- show .map file in listings? memory map view?
- 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)
- put globals into view/controller objects
WEB WORKER FORMAT
@ -204,4 +205,15 @@ Types
Mappers can refer to multiple objs
Slice (window) of array for selections
AssetEditorView
- scan files for assets
- build hierarchical view of assets
- expand/collapse
- create editor upon expansion
- double-click to source file
Assets come from:
- chr files
- bitmap data in files
- structured data (palette, sprites, metasprites, levels, etc)

View File

@ -31,10 +31,12 @@ const int note_table_63[64] = {
const int note_table_tri[64] = {
2138, 2018, 1905, 1798, 1697, 1602, 1512, 1427, 1347, 1272, 1200, 1133, 1069, 1009, 953, 899, 849, 801, 756, 714, 674, 636, 601, 567, 535, 505, 477, 450, 425, 401, 379, 358, 338, 319, 301, 284, 268, 253, 239, 226, 213, 201, 190, 179, 169, 160, 151, 142, 135, 127, 120, 113, 107, 101, 95, 90, 85, 80, 76, 72, 68, 64, 60, 57, };
#define note_table note_table_49
#define NOTE_TABLE note_table_49
#define BASS_NOTE 36
byte music_index = 0;
byte cur_duration = 0;
const byte music1[]; // music data -- see end of file
const byte* music_ptr = music1;
@ -52,8 +54,8 @@ void play_music() {
// is this a note?
if ((note & 0x80) == 0) {
// pulse plays higher notes, triangle for lower if it's free
if (note >= 36 || (chs & 4)) {
int period = note_table[note & 63];
if (note >= BASS_NOTE || (chs & 4)) {
int period = NOTE_TABLE[note & 63];
// see which pulse generator is free
if (!(chs & 1)) {
APU_PULSE_DECAY(0, period, DUTY_25, 2, 10);

View File

@ -99,16 +99,19 @@ describe('Worker', function() {
*/
// TODO: test NES bank switching, mapper
it('should compile CC65', function(done) {
compile('cc65', 'int main() {\nint x=1;\nreturn x+2;\n}', 'nes-conio', done, 40976, 3);
compile('cc65', 'int main() {\nint x=1;\nreturn x+2;\n}', 'nes', done, 40976, 3);
});
it('should compile CC65 banked', function(done) {
compile('cc65', '#define NES_MAPPER 4\nint main() {\nint x=1;\nreturn x+2;\n}', 'nes', done, 131088, 3);
});
it('should NOT compile CC65 (compile error)', function(done) {
compile('cc65', 'int main() {\nint x=1;\nprintf("%d",x);\nreturn x+2;\n}', 'nes-conio', done, 0, 0, 1);
compile('cc65', 'int main() {\nint x=1;\nprintf("%d",x);\nreturn x+2;\n}', 'nes', done, 0, 0, 1);
});
it('should NOT compile CC65 (link error)', function(done) {
compile('cc65', 'extern void bad();\nint main() {\nbad();\nreturn 0;\n}', 'nes-conio', done, 0, 0, 3, {ignoreErrorPath:true});
compile('cc65', 'extern void bad();\nint main() {\nbad();\nreturn 0;\n}', 'nes', done, 0, 0, 3, {ignoreErrorPath:true});
});
it('should NOT compile CC65 (preproc error)', function(done) {
compile('cc65', '#include "NOSUCH.file"\n', 'nes-conio', done, 0, 0, 1, {ignoreErrorPath:true});
compile('cc65', '#include "NOSUCH.file"\n', 'nes', done, 0, 0, 1, {ignoreErrorPath:true});
});
it('should assemble CA65', function(done) {
compile('ca65', '\t.segment "HEADER"\n\t.segment "STARTUP"\n\t.segment "CHARS"\n\t.segment "VECTORS"\n\tlda #0\n\tsta $1\n', 'nes-conio', done, 40976, 2);
@ -136,12 +139,6 @@ describe('Worker', function() {
it('should compile SDCC w/ include', function(done) {
compile('sdcc', '#include <string.h>\nvoid main() {\nstrlen(0);\n}\n', 'mw8080bw', done, 8192, 2, 0);
});
/*
it('should compile vicdual skeleton', function(done) {
var csource = ab2str(fs.readFileSync('presets/vicdual/skeleton.sdcc'));
compile('sdcc', csource, 'vicdual', done, 16416, 45, 0);
});
*/
it('should compile mw8080 skeleton', function(done) {
var csource = ab2str(fs.readFileSync('presets/mw8080bw/skeleton.sdcc'));
compile('sdcc', csource, 'mw8080bw', done, 8192, 84, 0);
@ -166,12 +163,10 @@ describe('Worker', function() {
var csource = ab2str(fs.readFileSync('presets/coleco/text.c'));
compile('sdcc', csource, 'coleco', done, 32768, 15, 0);
});
/* TODO: load extra files
it('should compile sg1000 skeleton', function(done) {
var csource = ab2str(fs.readFileSync('presets/sg1000/text.c'));
compile('sdcc', csource, 'sg1000', done, 32768, 15, 0);
var csource = ab2str(fs.readFileSync('presets/sms-sg1000-libcv/text.c'));
compile('sdcc', csource, 'sms-sg1000-libcv', done, 49152, 15, 0);
});
*/
it('should compile verilog example', function(done) {
var csource = ab2str(fs.readFileSync('presets/verilog/lfsr.v'));
var msgs = [{code:csource, platform:"verilog", tool:"verilator", path:'main.v'}];
@ -257,8 +252,8 @@ describe('Worker', function() {
{"path":"fn.c", "data":"int mul2(int x) { return x*x; }\n"}
],
"buildsteps":[
{"path":"main.c", "platform":"nes-conio", "tool":"cc65"},
{"path":"fn.c", "platform":"nes-conio", "tool":"cc65"}
{"path":"main.c", "platform":"nes", "tool":"cc65"},
{"path":"fn.c", "platform":"nes", "tool":"cc65"}
]
};
var m2 = {
@ -266,8 +261,8 @@ describe('Worker', function() {
{"path":"main.c", "data":"extern int mul2(int x); \nint main() { return mul2(2); }\n"}
],
"buildsteps":[
{"path":"main.c", "platform":"nes-conio", "tool":"cc65"},
{"path":"fn.c", "platform":"nes-conio", "tool":"cc65"}
{"path":"main.c", "platform":"nes", "tool":"cc65"},
{"path":"fn.c", "platform":"nes", "tool":"cc65"}
]
};
var msgs = [m, m, m2];

View File

@ -38,6 +38,7 @@ function Blob(blob) {
global.XMLHttpRequest = function() {
this.open = function(a,b,c) {
//console.log(':::xml',a,'src/worker/'+b,c,this.responseType);
if (this.responseType == 'json') {
var txt = fs.readFileSync('src/worker/'+b);
this.response = JSON.parse(txt);
@ -48,6 +49,8 @@ global.XMLHttpRequest = function() {
var data = fs.readFileSync('src/worker/'+b, {encoding:'binary'});
this.response = new Blob(data).asArrayBuffer();
}
this.status = this.response ? 200 : 404;
//console.log(':::xml',this.response.length);
}
this.send = function() { }
}

2
tss

@ -1 +1 @@
Subproject commit 5b5ee67fc06956bc7dce51726e98812d2d897eaa
Subproject commit 61a1691a1de05dca3b694bf603db49ffbaf572cf