Content deleted Content added
Tags: Mobile edit Mobile app edit Android app edit |
Pseudocode is unnecessarily confusing with multiple ++/-- operations on the same variable in an expression. |
||
Line 69:
jump top
add:
*sp++ = addend1 + addend2 // Add the two values together and store the result on the top of the stack
jump top
</syntaxhighlight>
Line 98 ⟶ 99:
jump *ip++
add:
*sp++ = addend1 + addend2 // Add the two values together and store the result on top of the stack
jump *ip++
</syntaxhighlight>
Line 118 ⟶ 120:
<syntaxhighlight lang="c">
#define PUSH(x) (*sp++ = (x))
#define POP() (*--sp)
start:
ip = &thread // ip points to &pushA (which points to the first instruction of pushA)
Line 127 ⟶ 131:
...
pushA:
jump *ip++ // send control where ip says to (i.e. to pushB) and advance ip
pushB:
jump *ip++
add:
PUSH(result)
*sp++ = *--sp + addend▼
jump *ip++
</syntaxhighlight>
Line 141 ⟶ 145:
<syntaxhighlight lang="c">
#define PUSH(x) (*sp++ = (x))
#define POP() (*--sp)
start:
ip = &thread
Line 152 ⟶ 158:
...
push:
PUSH(*variable_address) // Read value from variable and push on stack
jump *ip++
add:
PUSH(result)
*sp++ = *--sp + addend▼
jump *ip++
</syntaxhighlight>
Line 186 ⟶ 193:
jump *(*++ip) // advance ip in thread, jump through next indirect block to next subroutine
add:
jump *(*++ip)
</syntaxhighlight>
Line 211 ⟶ 219:
ret
add:
ret
</syntaxhighlight>
Line 243 ⟶ 252:
jump top
add:
*sp++ = addend1 + addend2
jump top
</syntaxhighlight>
|