Click to See Complete Forum and Search --> : Newbie ; Is this right ?
plenderj
May 25th, 2001, 02:40 AM
Howdy.
I'm learning assembly in college (for the m68000).
Is the following conversion from java to assembly correct ?
int a, b, c, d;
d = (b - a) + c;
goes to
A DC.L 0
B DC.L 0
C DC.L 0
D DC.L 0
ORG $0000
MOVE D0,A
MOVE D1,B
MOVE D2,C
MOVE D3,D
SUB D1,D0
ADD D1,D2
MOVE D3,D1
NOP
END
Zaei
May 25th, 2001, 04:42 PM
I dont know about the variables, or opcodes, but the meat of the thing looks fine.
Z.
ChimpFace9000
May 26th, 2001, 11:09 AM
When you find out, will you let us know?
plenderj
May 28th, 2001, 02:02 AM
Yeah sure ;)
da_silvy
Jun 22nd, 2001, 12:14 AM
Did u get it back yet?
ChimpFace, your avatar looks like it's flipping me the bird.
:D
Do you program Visual C++?
ChimpFace9000
Jun 22nd, 2001, 12:21 AM
Hes not, hes saying "number 1".
plenderj
Jun 22nd, 2001, 02:22 AM
Im getting my results on the 4th of july (ffs :)).
Anyway I'll let yiz know :)
Dim A
Jul 12th, 2001, 02:40 PM
find out yet?
Isn't that chipset similar to the 6802 processor that the super nintendo uses?
- Dim A
plenderj
Jul 17th, 2001, 04:51 AM
In the exam we had an awful loop construct to do in assembly, so I didnt do too well. But I'll get the repeats :)
Knight_Vision
Jul 19th, 2001, 12:00 PM
I wish I would have known. I could have helped you... err.. Here is the correct way to convert it. :)
From this...
int a, b, c, d;
d = (b - a) + c;
To this...
A DW 0 ;This sets it up as a 16-Bit variable.
B DW 0
C DW 0
D DW 0
MOV AX,1
MOV Word [A],AX
MOV Word [B],AX
MOV Word [C],AX
MOV Word [D],AX ;Now all of them are equal to 1
SUB Word [B],Word [A] ;B is now 0
ADD Word [B],Word [C] ;B is now 1
MOV Word [D],Word [B] ;D = 1
NOTE : This is NASM assembly code. NASM will compile cross platform for those who need it.
If your using TASM or MASM (shudder) then you will have to type it up slightly different with a PTR after the Word statements.
Hope this helps.. :)
Knight Vision
plenderj
Jul 20th, 2001, 01:56 AM
Well I need it for the M68K processor...
Knight_Vision
Jul 20th, 2001, 10:51 AM
I don't know if it will for that processor or not. You can check with the people who make nasm. (Their website I meant.)
If not, do you know all of the REGISTERS and COMMANDS that the processor can take? If so, is it in a TXT file already? If so, can you post it for all of us? I could then look at it and rewrite the code for you.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.