1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 18:33:11 +00:00

"use strict" for all; atarivec: include vector ROM in asm file

This commit is contained in:
Steven Hugg 2017-01-03 10:43:40 -05:00
parent 14f3667e7e
commit 3e817adcb1
8 changed files with 61 additions and 48 deletions

View File

@ -191,7 +191,6 @@ a.dropdown-toggle {
<script src="src/platform/vcs.js"></script>
<script src="src/platform/apple2.js"></script>
<script src="src/platform/atarivec.js"></script>
<script src="local/vecrom.js"></script>
<script src="src/ui.js"></script>
</body>

@ -1 +1 @@
Subproject commit b785efb3b9d653e7c1497301e093257206f25875
Subproject commit 531e945457a1714c11b7cf71aafc4216d14992bb

View File

@ -1,7 +1,8 @@
"use strict";
// Emulator classes
RasterVideo = function(mainElement, width, height, options) {
var RasterVideo = function(mainElement, width, height, options) {
var self = this;
var canvas, ctx;
var imageData, buf8, datau32;
@ -85,7 +86,7 @@ mainElement.appendChild(borderElement);
*/
}
VectorVideo = function(mainElement, width, height) {
var VectorVideo = function(mainElement, width, height) {
var self = this;
var canvas, ctx;
var persistenceAlpha = 0.5;
@ -151,17 +152,17 @@ VectorVideo = function(mainElement, width, height) {
}
}
SampleAudio = function(clockfreq) {
var SampleAudio = function(clockfreq) {
}
RAM = function(size) {
var RAM = function(size) {
var memArray = new ArrayBuffer(size);
this.mem = new Uint8Array(memArray);
}
// TODO
AnimationTimer = function(frequencyHz, callback) {
var AnimationTimer = function(frequencyHz, callback) {
var intervalMsec = 1000.0 / frequencyHz;
var curTime = 0;
var running;

View File

@ -1,14 +1,19 @@
"use strict";
var PRESETS = [
]
var APPLE2_PRESETS = [
];
Apple2Platform = function(mainElement) {
var Apple2Platform = function(mainElement) {
var self = this;
var cpuFrequency = 1.023;
var cpuCyclesPerLine = 65;
var cpu, ram, rom, bus;
var video, audio, timer;
this.getPresets = function() {
return APPLE2_PRESETS;
}
this.start = function() {
cpu = new jt.M6502();
ram = new RAM(0xc000);
@ -185,7 +190,7 @@ Apple2Platform = function(mainElement) {
}
};
APPLEIIGO_LZG = [
var APPLEIIGO_LZG = [
76,90,71,0,0,48,0,0,0,5,159,47,60,46,159,1,21,25,30,52,65,80,80,76,69,73,73,71,79,32,82,79,
77,49,46,48,0,52,31,52,31,52,31,52,31,52,31,52,31,52,31,52,31,52,28,52,6,32,0,224,25,30,67,52,
30,52,28,25,31,174,52,31,52,30,52,28,52,6,25,63,107,52,31,52,30,52,28,25,63,101,52,19,25,31,139,52,

View File

@ -1,8 +1,9 @@
"use strict";
var PRESETS = [
var ATARIVEC_PRESETS = [
]
AtariVectorPlatform = function(mainElement) {
var AtariVectorPlatform = function(mainElement) {
var self = this;
var cpuFrequency = 1500000.0;
var cpuCyclesPerNMI = 6000;
@ -13,11 +14,14 @@ AtariVectorPlatform = function(mainElement) {
var switches = new RAM(16).mem;
var nmicount = cpuCyclesPerNMI;
this.getPresets = function() {
return ATARIVEC_PRESETS;
}
this.start = function() {
cpu = new jt.M6502();
cpuram = new RAM(0x400);
dvgram = new RAM(0x2000);
vecrom = VECROM;
//switches[5] = 0xff;
//switches[7] = 0xff;
// bus
@ -79,6 +83,7 @@ AtariVectorPlatform = function(mainElement) {
//console.log(n, clock, nmicount);
}
cpu.clockPulse();
//cpu.executeInstruction();
}
});
video.setKeyboardEvents(function(key,flags) {
@ -107,10 +112,11 @@ AtariVectorPlatform = function(mainElement) {
}
this.loadROM = function(title, data) {
if(data.length != 0x1800) {
throw "ROM length must be == 0x1800";
if(data.length != 0x2000) {
throw "ROM length must be == 0x2000";
}
rom = data;
rom = data.slice(0,0x1800);
vecrom = data.slice(0x1800,0x2000);
this.reset();
}
@ -230,7 +236,7 @@ AtariVectorPlatform = function(mainElement) {
}
}
DVGStateMachine = function(bus, video) {
var DVGStateMachine = function(bus, video) {
var self = this;
var pc = 0;
var x = 0;
@ -246,7 +252,7 @@ DVGStateMachine = function(bus, video) {
}
function decodeSigned(w, o2) {
s = w & (1<<o2);
var s = w & (1<<o2);
w = w & ((1<<o2)-1);
if (s)
return -w;
@ -269,7 +275,7 @@ DVGStateMachine = function(bus, video) {
//console.log('DVG',i);
}
GSCALES = [7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8];
var GSCALES = [7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8];
this.nextInstruction = function() {
if (!running) return;

View File

@ -1,5 +1,6 @@
"use strict";
var PRESETS = [
var VCS_PRESETS = [
{id:'examples/hello', chapter:4, name:'Hello 6502 and TIA'},
{id:'examples/vsync', chapter:5, name:'Painting on the CRT', title:'Color Bars'},
{id:'examples/playfield', chapter:6, name:'Playfield Graphics'},
@ -35,9 +36,11 @@ Javatari.CARTRIDGE_CHANGE_DISABLED = true;
Javatari.DEBUG_SCANLINE_OVERFLOW = false; // TODO: make a switch
Javatari.AUDIO_BUFFER_SIZE = 256;
VCSPlatform = function() {
var VCSPlatform = function() {
var self = this;
this.getPresets = function() { return VCS_PRESETS; }
this.start = function() {
Javatari.start();
}

View File

@ -1,3 +1,4 @@
"use strict";
// 8bitworkshop IDE user interface
@ -9,7 +10,7 @@ var offset2line = null;
var line2offset = null;
var trace_pending_at_pc;
// vars: PRESETS, platform
var PRESETS, platform;
var CODE = 'code1';
var editor = CodeMirror(document.getElementById('editor'), {
@ -21,7 +22,7 @@ var editor = CodeMirror(document.getElementById('editor'), {
});
//editor.setSize("100%", "95%"); // TODO
editor.on('changes', function(ed, changeobj) {
text = editor.getValue() || "";
var text = editor.getValue() || "";
setCode(text);
});
@ -243,7 +244,7 @@ worker.onmessage = function(e) {
current_output = null;
} else {
gutters.removeClass("has-errors");
updatePreset(current_preset_id, text);
updatePreset(current_preset_id, editor.getValue()); // update persisted entry
// load ROM
var rom = e.data.output.slice(2);
var rom_changed = rom && !arrayCompare(rom, current_output);
@ -266,7 +267,7 @@ worker.onmessage = function(e) {
editor.clearGutter("gutter-clock");
offset2line = {};
line2offset = {};
for (info of e.data.listing.lines) {
for (var info of e.data.listing.lines) {
if (info.offset) {
var textel = document.createTextNode(info.offset.toString(16));
editor.setGutterMarker(info.line-1, "gutter-offset", textel);
@ -658,6 +659,7 @@ function showWelcomeMessage() {
{
// Instance the tour
var tour = new Tour({
autoscroll:false,
//storage:false,
steps: [
{
@ -688,12 +690,8 @@ function showWelcomeMessage() {
content: "Click the menu to create new files and share your work with others."
},
]});
// Initialize the tour
tour.init();
// Start the tour
tour.start();
setTimeout(function() { tour.start(); }, 2000);
}
}
@ -735,6 +733,18 @@ try {
if (!qs['platform']) {
qs['platform'] = 'vcs';
}
// load and start platform object
if (qs['platform'] == 'vcs') {
platform = new VCSPlatform();
} else if (qs['platform'] == 'apple2') {
platform = new Apple2Platform($("#emulator")[0]);
} else if (qs['platform'] == 'atarivec') {
platform = new AtariVectorPlatform($("#emulator")[0]);
} else {
alert("Platform " + qs['platform'] + " not recognized");
}
PRESETS = platform.getPresets();
platform.start();
// reset file?
if (qs['file'] && qs['reset']) {
localStorage.removeItem(qs['file']);
@ -750,19 +760,6 @@ try {
var lastid = localStorage.getItem("__lastid");
gotoPresetNamed(lastid || PRESETS[0].id);
}
// load and start platform object
if (qs['platform'] == 'vcs') {
platform = new VCSPlatform();
platform.start();
} else if (qs['platform'] == 'apple2') {
platform = new Apple2Platform($("#emulator")[0]);
platform.start();
} else if (qs['platform'] == 'atarivec') {
platform = new AtariVectorPlatform($("#emulator")[0]);
platform.start();
} else {
alert("Platform " + qs['platform'] + " not recognized");
}
}
} catch (e) {
alert(e+""); // TODO?

View File

@ -1,3 +1,5 @@
"use strict";
// set up require.js for worker
importScripts("../../dasm.js");
@ -17,9 +19,9 @@ var document = noop();
document.documentElement = noop();
document.documentElement.style = noop();
MAIN_FILENAME = "main.a";
PREAMBLE = "\tprocessor 6502\n";
PREAMBLE_LINES = 1;
var MAIN_FILENAME = "main.a";
var PREAMBLE = "\tprocessor 6502\n";
var PREAMBLE_LINES = 1;
function parseListing(code, unresolved) {
var errorMatch = /main.a [(](\d+)[)]: error: (.+)/;
@ -60,7 +62,7 @@ function parseListing(code, unresolved) {
}
// TODO: check filename too
// TODO: better symbol test (word boundaries)
for (key in unresolved) {
for (var key in unresolved) {
var pos = restline ? restline.indexOf(key) : line.indexOf(key);
if (pos >= 0) {
errors.push({