Deploying to gh-pages from @ sehugg/8bitworkshop@9e6fc9a0e3 🚀

This commit is contained in:
sehugg 2023-10-13 17:17:02 +00:00
parent 1d7252fc44
commit f59f814463
29 changed files with 36496 additions and 35 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
import{a as d}from"./chunk-3XE5YOCV.js";import{o as c}from"./chunk-2LW5MZY3.js";import"./chunk-SXEVG2WS.js";import"./chunk-5SHCNQ2O.js";import"./chunk-VDDQ2KMS.js";import{I as m,o as u,t as h}from"./chunk-ORITJQOD.js";import{$ as i,B as o,J as l,m as n}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";var s=31,a=class extends u{constructor(){super();this.cpuFrequency=1e6;this.defaultROMSize=32768;this.cpu=new h;this.ram=new Uint8Array(16384);this.read=i([[0,16383,16383,e=>this.ram[e]],[16384,16384,65535,e=>this.serial.byteAvailable()?128:0],[16385,16385,65535,e=>this.serial.recvByte()],[16386,16386,65535,e=>this.serial.clearToSend()?128:0],[32768,65535,32767,e=>this.rom&&this.rom[e]]]);this.write=i([[0,16383,16383,(e,t)=>{this.ram[e]=t}],[16387,16387,65535,(e,t)=>this.serial.sendByte(t)],[16399,16399,65535,(e,t)=>{this.inputs[s]=1}]]);this.connectCPUMemoryBus(this)}connectSerialIO(e){this.serial=e}readConst(e){return this.read(e)}advanceFrame(e){for(var t=0;t<this.cpuFrequency/60&&!(e&&e());)t+=this.advanceCPU();return t}advanceCPU(){if(this.isHalted())return 1;var e=super.advanceCPU();return this.serial&&this.serial.advance(e),e}reset(){this.inputs[s]=0,super.reset(),this.serial&&this.serial.reset()}isHalted(){return this.inputs[s]!=0}};var S=[{id:"hello.dasm",name:"Hello World (ASM)"}],f=class{constructor(e){e.style.overflowY="auto";var t=$('<div id="gameport"/>').appendTo(e);$('<p class="transcript-header">Serial Output</p>').appendTo(t);var y=$('<div id="windowport" class="transcript"/>').appendTo(t);this.div=y[0]}start(){this.tty=new d(this.div,!1)}reset(){this.tty.clear()}saveState(){return this.tty.saveState()}loadState(e){this.tty.loadState(e)}};function p(r){return r==10?"":r<32?String.fromCharCode(r+9216):String.fromCharCode(r)}var v=class{constructor(){this.bufferedRead=!0;this.cyclesPerByte=1e6/(57600/8);this.maxOutputBytes=4096}clearToSend(){return this.outputBytes.length<this.maxOutputBytes}sendByte(e){this.clearToSend()&&(this.outputBytes.push(e),this.viewer.tty.addtext(p(e),2|32),e==10&&this.viewer.tty.newline(),this.clearToSend()||(this.viewer.tty.newline(),this.viewer.tty.addtext("\u26A0\uFE0F OUTPUT BUFFER FULL \u26A0\uFE0F",4)))}byteAvailable(){return this.readIndex()>this.inputIndex}recvByte(){var e=this.readIndex();this.inputIndex=e;var t=(this.inputBytes&&this.inputBytes[e])|0;return this.viewer.tty.addtext(p(t),2|16),t==10&&this.viewer.tty.newline(),t}readIndex(){return this.bufferedRead?this.inputIndex+1:Math.floor(this.clk/this.cyclesPerByte)}reset(){this.inputIndex=-1,this.clk=0,this.outputBytes=[],this.bufin=""}advance(e){this.clk+=e}saveState(){return{clk:this.clk,idx:this.inputIndex,out:this.outputBytes.slice()}}loadState(e){this.clk=e.clk,this.inputIndex=e.idx,this.outputBytes=e.out.slice()}},x=class extends m{constructor(e){super(e);this.getMemoryMap=function(){return{main:[{name:"RAM",start:0,size:16384,type:"ram"},{name:"ROM",start:32768,size:32768,type:"rom"}]}};this.serview=new f(e)}async start(){super.start(),this.serial=new v,this.serial.viewer=this.serview,this.serview.start(),this.machine.connectSerialIO(this.serial)}reset(){this.serial.inputBytes=o(this.internalFiles["serialin.dat"]),super.reset(),this.serview.reset()}isBlocked(){return this.machine.isHalted()}advance(e){return this.isBlocked()?(this.internalFiles["serialout.dat"]=n(this.serial.outputBytes),c(),0):super.advance(e)}saveState(){var e=super.saveState();return e.serial=this.serial.saveState(),e.serview=this.serview.saveState(),e}loadState(e){super.loadState(e),this.serial.loadState(e.serial),this.serview.loadState(e.serview)}newMachine(){return new a}getPresets(){return S}getDefaultExtension(){return".dasm"}readAddress(e){return this.machine.readConst(e)}};l["devel-6502"]=x;export{v as SerialTestHarness};
//# sourceMappingURL=devel-EKPQFN6W.js.map
import{a as d}from"./chunk-3XE5YOCV.js";import{o as c}from"./chunk-NPUJICKW.js";import"./chunk-SXEVG2WS.js";import"./chunk-5SHCNQ2O.js";import"./chunk-LA7REXDT.js";import{I as m,o as u,t as h}from"./chunk-ORITJQOD.js";import{$ as i,B as o,J as l,m as n}from"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";var s=31,a=class extends u{constructor(){super();this.cpuFrequency=1e6;this.defaultROMSize=32768;this.cpu=new h;this.ram=new Uint8Array(16384);this.read=i([[0,16383,16383,e=>this.ram[e]],[16384,16384,65535,e=>this.serial.byteAvailable()?128:0],[16385,16385,65535,e=>this.serial.recvByte()],[16386,16386,65535,e=>this.serial.clearToSend()?128:0],[32768,65535,32767,e=>this.rom&&this.rom[e]]]);this.write=i([[0,16383,16383,(e,t)=>{this.ram[e]=t}],[16387,16387,65535,(e,t)=>this.serial.sendByte(t)],[16399,16399,65535,(e,t)=>{this.inputs[s]=1}]]);this.connectCPUMemoryBus(this)}connectSerialIO(e){this.serial=e}readConst(e){return this.read(e)}advanceFrame(e){for(var t=0;t<this.cpuFrequency/60&&!(e&&e());)t+=this.advanceCPU();return t}advanceCPU(){if(this.isHalted())return 1;var e=super.advanceCPU();return this.serial&&this.serial.advance(e),e}reset(){this.inputs[s]=0,super.reset(),this.serial&&this.serial.reset()}isHalted(){return this.inputs[s]!=0}};var S=[{id:"hello.dasm",name:"Hello World (ASM)"}],f=class{constructor(e){e.style.overflowY="auto";var t=$('<div id="gameport"/>').appendTo(e);$('<p class="transcript-header">Serial Output</p>').appendTo(t);var y=$('<div id="windowport" class="transcript"/>').appendTo(t);this.div=y[0]}start(){this.tty=new d(this.div,!1)}reset(){this.tty.clear()}saveState(){return this.tty.saveState()}loadState(e){this.tty.loadState(e)}};function p(r){return r==10?"":r<32?String.fromCharCode(r+9216):String.fromCharCode(r)}var v=class{constructor(){this.bufferedRead=!0;this.cyclesPerByte=1e6/(57600/8);this.maxOutputBytes=4096}clearToSend(){return this.outputBytes.length<this.maxOutputBytes}sendByte(e){this.clearToSend()&&(this.outputBytes.push(e),this.viewer.tty.addtext(p(e),2|32),e==10&&this.viewer.tty.newline(),this.clearToSend()||(this.viewer.tty.newline(),this.viewer.tty.addtext("\u26A0\uFE0F OUTPUT BUFFER FULL \u26A0\uFE0F",4)))}byteAvailable(){return this.readIndex()>this.inputIndex}recvByte(){var e=this.readIndex();this.inputIndex=e;var t=(this.inputBytes&&this.inputBytes[e])|0;return this.viewer.tty.addtext(p(t),2|16),t==10&&this.viewer.tty.newline(),t}readIndex(){return this.bufferedRead?this.inputIndex+1:Math.floor(this.clk/this.cyclesPerByte)}reset(){this.inputIndex=-1,this.clk=0,this.outputBytes=[],this.bufin=""}advance(e){this.clk+=e}saveState(){return{clk:this.clk,idx:this.inputIndex,out:this.outputBytes.slice()}}loadState(e){this.clk=e.clk,this.inputIndex=e.idx,this.outputBytes=e.out.slice()}},x=class extends m{constructor(e){super(e);this.getMemoryMap=function(){return{main:[{name:"RAM",start:0,size:16384,type:"ram"},{name:"ROM",start:32768,size:32768,type:"rom"}]}};this.serview=new f(e)}async start(){super.start(),this.serial=new v,this.serial.viewer=this.serview,this.serview.start(),this.machine.connectSerialIO(this.serial)}reset(){this.serial.inputBytes=o(this.internalFiles["serialin.dat"]),super.reset(),this.serview.reset()}isBlocked(){return this.machine.isHalted()}advance(e){return this.isBlocked()?(this.internalFiles["serialout.dat"]=n(this.serial.outputBytes),c(),0):super.advance(e)}saveState(){var e=super.saveState();return e.serial=this.serial.saveState(),e.serview=this.serview.saveState(),e}loadState(e){super.loadState(e),this.serial.loadState(e.serial),this.serview.loadState(e.serview)}newMachine(){return new a}getPresets(){return S}getDefaultExtension(){return".dasm"}readAddress(e){return this.machine.readConst(e)}};l["devel-6502"]=x;export{v as SerialTestHarness};
//# sourceMappingURL=devel-KJGA5VL5.js.map

