mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-29 14:51:17 +00:00
Merge branch 'master' of ssh://104.131.86.119:2222/home/pzp/git/8bitworkshop
This commit is contained in:
commit
d064f510bb
18
css/ui.css
18
css/ui.css
@ -54,6 +54,7 @@
|
||||
height:3em;
|
||||
width:100%;
|
||||
background-color:#999;
|
||||
display:flex;
|
||||
}
|
||||
#notebook {
|
||||
position:absolute;
|
||||
@ -111,7 +112,7 @@ div.mem_info a.selected {
|
||||
text-align:right;
|
||||
}
|
||||
.btn_group {
|
||||
border-radius:6px;
|
||||
border-radius:8px;
|
||||
padding:8px;
|
||||
margin-left:8px;
|
||||
background-color: #666;
|
||||
@ -283,14 +284,16 @@ canvas.pixelated {
|
||||
font-family: TinyFont;
|
||||
src: url(04B_03__.TTF);
|
||||
}
|
||||
#booksMenuButton {
|
||||
border-width:3px;
|
||||
border-color:#99ff99;
|
||||
background-color:#006600;
|
||||
.toolbarMenuButton {
|
||||
background-color:#666;
|
||||
border-style:solid;
|
||||
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
|
||||
position:relative;
|
||||
top:-0.25em;
|
||||
margin-left:0.5em;
|
||||
margin-right:0.5em;
|
||||
}
|
||||
a.toolbarMenuButton {
|
||||
padding:0.3em;
|
||||
}
|
||||
a.dropdown-toggle {
|
||||
}
|
||||
@ -539,3 +542,6 @@ div.asset_toolbar {
|
||||
.control-def {
|
||||
color: #ccc;
|
||||
}
|
||||
.book-title {
|
||||
font-size:12pt;
|
||||
}
|
||||
|
@ -122,6 +122,7 @@ TODO:
|
||||
- toolbar overlaps scope
|
||||
- CPU debugging
|
||||
- use $readmem for inline asm programs?
|
||||
- can't add control instructions b/c of split
|
||||
- single-stepping vector games makes screen fade
|
||||
- break on stack overflow, bad op, bad access, etc
|
||||
- PPU/TIA register write visualization
|
||||
@ -153,6 +154,7 @@ TODO:
|
||||
- support projects with subdirectories, file list?
|
||||
- emulator needs reset shortcut for nes
|
||||
- switching platform of a repo?
|
||||
- what to load if no main file?
|
||||
|
||||
|
||||
WEB WORKER FORMAT
|
||||
|
@ -13,8 +13,11 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
#emuscreen {
|
||||
flex-grow: 1;
|
||||
}
|
||||
.emuvideo {
|
||||
height:80%;
|
||||
width:90%;
|
||||
border-radius:20px;
|
||||
border: 4px solid #222;
|
||||
outline-color: #666;
|
||||
@ -35,6 +38,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
<body>
|
||||
|
||||
<div id="emulator">
|
||||
<!-- emulator video -->
|
||||
<div id="emuscreen">
|
||||
</div>
|
||||
<div id="javatari-div" style="margin:10px; display:none">
|
||||
<div id="javatari-screen" style="margin: 0 auto; box-shadow: 2px 2px 10px rgb(60, 60, 60);"></div>
|
||||
<div id="javatari-console-panel" style="margin: 0 auto; box-shadow: 2px 2px 10px rgb(60, 60, 60);"></div>
|
||||
|
81
index.html
81
index.html
@ -45,11 +45,11 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
|
||||
<div id="controls_top" class="disable-select">
|
||||
<span class="dropdown">
|
||||
<a class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Menu">
|
||||
<a class="btn dropdown-toggle toolbarMenuButton" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Menu">
|
||||
<span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span>
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<ul class="dropdown-menu dropdown-menu-left" aria-labelledby="dropdownMenuButton">
|
||||
<li><a class="dropdown-item" href="#" id="item_new_file">New Project...</a></li>
|
||||
<li><a class="dropdown-item" href="#" id="item_upload_file">Upload...</a></li>
|
||||
<hr>
|
||||
@ -113,10 +113,33 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<hr>
|
||||
<li class="dropdown dropdown-submenu">
|
||||
<a tabindex="-1" href="#">Platform</a>
|
||||
<ul class="dropdown-menu">
|
||||
<!--
|
||||
<hr><li><a class="dropdown-item" href="/redir.html">Use Latest Version</a></li>
|
||||
-->
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
<select id="preset_select" name="" title="Project Select" style="width:18em;visibility:hidden;height:2.3em">
|
||||
</select>
|
||||
|
||||
<img id="compile_spinner" src="images/spinner.gif" style="visibility:hidden;margin-left:8px;margin-right:8px;height:2em">
|
||||
<span id="toolbar" class="hidden-xs"></span>
|
||||
<span class="btn_group view_group hidden-sm hidden-xs" id="speed_bar" style="display:none">
|
||||
<button id="dbg_slowest" class="btn" title="Slowest"><span class="glyphicon glyphicon-fast-backward" aria-hidden="true"></span></button>
|
||||
<button id="dbg_slower" class="btn" title="Slower"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
|
||||
<span class="label"><span id="fps_label">60.00</span> fps</span>
|
||||
<button id="dbg_faster" class="btn" title="Faster"><span class="glyphicon glyphicon-forward" aria-hidden="true"></span></button>
|
||||
<button id="dbg_fastest" class="btn" title="Faster"><span class="glyphicon glyphicon-fast-forward" aria-hidden="true"></span></button>
|
||||
</span>
|
||||
<span id="verilog_bar" style="display:none">
|
||||
<span class="label"><span id="settle_label"></span> evals/clk</span>
|
||||
</span>
|
||||
|
||||
<span class="dropdown">
|
||||
<a class="btn dropdown-toggle hidden-xs toolbarMenuButton" id="platformsMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
PLATFORMS <span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="platformsMenuButton">
|
||||
<li class="dropdown dropdown-submenu">
|
||||
<a tabindex="-1" href="#">Game Consoles</a>
|
||||
<ul class="dropdown-menu">
|
||||
@ -158,49 +181,28 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
<select id="preset_select" name="" title="Project Select" style="width:18em;visibility:hidden">
|
||||
</select>
|
||||
|
||||
<img id="compile_spinner" src="images/spinner.gif" height="20em" style="visibility:hidden;margin-left:8px;margin-right:8px">
|
||||
<span id="toolbar" class="hidden-xs"></span>
|
||||
<span class="btn_group view_group hidden-sm hidden-xs" id="speed_bar" style="display:none">
|
||||
<button id="dbg_slowest" class="btn" title="Slowest"><span class="glyphicon glyphicon-fast-backward" aria-hidden="true"></span></button>
|
||||
<button id="dbg_slower" class="btn" title="Slower"><span class="glyphicon glyphicon-backward" aria-hidden="true"></span></button>
|
||||
<span class="label"><span id="fps_label">60.00</span> fps</span>
|
||||
<button id="dbg_faster" class="btn" title="Faster"><span class="glyphicon glyphicon-forward" aria-hidden="true"></span></button>
|
||||
<button id="dbg_fastest" class="btn" title="Faster"><span class="glyphicon glyphicon-fast-forward" aria-hidden="true"></span></button>
|
||||
</span>
|
||||
<span id="verilog_bar" style="display:none">
|
||||
<span class="label"><span id="settle_label"></span> evals/clk</span>
|
||||
</span>
|
||||
|
||||
<span class="dropdown" style="float:right">
|
||||
<span class="logo-gradient hidden-xs hidden-sm hidden-md">8bitworkshop</span>
|
||||
|
||||
<a class="btn btn-secondary dropdown-toggle hidden-xs" id="booksMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
GET BOOKS <span class="caret"></span>
|
||||
<span class="dropdown">
|
||||
<a class="btn dropdown-toggle hidden-xs toolbarMenuButton" id="booksMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
BOOKS <span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu pull-right" aria-labelledby="dropdownMenuButton">
|
||||
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="booksMenuButton">
|
||||
<li>
|
||||
<a class="dropdown-item dropdown-link" target="_book_a2600" href="https://www.amazon.com/gp/product/1541021304/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&tag=pzp-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B01N4DSRIZ&linkId=04d39e274c06e6c93b93d20a9a977111">
|
||||
<img src="images/book_a2600.png"/>
|
||||
<b>Making Games For The Atari 2600</b>
|
||||
<span class="book-title">Making Games For The Atari 2600</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item dropdown-link" target="_book_arcade" href="https://www.amazon.com/gp/product/1545484759/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1545484759&linkCode=as2&tag=pzp-20&linkId=b27709c022d2ebe639e90316d9f4fd5b">
|
||||
<img src="images/book_arcade.png"/>
|
||||
<b>Making 8-bit Arcade Games in C</b>
|
||||
<span class="book-title">Making 8-bit Arcade Games in C</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item dropdown-link" target="_book_verilog" href="https://www.amazon.com/gp/product/1728619440/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1728619440&linkCode=as2&tag=pzp-20">
|
||||
<img src="images/book_verilog.png"/>
|
||||
<b>Designing Video Game Hardware in Verilog</b>
|
||||
<span class="book-title">Designing Video Game Hardware in Verilog</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
@ -211,6 +213,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
<span class="logo-gradient hidden-xs hidden-sm hidden-md pull-right" style="margin-left:auto">8bitworkshop</span>
|
||||
|
||||
<!--<span id="best_in_firefox" style="display:none;font-size:12px;font-style:italic;float:right;color:#666">Note: Works best in Firefox</span>-->
|
||||
</div>
|
||||
<div id="notebook">
|
||||
@ -231,6 +236,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
<button id="replay_max" class="btn" title="End of replay"><span class="glyphicon glyphicon-fast-forward" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- emulator video -->
|
||||
<div id="emuscreen">
|
||||
</div>
|
||||
<!-- control instructions -->
|
||||
<div class="emucontrols-vcs text-center small control-insns" style="display:none">
|
||||
<span class="control-def"><span class="control-key">←↑↓→</span> Joystick</span>
|
||||
@ -359,6 +367,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
<p>Enter the GitHub repository URL:</p>
|
||||
<p><input id="importGithubURL" size="60" placeholder="https://github.com/user/repo"></input></p>
|
||||
<p>If the project is compatible with 8bitworkshop, it should build automatically.</p>
|
||||
<p>Otherwise, some work may be required -- make sure you've selected the correct platform.</p>
|
||||
<p>Source files must be in the root folder of the repository.</p>
|
||||
<p><button type="button" class="btn btn-primary" id="importGithubButton">Import Project</button></p>
|
||||
</div>
|
||||
@ -383,8 +392,8 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
<option value="private">Private</option>
|
||||
</select></p>
|
||||
<p>License: <select id="githubRepoLicense">
|
||||
<option value="">Will decide later</option>
|
||||
<option value="cc0-1.0">CC Zero (public domain, recommended)</option>
|
||||
<option value="">Will decide later / all rights reserved</option>
|
||||
<option value="cc0-1.0">CC Zero (public domain, remix-friendly)</option>
|
||||
<option value="mit">MIT (must preserve notices)</option>
|
||||
<option value="cc-by-4.0">CC BY (must attribute)</option>
|
||||
<option value="cc-by-sa-4.0">CC BY-SA (must attribute, use same license)</option>
|
||||
|
@ -34,8 +34,8 @@ void main(void) {
|
||||
pal_bg(PALETTE);
|
||||
|
||||
// fill nametable with diamonds
|
||||
vram_adr(NAMETABLE_A);
|
||||
vram_fill(0x16, 32*30);
|
||||
vram_adr(NAMETABLE_A); // start address ($2000)
|
||||
vram_fill(0x16, 32*30); // fill nametable (960 bytes)
|
||||
|
||||
// copy attribute table from PRG ROM to VRAM
|
||||
vram_write(ATTRIBUTE_TABLE, sizeof(ATTRIBUTE_TABLE));
|
||||
|
@ -133,7 +133,7 @@ function recordVideo(intervalMsec, maxFrames, callback) {
|
||||
|
||||
function startPlatform(qs) {
|
||||
if (!PLATFORMS[platform_id]) throw Error("Invalid platform '" + platform_id + "'.");
|
||||
platform = new PLATFORMS[platform_id]($("#emulator")[0]);
|
||||
platform = new PLATFORMS[platform_id]($("#emuscreen")[0]);
|
||||
platform.start();
|
||||
// start recorder when click on canvas (TODO?)
|
||||
if (qs['rec']) {
|
||||
|
@ -1,112 +0,0 @@
|
||||
/* profiler window: currently unused */
|
||||
|
||||
var profilelist;
|
||||
|
||||
var pcdata = {};
|
||||
var prof_reads, prof_writes;
|
||||
|
||||
function scrollProfileView(_ed) {
|
||||
_ed.on('scroll', function(ed, changeobj) {
|
||||
if (profilelist) {
|
||||
profilelist.container.scrollTop = ed.getScrollInfo().top;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateProfileWindow() {
|
||||
if (profilelist && sourcefile) {
|
||||
$("#profileview").find('[data-index]').each(function(i,e) {
|
||||
var div = $(e);
|
||||
var lineno = div.attr('data-index') | 0;
|
||||
var newtext = getProfileLine(lineno+1);
|
||||
if (newtext) {
|
||||
var oldtext = div.text();
|
||||
if (oldtext != newtext)
|
||||
div.text(newtext);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createProfileWindow() {
|
||||
profilelist = new VirtualList({
|
||||
w:$("#emulator").width(),
|
||||
h:$("#emulator").height(),
|
||||
itemHeight: getVisibleEditorLineHeight(),
|
||||
totalRows: getVisibleSourceFile().lineCount(),
|
||||
generatorFn: function(row) {
|
||||
var div = document.createElement("div");
|
||||
div.appendChild(document.createTextNode("."));
|
||||
return div;
|
||||
}
|
||||
});
|
||||
$("#profileview").empty().append(profilelist.container);
|
||||
updateProfileWindow();
|
||||
}
|
||||
|
||||
function resetProfiler() {
|
||||
prof_reads = [];
|
||||
prof_writes = [];
|
||||
pcdata = [];
|
||||
dumplines = null;
|
||||
}
|
||||
|
||||
function profileWindowCallback(a,v) {
|
||||
if (platform.getPC) {
|
||||
var pc = platform.getPC();
|
||||
var pcd = pcdata[pc];
|
||||
if (!pcd) {
|
||||
pcd = pcdata[pc] = {nv:1};
|
||||
}
|
||||
if (a != pc) {
|
||||
if (v >= 0) {
|
||||
pcd.lastwa = a;
|
||||
pcd.lastwv = v;
|
||||
} else {
|
||||
pcd.lastra = a;
|
||||
pcd.lastrv = platform.readAddress(a);
|
||||
}
|
||||
} else {
|
||||
pcd.nv++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getProfileLine(line) {
|
||||
var srcfile = getVisibleSourceFile();
|
||||
var offset = srcfile.line2offset[line];
|
||||
var offset2 = srcfile.line2offset[line+1];
|
||||
if (!(offset2 > offset)) offset2 = offset+1;
|
||||
var s = '';
|
||||
var nv = 0;
|
||||
while (offset < offset2) {
|
||||
var pcd = pcdata[offset];
|
||||
if (pcd) {
|
||||
nv += pcd.nv;
|
||||
if (pcd.lastra >= 0) {
|
||||
s += " rd [" + hex(pcd.lastra,4) + "] == " + hex(pcd.lastrv,2);
|
||||
}
|
||||
if (pcd.lastwa >= 0) {
|
||||
s += " wr " + hex(pcd.lastwv,2) + " -> [" + hex(pcd.lastwa,4) + "]";
|
||||
}
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
return nv ? (lpad(nv+"",8) + s) : '.';
|
||||
}
|
||||
|
||||
function toggleProfileWindow() {
|
||||
if ($("#memoryview").is(':visible')) toggleMemoryWindow();
|
||||
if ($("#profileview").is(':visible')) {
|
||||
profilelist = null;
|
||||
platform.getProbe().deactivate();
|
||||
$("#emulator").show();
|
||||
$("#profileview").hide();
|
||||
} else {
|
||||
createProfileWindow();
|
||||
platform.getProbe().activate(profileWindowCallback);
|
||||
$("#emulator").hide();
|
||||
$("#profileview").show();
|
||||
}
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ export class CodeProject {
|
||||
while (m = re2.exec(text)) {
|
||||
this.pushAllFiles(files, m[2]);
|
||||
}
|
||||
// for .c -- //#link "file" (or ;link or #link)
|
||||
let re3 = /^\s*([;#]|[/][/][#])resource\s+"(.+?)"/gm;
|
||||
// for .c -- //#resource "file" (or ;resource or #resource)
|
||||
let re3 = /^\s*([;]|[/][/])#resource\s+"(.+?)"/gm;
|
||||
while (m = re3.exec(text)) {
|
||||
this.pushAllFiles(files, m[2]);
|
||||
}
|
||||
@ -114,7 +114,7 @@ export class CodeProject {
|
||||
//
|
||||
} else {
|
||||
// for .c -- //#link "file" (or ;link or #link)
|
||||
let re = /^\s*([;#]|[/][/][#])link\s+"(.+?)"/gm;
|
||||
let re = /^\s*([;]|[/][/])#link\s+"(.+?)"/gm;
|
||||
while (m = re.exec(text)) {
|
||||
this.pushAllFiles(files, m[2]);
|
||||
}
|
||||
|
37
src/ui.ts
37
src/ui.ts
@ -472,7 +472,7 @@ function _publishProjectToGithub(e) {
|
||||
}
|
||||
var modal = $("#publishGithubModal");
|
||||
var btn = $("#publishGithubButton");
|
||||
$("#githubRepoName").val(getFilenamePrefix(current_project.mainPath));
|
||||
$("#githubRepoName").val(getFilenamePrefix(getFilenameForPath(current_project.mainPath)));
|
||||
modal.modal('show');
|
||||
btn.off('click').on('click', () => {
|
||||
var name = $("#githubRepoName").val()+"";
|
||||
@ -572,6 +572,11 @@ function pushChangesToGithub(message:string) {
|
||||
files.push({path:newpath, data:data});
|
||||
}
|
||||
}
|
||||
// include built ROM file in bin/[mainfile].rom
|
||||
if (current_output instanceof Uint8Array) {
|
||||
let binpath = "bin/"+getCurrentMainFilename()+".rom";
|
||||
files.push({path:binpath, data:current_output});
|
||||
}
|
||||
// push files
|
||||
setWaitDialog(true);
|
||||
return getGithubService().login().then( () => {
|
||||
@ -1003,7 +1008,7 @@ function setDebugButtonState(btnid:string, btnstate:string) {
|
||||
|
||||
function checkRunReady() {
|
||||
if (current_output == null) {
|
||||
alertError("Can't resume emulation until ROM is successfully built.");
|
||||
alertError("Can't do this until build successfully completes.");
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
@ -1070,11 +1075,13 @@ function togglePause() {
|
||||
}
|
||||
|
||||
function singleStep() {
|
||||
if (!checkRunReady()) return;
|
||||
setupBreakpoint("step");
|
||||
platform.step();
|
||||
}
|
||||
|
||||
function singleFrameStep() {
|
||||
if (!checkRunReady()) return;
|
||||
setupBreakpoint("tovsync");
|
||||
platform.runToVsync();
|
||||
}
|
||||
@ -1101,11 +1108,13 @@ function runToCursor() {
|
||||
}
|
||||
|
||||
function runUntilReturn() {
|
||||
if (!checkRunReady()) return;
|
||||
setupBreakpoint("stepout");
|
||||
platform.runUntilReturn();
|
||||
}
|
||||
|
||||
function runStepBackwards() {
|
||||
if (!checkRunReady()) return;
|
||||
setupBreakpoint("stepback");
|
||||
platform.stepBack();
|
||||
}
|
||||
@ -1118,6 +1127,7 @@ function clearBreakpoint() {
|
||||
}
|
||||
|
||||
function resetAndDebug() {
|
||||
if (!checkRunReady()) return;
|
||||
_disableRecording();
|
||||
if (platform.setupDebug && platform.readAddress) { // TODO??
|
||||
clearBreakpoint();
|
||||
@ -1661,7 +1671,6 @@ function addPageFocusHandlers() {
|
||||
|
||||
function showInstructions() {
|
||||
var div = $(document).find(".emucontrols-" + getRootBasePlatform(platform_id));
|
||||
$("#emulator").append(div);
|
||||
var vcanvas = $("#emulator").find("canvas");
|
||||
if (vcanvas) {
|
||||
vcanvas.on('focus', () => {
|
||||
@ -1685,7 +1694,7 @@ function installGAHooks() {
|
||||
|
||||
function startPlatform() {
|
||||
if (!PLATFORMS[platform_id]) throw Error("Invalid platform '" + platform_id + "'.");
|
||||
platform = new PLATFORMS[platform_id]($("#emulator")[0]);
|
||||
platform = new PLATFORMS[platform_id]($("#emuscreen")[0]);
|
||||
stateRecorder = new StateRecorderImpl(platform);
|
||||
PRESETS = platform.getPresets();
|
||||
if (!qs['file']) {
|
||||
@ -1858,18 +1867,16 @@ function convertLegacyVCS(store) {
|
||||
|
||||
const useHTTPSCookieName = "__use_https";
|
||||
|
||||
function shouldRedirectHTTPS() {
|
||||
// cookie set?
|
||||
if (getCookie(useHTTPSCookieName)) {
|
||||
return true;
|
||||
function shouldRedirectHTTPS() : boolean {
|
||||
// cookie set? either true or false
|
||||
var shouldRedir = getCookie(useHTTPSCookieName);
|
||||
if (typeof shouldRedir === 'string') {
|
||||
return !!shouldRedir; // convert to bool
|
||||
}
|
||||
// is this our first time here? if so, set a 10yr cookie
|
||||
if (hasLocalStorage && !localStorage.getItem("__lastplatform")) {
|
||||
document.cookie = useHTTPSCookieName + "=1;domain=8bitworkshop.com;path=/;max-age=315360000";
|
||||
return true;
|
||||
}
|
||||
// we can't redirect, might still have HTTP files
|
||||
return false;
|
||||
// set a 10yr cookie, value depends on if it's our first time here
|
||||
var val = hasLocalStorage && !localStorage.getItem("__lastplatform") ? 1 : 0;
|
||||
document.cookie = useHTTPSCookieName + "=" + val + ";domain=8bitworkshop.com;path=/;max-age=315360000";
|
||||
return !!val;
|
||||
}
|
||||
|
||||
function redirectToHTTPS() {
|
||||
|
@ -197,11 +197,6 @@ var PLATFORM_PARAMS = {
|
||||
{name:'Cartridge RAM',start:0x6000,size:0x2000,type:'ram'},
|
||||
],
|
||||
},
|
||||
'nes-asm': {
|
||||
cfgfile: 'nes.cfg',
|
||||
define: '__NES__',
|
||||
libargs: ['nes.lib'],
|
||||
},
|
||||
'apple2': {
|
||||
define: '__APPLE2__',
|
||||
cfgfile: 'apple2-hgr.cfg',
|
||||
@ -776,6 +771,9 @@ function assembleDASM(step:BuildStep) {
|
||||
listings[path] = {lines:[]};
|
||||
}
|
||||
parseDASMListing(alst, listings, errors, unresolved);
|
||||
if (errors.length) {
|
||||
return {errors:errors};
|
||||
}
|
||||
// read binary rom output and symbols
|
||||
var aout, asym;
|
||||
aout = FS.readFile(binpath);
|
||||
@ -914,6 +912,7 @@ function assembleCA65(step:BuildStep) {
|
||||
var FS = CA65['FS'];
|
||||
setupFS(FS, '65-'+getRootBasePlatform(step.platform));
|
||||
populateFiles(step, FS);
|
||||
fixParamsWithDefines(step.path, step.params);
|
||||
execMain(step, CA65, ['-v', '-g', '-I', '/share/asminc', '-o', objpath, '-l', lstpath, step.path]);
|
||||
if (errors.length)
|
||||
return {errors:errors};
|
||||
@ -947,6 +946,10 @@ function linkLD65(step:BuildStep) {
|
||||
setupFS(FS, '65-'+getRootBasePlatform(step.platform));
|
||||
populateFiles(step, FS);
|
||||
populateExtraFiles(step, FS, params.extra_link_files);
|
||||
// populate .cfg file, if it is a custom one
|
||||
if (workfs[params.cfgfile]) {
|
||||
populateEntry(FS, params.cfgfile, workfs[params.cfgfile], null);
|
||||
}
|
||||
var libargs = params.libargs;
|
||||
var cfgfile = params.cfgfile;
|
||||
var args = ['--cfg-path', '/share/cfg',
|
||||
@ -1034,6 +1037,7 @@ function fixParamsWithDefines(path:string, params){
|
||||
if (path && libargs) {
|
||||
var code = getWorkFileAsString(path);
|
||||
if (code) {
|
||||
var oldcfgfile = params.cfgfile;
|
||||
var ident2index = {};
|
||||
// find all lib args "IDENT=VALUE"
|
||||
for (var i=0; i<libargs.length; i++) {
|
||||
@ -1043,7 +1047,7 @@ function fixParamsWithDefines(path:string, params){
|
||||
}
|
||||
}
|
||||
// find #defines and replace them
|
||||
var re = /^#define\s+(\w+)\s+(\S+)/gmi;
|
||||
var re = /^[;]?#define\s+(\w+)\s+(\S+)/gmi; // TODO: empty string?
|
||||
var m;
|
||||
while (m = re.exec(code)) {
|
||||
var ident = m[1];
|
||||
@ -1055,8 +1059,13 @@ function fixParamsWithDefines(path:string, params){
|
||||
// TODO: MMC3 mapper switch
|
||||
if (ident == 'NES_MAPPER' && value == '4') {
|
||||
params.cfgfile = 'nesbanked.cfg';
|
||||
console.log('Using config file', params.cfgfile);
|
||||
console.log("using config file", params.cfgfile);
|
||||
}
|
||||
} else if (ident == 'CFGFILE' && value) {
|
||||
params.cfgfile = value;
|
||||
} else if (ident == 'LIBARGS' && value) {
|
||||
params.libargs = value.split(',').filter((s) => { return s!=''; });
|
||||
console.log('Using libargs', params.libargs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ describe('Worker', function() {
|
||||
compile('cc65', '#include "NOSUCH.file"\n', 'nes', done, 0, 0, 1, {ignoreErrorPath:true});
|
||||
});
|
||||
it('should assemble CA65', function(done) {
|
||||
compile('ca65', '\t.segment "HEADER"\n\t.segment "STARTUP"\n\t.segment "CHARS"\n\t.segment "VECTORS"\n\tlda #0\n\tsta $1\n', 'nes-asm', done, 40976, 2);
|
||||
compile('ca65', ';#define LIBARGS ,\n\t.segment "HEADER"\n\t.segment "STARTUP"\n\t.segment "CHARS"\n\t.segment "VECTORS"\n\t.segment "SAMPLES"\n\t.segment "CODE"\n\tlda #0\n\tsta $1\n', 'nes', done, 40976, 2);
|
||||
});
|
||||
/*
|
||||
it('should assemble Z80ASM', function(done) {
|
||||
|
Loading…
Reference in New Issue
Block a user