added emscripten build files; coleco presets

This commit is contained in:
Steven Hugg 2018-11-30 06:43:46 -05:00
parent dfbb5e0f47
commit c0d9bac039
7 changed files with 101 additions and 15 deletions

1
emsrc/mame/mame.build Normal file
View File

@ -0,0 +1 @@
emmake make SUBTARGET=a800 SOURCES=src/mame/drivers/atari400.cpp NOWERROR=1 -j 4

View File

@ -1,11 +1,26 @@
all: js/sdcc.js js/sdasz80.js js/sdldz80.js
# Emscripten target (see https://github.com/apiaryio/emscripten-docker)
js/%.js: js/%.bc
docker run --rm -v $(shell pwd):/src -e USERID=1000 -t apiaryio/emcc emcc -O2 --memory-init-file 0 \
-s ASM_JS=1 \
all: js/appmake.js js/copt.js js/dzx7.js js/sccz80.js js/ticks.js js/ucpp.js js/z80asm.js js/z80nm.js js/z88dk-dis.js js/z88dk-lstmanip.js js/zcc.js js/zcpp.js js/zobjcopy.js js/zpragma.js js/zx7.js wasm/appmake.js wasm/copt.js wasm/dzx7.js wasm/sccz80.js wasm/ticks.js wasm/ucpp.js wasm/z80asm.js wasm/z80nm.js wasm/z88dk-dis.js wasm/z88dk-lstmanip.js wasm/zcc.js wasm/zcpp.js wasm/zobjcopy.js wasm/zpragma.js wasm/zx7.js
js/%.js: bin/%.bc
emcc -O2 --memory-init-file 0 \
-s WASM=0 \
-s MODULARIZE=1 \
-s EXPORT_NAME=\"'$*'\" \
-s 'EXTRA_EXPORTED_RUNTIME_METHODS=["FS"]' \
-s FORCE_FILESYSTEM=1 \
$< -o $@ $(ARGS_$*) \
$< -o $@ $(ARGS_$*)
wasm/%.js: bin/%.bc
emcc -O2 --memory-init-file 0 \
-s WASM=1 \
-s MODULARIZE=1 \
-s EXPORT_NAME=\"'$*'\" \
-s 'EXTRA_EXPORTED_RUNTIME_METHODS=["FS"]' \
-s FORCE_FILESYSTEM=1 \
$< -o $@ $(ARGS_$*)
bin/%.bc: bin/%
cp bin/$* bin/$*.bc

View File

@ -0,0 +1,59 @@
# make clean
# rm CMakeCache.txt
# cmake -G "Unix Makefiles" .
# make
# zip -9r optables binaries/gen_*
# make clean
# rm CMakeCache.txt
# emmake cmake -G "Unix Makefiles" .
# unzip -o optables && touch binaries/gen_*
# emmake make
# (repeat until it works)
all:\
js/wla-6502.js\
js/wla-6510.js\
js/wla-65816.js\
js/wla-65c02.js\
js/wlab.js\
js/wla-gb.js\
js/wla-huc6280.js\
js/wlalink.js\
js/wla-spc700.js\
js/wla-z80.js\
wasm/wla-6502.js\
wasm/wla-6510.js\
wasm/wla-65816.js\
wasm/wla-65c02.js\
wasm/wlab.js\
wasm/wla-gb.js\
wasm/wla-huc6280.js\
wasm/wlalink.js\
wasm/wla-spc700.js\
wasm/wla-z80.js\
js/%.js: bin/%.bc
emcc -O2 --memory-init-file 0 \
-s WASM=0 \
-s MODULARIZE=1 \
-s EXPORT_NAME=\"'$(subst -,_,$*)'\" \
-s 'EXTRA_EXPORTED_RUNTIME_METHODS=["FS"]' \
-s FORCE_FILESYSTEM=1 \
$< -o $@ $(ARGS_$*)
wasm/%.js: bin/%.bc
emcc -O2 --memory-init-file 0 \
-s WASM=1 \
-s MODULARIZE=1 \
-s EXPORT_NAME=\"'$(subst -,_,$*)'\" \
-s 'EXTRA_EXPORTED_RUNTIME_METHODS=["FS"]' \
-s FORCE_FILESYSTEM=1 \
$< -o $@ $(ARGS_$*)
bin/%.bc: binaries/%
mkdir -p bin js wasm
cp $< $@

View File

@ -1,4 +1,4 @@

#include <stdlib.h>
#include <string.h>
#include <cv.h>
@ -6,7 +6,10 @@
#include "common.h"
//#link "common.c"
#ifdef CV_SMS
//#link "fonts.s"
#endif
#define XOFS 12 // sprite horiz. offset

View File

@ -33,12 +33,16 @@ void clrscr() {
cvu_vmemset(IMAGE, 0, COLS*ROWS);
}
word getimageaddr(byte x, byte y) {
return IMAGE + y*COLS + x;
}
byte getchar(byte x, byte y) {
return cvu_vinb(IMAGE + y*COLS + x);
return cvu_vinb(getimageaddr(x,y));
}
void putchar(byte x, byte y, byte attr) {
cvu_voutb(attr, IMAGE + y*COLS + x);
cvu_voutb(attr, getimageaddr(x,y));
}
void putstring(byte x, byte y, const char* string) {

View File

@ -52,6 +52,7 @@ extern char cursor_y;
extern void clrscr();
extern word getimageaddr(byte x, byte y);
extern byte getchar(byte x, byte y);
extern void putchar(byte x, byte y, byte attr);
extern void putstring(byte x, byte y, const char* string);

View File

@ -1,4 +1,4 @@

#include <stdlib.h>
#include <string.h>
#include <cv.h>
@ -169,8 +169,9 @@ void copy_sprites() {
ofs = SPRITES + NSPRITES*4;
for (i=0; i<NMISSILES; i++) {
// sprite struct: {y, x, name, tag}
cvu_voutb(missiles[i].ypos, ofs);
cvu_voutb(missiles[i].xpos, ofs+1);
cv_set_write_vram_address(ofs);
cv_voutb(missiles[i].ypos);
cv_voutb(missiles[i].xpos);
ofs += 4;
}
}
@ -216,24 +217,26 @@ void draw_row(byte row) {
byte x = formation_offset_x / 8;
byte xd = (formation_offset_x & 7) * 3;
byte y = 3 + row * 2;
cv_set_write_vram_address(IMAGE + y*32);
for (i=0; i<x; i++)
putchar(i, y, starfield_get_tile_xy(i,y));
cv_graphics_port = starfield_get_tile_xy(i,y);
for (i=0; i<ENEMIES_PER_ROW; i++) {
byte shape = formation[i + row*ENEMIES_PER_ROW].shape;
if (shape) {
shape += xd;
for (j=0; j<3; j++) {
putchar(x++, y, shape++);
cv_graphics_port = shape++;
x++;
}
} else {
for (j=0; j<3; j++) {
putchar(x, y, starfield_get_tile_xy(x,y));
cv_graphics_port = starfield_get_tile_xy(x,y);
x++;
}
}
}
for (; x<COLS; x++)
putchar(x, y, starfield_get_tile_xy(x,y));
cv_graphics_port = starfield_get_tile_xy(x,y);
}
void draw_next_row() {