Results 1 to 12 of 12

Thread: Newbie ; Is this right ?

  1. #1

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    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]

  2. #2
    Zaei
    Guest
    I dont know about the variables, or opcodes, but the meat of the thing looks fine.

    Z.

  3. #3
    ChimpFace9000
    Guest
    When you find out, will you let us know?

  4. #4

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Yeah sure
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Did u get it back yet?

    ChimpFace, your avatar looks like it's flipping me the bird.


    Do you program Visual C++?

  6. #6
    ChimpFace9000
    Guest
    Hes not, hes saying "number 1".

  7. #7

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Im getting my results on the 4th of july (ffs ).
    Anyway I'll let yiz know
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  8. #8
    Addicted Member Dim A's Avatar
    Join Date
    Jul 2000
    Posts
    201
    find out yet?

    Isn't that chipset similar to the 6802 processor that the super nintendo uses?

    - Dim A

  9. #9

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    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]

  10. #10
    Knight_Vision
    Guest
    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

  11. #11

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well I need it for the M68K processor...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  12. #12
    Knight_Vision
    Guest
    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
  •  



Click Here to Expand Forum to Full Width