Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions css/ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -812,4 +812,7 @@ div.scripting-cell button:hover {
}
div.scripting-cell button.scripting-enabled {
background-color: #339999;
}
.dialog-help {
color: #6666ff;
}
4 changes: 2 additions & 2 deletions doc/platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Mandatory functions:
These are for the compiler/editor:
~~~
getToolForFilename(s:string) : string;
getDefaultExtension() : string;
getDefaultExtensions() : string[];
getPresets() : Preset[];
~~~

Expand Down Expand Up @@ -205,7 +205,7 @@ class ColecoVisionMAMEPlatform extends BaseMAMEPlatform implements Platform {

getPresets() { return ColecoVision_PRESETS; }
getToolForFilename = getToolForFilename_z80;
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [".c", ".ns", ".s", ".scc", ".sgb", ".z", ".wiz"]; }
}
~~~

Expand Down
13 changes: 8 additions & 5 deletions src/common/baseplatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface Platform {
reset(): void;
isRunning(): boolean;
getToolForFilename(s: string): string;
getDefaultExtension(): string;
getDefaultExtensions(): string[];
getPresets?(): Preset[];
pause(): void;
resume(): void;
Expand Down Expand Up @@ -480,7 +480,7 @@ export abstract class Base6502Platform extends BaseDebugPlatform {
return disassemble6502(pc, read(pc), read(pc + 1), read(pc + 2));
}
getToolForFilename = getToolForFilename_6502;
getDefaultExtension() { return ".a"; };
getDefaultExtensions() { return [".c", ".cpp", ".acme", ".ca65", ".dasm", ".ecs", ".wiz"]; };

getDebugCategories() {
return ['CPU', 'ZPRAM', 'Stack'];
Expand Down Expand Up @@ -600,7 +600,7 @@ export abstract class BaseZ80Platform extends BaseDebugPlatform {
}

getToolForFilename = getToolForFilename_z80;
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [".c", ".ns", ".s", ".scc", ".sgb", ".z", ".wiz"]; };
// TODO: Z80 opcode metadata
//this.getOpcodeMetadata = function() { }

Expand Down Expand Up @@ -677,7 +677,7 @@ export abstract class Base6809Platform extends BaseZ80Platform {
// TODO: don't create new CPU
return Object.create(CPU6809()).disasm(read(pc), read(pc + 1), read(pc + 2), read(pc + 3), read(pc + 4), pc);
}
getDefaultExtension(): string { return ".asm"; };
getDefaultExtensions() { return [".c", ".lwasm", ".xasm"]; };
//this.getOpcodeMetadata = function() { }
getToolForFilename = getToolForFilename_6809;
getDebugCategories() {
Expand Down Expand Up @@ -789,7 +789,7 @@ export abstract class BaseMachinePlatform<T extends Machine> extends BaseDebugPl

abstract newMachine(): T;
abstract getToolForFilename(s: string): string;
abstract getDefaultExtension(): string;
abstract getDefaultExtensions(): string[];
abstract getPresets(): Preset[];

constructor(mainElement: HTMLElement) {
Expand Down Expand Up @@ -979,6 +979,7 @@ export abstract class Base6502MachinePlatform<T extends Machine> extends BaseMac

getOpcodeMetadata = getOpcodeMetadata_6502;
getToolForFilename(fn) { return getToolForFilename_6502(fn); }
getDefaultExtensions() { return [".c", ".cpp", ".acme", ".ca65", ".dasm", ".ecs", ".wiz"]; }

disassemble(pc: number, read: (addr: number) => number): DisasmLine {
return disassemble6502(pc, read(pc), read(pc + 1), read(pc + 2));
Expand All @@ -1003,6 +1004,7 @@ export abstract class BaseZ80MachinePlatform<T extends Machine> extends BaseMach

//getOpcodeMetadata = getOpcodeMetadata_z80;
getToolForFilename = getToolForFilename_z80;
getDefaultExtensions() { return [".c", ".ns", ".s", ".scc", ".sgb", ".z", ".wiz"]; }

getDebugCategories() {
if (isDebuggable(this.machine))
Expand Down Expand Up @@ -1032,6 +1034,7 @@ export abstract class BaseZ80MachinePlatform<T extends Machine> extends BaseMach
export abstract class Base6809MachinePlatform<T extends Machine> extends BaseMachinePlatform<T> {

getToolForFilename = getToolForFilename_6809;
getDefaultExtensions() { return [".c", ".lwasm", ".xasm"]; }

getDebugCategories() {
if (isDebuggable(this.machine))
Expand Down
10 changes: 7 additions & 3 deletions src/ide/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,18 @@ function checkEnteredFilename(fn: string): boolean {

function _createNewFile(e) {
// TODO: support spaces
var extensions = platform.getDefaultExtensions();
bootbox.prompt({
title: "Enter the name of your new main source file.",
placeholder: "newfile" + platform.getDefaultExtension(),
title: "Enter the name of your new main source file.<br><br>" +
"<span class='dialog-help'>" +
(extensions.length > 1 ? extensions.join(" ") : "") +
"</span>",
placeholder: "newfile" + extensions[0],
callback: (filename) => {
if (filename && filename.trim().length > 0) {
if (!checkEnteredFilename(filename)) return;
if (filename.indexOf(".") < 0) {
filename += platform.getDefaultExtension();
filename += extensions[0];
}
var path = filename;
gaEvent('workspace', 'file', 'new');
Expand Down
4 changes: 2 additions & 2 deletions src/platform/apple2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Apple2MAMEPlatform extends BaseMAME6502Platform implements Platform {
}

getOpcodeMetadata = getOpcodeMetadata_6502;
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [".c", ".cpp", ".acme", ".ca65", ".dasm", ".ecs", ".wiz"]; }
getToolForFilename = getToolForFilename_6502;

getPresets() { return APPLE2_PRESETS; }
Expand All @@ -64,7 +64,7 @@ class NewApple2Platform extends Base6502MachinePlatform<AppleII> implements Plat

newMachine() { return new AppleII(); }
getPresets() { return APPLE2_PRESETS; }
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [...super.getDefaultExtensions(), ".lnk"]; }
readAddress(a) { return this.machine.readConst(a); }
// TODO loadBIOS(bios) { this.machine.loadBIOS(a); }
getMemoryMap = function () {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/arm32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export abstract class BaseARMMachinePlatform<T extends Machine> extends BaseMach
return "armtcc";
}
getPresets() { return ARM32_PRESETS; }
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [".c", ".armips", ".vasm"]; }
}

class ARM32Platform extends BaseARMMachinePlatform<ARM32Machine> implements Platform {
Expand Down
1 change: 0 additions & 1 deletion src/platform/astrocade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class BallyAstrocadePlatform extends BaseZ80MachinePlatform<BallyAstrocade> impl

newMachine() { return new BallyAstrocade(false); }
getPresets() { return ASTROCADE_PRESETS; }
getDefaultExtension() { return ".c"; };
readAddress(a) { return this.machine.read(a); }
getMemoryMap = function() { return { main:[
{name:'BIOS',start:0x0,size:0x2000,type:'rom'},
Expand Down
2 changes: 1 addition & 1 deletion src/platform/atari7800.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Atari7800Platform extends Base6502MachinePlatform<Atari7800> implements Pl

newMachine() { return new Atari7800(); }
getPresets() { return Atari7800_PRESETS; }
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [...super.getDefaultExtensions(), ".cc7800"]; }
readAddress(a) { return this.machine.readConst(a); }
// TODO loadBIOS(bios) { this.machine.loadBIOS(a); }
getMemoryMap = function() { return { main:[
Expand Down
4 changes: 2 additions & 2 deletions src/platform/atari8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function getToolForFilename_Atari8(fn:string) {
class Atari800Platform extends Base6502MachinePlatform<Atari800> {
newMachine() { return new Atari800(); }
getPresets() { return Atari800_PRESETS; }
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [...super.getDefaultExtensions(), ".bas"]; }
getToolForFilename = getToolForFilename_Atari8;
readAddress(a) { return this.machine.readConst(a); }
getMemoryMap() { return Atari800_MemoryMap; }
Expand Down Expand Up @@ -83,7 +83,7 @@ abstract class Atari8MAMEPlatform extends BaseMAME6502Platform {
getPresets() { return Atari8_PRESETS; }
getToolForFilename = getToolForFilename_Atari8;
getOpcodeMetadata = getOpcodeMetadata_6502;
getDefaultExtension() { return ".asm"; };
getDefaultExtensions() { return [".c", ".bas", ".cpp", ".acme", ".ca65", ".dasm", ".ecs", ".wiz"]; }
showHelp = atari8_showHelp;
}

Expand Down
2 changes: 1 addition & 1 deletion src/platform/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class BASICPlatform implements Platform {

isBlocked() { return this.tty.waitingfor != null || this.runtime.exited; } // is blocked for input?
isRunning() { return this.timer.isRunning(); }
getDefaultExtension() { return ".bas"; }
getDefaultExtensions() { return [".bas"]; }
getToolForFilename() { return "basic"; }
getPresets() { return BASIC_PRESETS; }

Expand Down
3 changes: 1 addition & 2 deletions src/platform/c64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class C64WASMPlatform extends Base6502MachinePlatform<C64_WASMMachine> implement
newMachine() { return new C64_WASMMachine('c64'); }

getPresets() { return C64_PRESETS; }
getDefaultExtension() { return ".c"; };
readAddress(a) { return this.machine.readConst(a); }
getMemoryMap() { return C64_MEMORY_MAP; }
showHelp() { return "https://8bitworkshop.com/docs/platforms/c64/" }
Expand All @@ -87,7 +86,7 @@ abstract class C64MAMEPlatform extends BaseMAME6502Platform {
getPresets() { return C64_PRESETS; }
getToolForFilename = getToolForFilename_6502;
getOpcodeMetadata = getOpcodeMetadata_6502;
getDefaultExtension() { return ".c"; }
getDefaultExtensions() { return [".c", ".cpp", ".acme", ".ca65", ".dasm", ".ecs", ".wiz"]; }
loadROM(title, data) {
if (!this.started) {
this.startModule(this.mainElement, {
Expand Down
3 changes: 1 addition & 2 deletions src/platform/coleco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class ColecoVisionPlatform extends BaseZ80MachinePlatform<ColecoVision> implemen

newMachine() { return new ColecoVision(); }
getPresets() { return ColecoVision_PRESETS; }
getDefaultExtension() { return ".c"; };
readAddress(a) { return this.machine.read(a); }
readVRAMAddress(a) { return this.machine.readVRAMAddress(a); }
// TODO loadBIOS(bios) { this.machine.loadBIOS(a); }
Expand Down Expand Up @@ -65,7 +64,7 @@ class ColecoVisionMAMEPlatform extends BaseMAMEZ80Platform implements Platform {
getPresets() { return ColecoVision_PRESETS; }

getToolForFilename = getToolForFilename_z80;
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [".c", ".ns", ".s", ".scc", ".sgb", ".z", ".wiz"]; }
}


Expand Down
1 change: 0 additions & 1 deletion src/platform/cpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class CPCWASMPlatform extends BaseZ80MachinePlatform<CPC_WASMMachine> implements
newMachine() { return new CPC_WASMMachine('cpc'); }

getPresets() { return CPC_PRESETS; }
getDefaultExtension() { return ".asm"; };
readAddress(a) { return this.machine.readConst(a); }
getMemoryMap() { return CPC_MEMORY_MAP; }
showHelp() {
Expand Down
1 change: 0 additions & 1 deletion src/platform/devel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ class Devel6502Platform extends Base6502MachinePlatform<Devel6502> implements Pl

newMachine() { return new Devel6502(); }
getPresets() { return DEVEL_6502_PRESETS; }
getDefaultExtension() { return ".dasm"; };
readAddress(a) { return this.machine.readConst(a); }

getMemoryMap = function() { return { main:[
Expand Down
1 change: 0 additions & 1 deletion src/platform/exidy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class ExidyUGBPlatform extends Base6502MachinePlatform<ExidyUGBv2> implements Pl

newMachine() { return new ExidyUGBv2(); }
getPresets() { return EXIDY_PRESETS; }
getDefaultExtension() { return ".dasm"; };
readAddress(a) { return this.machine.readConst(a); }

getMemoryMap() {
Expand Down
1 change: 0 additions & 1 deletion src/platform/galaxian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class GalaxianPlatform extends BaseZ80MachinePlatform<GalaxianMachine> implement

newMachine() { return new GalaxianMachine(); }
getPresets() { return GALAXIAN_PRESETS; }
getDefaultExtension() { return ".c"; };
readAddress(a) { return this.machine.readConst(a); }
readVRAMAddress(a) { return (a < 0x800) ? this.machine.vram[a] : this.machine.oram[a-0x800]; }
// TODO loadBIOS(bios) { this.machine.loadBIOS(a); }
Expand Down
5 changes: 2 additions & 3 deletions src/platform/gb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { GameBoyMachine } from "../machine/gb";
import { BaseMachinePlatform, cpuStateToLongString_SM83, getToolForFilename_z80, Platform, Preset, dumpStackToString, isDebuggable, EmuState, DisasmLine } from "../common/baseplatform";
import { PLATFORMS } from "../common/emu";
Expand All @@ -13,7 +12,7 @@ class GameBoyPlatform extends BaseMachinePlatform<GameBoyMachine> implements Pla

newMachine() { return new GameBoyMachine(); }
getPresets() { return GB_PRESETS; }
getDefaultExtension() { return ".c"; }
getDefaultExtensions() { return [".c", ".ns", ".s", ".scc", ".sgb", ".z", ".wiz"]; }
getToolForFilename = getToolForFilename_z80;
readAddress(a) { return this.machine.read(a); }
readVRAMAddress(a) { return this.machine.readVRAMAddress(a); }
Expand Down Expand Up @@ -72,4 +71,4 @@ class GameBoyPlatform extends BaseMachinePlatform<GameBoyMachine> implements Pla
}

PLATFORMS['gb'] = GameBoyPlatform;
PLATFORMS['gameboy'] = GameBoyPlatform;
PLATFORMS['gameboy'] = GameBoyPlatform;
1 change: 0 additions & 1 deletion src/platform/kim1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class KIM1Platform extends Base6502MachinePlatform<KIM1> implements Platform {

newMachine() { return new KIM1(); }
getPresets() { return KIM1_PRESETS; }
getDefaultExtension() { return ".dasm"; };
readAddress(a) { return this.machine.readConst(a); }

getMemoryMap = function() { return { main:[
Expand Down
4 changes: 2 additions & 2 deletions src/platform/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class MarkdownPlatform implements Platform {
getToolForFilename(fn : string) : string {
return "markdown";
}
getDefaultExtension() : string {
return ".md";
getDefaultExtensions() {
return [".md"];
}
getPresets() {
return [
Expand Down
2 changes: 1 addition & 1 deletion src/platform/msx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MSXPlatform extends BaseZ80MachinePlatform<MSX1> implements Platform {

newMachine() { return new MSX1(); }
getPresets() { return MSX_BIOS_PRESETS; }
getDefaultExtension() { return ".c"; };

readAddress(a) { return this.machine.read(a); }
readVRAMAddress(a) { return this.machine.readVRAMAddress(a); }
getMemoryMap = function() { return { main:[
Expand Down
1 change: 0 additions & 1 deletion src/platform/mw8080bw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class Midway8080BWPlatform extends BaseZ80MachinePlatform<Midway8080> implements

newMachine() { return new Midway8080(); }
getPresets() { return MW8080BW_PRESETS; }
getDefaultExtension() { return ".c"; };
readAddress(a) { return this.machine.read(a); }
getMemoryMap = function() { return { main:[
{name:'Frame Buffer',start:0x2400,size:7168,type:'ram'},
Expand Down
4 changes: 2 additions & 2 deletions src/platform/nes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class JSNESPlatform extends Base6502Platform implements Platform, Probeable {
getOriginPC() { // TODO: is actually NMI
return (this.readAddress(0xfffa) | (this.readAddress(0xfffb) << 8)) & 0xffff;
}
getDefaultExtension() { return ".c"; }
getDefaultExtensions() { return [...super.getDefaultExtensions(), ".nesasm"]; }

getROMExtension() { return ".nes"; }

Expand Down Expand Up @@ -558,7 +558,7 @@ class NESMAMEPlatform extends BaseMAME6502Platform implements Platform {
getPresets() { return JSNES_PRESETS; }
getToolForFilename = getToolForFilename_6502;
getOpcodeMetadata = getOpcodeMetadata_6502;
getDefaultExtension() { return ".c"; };
getDefaultExtensions() { return [".c", ".cpp", ".acme", ".ca65", ".dasm", ".ecs", ".wiz"]; }

}

Expand Down
4 changes: 2 additions & 2 deletions src/platform/pce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class PCEnginePlatform implements Platform {
getToolForFilename(fn: string): string {
return getToolForFilename_6502(fn);
}
getDefaultExtension(): string {
return ".pce";
getDefaultExtensions() {
return [".c", ".cpp", ".acme", ".ca65", ".dasm", ".ecs", ".wiz"];
}
readAddress(addr: number): number {
return this.pce.Get(addr);
Expand Down
6 changes: 3 additions & 3 deletions src/platform/sms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SG1000Platform extends BaseZ80MachinePlatform<SG1000> implements Platform

newMachine() { return new SG1000(); }
getPresets() { return SG1000_PRESETS; }
getDefaultExtension() { return ".c"; };

readAddress(a) { return this.machine.read(a); }
readVRAMAddress(a) { return this.machine.readVRAMAddress(a); }
}
Expand All @@ -41,7 +41,7 @@ class SMSPlatform extends BaseZ80MachinePlatform<SMS> implements Platform {

newMachine() { return new SMS(); }
getPresets() { return SMS_PRESETS; }
getDefaultExtension() { return ".c"; };

readAddress(a) { return this.machine.read(a); }
readVRAMAddress(a) { return this.machine.readVRAMAddress(a); }
}
Expand All @@ -50,7 +50,7 @@ class GameGearPlatform extends BaseZ80MachinePlatform<GameGear> implements Platf

newMachine() { return new GameGear(); }
getPresets() { return SMS_PRESETS; }
getDefaultExtension() { return ".c"; };

readAddress(a) { return this.machine.read(a); }
readVRAMAddress(a) { return this.machine.readVRAMAddress(a); }
}
Expand Down
1 change: 0 additions & 1 deletion src/platform/sound_williams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export class WilliamsSoundPlatform extends BaseZ80MachinePlatform<WilliamsSound>

newMachine() { return new WilliamsSound(); }
getPresets() { return WILLIAMS_SOUND_PRESETS; }
getDefaultExtension() { return ".c"; };
readAddress(a) { return this.machine.read(a); }

}
Expand Down
Loading
Loading