1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-29 14:51:17 +00:00

making astro c pgms

This commit is contained in:
Steven Hugg 2018-08-28 21:41:51 -04:00
parent 9e900a5a26
commit 132147b1a4
8 changed files with 91 additions and 11 deletions

View File

@ -58,6 +58,8 @@ TODO:
- bring back the profiler! - bring back the profiler!
- vcs disasm is broken - vcs disasm is broken
- links to external tools in ide - links to external tools in ide
- error msg when #link doesn't work
- figure out folders for projects for real
On the website the additional grey spacing next to the program line numbers is not dynamically resized when the web browser window size is changed. Intentional? On the website the additional grey spacing next to the program line numbers is not dynamically resized when the web browser window size is changed. Intentional?

View File

@ -318,7 +318,7 @@ function require(modname) {
<script src="gen/ui.js"></script> <script src="gen/ui.js"></script>
<!-- <script src="src/audio/votrax.js"></script> --> <!-- <script src="src/audio/votrax.js"></script> -->
<script src="local/lzg.js"></script> <!--<script src="local/lzg.js"></script>-->
<script> <script>
startUI(true); startUI(true);

View File

@ -29,7 +29,7 @@ PrgStart: DI ; Disable interrupts
DB 32 ; ... and 32 pixels from the top of the screen DB 32 ; ... and 32 pixels from the top of the screen
DB 00001100b ; ... with no enlargement, foreground color = 11, background color = 00 DB 00001100b ; ... with no enlargement, foreground color = 11, background color = 00
DW PrgName ; ... to show string at PrgName DW PrgName ; ... to show string at PrgName
; EXIT ; Exit interpreter mode EXIT ; Exit interpreter mode
Loop: JP Loop ; Play infinite loop Loop: JP Loop ; Play infinite loop
Palettes: DB $BF,$00,$00,$00 ; Left color palette (11b, 10b, 01b, 00b) Palettes: DB $BF,$00,$00,$00 ; Left color palette (11b, 10b, 01b, 00b)
DB $E7,$9A,$39,$19 ; Right color palette (11b, 10b, 01b, 00b) DB $E7,$9A,$39,$19 ; Right color palette (11b, 10b, 01b, 00b)

View File

@ -0,0 +1,11 @@

; Minimal header file for use with Astrocade C programs
.area _CODE
.byte 0x55 ; ... with the code for a normal menued cartridge
.word 0x0218 ; Initialize menu
.word PrgName ; ... with string at PrgName
.word _main ; ... such that selecting the program enters PrgStart
PrgName: .ascii "8BITWORKSHOP" ; String
.byte 0 ; ... which must be followed by 0

View File

@ -0,0 +1,8 @@
//#link "acheader.s"
#include <string.h>
void main() {
memset((void*)0x4000, 0, 0xe00); // clear screen, avoid vars and stack (1e00-1fff)
}

View File

@ -0,0 +1,35 @@
; Demo 1: HELLO, WORLDS! / 2018 hxlnt
; Inspired by Adam Trionfo's Hello World
; http://www.ballyalley.com/ml/ml_homebrew/helloworld/hello.asm
; Assemble with Zmac 1.3
; From: https://github.com/hxlnt/astrocade
INCLUDE "hvglib.h" ; Include HVGLIB library
ORG FIRSTC ; Initialize at beginning of cartridge ROM area
DB $55 ; ... with the code for a normal menued cartridge
DW MENUST ; Initialize menu
DW PrgName ; ... with string at PrgName
DW PrgStart ; ... such that selecting the program enters PrgStart
PrgName: DB "HELLO, WORLDS!"; String
DB 0 ; ... which must be followed by 0
PrgStart: DI ; Disable interrupts
SYSTEM INTPC ; Begin interpreter mode
DO SETOUT ; Set output ports
DB 100*2 ; ... with VBLANK line set to line 100
DB 112/4 ; ... with color boundary 112 pixels from the left of the screen
DB 00001000b ; ... with screen interrupts reenabled
DO COLSET ; Set color palettes
DW Palettes ; ... with the values at Palettes
DO FILL ; Set background fill
DW NORMEM ; ... starting at the beginning of screen RAM
DW 100*BYTEPL ; ... and going for 100 lines
DB 00010010b ; ... with a fill pattern of three different colored pixels
DO STRDIS ; Set string display
DB 0 ; ... starting 0 pixels from the left of the screen
DB 32 ; ... and 32 pixels from the top of the screen
DB 00001100b ; ... with no enlargement, foreground color = 11, background color = 00
DW PrgName ; ... to show string at PrgName
EXIT ; Exit interpreter mode
Loop: JP Loop ; Play infinite loop
Palettes: DB $BF,$00,$00,$00 ; Left color palette (11b, 10b, 01b, 00b)
DB $E7,$9A,$39,$19 ; Right color palette (11b, 10b, 01b, 00b)

View File

@ -11,7 +11,7 @@ const ASTROCADE_PRESETS = [
{id:'03-horcbpal.asm', name:'Paddle Demo'}, {id:'03-horcbpal.asm', name:'Paddle Demo'},
]; ];
// TODO: fix keys, more controllers, paddles, vibrato/noise, border color // TODO: fix keys, more controllers, paddles, vibrato/noise, border color, full refresh
const ASTROCADE_KEYCODE_MAP = makeKeycodeMap([ const ASTROCADE_KEYCODE_MAP = makeKeycodeMap([
// player 1 // player 1
@ -53,10 +53,8 @@ const ASTROCADE_KEYCODE_MAP = makeKeycodeMap([
const _BallyAstrocadePlatform = function(mainElement) { const _BallyAstrocadePlatform = function(mainElement) {
var cpu, ram, membus, iobus, rom, bios; var cpu, ram, membus, iobus, rom, bios;
var probe;
var video, timer, pixels; var video, timer, pixels;
var audio, psg; var audio, psg;
var inputs = new Uint8Array(0x20);
//var watchdog_counter; //var watchdog_counter;
const swidth = 160; const swidth = 160;
const sheight = 102; const sheight = 102;
@ -66,6 +64,8 @@ const _BallyAstrocadePlatform = function(mainElement) {
const PIXEL_ON = 0xffeeeeee; const PIXEL_ON = 0xffeeeeee;
const PIXEL_OFF = 0xff000000; const PIXEL_OFF = 0xff000000;
// state variables
var inputs = new Uint8Array(0x20);
var magicop = 0; var magicop = 0;
var xpand = 0; var xpand = 0;
var xplower = false; var xplower = false;
@ -157,8 +157,11 @@ const _BallyAstrocadePlatform = function(mainElement) {
start = function() { start = function() {
ram = new RAM(0x2000); ram = new RAM(0x2000);
bios = new lzgmini().decode(stringToByteArray(atob(window['ASTROCADE_LZGROM']))); var lzgrom = window['ASTROCADE_LZGROM'];
//displayPCs = new Uint16Array(new ArrayBuffer(0x2000*2)); if (lzgrom)
bios = new lzgmini().decode(stringToByteArray(atob(lzgrom)));
else
bios = padBytes([0xf3, 0x31, 0x00, 0x50, 0x21, 0x05, 0x20, 0x7e, 0x23, 0x66, 0x6f, 0xe9], 0x2000); // SP=$5000, jump to ($2005)
membus = { membus = {
read: newAddressDecoder([ read: newAddressDecoder([
[0x0000, 0x1fff, 0x1fff, function(a) { return bios ? bios[a] : 0; }], [0x0000, 0x1fff, 0x1fff, function(a) { return bios ? bios[a] : 0; }],
@ -281,14 +284,32 @@ const _BallyAstrocadePlatform = function(mainElement) {
cpu.loadState(state.c); cpu.loadState(state.c);
ram.mem.set(state.b); ram.mem.set(state.b);
palette.set(state.palette); palette.set(state.palette);
magicop = state.magicop;
xpand = state.xpand;
xplower = state.xplower;
shift2 = state.shift2;
horcb = state.horcb;
inmod = state.inmod;
inlin = state.inlin;
infbk = state.infbk;
verbl = state.verbl;
this.loadControlsState(state); this.loadControlsState(state);
} }
saveState() { saveState() {
return { return {
c:this.getCPUState(), c: this.getCPUState(),
b:ram.mem.slice(0), b: ram.mem.slice(0),
in:inputs.slice(0), in: inputs.slice(0),
palette:palette.slice(0), palette: palette.slice(0),
magicop: magicop,
xpand: xpand,
xplower: xplower,
shift2: shift2,
horcb: horcb,
inmod: inmod,
inlin: inlin,
infbk: infbk,
verbl: verbl,
}; };
} }
loadControlsState(state) { loadControlsState(state) {

View File

@ -917,6 +917,9 @@ function assembleSDASZ80(step) {
path:step.path, path:step.path,
msg:matches[1] msg:matches[1]
}); });
} else {
// ?ASxxxx-Error-<q> in line 1627 of cosmic.asm
// <q> missing or improper operators, terminators, or delimiters
} }
} }
var ASZ80 = sdasz80({ var ASZ80 = sdasz80({