mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-28 05:29:33 +00:00
apple2: implement loadBIOS / apple2.rom
This commit is contained in:
parent
b3d42f944b
commit
5970ae5bcc
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import { MOS6502, MOS6502State } from "../common/cpu/MOS6502";
|
import { MOS6502, MOS6502State } from "../common/cpu/MOS6502";
|
||||||
import { Bus, BasicScanlineMachine, SavesState } from "../common/devices";
|
import { Bus, BasicScanlineMachine, SavesState, AcceptsBIOS } from "../common/devices";
|
||||||
import { KeyFlags } from "../common/emu"; // TODO
|
import { KeyFlags } from "../common/emu"; // TODO
|
||||||
import { hex, lzgmini, stringToByteArray, RGBA, printFlags } from "../common/util";
|
import { hex, lzgmini, stringToByteArray, RGBA, printFlags } from "../common/util";
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ interface SlotDevice extends Bus {
|
|||||||
readConst(address: number) : number;
|
readConst(address: number) : number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AppleII extends BasicScanlineMachine {
|
export class AppleII extends BasicScanlineMachine implements AcceptsBIOS {
|
||||||
|
|
||||||
// approx: http://www.cs.columbia.edu/~sedwards/apple2fpga/
|
// approx: http://www.cs.columbia.edu/~sedwards/apple2fpga/
|
||||||
cpuFrequency = 1022727;
|
cpuFrequency = 1022727;
|
||||||
@ -88,9 +88,7 @@ export class AppleII extends BasicScanlineMachine {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.bios = new lzgmini().decode(stringToByteArray(atob(APPLEIIGO_LZG)));
|
this.loadBIOS(new lzgmini().decode(stringToByteArray(atob(APPLEIIGO_LZG))));
|
||||||
this.bios[0x39a] = 0x60; // $d39a = RTS
|
|
||||||
this.ram.set(this.bios, 0xd000);
|
|
||||||
this.ram[0xbf00] = 0x4c; // fake DOS detect for C
|
this.ram[0xbf00] = 0x4c; // fake DOS detect for C
|
||||||
this.ram[0xbf6f] = 0x01; // fake DOS detect for C
|
this.ram[0xbf6f] = 0x01; // fake DOS detect for C
|
||||||
this.connectCPUMemoryBus(this);
|
this.connectCPUMemoryBus(this);
|
||||||
@ -131,6 +129,11 @@ export class AppleII extends BasicScanlineMachine {
|
|||||||
loadControlsState(s:AppleIIControlsState) {
|
loadControlsState(s:AppleIIControlsState) {
|
||||||
this.kbdlatch = s.kbdlatch;
|
this.kbdlatch = s.kbdlatch;
|
||||||
}
|
}
|
||||||
|
loadBIOS(data, title?) {
|
||||||
|
this.bios = Uint8Array.from(data);
|
||||||
|
this.bios[0x39a] = 0x60; // $d39a = RTS
|
||||||
|
this.ram.set(this.bios, 0xd000);
|
||||||
|
}
|
||||||
loadROM(data) {
|
loadROM(data) {
|
||||||
if (data.length == 35*16*256) { // is it a disk image?
|
if (data.length == 35*16*256) { // is it a disk image?
|
||||||
var diskii = new DiskII(this, data);
|
var diskii = new DiskII(this, data);
|
||||||
|
Loading…
Reference in New Issue
Block a user