Skip to content

Commit

Permalink
Fixes #137
Browse files Browse the repository at this point in the history
  • Loading branch information
neauoire committed Jan 15, 2025
1 parent fa82413 commit fc3a487
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
5 changes: 3 additions & 2 deletions etc/uxn5/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
textarea { resize:none; width:100%; height:100vh; border:0; padding:10px; margin-bottom:0px; background:#efefef }
div#term { width:100%; background:#000; padding:10px; color:white; height:55px; overflow:scroll; white-space:pre; display:none }
div#stack { width:100%; height:25px; background:#72dec2; padding:10px; margin-bottom:20px;font-weight:bold; display:none }
#emulator { width:fit-content; margin:auto; display:block; }
#emulator { width:fit-content; margin:auto; display:none; }
body.embed #emulator, body.default #emulator { display:block }
#share { display:none }
#screen { image-rendering:pixelated; image-rendering:crisp-edges; touch-action:none;border:1px solid #333; border-radius:3px;overflow:hidden; position:relative; margin:auto }
#screen { image-rendering:pixelated; image-rendering:crisp-edges; touch-action:none;overflow:hidden; position:relative; margin:auto }
#screen > * { cursor:none }
#screen #bgcanvas { position:absolute; left:0; top:0; z-index:0 }
#screen #fgcanvas { position:absolute; left:0; top:0; z-index:1 }
Expand Down Expand Up @@ -91,6 +91,7 @@
<script src="src/devices/file.js"></script>
<script src="src/devices/mouse.js"></script>
<script src="src/devices/screen.js"></script>
<script src="src/boot.js"></script>
<script>
const emulator = new Emu(window.self !== window.top)
emulator.init()
Expand Down
2 changes: 2 additions & 0 deletions etc/uxn5/src/boot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const boot_rom = [];
const default_zoom = 1;
7 changes: 6 additions & 1 deletion etc/uxn5/src/devices/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ function Controller(emu)
event.preventDefault();
}
emu.uxn.dev[0x82] = this.state;
emu.uxn.eval(peek16(emu.uxn.dev, 0x80))
if(mask || event.type == "keydown") {
emu.uxn.eval(peek16(emu.uxn.dev, 0x80))
}
if(event.type == "keydown") {
emu.uxn.dev[0x83] = 0;
}
}
}
9 changes: 5 additions & 4 deletions etc/uxn5/src/emu.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function Emu (embed)
}
emulator.load(rom, true);
}
// Get boot rom
else if(boot_rom){
emulator.load(boot_rom, true);
}
// Start screen vector
setInterval(() => {
window.requestAnimationFrame(() => {
Expand All @@ -73,7 +77,7 @@ function Emu (embed)
}

this.load = (rom, fromURL = false) => {
this.screen.set_zoom(1)
this.screen.set_zoom(default_zoom ? default_zoom : 1)
this.uxn.load(rom).eval(0x0100);
share.setROM(rom);
if (fromURL) {
Expand Down Expand Up @@ -154,10 +158,8 @@ function SaveView(el) {
saveButtonEl.disabled = true;
saveButtonEl.style.display = "none"
saveButtonEl.innerHTML = `Save`

saveButtonEl.addEventListener("click", (ev) => {
ev.preventDefault();

let blob = new Blob([rom]);
let blobUrl = URL.createObjectURL(blob);
let link = document.createElement("a");
Expand All @@ -168,7 +170,6 @@ function SaveView(el) {
link.remove()
});
el.appendChild(saveButtonEl);

this.setROM = (v) => {
rom = v;
saveButtonEl.disabled = false;
Expand Down
4 changes: 1 addition & 3 deletions site/astronomy.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<nav><ul><li><a href="audio.html">audio</a></li><li><a href="visual.html">visual</a></li><li><a href="research.html" class="parent">research</a></li><li><a href="about.html">about</a></li></ul><ul><li><a href="logic.html">logic</a></li><li><a href="arithmetic.html">arithmetic</a></li><li><a href="geometry.html">geometry</a></li><li><a href="astronomy.html" class="self">astronomy</a></li><li><a href="language.html">language</a></li><li><a href="computation.html">computation</a></li><li><a href="hardware.html">hardware</a></li><li><a href="time.html">time</a></li></ul><ul></ul></nav>
<main><h2>Astronomy is the study of celestial objects and phenomena.</h2>

<p>[work in progress]</p>

<h3>The Earth</h3>

<p>The equinox is the moment when the Sun crosses the Earth's equator, these are
Expand Down Expand Up @@ -51,7 +49,7 @@ <h4>The Moon</h4>

<div class='codeview'>
<iframe src="../etc/moon.c.txt"></iframe>
<pre>cc -lm moon.c -o moon && ./moon <a href='./etc/moon.c.txt' target='_blank'>view raw</a></pre>
<pre>cc -lm moon.c -o moon && ./moon <a href='../etc/moon.c.txt' target='_blank'>view raw</a></pre>
</div>

<img src="../media/refs/horizon.png" width="200">
Expand Down
4 changes: 1 addition & 3 deletions src/htm/astronomy.htm
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<h2>Astronomy is the study of celestial objects and phenomena.</h2>

<p>[work in progress]</p>

<h3>The Earth</h3>

<p>The equinox is the moment when the Sun crosses the Earth's equator, these are
Expand Down Expand Up @@ -45,7 +43,7 @@ <h4>The Moon</h4>

<div class='codeview'>
<iframe src="../etc/moon.c.txt"></iframe>
<pre>cc -lm moon.c -o moon && ./moon <a href='./etc/moon.c.txt' target='_blank'>view raw</a></pre>
<pre>cc -lm moon.c -o moon && ./moon <a href='../etc/moon.c.txt' target='_blank'>view raw</a></pre>
</div>

<img src="../media/refs/horizon.png" width="200">
Expand Down

0 comments on commit fc3a487

Please sign in to comment.