diff --git a/src/audio.ts b/src/audio.ts index 9d8f57b8..8a77fdd3 100644 --- a/src/audio.ts +++ b/src/audio.ts @@ -63,6 +63,16 @@ export class SN76489_Audio { // https://user.xmission.com/~trevin/atari/pokey_regs.html // http://krap.pl/mirrorz/atari/homepage.ntlworld.com/kryten_droid/Atari/800XL/atari_hw/pokey.htm +export function newPOKEYAudio(count:number) { + var audio = new MasterAudio(); + for (var i=1; i<=count; i++) { + var pokey = new POKEYDeviceChannel(); + audio['pokey'+i] = pokey; // TODO: cheezy + audio.master.addChannel(pokey); + } + return audio; +} + export var POKEYDeviceChannel = function() { /* definitions for AUDCx (D201, D203, D205, D207) */ diff --git a/src/platform/atari8.ts b/src/platform/atari8.ts index edde6b4a..b301cc0a 100644 --- a/src/platform/atari8.ts +++ b/src/platform/atari8.ts @@ -3,7 +3,7 @@ import { Platform, Base6502Platform, BaseMAMEPlatform, getOpcodeMetadata_6502, getToolForFilename_6502 } from "../baseplatform"; import { PLATFORMS, RAM, newAddressDecoder, padBytes, noise, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap, dumpRAM, getMousePos } from "../emu"; import { hex, lzgmini, stringToByteArray, lpad, rpad, rgb2bgr } from "../util"; -import { MasterAudio, POKEYDeviceChannel } from "../audio"; +import { MasterAudio, POKEYDeviceChannel, newPOKEYAudio } from "../audio"; declare var jt; // for 6502 @@ -17,14 +17,6 @@ const ATARI8_KEYCODE_MAP = makeKeycodeMap([ [Keys.VK_ENTER, 0, 0], ]); -function newPOKEYAudio() { - var pokey1 = new POKEYDeviceChannel(); - var audio = new MasterAudio(); - audio['pokey1'] = pokey1; // TODO: cheezy - audio.master.addChannel(pokey1); - return audio; -} - // ANTIC // https://www.atarimax.com/jindroush.atari.org/atanttim.html @@ -477,7 +469,7 @@ const _Atari8Platform = function(mainElement) { gtia = new GTIA(antic); // create video/audio video = new RasterVideo(mainElement, 352, 192); - audio = newPOKEYAudio(); + audio = newPOKEYAudio(1); video.create(); setKeyboardFromMap(video, inputs, ATARI8_KEYCODE_MAP, (o,key,code,flags) => { // TODO diff --git a/src/platform/vector.ts b/src/platform/vector.ts index 42f3889b..006371cd 100644 --- a/src/platform/vector.ts +++ b/src/platform/vector.ts @@ -3,7 +3,7 @@ import { Platform, BaseZ80Platform, Base6502Platform } from "../baseplatform"; import { PLATFORMS, RAM, newAddressDecoder, padBytes, noise, setKeyboardFromMap, AnimationTimer, VectorVideo, Keys, makeKeycodeMap } from "../emu"; import { hex } from "../util"; -import { MasterAudio, POKEYDeviceChannel } from "../audio"; +import { MasterAudio, POKEYDeviceChannel, newPOKEYAudio } from "../audio"; // http://www.computerarcheology.com/Arcade/Asteroids/DVG.html // http://arcarc.xmission.com/Tech/neilw_xy.txt @@ -41,17 +41,6 @@ var GRAVITAR_KEYCODE_MAP = makeKeycodeMap([ [Keys.VK_LEFT, 1, -0x8], ]); -function newPOKEYAudio() { - var pokey1 = new POKEYDeviceChannel(); - var pokey2 = new POKEYDeviceChannel(); - var audio = new MasterAudio(); - audio['pokey1'] = pokey1; // TODO: cheezy - audio['pokey2'] = pokey2; - audio.master.addChannel(pokey1); - audio.master.addChannel(pokey2); - return audio; -} - var AtariVectorPlatform = function(mainElement) { var XTAL = 12096000; var cpuFrequency = XTAL/8; @@ -103,7 +92,7 @@ var AtariVectorPlatform = function(mainElement) { // create video/audio video = new VectorVideo(mainElement,1024,1024); dvg = new DVGBWStateMachine(bus, video, 0x4000); - audio = newPOKEYAudio(); + audio = newPOKEYAudio(2); video.create(); timer = new AnimationTimer(60, this.nextFrame.bind(this)); setKeyboardFromMap(video, switches, ASTEROIDS_KEYCODE_MAP); @@ -259,7 +248,7 @@ var AtariColorVectorPlatform = function(mainElement) { // create video/audio video = new VectorVideo(mainElement,1024,1024); dvg = new DVGColorStateMachine(bus, video, 0x2000); - audio = newPOKEYAudio(); + audio = newPOKEYAudio(2); video.create(); timer = new AnimationTimer(60, this.nextFrame.bind(this)); setKeyboardFromMap(video, switches, GRAVITAR_KEYCODE_MAP); @@ -404,7 +393,7 @@ var Z80ColorVectorPlatform = function(mainElement, proto) { // create video/audio video = new VectorVideo(mainElement,1024,1024); dvg = new DVGColorStateMachine(bus, video, 0xa000); - audio = newPOKEYAudio(); + audio = newPOKEYAudio(2); video.create(); timer = new AnimationTimer(60, this.nextFrame.bind(this)); setKeyboardFromMap(video, switches, GRAVITAR_KEYCODE_MAP); diff --git a/src/ui.ts b/src/ui.ts index 866f62a3..6c04810d 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -976,8 +976,10 @@ function loadBIOSFromProject() { if (platform.loadBIOS) { var biospath = platform_id + '.rom'; store.getItem(biospath).then( (biosdata) => { - console.log('loading BIOS') - platform.loadBIOS('BIOS', biosdata); + if (biosdata instanceof Uint8Array) { + console.log('loading BIOS') + platform.loadBIOS('BIOS', biosdata); + } }); } }