View File

@ -1,2 +1,2 @@
import{b as w,c as x}from"./chunk-VDDQ2KMS.js";import{D as v,J as c,k as m,l as u,x as g,z as p}from"./chunk-QR47OPYG.js";import{e as I}from"./chunk-5XVCUSSZ.js";var h=I(x()),i,a,l,y=function(e){if(!e||e.length==0)return{};for(var r={},t=0;t<e.length;++t){var o=e[t].split("=",2);o.length==1?r[o[0]]="":r[o[0]]=decodeURIComponent(o[1].replace(/\+/g," "))}return r}(window.location.search.substr(1).split("&"));function P(){typeof window.onerror=="object"&&(window.onerror=function(e,r,t,o,n){var s=e+" "+r+" "+t+":"+o+", "+n;$.get("/error?msg="+encodeURIComponent(s),"text")})}function M(){var e=!1;document.addEventListener("visibilitychange",function(r){document.visibilityState=="hidden"&&a.isRunning()?(a.pause(),e=!0):document.visibilityState=="visible"&&e&&(a.resume(),e=!1)}),$(window).on("focus",function(){e&&(a.resume(),e=!1)}),$(window).on("blur",function(){a.isRunning()&&(a.pause(),e=!0)})}async function k(e,r){if(!r){alert("No ROM found.");return}console.log(r.length+" bytes"),await a.loadROM(e,r),a.resume()}function R(){return $("#emulator").find("canvas")}function E(e,r,t){v("gif.js/dist/gif.js").then(()=>{var o=R()[0];if(!o){alert("Could not find canvas element to record video!");return}var n=0;o.style&&o.style.transform&&(o.style.transform.indexOf("rotate(-90deg)")>=0?n=-1:o.style.transform.indexOf("rotate(90deg)")>=0&&(n=1));var s=new GIF({workerScript:"gif.js/dist/gif.worker.js",workers:4,quality:10,rotate:n});s.on("finished",function(C){console.log("finished encoding GIF"),t(C)}),e=e||100+(Math.random()*256&3),r=r||100+(Math.random()*256&15);var f=0;console.log("Recording video",o);var d=()=>{f++>r?(console.log("Rendering video"),s.render()):(s.addFrame(o,{delay:e,copy:!0}),setTimeout(d,e))};d()})}async function S(e){if(!c[i])throw Error("Invalid platform '"+i+"'.");a=new c[i]($("#emuscreen")[0]),await a.start(),e.rec&&R().on("focus",()=>{a.resume()});var r=e.n||"Game",t,o=e.url,n=e.r;if(o)return console.log(o),g(o,f=>{k(r,f)},"arraybuffer"),!0;if(n){var s=u(atob(n));t=new m().decode(s)}return M(),k(r,t),!0}async function b(e){if(e.data&&(e=e.data),i=e.p,!i)throw new Error("No platform variable!");try{var r=await w(p(i));console.log("starting platform",i),await S(e)}catch(t){console.log(t),alert('Platform "'+i+'" not supported.')}}function F(){P(),y.p&&b(y)}window.addEventListener("message",O,!1);function O(e){if(e.data){var r=e.data.cmd;if(r=="start"&&!a)b(e);else if(r=="reset")a.reset(),l.reset();else if(r=="getReplay"){var t={frameCount:l.frameCount,checkpoints:l.checkpoints,framerecs:l.framerecs,checkpointInterval:l.checkpointInterval,maxCheckpoints:l.maxCheckpoints};e.source.postMessage({ack:r,replay:t},e.origin)}else if(r=="watchState"){var o=new Function("platform","state",e.data.fn);l.callbackNewCheckpoint=n=>{e.source.postMessage({ack:r,state:o(a,n)},e.origin)}}else r=="recordVideo"?E(e.data.intervalMsec,e.data.maxFrames,function(n){e.data.filename&&(0,h.saveAs)(n,e.data.filename),e.source.postMessage({ack:r,gif:n},e.origin)}):console.log("Unknown data.cmd: "+r)}}self===top&&(document.body.style.backgroundColor="#555");F();export{a as platform,i as platform_id,F as startEmbed,l as stateRecorder};
import{b as w,c as x}from"./chunk-LA7REXDT.js";import{D as v,J as c,k as m,l as u,x as g,z as p}from"./chunk-QR47OPYG.js";import{e as I}from"./chunk-5XVCUSSZ.js";var h=I(x()),i,a,l,y=function(e){if(!e||e.length==0)return{};for(var r={},t=0;t<e.length;++t){var o=e[t].split("=",2);o.length==1?r[o[0]]="":r[o[0]]=decodeURIComponent(o[1].replace(/\+/g," "))}return r}(window.location.search.substr(1).split("&"));function P(){typeof window.onerror=="object"&&(window.onerror=function(e,r,t,o,n){var s=e+" "+r+" "+t+":"+o+", "+n;$.get("/error?msg="+encodeURIComponent(s),"text")})}function M(){var e=!1;document.addEventListener("visibilitychange",function(r){document.visibilityState=="hidden"&&a.isRunning()?(a.pause(),e=!0):document.visibilityState=="visible"&&e&&(a.resume(),e=!1)}),$(window).on("focus",function(){e&&(a.resume(),e=!1)}),$(window).on("blur",function(){a.isRunning()&&(a.pause(),e=!0)})}async function k(e,r){if(!r){alert("No ROM found.");return}console.log(r.length+" bytes"),await a.loadROM(e,r),a.resume()}function R(){return $("#emulator").find("canvas")}function E(e,r,t){v("gif.js/dist/gif.js").then(()=>{var o=R()[0];if(!o){alert("Could not find canvas element to record video!");return}var n=0;o.style&&o.style.transform&&(o.style.transform.indexOf("rotate(-90deg)")>=0?n=-1:o.style.transform.indexOf("rotate(90deg)")>=0&&(n=1));var s=new GIF({workerScript:"gif.js/dist/gif.worker.js",workers:4,quality:10,rotate:n});s.on("finished",function(C){console.log("finished encoding GIF"),t(C)}),e=e||100+(Math.random()*256&3),r=r||100+(Math.random()*256&15);var f=0;console.log("Recording video",o);var d=()=>{f++>r?(console.log("Rendering video"),s.render()):(s.addFrame(o,{delay:e,copy:!0}),setTimeout(d,e))};d()})}async function S(e){if(!c[i])throw Error("Invalid platform '"+i+"'.");a=new c[i]($("#emuscreen")[0]),await a.start(),e.rec&&R().on("focus",()=>{a.resume()});var r=e.n||"Game",t,o=e.url,n=e.r;if(o)return console.log(o),g(o,f=>{k(r,f)},"arraybuffer"),!0;if(n){var s=u(atob(n));t=new m().decode(s)}return M(),k(r,t),!0}async function b(e){if(e.data&&(e=e.data),i=e.p,!i)throw new Error("No platform variable!");try{var r=await w(p(i));console.log("starting platform",i),await S(e)}catch(t){console.log(t),alert('Platform "'+i+'" not supported.')}}function F(){P(),y.p&&b(y)}window.addEventListener("message",O,!1);function O(e){if(e.data){var r=e.data.cmd;if(r=="start"&&!a)b(e);else if(r=="reset")a.reset(),l.reset();else if(r=="getReplay"){var t={frameCount:l.frameCount,checkpoints:l.checkpoints,framerecs:l.framerecs,checkpointInterval:l.checkpointInterval,maxCheckpoints:l.maxCheckpoints};e.source.postMessage({ack:r,replay:t},e.origin)}else if(r=="watchState"){var o=new Function("platform","state",e.data.fn);l.callbackNewCheckpoint=n=>{e.source.postMessage({ack:r,state:o(a,n)},e.origin)}}else r=="recordVideo"?E(e.data.intervalMsec,e.data.maxFrames,function(n){e.data.filename&&(0,h.saveAs)(n,e.data.filename),e.source.postMessage({ack:r,gif:n},e.origin)}):console.log("Unknown data.cmd: "+r)}}self===top&&(document.body.style.backgroundColor="#555");F();export{a as platform,i as platform_id,F as startEmbed,l as stateRecorder};
//# sourceMappingURL=embedui.js.map

