1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-24 09:30:45 +00:00

Merge branch 'master' of github.com:sehugg/8bitworkshop

This commit is contained in:
Steven Hugg 2019-03-16 18:48:09 -04:00
commit 49929e28b3
12 changed files with 108 additions and 87 deletions

View File

@ -16,8 +16,7 @@ TODO:
- break on BRK/illegal opcode?
- multiple breakpoints, expression breakpoints
- watchpoints
- breakpoints
- debug inspector
- debug inspector for variables
- MAME single step (?)
- step over (line, instruction)
- slowdown beam for all platforms?
@ -39,13 +38,12 @@ TODO:
- online tools for music etc
- text log debugging script
- NES crt should mark raster pos when debugging
- intro/help text for each platform (+ memory map)
- intro/help text for each platform
- vscode/atom extension?
- navigator.getGamepads
- VCS library
- VCS asm library
- better VCS single stepping, maybe also listings
- VCS skips step on lsr/lsr after run to line
- bring back the profiler!
- links to external tools in ide
- error msg when #link doesn't work
- figure out folders for projects for real
@ -55,7 +53,6 @@ TODO:
- quantify verilog "graph iterations"
- debug bankswitching for funky formats
- spaces in filename don't parse code listing (DASM, maybe more)
- zmac: item_lookup needs better hash function
- 'undefined' for bitmap replacer
- astrocade: run to cursor in hello world messes up emulation
- requestInterrupt needs to be disabled after breakpoint?
@ -73,13 +70,11 @@ TODO:
- compiler flags for final ROM build
- workermain: split build functions, better msg types
- vcs: INPTx needs to be added to control state
- rename, delete, save as
- sdcc: can't link asm files before c files (e.g. acheader.s must be last)
- what if >1 file with same name? (local/nonlocal/directory)
- what if .c and .s names collide?
- live coding URL
- memory viewer: ROM/RAM/VRAM/etc
- resize memory browser when split resize (any div resize)
- resize memory browser when vertical div resize
- preroll the emulator so optimizer does its thing before loading rom
- wasm dynamic linking of emulators (https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md)
- use alternate confirm/prompt dialogs
@ -94,8 +89,6 @@ TODO:
- https://makecode.com/language?
- show .map file in listings? memory map view?
- open ROM from URL?
- NES: disassembly not aligned on PC
- NES: vrambuf.c for Solarian
- game starts even if switched away before first load
- vcs: break on # of lines changed (maybe using getRasterPosition?)
- profiler restarts when paused

View File

@ -1,9 +1,10 @@
# Emscripten target (see https://github.com/apiaryio/emscripten-docker)
DOCKEREMCC=docker run --rm -v $(shell pwd):/src -e USERID=$(shell id -u) -t apiaryio/emcc
CC=emcc
%.js: bin/%.bc
$(DOCKEREMCC) emcc -O2 --memory-init-file 0 \
all: js/cc65.js js/ca65.js js/ld65.js
js/%.js: bin/%.bc
emcc -O2 --memory-init-file 0 \
-s ASM_JS=1 \
-s MODULARIZE=1 \
-s EXPORT_NAME=\"'$*'\" \
@ -13,13 +14,32 @@ DOCKEREMCC=docker run --rm -v $(shell pwd):/src -e USERID=$(shell id -u) -t apia
bin/%.bc:
mkdir -p bin js
$(DOCKEREMCC) emmake make $*
emmake make $* CC=emcc
cp bin/$*.exe bin/$*.bc
emscripten: include asminc cfg lib/apple2.lib target/apple2
cp -rp src Makefile js
make -C js cc65.js ca65.js co65.js ld65.js
$(DOCKEREMCC) \
python /emscripten/tools/file_packager.py fs65.data \
--preload include asminc cfg lib/apple2.lib target/apple2 \
FILE_PACKAGER=python $(EMSCRIPTEN)/tools/file_packager.py
fs65-all.js:
python $(EMSCRIPTEN)/tools/file_packager.py fs65.data \
--preload include asminc cfg lib target \
neslib/nes.cfg@cfg/neslib.cfg \
neslib/neslib.lib@lib/neslib.lib \
neslib/neslib.h@include/neslib.h \
--separate-metadata --js-output=fs65.js
fs65-nes.js:
$(FILE_PACKAGER) fs65-nes.data --separate-metadata --js-output=$@ \
--preload include asminc cfg/nes* lib/nes* target/nes* \
neslib/nes.cfg@cfg/neslib.cfg \
neslib/neslib.lib@lib/neslib.lib \
neslib/neslib.h@include/neslib.h \
fs65-atari8.js:
$(FILE_PACKAGER) fs65-atari8.data --separate-metadata --js-output=$@ \
--preload include asminc cfg/atari* lib/atari* target/atari*
fs65-%.js:
$(FILE_PACKAGER) fs65-$*.data --separate-metadata --js-output=$@ \
--preload include asminc cfg/$** lib/$** target/$**
filesystems: fs65-nes.js fs65-apple2.js fs65-c64.js fs65-atari8.js

