Converting Assembly to machine code. Help with Address modes

This is a discussion on Converting Assembly to machine code. Help with Address modes within the Tech Board forums, part of the Community Boards category; Hi, I have a question and if anyone could assist me, it would be really appreciated. I am trying to ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Location
    U.K.
    Posts
    148

    Converting Assembly to machine code. Help with Address modes

    Hi,

    I have a question and if anyone could assist me, it would be really appreciated.

    I am trying to convert the following line of Assembler code into machine code, but I am unable to understand how to choose the Source and Destination modes from my copy of the instruction set.

    The original instruction is:-

    MOVE.L #$D3A5, D2
    Starting with a 'blank':-

    0000 0000 0000 0000
    I added the MOVE part, leaving:-

    0000 0000 0000 0000
    I then added the .L (signifying a LONG WORD), leaving:-

    0010 0000 0000 0000
    Then I added the destination address (D2):-

    0010 0100 0000 0000
    But now I am stuck, I have the answer which is:-

    0010 0100 0011 1100


    My problem is that despite having a copy of the instruction set, I don't understand the notation used.

    I am aware that I am moving the data it'self in Hex format, but unfortunately this isn't bridging my gap in knowledge. The image below is a copy of the instruction set, but as I say, I do not understand the addressing mode's and so am not able to convert the last remaining parts of the assembler.

    http://www.imageox.com/image/273085-image.jpeg

    If anyone could explain how to select the correct addressing modes so as to be able to finish to conversion to machine code I would be extremely grateful.

    Many thanks for any help!

    Swerve.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    OK, let's pick up more or less where you left off.

    0 0 10 010 000 000 000
    The source is #$D3A5.

    That looks like a possible memory address in hexadecimal. Looking through your addressing modes for source, there is only one marked as starting with a '#'. That option contains mode 111, and register 100. Thus, we have this:

    Code:
    0 0 10 010 000 111 100
    Hope that helps.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    I like the other style notation so much better.

    mov d2 , [D3A5]


    so much easier to read imo
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 07:17 PM
  2. how do I morse code converting program
    By panfilero in forum C Programming
    Replies: 17
    Last Post: 10-29-2005, 10:16 PM
  3. Counting machine code?
    By IBCNUNHELL in forum C++ Programming
    Replies: 8
    Last Post: 02-27-2002, 02:41 PM
  4. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 03:35 AM
  5. How can I incorporate Assembly code in my C++ program.
    By bman1176 in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2001, 10:58 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21