vic20: default tiny bios

This commit is contained in:
Steven Hugg 2023-11-13 22:19:30 -06:00
parent 1c0b3e2fdd
commit a252ea65bd
4 changed files with 36 additions and 6 deletions

View File

@ -0,0 +1,5 @@
org $a000-2 ; so we can write the ...
.word $a000 ; cartridge 2-byte header
.word Start ; start vector
.word Start ; RESTORE vector
.byte $41, $30, $c3, $c2, $cd ; "A0CBM"

View File

@ -66,13 +66,16 @@ export abstract class BaseWASMMachine {
this.exports = wasmResult.exports;
} else throw new Error('could not load WASM file');
}
allocateBIOS(biosBinary: Uint8Array) {
this.biosptr = this.exports.malloc(biosBinary.byteLength);
this.biosarr = new Uint8Array(this.exports.memory.buffer, this.biosptr, biosBinary.byteLength);
}
async fetchBIOS() {
var biosResponse = await fetch('res/'+this.prefix+'.bios');
if (biosResponse.status == 200 || (biosResponse as any as Blob).size) {
var biosBinary = await biosResponse.arrayBuffer();
this.biosptr = this.exports.malloc(biosBinary.byteLength);
this.biosarr = new Uint8Array(this.exports.memory.buffer, this.biosptr, biosBinary.byteLength);
this.loadBIOS(new Uint8Array(biosBinary));
var biosBinary = new Uint8Array(await biosResponse.arrayBuffer());
this.allocateBIOS(biosBinary);
this.loadBIOS(biosBinary);
} else throw new Error('could not load BIOS file');
}
async initWASM() {

View File

@ -26,6 +26,12 @@ export class VIC20_WASMMachine extends BaseWASMMachine implements Machine, Probe
loadBIOS(srcArray: Uint8Array) {
super.loadBIOS(srcArray);
}
async fetchBIOS() {
let bios = new Uint8Array(20480);
bios.set(DEFAULT_BIOS, bios.length - DEFAULT_BIOS.length);
this.allocateBIOS(bios);
this.loadBIOS(new Uint8Array(bios));
}
reset() {
super.reset();
// clear keyboard
@ -170,3 +176,19 @@ export class VIC20_WASMMachine extends BaseWASMMachine implements Machine, Probe
}
}
// pretty much just runs autostart ROM and not much else...
const DEFAULT_BIOS = [
0xA2, 0x10, 0xA0, 0x91, 0x60, 0x71, 0xFF, 0x71, 0xFF, 0x5C, 0xFF, 0xA2, 0xFF, 0x78, 0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../common/emu";
import { BaseMAME6502Platform } from "../common/mameplatform";
const VIC20_PRESETS = [
{id:'hello.dasm', name:'Hello World (ASM)'},
// {id:'hello.dasm', name:'Hello World (ASM)'},
{id:'hellocart.dasm', name:'Hello Cartridge (ASM)'},
{id:'siegegame.c', name:'Siege Game (C)'},
// {id:'siegegame.c', name:'Siege Game (C)'},
];
const VIC20_MEMORY_MAP = { main:[