SimpleAdd

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SimpleAdd

Jack ZRP
This post was updated on .
I use my VM translator to translate the SimpleAdd.vm, I got my SimpleAdd.asm



SimpleAdd.asm can run on the CPU Emulator if I add

It can set RAM[0] 256

but, I got a error "in line 1 unknown instruction -@7"
when I test SimpleAdd.asm by SimpleAdd.tst
Reply | Threaded
Open this post in threaded view
|

Re: SimpleAdd

cadet1620
Administrator
Jack ZRP wrote
I use my VM translator to translate the SimpleAdd.vm, I got my SimpleAdd.asm

@7
D=A
@SP
...
D=D+M
M=D
@SP

SimpleAdd.asm can run on the CPU Emulator if I add
"@256"
"D=A"
"@SP"
"M=D"
It can set RAM[0] 256

but, I got a error "in line 1 unknown instruction -@7"
when I test SimpleAdd.asm by SimpleAdd.tst
The "SimpleAdd.asm: in line 1: unknown instruction - @7" message is a VMEmultator error because the VMEmulator is trying to interpret @7 as a VM command.

You need to run SimpleAdd.tst using the CPUEmulator.

[c:/TECS/projects/07/StackArithmetic/SimpleAdd]
% VMEmulator SimpleAdd.tst
SimpleAdd.asm: in line 1: unknown instruction - @7

[c:/TECS/projects/07/StackArithmetic/SimpleAdd]
% CPUEmulator SimpleAdd.tst
Comparison failure at line 2

[c:/TECS/projects/07/StackArithmetic/SimpleAdd]
% diff -c SimpleAdd.cmp SimpleAdd.out
*** SimpleAdd.cmp       Sun Apr 07 12:04:00 2002
--- SimpleAdd.out       Tue Jan 12 05:50:56 2016
***************
*** 1,2 ****
  |  RAM[0]  | RAM[256] |
! |     257  |      15  |
--- 1,2 ----
  |  RAM[0]  | RAM[256] |
! |     258  |      15  |
Your ASM code is correctly computing 7+8, but leaving the SP with the wrong value.

Please edit your post to remove the majority of your ASM code so as not to provide a spoiler.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: SimpleAdd

Jack ZRP
Thank you!