View File

@ -59,6 +59,8 @@ function getToolForFilename_vcs(fn) {
return "bataribasic";
if (fn.endsWith(".ca65"))
return "ca65";
if (fn.endsWith(".c"))
return "cc65";
if (fn.endsWith(".ecs"))
return "ecs";
return "dasm";

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t,v as u,w as v,x as w}from"./chunk-2LW5MZY3.js";import"./chunk-SXEVG2WS.js";import"./chunk-5SHCNQ2O.js";import"./chunk-VDDQ2KMS.js";import"./chunk-ORITJQOD.js";import"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";export{l as clearBreakpoint,h as compparams,f as current_project,u as emulationHalted,p as getPlatformAndRepo,t as getSaveState,s as getTestOutput,n as haltEmulation,w as highlightSearch,i as lastDebugState,e as platform,b as platform_id,g as projectWindows,a as qs,v as reloadWorkspaceFile,d as repo_id,k as runToPC,m as setFrameRateUI,r as setTestInput,j as setupBreakpoint,o as setupSplits,q as startUI,c as store_id};
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t,v as u,w as v,x as w}from"./chunk-NPUJICKW.js";import"./chunk-SXEVG2WS.js";import"./chunk-5SHCNQ2O.js";import"./chunk-LA7REXDT.js";import"./chunk-ORITJQOD.js";import"./chunk-QR47OPYG.js";import"./chunk-5XVCUSSZ.js";export{l as clearBreakpoint,h as compparams,f as current_project,u as emulationHalted,p as getPlatformAndRepo,t as getSaveState,s as getTestOutput,n as haltEmulation,w as highlightSearch,i as lastDebugState,e as platform,b as platform_id,g as projectWindows,a as qs,v as reloadWorkspaceFile,d as repo_id,k as runToPC,m as setFrameRateUI,r as setTestInput,j as setupBreakpoint,o as setupSplits,q as startUI,c as store_id};
//# sourceMappingURL=ui.js.map

