Skip to content

Commit

Permalink
Clean up whitespace and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
eliben committed Apr 21, 2021
1 parent 1e2e439 commit 7a0c9bf
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let codeSamples = [
'code': `
; The sum will be accumulated into d
mvi d, 0
; Demonstrates indirect addressing, by keeping
; a "pointer" to myArray in bc.
lxi bc, myArray
Expand Down Expand Up @@ -77,22 +77,22 @@ Capitalize:
mov a, c
cpi 0
jz AllDone
mov a, m
cpi 61h
jc SkipIt
cpi 7bh
jnc SkipIt
sui 20h
mov m, a
SkipIt:
inx hl
dcr c
jmp Capitalize
AllDone:
ret
Expand Down Expand Up @@ -133,7 +133,7 @@ loop:
jnz loop ;Jump to 'loop:' if the zero-flag is not set.
ret ;Return
`}

];

// Code samples.
Expand Down Expand Up @@ -273,11 +273,12 @@ function setStatusReady() {
// RAM per the user's request in the RAM table.
let memFromLastRun = new Array(65536).fill(0);

// Checks if the value in the maxsteps box is valid; throws exception if not.
function checkSteps() {
if (maxsteps.value === 'undefined' || isNaN(parseInt(maxsteps.value))
|| parseInt(maxsteps.value) < 0) {
if (maxsteps.value === 'undefined' || isNaN(parseInt(maxsteps.value)) ||
parseInt(maxsteps.value) < 0) {
throw new Error(`Steps value is invalid`);
}
}
}

function dispatchStep(event) {
Expand All @@ -292,7 +293,7 @@ function dispatchStep(event) {
break;
case "prev":
onPrevStep();
break;
break;
}
} catch (e) {
if (e instanceof js8080sim.ParseError ||
Expand Down

0 comments on commit 7a0c9bf

Please sign in to comment.