JavaScript Program | Assembly Language Program | |
---|---|---|
z = x + y;
|
LOD X |
Load contents of memory location 129 (X) into Accumulator Add contents at address 130 (Y) to Accumulator Store contents of Accumulator in location 131 (Z) Halt execution |
JavaScript Program | Assembly Language Program | |
---|---|---|
z = x*x + y*y;
|
LOD X |
Load contents of memory location 129 (X) into Accumulator Multiply Accumulator by contents of location 129 (X) Store contents of Accumulator in temporary location 132 (T1) Load contents of memory location 130 (Y) into Accumulator Multiply Accumulator by contents of location 130 (Y) Add contents at address 132 (T1) to Accumulator Store contents of Accumulator in location 131 (Z) Halt execution |
JavaScript Program | Assembly Language Program | |
---|---|---|
if (x > y) { |
00: LOD Y |
Load contents of memory location 130 (Y) into Accumulator Subtract contents of location 129 (X) from Accumulator Store contents of Accumulator in location 132 (T1) Test if contents of location 132 (T1) is < 0 Jump to location 16 if location 132 (T1) was not < 0 Load 2 into Accumulator Store contents of Accumulator in location 131 (Z) Halt execution Load 3 into Accumulator Store contents of Accumulator in location 131 (Z) Halt execution |
JavaScript Program | Assembly Language Program | |
---|---|---|
// input in y |
00: LOD #0 |
Load 0 into Accumulator Store contents of Accumulator in location 129 (X) Load contents of memory location 130 (Y) into Accumulator Jump to location 20 if Accumulator is 0 Divide Accumulator by 10 Store contents of Accumulator in location 130 (Y) Load contents of memory location 129 (X) into Accumulator Add 1 to Accumulator Store contents of Accumulator in location 129 (X) Jump to location 4 Halt execution |