Skip to content

Commit 8fc2e3a

Browse files
committed
First instruction has now also 0 as adress
1 parent 2ea4465 commit 8fc2e3a

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,28 @@ Enable the collaboration mode to work with others at the same time
4444
```
4545
; As long as the multiplier is not 0, continue with the program
4646
tst 0
47-
--jmp 4
47+
--jmp 3
4848
hlt
4949
5050
; Decrement the multiplier, done once per iteration
5151
dec 0
5252
5353
; Decrement the multiplicand until it's 0 and add its content onto registers 2 and 3
5454
tst 1
55-
--jmp 8
56-
jmp 12
55+
--jmp 7
56+
jmp 11
5757
dec 1
5858
inc 2
5959
inc 3
60-
jmp 5
60+
jmp 4
6161
6262
; Move the multiplicand, now stored in register 2, back to register 1
6363
tst 2
64-
--jmp 16
65-
jmp 1
64+
--jmp 15
65+
jmp 0
6666
; move complete, go to next iteration
67-
jmp 1
67+
jmp 0
6868
dec 2
6969
inc 1
70-
jmp 12
70+
jmp 11
7171
```

js/editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function update() {
8080
linenums.value = '';
8181

8282
// add line number for every line that is not empty
83-
let counter = 1;
83+
let counter = 0;
8484
for (let i = 0; i < lines.length; i++) {
8585
if (lines[i] != '' && !lines[i].startsWith(';')) {
8686
linenums.value += counter + '\n';

js/simulator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function executeLine() {
8383
// evaluate code
8484
switch (cmd) {
8585
case 'jmp':
86-
line = param - 1;
86+
line = param;
8787
break;
8888

8989
case 'tst':

0 commit comments

Comments
 (0)