Re: New to Assembly Language
Or would it be something like this...
LDA AL
ADD BL
STA CL
CLA
CIL
ADD AH
ADD BH
STA CH
HLT
Re: New to Assembly Language
Quote:
Originally Posted by
halt4814
Or would it be something like this...
[...]
Depends on the architecture that's meant for, I'd say. To me that looks somewhat like 6502-style instructions, but with the 8086 register set or at least variables named like the 8086 registers.
At the very least it's much closer than the one from post #1 which rather looks like BASIC.
However, it doesn't declare or initalize the variables, neither does it account for the part of the assigment about the program origin.
Re: New to Assembly Language
So if I add ORG 100 to the top, then what?
Re: New to Assembly Language
Given the assembler that finally has to process that source code understands that directive and interprets integer literals as being hexadecimal by default (rather uncommon, IMO, at least without a directive telling it to do so), that would fix at least one of the potential problems I mentioned. However, without knowing more about your environment, I can't really say anything for sure.
Re: New to Assembly Language
I do not think it needs to be double precision,so couldn't be as simple as...
ORG 100
LDA A
ADD B
STA C
HLT
A, 7
B, 148
Re: New to Assembly Language
Your code seems to deal with integral numbers, and if that assumption is correct, the term double precision does not apply here, since it referts to floating point arithmetic.
In case you're refering to the bitness (width) of integer operands in registers, now that doesn't match the model of the 8086 register set anymore: It has a 16-bit AX register, of which the high-order 8 bits can be accessed under the name AH and the low-order 8 bits can be accessed as AL. However, they're still no distinct registers: Modifying AL unconditionally modifies AX as well, for instance. Likewise for the registers BX, CX and DX. (There are more registers with properties differing from those, but I think we can ignore them here for now.)
Again, it's quite important to know for which architecture you're writing your assembly language code. Assembly languages for different architectures can be quite different as well. And the more specific it gets, the more important that is.