diff --git a/index.html b/index.html index 32b96b9a..0ddf61f4 100644 --- a/index.html +++ b/index.html @@ -173,6 +173,23 @@ canvas.pixelated { image-rendering: pixelated; /* Awesome future-browsers */ -ms-interpolation-mode: nearest-neighbor; /* IE */ } +div.bitmap_editor { + position: fixed; + left: 2%; + width: 46%; + top: 10%; + bottom: 10%; + background-color: #333; + border-color: #fff; + border-style: ridge; + border-radius: 16px; + color: #66ff66; + white-space: pre; + padding: 20px; + z-index: 9; + font-family: "Andale Mono", "Menlo", "Lucida Console", monospace; + font-size: 12pt; +} @@ -194,7 +211,7 @@ canvas.pixelated {
  • Midway 8080 B&W
  • VIC Dual
  • -
  • Scramble
  • +
  • Galaxian/Scramble
  • Atari Color Vector (Z80)
  • Williams (Z80)
  • @@ -253,6 +270,14 @@ canvas.pixelated { Making Games For The Atari 2600 + + diff --git a/presets/mw8080bw/game2.c b/presets/mw8080bw/game2.c index 6e18bbdb..43785ae3 100644 --- a/presets/mw8080bw/game2.c +++ b/presets/mw8080bw/game2.c @@ -11,16 +11,16 @@ __sfr __at (0x2) bitshift_offset; __sfr __at (0x3) bitshift_read; __sfr __at (0x4) bitshift_value; __sfr __at (0x6) watchdog_strobe; -byte __at (0x2400) vidmem[0x1c00]; // 256x224x1 video memory +byte __at (0x2400) vidmem[224][32]; // 256x224x1 video memory #define FIRE1 (input1 & 0x10) #define LEFT1 (input1 & 0x20) #define RIGHT1 (input1 & 0x40) -void main(); void scanline96() __interrupt; -void scanline224(); +void scanline224() __interrupt; +void main(); // start routine @ 0x0 // set stack pointer, enable interrupts void start() { @@ -48,24 +48,26 @@ __endasm; // scanline 224 interrupt @ 0x10 // this one, we make an interrupt so it saves regs. -void RST_10() __interrupt { - scanline224(); +void scanline224() __interrupt { + vidmem[2]++; } // scanline 96 function, saves regs void scanline96() __interrupt { -} - -// scanline 224 function, regs already saved -void scanline224() { + vidmem[0]++; } /// GRAPHICS FUNCTIONS +/* +void draw_hline(byte y, byte x1, byte x2) { +} +*/ + void draw_vline(byte x, byte y1, byte y2) { byte yb1 = y1/8; byte yb2 = y2/8; - byte* dest = &vidmem[x*32+yb1]; + byte* dest = &vidmem[x][yb1]; signed char nbytes = yb2 - yb1; *dest++ ^= 0xff << (y1&7); if (nbytes > 0) { @@ -103,7 +105,7 @@ const byte enemy1_bitmap[] = void draw_sprite(const byte* src, byte x, byte y) { byte i,j; - byte* dest = &vidmem[y+x*32]; + byte* dest = &vidmem[x][y]; byte w = *src++; byte h = *src++; for (j=0; jshape[0]; - byte w = e->shape[1]; - return (x >= e->x && x <= e->x+w && y >= e->y && y <= e->y+h); +char in_rect(Entity* e, byte x, byte y, byte w, byte h) { + byte eh = e->shape[0]; + byte ew = e->shape[1]; + return (x >= e->x-w && x <= e->x+ew && y >= e->y-h && y <= e->y+eh); } Entity* find_entity_at(byte x, byte y) { byte i; for (i=0; i>i; pixels[outi] = (data&bm) ? color2 : color1; + if (framestats) { + framestats.layers.tiles[outi] = (data&bm) ? colorprom[col+8] : colorprom[col]; + } outi++; } } @@ -203,7 +207,13 @@ var VicDualPlatform = function(mainElement) { if (!this.getDebugCallback()) cpu.setTstates(0); // TODO? } this.readAddress = function(addr) { - return membus.read(addr); // TODO? + return membus.read(addr & 0xffff); // TODO? + } + this.setFrameStats = function(on) { + framestats = on ? { + palette: palette, + layers: {width:256, height:224, tiles:[]} + } : null; } } diff --git a/src/ui.js b/src/ui.js index af19811e..09c19e3c 100644 --- a/src/ui.js +++ b/src/ui.js @@ -192,7 +192,11 @@ function loadFile(fileid, filename, index) { $.get( filename, function( text ) { console.log("GET",text.length,'bytes'); loadCode(text, fileid); - }, 'text'); + }, 'text') + .fail(function() { + alert("Could not load preset " + fileid); + loadCode("", fileid); + }); } } else { var ext = platform.getToolForFilename(fileid); @@ -201,7 +205,7 @@ function loadFile(fileid, filename, index) { updatePreset(fileid, text); }, 'text') .fail(function() { - console.log("Could not load skeleton for " + platform_id + "/" + ext); + alert("Could not load skeleton for " + platform_id + "/" + ext); loadCode("", fileid); }); } @@ -925,6 +929,11 @@ function showWelcomeMessage() { /////////////////////////////////////////////////// +function setupBitmapEditor() { +} + +/////////////////////////////////////////////////// + var qs = (function (a) { if (!a || a == "") return {}; @@ -957,6 +966,7 @@ function startPlatform() { // start platform and load file preloadWorker(qs['file']); setupDebugControls(); + setupBitmapEditor(); platform.start(); loadPreset(qs['file']); updateSelector();