Getting error while runing simple assembly

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

Getting error while runing simple assembly

ajilraju
Hello,

While I'm running a simple and other piece of code in the CPU emulator getting this kind of error "Expression Excepted".

my code is

"""

@1
M=100

"""

code I'm mentioned have no problem
"""

@1
M=1


"""
Reply | Threaded
Open this post in threaded view
|

Re: Getting error while runing simple assembly

WBahn
Administrator
Are you sure it's "expression excepted" and not "expression expected"?

Can you find in the instruction set the instruction M=100 ?

A better error message would be "mnemonic expected"
Reply | Threaded
Open this post in threaded view
|

Re: Getting error while runing simple assembly

ajilraju
yes, Thank you for your responds

ERROR: - Expression expected,


In this screenshot, I have little code on left that make immediate addressing on the R[1] register. When I load the code that throw this error, But on CPU Emulator have some fine assigning the value #1 to R[1]  is looking fine, can't put a value more than one digit.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Getting error while runing simple assembly

WBahn
Administrator
Try doing

@1
M=2

and you will get the same result.

The format of a C-type instruction is very explicit

[dest=]comp[;jmp]

The comp MUST BE one of the 28 mnemonics defined in Figure 4-3. There is no mnemonic "100", nor is there a mnemonic "2".

Somewhat unfortunately, the authors' CPU emulator will accept "M+D" as a mnemonic equivalent to "D+M". This is not in strict conformance with the ISA specification, it is because whoever wrote the emulator chose to extend its instruction set to include additional mnemonics that have obvious semantics that are the same as specified mnemonics. This is not optimal because it means that code that will run after being assembled on one person's assembler may not run if assembled on another person's assembler.
Reply | Threaded
Open this post in threaded view
|

Re: Getting error while runing simple assembly

ajilraju
Thank you for your feedback.

Now I got the clear point.