|
-
May 25th, 2001, 02:40 AM
#1
Thread Starter
Retired VBF Adm1nistrator
Newbie ; Is this right ?
Howdy.
I'm learning assembly in college (for the m68000).
Is the following conversion from java to assembly correct ?
Code:
int a, b, c, d;
d = (b - a) + c;
goes to
Code:
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
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
May 25th, 2001, 04:42 PM
#2
I dont know about the variables, or opcodes, but the meat of the thing looks fine.
Z.
-
May 26th, 2001, 11:09 AM
#3
When you find out, will you let us know?
-
May 28th, 2001, 02:02 AM
#4
Thread Starter
Retired VBF Adm1nistrator
Yeah sure
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jun 22nd, 2001, 12:14 AM
#5
Conquistador
Did u get it back yet?
ChimpFace, your avatar looks like it's flipping me the bird.

Do you program Visual C++?
-
Jun 22nd, 2001, 12:21 AM
#6
Hes not, hes saying "number 1".
-
Jun 22nd, 2001, 02:22 AM
#7
Thread Starter
Retired VBF Adm1nistrator
Im getting my results on the 4th of july (ffs ).
Anyway I'll let yiz know
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 12th, 2001, 02:40 PM
#8
Addicted Member
find out yet?
Isn't that chipset similar to the 6802 processor that the super nintendo uses?
- Dim A
-
Jul 17th, 2001, 04:51 AM
#9
Thread Starter
Retired VBF Adm1nistrator
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
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 19th, 2001, 12:00 PM
#10
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
-
Jul 20th, 2001, 01:56 AM
#11
Thread Starter
Retired VBF Adm1nistrator
Well I need it for the M68K processor...
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 20th, 2001, 10:51 AM
#12
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|