File diff suppressed because one or more lines are too long

7
gen/vcs-PWKP77OJ.js.map Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8863,7 +8863,9 @@ ${this.scopeSymbol(name)} = ${name}::__Start`;
wiz_rom_ext: ".a26",
wiz_inc_dir: "2600",
extra_link_files: ["atari2600.cfg"],
cfgfile: "atari2600.cfg"
cfgfile: "atari2600.cfg",
libargs: ["atari2600.lib"],
define: ["__ATARI2600__"]
},
"mw8080bw": {
arch: "z80",
@ -9528,7 +9530,7 @@ ${this.scopeSymbol(name)} = ${name}::__Start`;
if (name === "65-devel")
name = "65-none";
if (name === "65-vcs")
name = "65-none";
name = "65-atari2600";
if (!fsMeta[name])
throw Error("No filesystem for '" + name + "'");
FS.mkdir("/share");
@ -9846,7 +9848,8 @@ ${this.scopeSymbol(name)} = ${name}::__Start`;
"ca65-atari7800": "65-none",
"cc65-devel": "65-none",
"ca65-devel": "65-none",
"ca65-vcs": "65-none",
"cc65-vcs": "65-atari2600",
"ca65-vcs": "65-atari2600",
"sdasz80": "sdcc",
"sdcc": "sdcc",
"sccz80": "sccz80",
@ -9855,7 +9858,7 @@ ${this.scopeSymbol(name)} = ${name}::__Start`;
"fastbasic": "65-atari8",
"silice": "Silice",
"wiz": "wiz",
"ecs-vcs": "65-none",
"ecs-vcs": "65-atari2600",
"ecs-nes": "65-nes",
"ecs-c64": "65-c64"
};

