mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-18 00:30:43 +00:00
Merge branch 'master' of ssh://104.131.86.119:2222/home/pzp/git/8bitworkshop
This commit is contained in:
commit
d064f510bb
22
css/ui.css
22
css/ui.css
@ -49,11 +49,12 @@
|
|||||||
background-color:#000066;
|
background-color:#000066;
|
||||||
}
|
}
|
||||||
#controls_top {
|
#controls_top {
|
||||||
position: absolute;
|
position:absolute;
|
||||||
padding: 0.5em;
|
padding:0.5em;
|
||||||
height:3em;
|
height:3em;
|
||||||
width:100%;
|
width:100%;
|
||||||
background-color:#999;
|
background-color:#999;
|
||||||
|
display:flex;
|
||||||
}
|
}
|
||||||
#notebook {
|
#notebook {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
@ -111,7 +112,7 @@ div.mem_info a.selected {
|
|||||||
text-align:right;
|
text-align:right;
|
||||||
}
|
}
|
||||||
.btn_group {
|
.btn_group {
|
||||||
border-radius:6px;
|
border-radius:8px;
|
||||||
padding:8px;
|
padding:8px;
|
||||||
margin-left:8px;
|
margin-left:8px;
|
||||||
background-color: #666;
|
background-color: #666;
|
||||||
@ -283,14 +284,16 @@ canvas.pixelated {
|
|||||||
font-family: TinyFont;
|
font-family: TinyFont;
|
||||||
src: url(04B_03__.TTF);
|
src: url(04B_03__.TTF);
|
||||||
}
|
}
|
||||||
#booksMenuButton {
|
.toolbarMenuButton {
|
||||||
border-width:3px;
|
background-color:#666;
|
||||||
border-color:#99ff99;
|
|
||||||
background-color:#006600;
|
|
||||||
border-style:solid;
|
border-style:solid;
|
||||||
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
|
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
|
||||||
position:relative;
|
position:relative;
|
||||||
top:-0.25em;
|
margin-left:0.5em;
|
||||||
|
margin-right:0.5em;
|
||||||
|
}
|
||||||
|
a.toolbarMenuButton {
|
||||||
|
padding:0.3em;
|
||||||
}
|
}
|
||||||
a.dropdown-toggle {
|
a.dropdown-toggle {
|
||||||
}
|
}
|
||||||
@ -539,3 +542,6 @@ div.asset_toolbar {
|
|||||||
.control-def {
|
.control-def {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
}
|
}
|
||||||
|
.book-title {
|
||||||
|
font-size:12pt;
|
||||||
|
}
|
||||||
|
@ -122,6 +122,7 @@ TODO:
|
|||||||
- toolbar overlaps scope
|
- toolbar overlaps scope
|
||||||
- CPU debugging
|
- CPU debugging
|
||||||
- use $readmem for inline asm programs?
|
- use $readmem for inline asm programs?
|
||||||
|
- can't add control instructions b/c of split
|
||||||
- single-stepping vector games makes screen fade
|
- single-stepping vector games makes screen fade
|
||||||
- break on stack overflow, bad op, bad access, etc
|
- break on stack overflow, bad op, bad access, etc
|
||||||
- PPU/TIA register write visualization
|
- PPU/TIA register write visualization
|
||||||
@ -153,6 +154,7 @@ TODO:
|
|||||||
- support projects with subdirectories, file list?
|
- support projects with subdirectories, file list?
|
||||||
- emulator needs reset shortcut for nes
|
- emulator needs reset shortcut for nes
|
||||||
- switching platform of a repo?
|
- switching platform of a repo?
|
||||||
|
- what to load if no main file?
|
||||||
|
|
||||||
|
|
||||||
WEB WORKER FORMAT
|
WEB WORKER FORMAT
|
||||||
|
@ -13,8 +13,11 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
#emuscreen {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
.emuvideo {
|
.emuvideo {
|
||||||
height:80%;
|
width:90%;
|
||||||
border-radius:20px;
|
border-radius:20px;
|
||||||
border: 4px solid #222;
|
border: 4px solid #222;
|
||||||
outline-color: #666;
|
outline-color: #666;
|
||||||
@ -35,6 +38,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="emulator">
|
<div id="emulator">
|
||||||
|
<!-- emulator video -->
|
||||||
|
<div id="emuscreen">
|
||||||
|
</div>
|
||||||
<div id="javatari-div" style="margin:10px; display:none">
|
<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-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>
|
<div id="javatari-console-panel" style="margin: 0 auto; box-shadow: 2px 2px 10px rgb(60, 60, 60);"></div>
|
||||||
|
89
index.html
89
index.html
@ -44,12 +44,12 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
<input type="file" id="uploadFileElem" multiple accept="*" style="display:none" onchange="handleFileUpload(this.files)">
|
<input type="file" id="uploadFileElem" multiple accept="*" style="display:none" onchange="handleFileUpload(this.files)">
|
||||||
|
|
||||||
<div id="controls_top" class="disable-select">
|
<div id="controls_top" class="disable-select">
|
||||||
<span class="dropdown">
|
<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="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span>
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</a>
|
</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_new_file">New Project...</a></li>
|
||||||
<li><a class="dropdown-item" href="#" id="item_upload_file">Upload...</a></li>
|
<li><a class="dropdown-item" href="#" id="item_upload_file">Upload...</a></li>
|
||||||
<hr>
|
<hr>
|
||||||
@ -113,10 +113,33 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<hr>
|
<!--
|
||||||
<li class="dropdown dropdown-submenu">
|
<hr><li><a class="dropdown-item" href="/redir.html">Use Latest Version</a></li>
|
||||||
<a tabindex="-1" href="#">Platform</a>
|
-->
|
||||||
<ul class="dropdown-menu">
|
</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">
|
<li class="dropdown dropdown-submenu">
|
||||||
<a tabindex="-1" href="#">Game Consoles</a>
|
<a tabindex="-1" href="#">Game Consoles</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
@ -157,50 +180,29 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
<li><a class="dropdown-item" href="?platform=markdown" id="item_platform_markdown">Markdown</a></li>
|
<li><a class="dropdown-item" href="?platform=markdown" id="item_platform_markdown">Markdown</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</span>
|
</span>
|
||||||
|
<span class="dropdown">
|
||||||
<select id="preset_select" name="" title="Project Select" style="width:18em;visibility:hidden">
|
<a class="btn dropdown-toggle hidden-xs toolbarMenuButton" id="booksMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
</select>
|
BOOKS <span class="caret"></span>
|
||||||
|
|
||||||
<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>
|
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu pull-right" aria-labelledby="dropdownMenuButton">
|
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="booksMenuButton">
|
||||||
<li>
|
<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">
|
<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"/>
|
<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>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<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">
|
<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"/>
|
<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>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<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">
|
<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"/>
|
<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>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -211,6 +213,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</span>
|
</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>-->
|
<!--<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>
|
||||||
<div id="notebook">
|
<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>
|
<button id="replay_max" class="btn" title="End of replay"><span class="glyphicon glyphicon-fast-forward" aria-hidden="true"></span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- emulator video -->
|
||||||
|
<div id="emuscreen">
|
||||||
|
</div>
|
||||||
<!-- control instructions -->
|
<!-- control instructions -->
|
||||||
<div class="emucontrols-vcs text-center small control-insns" style="display:none">
|
<div class="emucontrols-vcs text-center small control-insns" style="display:none">
|
||||||
<span class="control-def"><span class="control-key">←↑↓→</span> Joystick</span>
|
<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>Enter the GitHub repository URL:</p>
|
||||||
<p><input id="importGithubURL" size="60" placeholder="https://github.com/user/repo"></input></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>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>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>
|
<p><button type="button" class="btn btn-primary" id="importGithubButton">Import Project</button></p>
|
||||||
</div>
|
</div>
|
||||||
@ -383,8 +392,8 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
<option value="private">Private</option>
|
<option value="private">Private</option>
|
||||||
</select></p>
|
</select></p>
|
||||||
<p>License: <select id="githubRepoLicense">
|
<p>License: <select id="githubRepoLicense">
|
||||||
<option value="">Will decide later</option>
|
<option value="">Will decide later / all rights reserved</option>
|
||||||
<option value="cc0-1.0">CC Zero (public domain, recommended)</option>
|
<option value="cc0-1.0">CC Zero (public domain, remix-friendly)</option>
|
||||||
<option value="mit">MIT (must preserve notices)</option>
|
<option value="mit">MIT (must preserve notices)</option>
|
||||||
<option value="cc-by-4.0">CC BY (must attribute)</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>
|
<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);
|
pal_bg(PALETTE);
|
||||||
|
|
||||||
// fill nametable with diamonds
|
// fill nametable with diamonds
|
||||||
vram_adr(NAMETABLE_A);
|
vram_adr(NAMETABLE_A); // start address ($2000)
|
||||||
vram_fill(0x16, 32*30);
|
vram_fill(0x16, 32*30); // fill nametable (960 bytes)
|
||||||
|
|
||||||
// copy attribute table from PRG ROM to VRAM
|
// copy attribute table from PRG ROM to VRAM
|
||||||
vram_write(ATTRIBUTE_TABLE, sizeof(ATTRIBUTE_TABLE));
|
vram_write(ATTRIBUTE_TABLE, sizeof(ATTRIBUTE_TABLE));
|
||||||
|
@ -133,7 +133,7 @@ function recordVideo(intervalMsec, maxFrames, callback) {
|
|||||||
|
|
||||||
function startPlatform(qs) {
|
function startPlatform(qs) {
|
||||||
if (!PLATFORMS[platform_id]) throw Error("Invalid platform '" + platform_id + "'.");
|
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();
|
platform.start();
|
||||||
// start recorder when click on canvas (TODO?)
|
// start recorder when click on canvas (TODO?)
|
||||||
if (qs['rec']) {
|
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)) {
|
while (m = re2.exec(text)) {
|
||||||
this.pushAllFiles(files, m[2]);
|
this.pushAllFiles(files, m[2]);
|
||||||
}
|
}
|
||||||
// for .c -- //#link "file" (or ;link or #link)
|
// for .c -- //#resource "file" (or ;resource or #resource)
|
||||||
let re3 = /^\s*([;#]|[/][/][#])resource\s+"(.+?)"/gm;
|
let re3 = /^\s*([;]|[/][/])#resource\s+"(.+?)"/gm;
|
||||||
while (m = re3.exec(text)) {
|
while (m = re3.exec(text)) {
|
||||||
this.pushAllFiles(files, m[2]);
|
this.pushAllFiles(files, m[2]);
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ export class CodeProject {
|
|||||||
//
|
//
|
||||||
} else {
|
} else {
|
||||||
// for .c -- //#link "file" (or ;link or #link)
|
// 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)) {
|
while (m = re.exec(text)) {
|
||||||
this.pushAllFiles(files, m[2]);
|
this.pushAllFiles(files, m[2]);
|
||||||
}
|
}
|
||||||
|
37
src/ui.ts
37
src/ui.ts
@ -472,7 +472,7 @@ function _publishProjectToGithub(e) {
|
|||||||
}
|
}
|
||||||
var modal = $("#publishGithubModal");
|
var modal = $("#publishGithubModal");
|
||||||
var btn = $("#publishGithubButton");
|
var btn = $("#publishGithubButton");
|
||||||
$("#githubRepoName").val(getFilenamePrefix(current_project.mainPath));
|
$("#githubRepoName").val(getFilenamePrefix(getFilenameForPath(current_project.mainPath)));
|
||||||
modal.modal('show');
|
modal.modal('show');
|
||||||
btn.off('click').on('click', () => {
|
btn.off('click').on('click', () => {
|
||||||
var name = $("#githubRepoName").val()+"";
|
var name = $("#githubRepoName").val()+"";
|
||||||
@ -572,6 +572,11 @@ function pushChangesToGithub(message:string) {
|
|||||||
files.push({path:newpath, data:data});
|
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
|
// push files
|
||||||
setWaitDialog(true);
|
setWaitDialog(true);
|
||||||
return getGithubService().login().then( () => {
|
return getGithubService().login().then( () => {
|
||||||
@ -1003,7 +1008,7 @@ function setDebugButtonState(btnid:string, btnstate:string) {
|
|||||||
|
|
||||||
function checkRunReady() {
|
function checkRunReady() {
|
||||||
if (current_output == null) {
|
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;
|
return false;
|
||||||
} else
|
} else
|
||||||
return true;
|
return true;
|
||||||
@ -1070,11 +1075,13 @@ function togglePause() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function singleStep() {
|
function singleStep() {
|
||||||
|
if (!checkRunReady()) return;
|
||||||
setupBreakpoint("step");
|
setupBreakpoint("step");
|
||||||
platform.step();
|
platform.step();
|
||||||
}
|
}
|
||||||
|
|
||||||
function singleFrameStep() {
|
function singleFrameStep() {
|
||||||
|
if (!checkRunReady()) return;
|
||||||
setupBreakpoint("tovsync");
|
setupBreakpoint("tovsync");
|
||||||
platform.runToVsync();
|
platform.runToVsync();
|
||||||
}
|
}
|
||||||
@ -1101,11 +1108,13 @@ function runToCursor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runUntilReturn() {
|
function runUntilReturn() {
|
||||||
|
if (!checkRunReady()) return;
|
||||||
setupBreakpoint("stepout");
|
setupBreakpoint("stepout");
|
||||||
platform.runUntilReturn();
|
platform.runUntilReturn();
|
||||||
}
|
}
|
||||||
|
|
||||||
function runStepBackwards() {
|
function runStepBackwards() {
|
||||||
|
if (!checkRunReady()) return;
|
||||||
setupBreakpoint("stepback");
|
setupBreakpoint("stepback");
|
||||||
platform.stepBack();
|
platform.stepBack();
|
||||||
}
|
}
|
||||||
@ -1118,6 +1127,7 @@ function clearBreakpoint() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetAndDebug() {
|
function resetAndDebug() {
|
||||||
|
if (!checkRunReady()) return;
|
||||||
_disableRecording();
|
_disableRecording();
|
||||||
if (platform.setupDebug && platform.readAddress) { // TODO??
|
if (platform.setupDebug && platform.readAddress) { // TODO??
|
||||||
clearBreakpoint();
|
clearBreakpoint();
|
||||||
@ -1661,7 +1671,6 @@ function addPageFocusHandlers() {
|
|||||||
|
|
||||||
function showInstructions() {
|
function showInstructions() {
|
||||||
var div = $(document).find(".emucontrols-" + getRootBasePlatform(platform_id));
|
var div = $(document).find(".emucontrols-" + getRootBasePlatform(platform_id));
|
||||||
$("#emulator").append(div);
|
|
||||||
var vcanvas = $("#emulator").find("canvas");
|
var vcanvas = $("#emulator").find("canvas");
|
||||||
if (vcanvas) {
|
if (vcanvas) {
|
||||||
vcanvas.on('focus', () => {
|
vcanvas.on('focus', () => {
|
||||||
@ -1685,7 +1694,7 @@ function installGAHooks() {
|
|||||||
|
|
||||||
function startPlatform() {
|
function startPlatform() {
|
||||||
if (!PLATFORMS[platform_id]) throw Error("Invalid platform '" + platform_id + "'.");
|
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);
|
stateRecorder = new StateRecorderImpl(platform);
|
||||||
PRESETS = platform.getPresets();
|
PRESETS = platform.getPresets();
|
||||||
if (!qs['file']) {
|
if (!qs['file']) {
|
||||||
@ -1858,18 +1867,16 @@ function convertLegacyVCS(store) {
|
|||||||
|
|
||||||
const useHTTPSCookieName = "__use_https";
|
const useHTTPSCookieName = "__use_https";
|
||||||
|
|
||||||
function shouldRedirectHTTPS() {
|
function shouldRedirectHTTPS() : boolean {
|
||||||
// cookie set?
|
// cookie set? either true or false
|
||||||
if (getCookie(useHTTPSCookieName)) {
|
var shouldRedir = getCookie(useHTTPSCookieName);
|
||||||
return true;
|
if (typeof shouldRedir === 'string') {
|
||||||
|
return !!shouldRedir; // convert to bool
|
||||||
}
|
}
|
||||||
// is this our first time here? if so, set a 10yr cookie
|
// set a 10yr cookie, value depends on if it's our first time here
|
||||||
if (hasLocalStorage && !localStorage.getItem("__lastplatform")) {
|
var val = hasLocalStorage && !localStorage.getItem("__lastplatform") ? 1 : 0;
|
||||||
document.cookie = useHTTPSCookieName + "=1;domain=8bitworkshop.com;path=/;max-age=315360000";
|
document.cookie = useHTTPSCookieName + "=" + val + ";domain=8bitworkshop.com;path=/;max-age=315360000";
|
||||||
return true;
|
return !!val;
|
||||||
}
|
|
||||||
// we can't redirect, might still have HTTP files
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectToHTTPS() {
|
function redirectToHTTPS() {
|
||||||
|
@ -197,11 +197,6 @@ var PLATFORM_PARAMS = {
|
|||||||
{name:'Cartridge RAM',start:0x6000,size:0x2000,type:'ram'},
|
{name:'Cartridge RAM',start:0x6000,size:0x2000,type:'ram'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'nes-asm': {
|
|
||||||
cfgfile: 'nes.cfg',
|
|
||||||
define: '__NES__',
|
|
||||||
libargs: ['nes.lib'],
|
|
||||||
},
|
|
||||||
'apple2': {
|
'apple2': {
|
||||||
define: '__APPLE2__',
|
define: '__APPLE2__',
|
||||||
cfgfile: 'apple2-hgr.cfg',
|
cfgfile: 'apple2-hgr.cfg',
|
||||||
@ -776,6 +771,9 @@ function assembleDASM(step:BuildStep) {
|
|||||||
listings[path] = {lines:[]};
|
listings[path] = {lines:[]};
|
||||||
}
|
}
|
||||||
parseDASMListing(alst, listings, errors, unresolved);
|
parseDASMListing(alst, listings, errors, unresolved);
|
||||||
|
if (errors.length) {
|
||||||
|
return {errors:errors};
|
||||||
|
}
|
||||||
// read binary rom output and symbols
|
// read binary rom output and symbols
|
||||||
var aout, asym;
|
var aout, asym;
|
||||||
aout = FS.readFile(binpath);
|
aout = FS.readFile(binpath);
|
||||||
@ -914,6 +912,7 @@ function assembleCA65(step:BuildStep) {
|
|||||||
var FS = CA65['FS'];
|
var FS = CA65['FS'];
|
||||||
setupFS(FS, '65-'+getRootBasePlatform(step.platform));
|
setupFS(FS, '65-'+getRootBasePlatform(step.platform));
|
||||||
populateFiles(step, FS);
|
populateFiles(step, FS);
|
||||||
|
fixParamsWithDefines(step.path, step.params);
|
||||||
execMain(step, CA65, ['-v', '-g', '-I', '/share/asminc', '-o', objpath, '-l', lstpath, step.path]);
|
execMain(step, CA65, ['-v', '-g', '-I', '/share/asminc', '-o', objpath, '-l', lstpath, step.path]);
|
||||||
if (errors.length)
|
if (errors.length)
|
||||||
return {errors:errors};
|
return {errors:errors};
|
||||||
@ -947,6 +946,10 @@ function linkLD65(step:BuildStep) {
|
|||||||
setupFS(FS, '65-'+getRootBasePlatform(step.platform));
|
setupFS(FS, '65-'+getRootBasePlatform(step.platform));
|
||||||
populateFiles(step, FS);
|
populateFiles(step, FS);
|
||||||
populateExtraFiles(step, FS, params.extra_link_files);
|
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 libargs = params.libargs;
|
||||||
var cfgfile = params.cfgfile;
|
var cfgfile = params.cfgfile;
|
||||||
var args = ['--cfg-path', '/share/cfg',
|
var args = ['--cfg-path', '/share/cfg',
|
||||||
@ -1034,6 +1037,7 @@ function fixParamsWithDefines(path:string, params){
|
|||||||
if (path && libargs) {
|
if (path && libargs) {
|
||||||
var code = getWorkFileAsString(path);
|
var code = getWorkFileAsString(path);
|
||||||
if (code) {
|
if (code) {
|
||||||
|
var oldcfgfile = params.cfgfile;
|
||||||
var ident2index = {};
|
var ident2index = {};
|
||||||
// find all lib args "IDENT=VALUE"
|
// find all lib args "IDENT=VALUE"
|
||||||
for (var i=0; i<libargs.length; i++) {
|
for (var i=0; i<libargs.length; i++) {
|
||||||
@ -1043,7 +1047,7 @@ function fixParamsWithDefines(path:string, params){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// find #defines and replace them
|
// 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;
|
var m;
|
||||||
while (m = re.exec(code)) {
|
while (m = re.exec(code)) {
|
||||||
var ident = m[1];
|
var ident = m[1];
|
||||||
@ -1055,8 +1059,13 @@ function fixParamsWithDefines(path:string, params){
|
|||||||
// TODO: MMC3 mapper switch
|
// TODO: MMC3 mapper switch
|
||||||
if (ident == 'NES_MAPPER' && value == '4') {
|
if (ident == 'NES_MAPPER' && value == '4') {
|
||||||
params.cfgfile = 'nesbanked.cfg';
|
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});
|
compile('cc65', '#include "NOSUCH.file"\n', 'nes', done, 0, 0, 1, {ignoreErrorPath:true});
|
||||||
});
|
});
|
||||||
it('should assemble CA65', function(done) {
|
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) {
|
it('should assemble Z80ASM', function(done) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user