mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-08-15 17:27:22 +00:00
updated presets; thinking about sprite editor
This commit is contained in:
27
index.html
27
index.html
@@ -173,6 +173,23 @@ canvas.pixelated {
|
|||||||
image-rendering: pixelated; /* Awesome future-browsers */
|
image-rendering: pixelated; /* Awesome future-browsers */
|
||||||
-ms-interpolation-mode: nearest-neighbor; /* IE */
|
-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;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -194,7 +211,7 @@ canvas.pixelated {
|
|||||||
<!--<li><a class="dropdown-item" href="?platform=apple2" id="item_platform_apple2">Apple ][</a></li>-->
|
<!--<li><a class="dropdown-item" href="?platform=apple2" id="item_platform_apple2">Apple ][</a></li>-->
|
||||||
<li><a class="dropdown-item" href="?platform=mw8080bw" id="item_platform_mw8080bw">Midway 8080 B&W</a></li>
|
<li><a class="dropdown-item" href="?platform=mw8080bw" id="item_platform_mw8080bw">Midway 8080 B&W</a></li>
|
||||||
<li><a class="dropdown-item" href="?platform=vicdual" id="item_platform_vicdual">VIC Dual</a></li>
|
<li><a class="dropdown-item" href="?platform=vicdual" id="item_platform_vicdual">VIC Dual</a></li>
|
||||||
<li><a class="dropdown-item" href="?platform=galaxian-scramble" id="item_platform_galaxian_scramble">Scramble</a></li>
|
<li><a class="dropdown-item" href="?platform=galaxian-scramble" id="item_platform_galaxian_scramble">Galaxian/Scramble</a></li>
|
||||||
<li><a class="dropdown-item" href="?platform=vector-z80color" id="item_platform_vector_z80color">Atari Color Vector (Z80)</a></li>
|
<li><a class="dropdown-item" href="?platform=vector-z80color" id="item_platform_vector_z80color">Atari Color Vector (Z80)</a></li>
|
||||||
<li><a class="dropdown-item" href="?platform=williams" id="item_platform_williams">Williams (Z80)</a></li>
|
<li><a class="dropdown-item" href="?platform=williams" id="item_platform_williams">Williams (Z80)</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -253,6 +270,14 @@ canvas.pixelated {
|
|||||||
Making Games For The Atari 2600</a>
|
Making Games For The Atari 2600</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="bitmap_editor" style="display:none">
|
||||||
|
PC: $<span id="bitmap_editor_pc">0000</span>
|
||||||
|
X: <span id="bitmap_editor_x">0</span>
|
||||||
|
Y: <span id="bitmap_editor_y">0</span>
|
||||||
|
Dest: $<span id="bitmap_editor_dest">0000/0</span>
|
||||||
|
<canvas width="32" height="32" id="bitmap_editor_canvas"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="jquery/jquery-2.2.3.min.js"></script>
|
<script src="jquery/jquery-2.2.3.min.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
|
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
|
||||||
|
@@ -11,16 +11,16 @@ __sfr __at (0x2) bitshift_offset;
|
|||||||
__sfr __at (0x3) bitshift_read;
|
__sfr __at (0x3) bitshift_read;
|
||||||
__sfr __at (0x4) bitshift_value;
|
__sfr __at (0x4) bitshift_value;
|
||||||
__sfr __at (0x6) watchdog_strobe;
|
__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 FIRE1 (input1 & 0x10)
|
||||||
#define LEFT1 (input1 & 0x20)
|
#define LEFT1 (input1 & 0x20)
|
||||||
#define RIGHT1 (input1 & 0x40)
|
#define RIGHT1 (input1 & 0x40)
|
||||||
|
|
||||||
void main();
|
|
||||||
void scanline96() __interrupt;
|
void scanline96() __interrupt;
|
||||||
void scanline224();
|
void scanline224() __interrupt;
|
||||||
|
|
||||||
|
void main();
|
||||||
// start routine @ 0x0
|
// start routine @ 0x0
|
||||||
// set stack pointer, enable interrupts
|
// set stack pointer, enable interrupts
|
||||||
void start() {
|
void start() {
|
||||||
@@ -48,24 +48,26 @@ __endasm;
|
|||||||
|
|
||||||
// scanline 224 interrupt @ 0x10
|
// scanline 224 interrupt @ 0x10
|
||||||
// this one, we make an interrupt so it saves regs.
|
// this one, we make an interrupt so it saves regs.
|
||||||
void RST_10() __interrupt {
|
void scanline224() __interrupt {
|
||||||
scanline224();
|
vidmem[2]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// scanline 96 function, saves regs
|
// scanline 96 function, saves regs
|
||||||
void scanline96() __interrupt {
|
void scanline96() __interrupt {
|
||||||
}
|
vidmem[0]++;
|
||||||
|
|
||||||
// scanline 224 function, regs already saved
|
|
||||||
void scanline224() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// GRAPHICS FUNCTIONS
|
/// GRAPHICS FUNCTIONS
|
||||||
|
|
||||||
|
/*
|
||||||
|
void draw_hline(byte y, byte x1, byte x2) {
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void draw_vline(byte x, byte y1, byte y2) {
|
void draw_vline(byte x, byte y1, byte y2) {
|
||||||
byte yb1 = y1/8;
|
byte yb1 = y1/8;
|
||||||
byte yb2 = y2/8;
|
byte yb2 = y2/8;
|
||||||
byte* dest = &vidmem[x*32+yb1];
|
byte* dest = &vidmem[x][yb1];
|
||||||
signed char nbytes = yb2 - yb1;
|
signed char nbytes = yb2 - yb1;
|
||||||
*dest++ ^= 0xff << (y1&7);
|
*dest++ ^= 0xff << (y1&7);
|
||||||
if (nbytes > 0) {
|
if (nbytes > 0) {
|
||||||
@@ -103,7 +105,7 @@ const byte enemy1_bitmap[] =
|
|||||||
|
|
||||||
void draw_sprite(const byte* src, byte x, byte y) {
|
void draw_sprite(const byte* src, byte x, byte y) {
|
||||||
byte i,j;
|
byte i,j;
|
||||||
byte* dest = &vidmem[y+x*32];
|
byte* dest = &vidmem[x][y];
|
||||||
byte w = *src++;
|
byte w = *src++;
|
||||||
byte h = *src++;
|
byte h = *src++;
|
||||||
for (j=0; j<h; j++) {
|
for (j=0; j<h; j++) {
|
||||||
@@ -117,7 +119,7 @@ void draw_sprite(const byte* src, byte x, byte y) {
|
|||||||
byte xor_sprite(const byte* src, byte x, byte y) {
|
byte xor_sprite(const byte* src, byte x, byte y) {
|
||||||
byte i,j;
|
byte i,j;
|
||||||
byte result = 0;
|
byte result = 0;
|
||||||
byte* dest = &vidmem[y+x*32];
|
byte* dest = &vidmem[x][y];
|
||||||
byte w = *src++;
|
byte w = *src++;
|
||||||
byte h = *src++;
|
byte h = *src++;
|
||||||
for (j=0; j<h; j++) {
|
for (j=0; j<h; j++) {
|
||||||
@@ -131,7 +133,7 @@ byte xor_sprite(const byte* src, byte x, byte y) {
|
|||||||
|
|
||||||
void erase_sprite(const byte* src, byte x, byte y) {
|
void erase_sprite(const byte* src, byte x, byte y) {
|
||||||
byte i,j;
|
byte i,j;
|
||||||
byte* dest = &vidmem[y+x*32];
|
byte* dest = &vidmem[x][y];
|
||||||
byte w = *src++;
|
byte w = *src++;
|
||||||
byte h = *src++;
|
byte h = *src++;
|
||||||
for (j=0; j<h; j++) {
|
for (j=0; j<h; j++) {
|
||||||
@@ -144,10 +146,9 @@ void erase_sprite(const byte* src, byte x, byte y) {
|
|||||||
|
|
||||||
void draw_char(char ch, byte x, byte y) {
|
void draw_char(char ch, byte x, byte y) {
|
||||||
byte i;
|
byte i;
|
||||||
byte* dest = &vidmem[y+x*32*8];
|
|
||||||
const byte* src = &font8x8[(ch-LOCHAR)][0];
|
const byte* src = &font8x8[(ch-LOCHAR)][0];
|
||||||
|
byte* dest = &vidmem[x*8][y];
|
||||||
for (i=0; i<8; i++) {
|
for (i=0; i<8; i++) {
|
||||||
//dest[i*32] ^= src[i];
|
|
||||||
*dest ^= *src;
|
*dest ^= *src;
|
||||||
dest += 32;
|
dest += 32;
|
||||||
src += 1;
|
src += 1;
|
||||||
@@ -254,17 +255,17 @@ void draw_bunker(byte x, byte y, byte y2, byte h, byte w) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char in_rect(Entity* e, byte x, byte y) {
|
char in_rect(Entity* e, byte x, byte y, byte w, byte h) {
|
||||||
byte h = e->shape[0];
|
byte eh = e->shape[0];
|
||||||
byte w = e->shape[1];
|
byte ew = e->shape[1];
|
||||||
return (x >= e->x && x <= e->x+w && y >= e->y && y <= e->y+h);
|
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) {
|
Entity* find_entity_at(byte x, byte y) {
|
||||||
byte i;
|
byte i;
|
||||||
for (i=0; i<num_entities; i++) {
|
for (i=0; i<num_entities; i++) {
|
||||||
Entity* e = &entities[i];
|
Entity* e = &entities[i];
|
||||||
if (in_rect(e, x, y)) {
|
if (in_rect(e, x, y, 2, 0)) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,8 +281,6 @@ void check_bullet_hit(byte x, byte y) {
|
|||||||
|
|
||||||
void gameloop() {
|
void gameloop() {
|
||||||
watchdog_strobe = 0b0111 / 14;
|
watchdog_strobe = 0b0111 / 14;
|
||||||
//draw_char('S',0,50);
|
|
||||||
//draw_string("HELLO WORLD", 6, 16);
|
|
||||||
draw_bunker(30, 40, 15, 15, 20);
|
draw_bunker(30, 40, 15, 15, 20);
|
||||||
draw_bunker(120, 40, 15, 15, 20);
|
draw_bunker(120, 40, 15, 15, 20);
|
||||||
draw_sprite(enemy1_bitmap, 10, 20);
|
draw_sprite(enemy1_bitmap, 10, 20);
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var GALAXIAN_PRESETS = [
|
var GALAXIAN_PRESETS = [
|
||||||
|
{id:'minimal.c', name:'Minimal Example'},
|
||||||
|
{id:'hello.c', name:'Hello World'},
|
||||||
|
{id:'gfxtest.c', name:'Graphics Test'},
|
||||||
];
|
];
|
||||||
|
|
||||||
var GALAXIAN_KEYCODE_MAP = makeKeycodeMap([
|
var GALAXIAN_KEYCODE_MAP = makeKeycodeMap([
|
||||||
|
@@ -29,6 +29,7 @@ var VicDualPlatform = function(mainElement) {
|
|||||||
var timerFrequency = 500; // TODO
|
var timerFrequency = 500; // TODO
|
||||||
var reset_disable = false;
|
var reset_disable = false;
|
||||||
var reset_disable_timer;
|
var reset_disable_timer;
|
||||||
|
var framestats;
|
||||||
|
|
||||||
var palette = [
|
var palette = [
|
||||||
0xff000000, // black
|
0xff000000, // black
|
||||||
@@ -70,6 +71,9 @@ var VicDualPlatform = function(mainElement) {
|
|||||||
for (var i=0; i<8; i++) {
|
for (var i=0; i<8; i++) {
|
||||||
var bm = 128>>i;
|
var bm = 128>>i;
|
||||||
pixels[outi] = (data&bm) ? color2 : color1;
|
pixels[outi] = (data&bm) ? color2 : color1;
|
||||||
|
if (framestats) {
|
||||||
|
framestats.layers.tiles[outi] = (data&bm) ? colorprom[col+8] : colorprom[col];
|
||||||
|
}
|
||||||
outi++;
|
outi++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,7 +207,13 @@ var VicDualPlatform = function(mainElement) {
|
|||||||
if (!this.getDebugCallback()) cpu.setTstates(0); // TODO?
|
if (!this.getDebugCallback()) cpu.setTstates(0); // TODO?
|
||||||
}
|
}
|
||||||
this.readAddress = function(addr) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
src/ui.js
14
src/ui.js
@@ -192,7 +192,11 @@ function loadFile(fileid, filename, index) {
|
|||||||
$.get( filename, function( text ) {
|
$.get( filename, function( text ) {
|
||||||
console.log("GET",text.length,'bytes');
|
console.log("GET",text.length,'bytes');
|
||||||
loadCode(text, fileid);
|
loadCode(text, fileid);
|
||||||
}, 'text');
|
}, 'text')
|
||||||
|
.fail(function() {
|
||||||
|
alert("Could not load preset " + fileid);
|
||||||
|
loadCode("", fileid);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var ext = platform.getToolForFilename(fileid);
|
var ext = platform.getToolForFilename(fileid);
|
||||||
@@ -201,7 +205,7 @@ function loadFile(fileid, filename, index) {
|
|||||||
updatePreset(fileid, text);
|
updatePreset(fileid, text);
|
||||||
}, 'text')
|
}, 'text')
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
console.log("Could not load skeleton for " + platform_id + "/" + ext);
|
alert("Could not load skeleton for " + platform_id + "/" + ext);
|
||||||
loadCode("", fileid);
|
loadCode("", fileid);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -925,6 +929,11 @@ function showWelcomeMessage() {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
|
function setupBitmapEditor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
var qs = (function (a) {
|
var qs = (function (a) {
|
||||||
if (!a || a == "")
|
if (!a || a == "")
|
||||||
return {};
|
return {};
|
||||||
@@ -957,6 +966,7 @@ function startPlatform() {
|
|||||||
// start platform and load file
|
// start platform and load file
|
||||||
preloadWorker(qs['file']);
|
preloadWorker(qs['file']);
|
||||||
setupDebugControls();
|
setupDebugControls();
|
||||||
|
setupBitmapEditor();
|
||||||
platform.start();
|
platform.start();
|
||||||
loadPreset(qs['file']);
|
loadPreset(qs['file']);
|
||||||
updateSelector();
|
updateSelector();
|
||||||
|
Reference in New Issue
Block a user