File diff suppressed because one or more lines are too long

View File

@ -98,6 +98,8 @@ var PLATFORM_PARAMS = {
wiz_inc_dir: '2600',
extra_link_files: ['atari2600.cfg'],
cfgfile: 'atari2600.cfg',
libargs: ['atari2600.lib'],
define: ['__ATARI2600__'],
},
'mw8080bw': {
arch: 'z80',
@ -807,7 +809,7 @@ function setupFS(FS, name) {
if (name === '65-devel')
name = '65-none'; // TODO
if (name === '65-vcs')
name = '65-none'; // TODO
name = '65-atari2600'; // TODO
if (!fsMeta[name])
throw Error("No filesystem for '" + name + "'");
FS.mkdir('/share');
@ -1169,7 +1171,8 @@ var TOOL_PRELOADFS = {
'ca65-atari7800': '65-none',
'cc65-devel': '65-none',
'ca65-devel': '65-none',
'ca65-vcs': '65-none',
'cc65-vcs': '65-atari2600',
'ca65-vcs': '65-atari2600',
'sdasz80': 'sdcc',
'sdcc': 'sdcc',
'sccz80': 'sccz80',
@ -1178,7 +1181,7 @@ var TOOL_PRELOADFS = {
'fastbasic': '65-atari8',
'silice': 'Silice',
'wiz': 'wiz',
'ecs-vcs': '65-none',
'ecs-vcs': '65-atari2600',
'ecs-nes': '65-nes',
'ecs-c64': '65-c64', // TODO: support multiple platforms
};

File diff suppressed because one or more lines are too long

147
presets/vcs/ecs/kernel1.ecs Normal file
View File

@ -0,0 +1,147 @@
//#resource "vcs-ca65.h"
import "vcslib.ecs"
import "sprites.ecs"
system Kernel1Sprite
locals 7
on kernelsetup do with [Sprite]
---
; set player object flags
lda {{<plyrflags}}
sta NUSIZ0
sta REFP0
---
on kernelsetup do with
[Sprite,HasBitmap,HasColormap,HasYpos]
---
; calculate screen height - ypos
lda {{<lines}}
clc
adc #32
sec
sbc {{<ypos}}
sta {{$5}}
; calculate bitmap pointer
stx {{$6}} ; save X (Sprite index)
lda {{<bitmap}} ; deref bitmap
tax
lda {{<Bitmap:bitmapdata}},x
sec
sbc {{$5}}
sta {{$0}} ; Y = sprite slot index
lda {{>Bitmap:bitmapdata}},x
sbc #0
sta {{$1}}
; get bitmap height
lda {{<Bitmap:height}},x
sta {{$4}}
; calculate colormap pointer
ldx {{$6}} ; restore X
lda {{<colormap}} ; deref colormap
tax
lda {{<Colormap:colormapdata}},x
sec
sbc {{$5}}
sta {{$2}}
lda {{>Colormap:colormapdata}},x
sbc #0
sta {{$3}}
; save ypos
ldx {{$6}} ; restore X
lda {{<ypos}}
sta {{$5}}
@nosprite:
---
// TODO: what if > 1 player? or missile?
on kernelsetup do with [Sprite,HasXpos]
---
ldy #0
lda {{<xpos}}
{{!SetHorizPos}}
sta HMOVE
---
on prescanline do once
---
; draw player 0
lda {{$4}} ; height
dcp {{$5}} ; ypos
bcs @DoDraw1
lda #0
.byte $2C
@DoDraw1:
lda ({{$0}}),y
---
on scanline do once
---
sta GRP0
lda ({{$2}}),y
sta COLUP0
---
on kerneldone do once
---
lda #0
sta GRP0
sta GRP1
sta GRP0
sta GRP1
---
end
system KernelMissile
locals 1
// TODO: unroll loops
on preframe do foreach [Missile,HasYpos] limit 1
---
lda {{<ypos}}
sta {{$0}}
---
on scanline do foreach [Missile,HasYpos] limit 1
---
dec {{$0}}
php
pla
sta ENAM0+{{const index}}-2
---
on kerneldone do foreach [Missile,HasYpos] limit 1
---
; skip 3 lines each kernel section
lda #0
sta ENAM0+{{const index}}-2
dec {{$0}}
dec {{$0}}
dec {{$0}}
---
end
system KernelCollide
locals 1
on preframe do once
---
lda #$ff
sta {{$0}} ; object index if collision
---
on kernelsetup do once
---
sta CXCLR ; clear collision flags
---
on kerneldone do with [Sprite]
---
lda CXM1P
bpl @nocollide ; missile 1 <-> player 0?
stx {{$0}} ; save object index
@nocollide:
---
// TODO: somehow avoid select? pass arg to explode?
on postframe do select [Sprite]
---
ldx {{$0}} ; get object index
bmi @noexplode ; was there collision?
{{!explode}}
@noexplode:
---
end

View File

@ -7,6 +7,7 @@ system Init
.include "vcs-ca65.h"
.macpack longbranch
.define PAL 0
.segment "STARTUP"
__NMI:
__Reset:
__BRK:

View File

@ -60,6 +60,7 @@ function getToolForFilename_vcs(fn: string) {
if (fn.endsWith(".wiz")) return "wiz";
if (fn.endsWith(".bb") || fn.endsWith(".bas")) return "bataribasic";
if (fn.endsWith(".ca65")) return "ca65";
if (fn.endsWith(".c")) return "cc65";
if (fn.endsWith(".ecs")) return "ecs";
return "dasm";
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
var Module = typeof Module !== 'undefined' ? Module : {};
if (!Module.expectedDataFileDownloads) {
Module.expectedDataFileDownloads = 0;
}
Module.expectedDataFileDownloads++;
(function() {
// Do not attempt to redownload the virtual filesystem data when in a pthread or a Wasm Worker context.
if (Module['ENVIRONMENT_IS_PTHREAD'] || Module['$ww']) return;
var loadPackage = function(metadata) {
var PACKAGE_PATH = '';
if (typeof window === 'object') {
PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/');
} else if (typeof process === 'undefined' && typeof location !== 'undefined') {
// web worker
PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/');
}
var PACKAGE_NAME = '/home/pzp/8bitworkshop-compilers/output/fs/fs65-atari2600.data';
var REMOTE_PACKAGE_BASE = 'fs65-atari2600.data';
if (typeof Module['locateFilePackage'] === 'function' && !Module['locateFile']) {
Module['locateFile'] = Module['locateFilePackage'];
err('warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)');
}
var REMOTE_PACKAGE_NAME = Module['locateFile'] ? Module['locateFile'](REMOTE_PACKAGE_BASE, '') : REMOTE_PACKAGE_BASE;
var REMOTE_PACKAGE_SIZE = metadata['remote_package_size'];
function fetchRemotePackage(packageName, packageSize, callback, errback) {
if (typeof process === 'object' && typeof process.versions === 'object' && typeof process.versions.node === 'string') {
require('fs').readFile(packageName, function(err, contents) {
if (err) {
errback(err);
} else {
callback(contents.buffer);
}
});
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', packageName, true);
xhr.responseType = 'arraybuffer';
xhr.onprogress = function(event) {
var url = packageName;
var size = packageSize;
if (event.total) size = event.total;
if (event.loaded) {
if (!xhr.addedTotal) {
xhr.addedTotal = true;
if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
Module.dataFileDownloads[url] = {
loaded: event.loaded,
total: size
};
} else {
Module.dataFileDownloads[url].loaded = event.loaded;
}
var total = 0;
var loaded = 0;
var num = 0;
for (var download in Module.dataFileDownloads) {
var data = Module.dataFileDownloads[download];
total += data.total;
loaded += data.loaded;
num++;
}
total = Math.ceil(total * Module.expectedDataFileDownloads/num);
if (Module['setStatus']) Module['setStatus']('Downloading data... (' + loaded + '/' + total + ')');
} else if (!Module.dataFileDownloads) {
if (Module['setStatus']) Module['setStatus']('Downloading data...');
}
};
xhr.onerror = function(event) {
throw new Error("NetworkError for: " + packageName);
}
xhr.onload = function(event) {
if (xhr.status == 200 || xhr.status == 304 || xhr.status == 206 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
var packageData = xhr.response;
callback(packageData);
} else {
throw new Error(xhr.statusText + " : " + xhr.responseURL);
}
};
xhr.send(null);
};
function handleError(error) {
console.error('package error:', error);
};
var fetchedCallback = null;
var fetched = Module['getPreloadedPackage'] ? Module['getPreloadedPackage'](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) : null;
if (!fetched) fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
if (fetchedCallback) {
fetchedCallback(data);
fetchedCallback = null;
} else {
fetched = data;
}
}, handleError);
function runWithFS() {
function assert(check, msg) {
if (!check) throw msg + new Error().stack;
}
Module['FS_createPath']("/", "asminc", true, true);
Module['FS_createPath']("/", "cfg", true, true);
Module['FS_createPath']("/", "include", true, true);
Module['FS_createPath']("/include", "arpa", true, true);
Module['FS_createPath']("/include", "em", true, true);
Module['FS_createPath']("/include", "geos", true, true);
Module['FS_createPath']("/include", "joystick", true, true);
Module['FS_createPath']("/include", "mouse", true, true);
Module['FS_createPath']("/include", "sys", true, true);
Module['FS_createPath']("/include", "tgi", true, true);
Module['FS_createPath']("/", "lib", true, true);
/** @constructor */
function DataRequest(start, end, audio) {
this.start = start;
this.end = end;
this.audio = audio;
}
DataRequest.prototype = {
requests: {},
open: function(mode, name) {
this.name = name;
this.requests[name] = this;
Module['addRunDependency']('fp ' + this.name);
},
send: function() {},
onload: function() {
var byteArray = this.byteArray.subarray(this.start, this.end);
this.finish(byteArray);
},
finish: function(byteArray) {
var that = this;
// canOwn this data in the filesystem, it is a slide into the heap that will never change
Module['FS_createDataFile'](this.name, null, byteArray, true, true, true);
Module['removeRunDependency']('fp ' + that.name);
this.requests[this.name] = null;
}
};
var files = metadata['files'];
for (var i = 0; i < files.length; ++i) {
new DataRequest(files[i]['start'], files[i]['end'], files[i]['audio'] || 0).open('GET', files[i]['filename']);
}
function processPackageData(arrayBuffer) {
assert(arrayBuffer, 'Loading data file failed.');
assert(arrayBuffer.constructor.name === ArrayBuffer.name, 'bad input to processPackageData');
var byteArray = new Uint8Array(arrayBuffer);
var curr;
// Reuse the bytearray from the XHR as the source for file reads.
DataRequest.prototype.byteArray = byteArray;
var files = metadata['files'];
for (var i = 0; i < files.length; ++i) {
DataRequest.prototype.requests[files[i].filename].onload();
} Module['removeRunDependency']('datafile_/home/pzp/8bitworkshop-compilers/output/fs/fs65-atari2600.data');
};
Module['addRunDependency']('datafile_/home/pzp/8bitworkshop-compilers/output/fs/fs65-atari2600.data');
if (!Module.preloadResults) Module.preloadResults = {};
Module.preloadResults[PACKAGE_NAME] = {fromCache: false};
if (fetched) {
processPackageData(fetched);
fetched = null;
} else {
fetchedCallback = processPackageData;
}
}
if (Module['calledRun']) {
runWithFS();
} else {
if (!Module['preRun']) Module['preRun'] = [];
Module["preRun"].push(runWithFS); // FS is not initialized yet, wait for it
}
Module['removeRunDependency']('fs65-atari2600.js.metadata');
}
function runMetaWithFS() {
Module['addRunDependency']('fs65-atari2600.js.metadata');
var REMOTE_METADATA_NAME = Module['locateFile'] ? Module['locateFile']('fs65-atari2600.js.metadata', '') : 'fs65-atari2600.js.metadata';
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
loadPackage(JSON.parse(xhr.responseText));
}
}
xhr.open('GET', REMOTE_METADATA_NAME, true);
xhr.overrideMimeType('application/json');
xhr.send(null);
}
if (Module['calledRun']) {
runMetaWithFS();
} else {
if (!Module['preRun']) Module['preRun'] = [];
Module["preRun"].push(runMetaWithFS);
}
})();

File diff suppressed because one or more lines are too long

View File

@ -10,6 +10,7 @@ MEMORY {
SEGMENTS {
RODATA: load=ROM, type=ro, align=$100;
STARTUP: load=ROM, type=ro, optional=yes;
CODE: load=ROM, type=ro, define=yes;
DATA: load=ROM, run=RAM, type=rw, define=yes;
BSS: load=RAM, type=bss, define=yes;

View File

@ -87,6 +87,8 @@ var PLATFORM_PARAMS = {
wiz_inc_dir: '2600',
extra_link_files: ['atari2600.cfg'],
cfgfile: 'atari2600.cfg',
libargs: ['atari2600.lib'],
define: ['__ATARI2600__'],
},
'mw8080bw': {
arch: 'z80',
@ -832,7 +834,7 @@ export function setupFS(FS, name:string) {
if (name === '65-vector') name = '65-none'; // TODO
if (name === '65-atari7800') name = '65-none'; // TODO
if (name === '65-devel') name = '65-none'; // TODO
if (name === '65-vcs') name = '65-none'; // TODO
if (name === '65-vcs') name = '65-atari2600'; // TODO
if (!fsMeta[name]) throw Error("No filesystem for '" + name + "'");
FS.mkdir('/share');
FS.mount(WORKERFS, {
@ -1185,7 +1187,8 @@ var TOOL_PRELOADFS = {
'ca65-atari7800': '65-none',
'cc65-devel': '65-none',
'ca65-devel': '65-none',
'ca65-vcs': '65-none',
'cc65-vcs': '65-atari2600',
'ca65-vcs': '65-atari2600',
'sdasz80': 'sdcc',
'sdcc': 'sdcc',
'sccz80': 'sccz80',
@ -1194,7 +1197,7 @@ var TOOL_PRELOADFS = {
'fastbasic': '65-atari8',
'silice': 'Silice',
'wiz': 'wiz',
'ecs-vcs': '65-none', // TODO: support multiple platforms
'ecs-vcs': '65-atari2600', // TODO: support multiple platforms
'ecs-nes': '65-nes', // TODO: support multiple platforms
'ecs-c64': '65-c64', // TODO: support multiple platforms
}