View File

@ -1,3 +1,14 @@
CC65LIB=../../src/worker/lib/nes/
NESLIB=$(HOME)/compilers/cc65/neslib/
shoot2: shoot2.c neslib.h
cl65 -tnes -O -o $@ -l $@.lst vrambuf.c bcd.c apu.c shoot2.c -lnes -lneslib $(CC65LIB)/crt0.o -L$(CC65LIB) -C$(NESLIB)/nes.cfg\
-Wl -DNES_MIRRORING=1 -Wl -DNES_PRG_BANKS=2 -Wl -DNES_CHR_BANKS=0 -Wl -DNES_MAPPER=2
conio: conio.c
cl65 -l conio.lst -tnes -O $<
test.rom: ex2.asm nesdefs.asm nesppu.asm
dasm ex2.asm

View File

@ -429,15 +429,9 @@ void return_attacker(register AttackingEnemy* a) {
}
}
#pragma bss-name (push,"ZEROPAGE")
#pragma data-name (push,"ZEROPAGE")
int sincos;
#pragma data-name(pop)
#pragma bss-name (pop)
void fly_attacker(register AttackingEnemy* a) {
#if 1
//register int sincos;
#ifdef USE_FASTLUT
static int sincos;
sincos = FASTLUT16(sincos, SINTBL2, a->dir&31);
a->x += sincos;
sincos = FASTLUT16(sincos, SINTBL2, (a->dir+8)&31);
@ -766,6 +760,10 @@ void play_round() {
}
}
// turn off aggressive inlining to save a few bytes
// functions after this point aren't called often
#pragma codesize(100)
void set_shifted_pattern(const byte* src, word dest, byte shift) {
static byte buf[16*3];
byte y;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -474,7 +474,7 @@ function loadWASM(modulename:string, debug?:boolean) {
xhr.send(null);
if (xhr.response) {
wasmBlob[modulename] = new Uint8Array(xhr.response);
console.log("Loaded " + modulename + ".wasm");
console.log("Loaded " + modulename + ".wasm (" + wasmBlob[modulename].length + " bytes)");
loaded[modulename] = 1;
} else {
throw Error("Could not load WASM file " + modulename + ".wasm");
@ -1022,7 +1022,7 @@ function fixParamsWithDefines(path:string, params){
}
function compileCC65(step:BuildStep) {
load("cc65");
loadNative("cc65");
var params = step.params;
// stderr
var re_err1 = /.*?[(](\d+)[)].*?: (.+)/;
@ -1043,6 +1043,7 @@ function compileCC65(step:BuildStep) {
var destpath = step.prefix + '.s';
if (staleFiles(step, [destpath])) {
var CC65 = emglobal.cc65({
instantiateWasm: moduleInstFn('cc65'),
noInitialRun:true,
//logReadFiles:true,
print:print_fn,
@ -1053,7 +1054,7 @@ function compileCC65(step:BuildStep) {
populateFiles(step, FS);
fixParamsWithDefines(step.path, params);
execMain(step, CC65, ['-T', '-g',
'-Oirs',
'-Oirs', // don't inline CodeSizeFactor 200? (no -Oi)
'-Cl', // static locals
'-I', '/share/include',
'-D' + params.define,