Skip to content

Commit

Permalink
increase window size, speed up clock, debug to out
Browse files Browse the repository at this point in the history
  • Loading branch information
Maya Karabula-Stysiak committed May 8, 2023
1 parent 8aa2d5d commit c2987ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
</script>

<body>
<canvas width="512" height="320" id="canvas">
</canvas>

<div class="out" id="out">
<pre class="stdlabel">UXN ts</pre>
<span class="stdout-label">stdout:</span>
Expand All @@ -23,8 +26,7 @@
<pre id="stderr"></pre>
</div>

<canvas width="512" height="320" id="canvas">
</canvas>


<style>
body {
Expand Down
7 changes: 4 additions & 3 deletions src/uxn.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { uxn_halt } from './devices/system';
import { base, keepFlag, opCodes, returnFlag, shortFlag } from './opCodes';
import { deo_mask, dei_mask, uxn_deo, uxn_dei } from './uxnemu';
import { out } from './out'

export const PAGE_PROGRAM = 0x0100;

Expand Down Expand Up @@ -145,8 +146,8 @@ export const uxn_eval = async (u: Uxn, pc: number): Promise<number> => {
k = keepFlag(ins);
s = returnFlag(ins) ? u.rst : u.wst;

// console.log(opCodes[ins])
// console.log("( ", s.dat.slice(0, s.ptr).map(i => i.toString(16).padStart(2, "0")).join(' '), " )")
// out(opCodes[ins] + '\n')
// out("( " + s.dat.slice(0, s.ptr).map(i => i.toString(16).padStart(2, "0")).join(' ') + " )\n")

switch (ins) {
case opCodes.BRK:
Expand Down Expand Up @@ -565,7 +566,7 @@ export const uxn_eval = async (u: Uxn, pc: number): Promise<number> => {
}

if (!BRK) {
if (BATCH < 100) {
if (BATCH < 150) {
BATCH++;
return await step();
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/uxnemu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ export function draw() {
canvas = document.getElementById('canvas') as HTMLCanvasElement;
}

canvas.width = uxn_screen.width * zoom;
canvas.height = uxn_screen.height * zoom;
canvas.width = uxn_screen.width * zoom * 1.5;
canvas.height = uxn_screen.height * zoom * 1.5;

if (canvas) {
if (!ctx) {
ctx = canvas.getContext('2d');
}

if (ctx) {
ctx.scale(zoom, zoom);
ctx.scale(zoom * 1.5, zoom * 1.5);

for (let x = 0; x < uxn_screen.width; x++) {
for (let y = 0; y < uxn_screen.height; y++) {
Expand Down Expand Up @@ -163,4 +163,4 @@ main();

setInterval(() => {
draw();
}, 50);
}, 1000 / 60);

0 comments on commit c2987ed

Please sign in to comment.