Assembler help

Do you have a technical question that doesn't really fit a specific console? Want some general info on electronics, hacking, making cookies, etc? Here's the place to ask! Go nuts.

Moderator:Moderators

Post Reply
sammy
Posts:568
Joined:Thu Dec 08, 2005 3:13 pm
Assembler help

Post by sammy » Fri Oct 13, 2006 11:45 am

Can somebody tell me what the difference between immediate and direct functions? I don't really understand what the difference would be in this porgram for example:

ljmp 200h
mov R1,#20h

If I understand it correctly, this will let the cpu move 20 hexadecimal to register R1.

But if I use direct it would be like this:

ljmp 200
mov 1,20h

Now what's the difference?

User avatar
gannon
Moderator
Posts:6974
Joined:Sun Apr 04, 2004 4:48 pm
Location:Near that one big lake
Contact:

Post by gannon » Fri Oct 13, 2006 12:22 pm

Pretty sure the difference is when the bits are moved, been awhile since I've done ASM work though...really should get back into it for PICs and my NES

User avatar
marshallh
Moderator
Posts:2986
Joined:Sat Sep 10, 2005 2:17 pm
360 GamerTag:marshallh
Location:here and there
Contact:

Post by marshallh » Sat Oct 14, 2006 7:56 pm

"Microprocessors provide a number of ways to specify the location of data to be used in calculations.
For example, one of the data values to be used in an add instruction may be encoded as part of that instruction's opcode, the raw machine language produced by the assembler as it parses your assembly language program. This is known as immediate addressing.
Alternatively, perhaps the opcode will instead contain a memory address which holds the data (direct addressing). More commonly, the instruction will specify that an auxiliary register holds the memory address which in turn holds the data (indirect addressing). The processor knows which addressing mode is being used by examining special bit fields in the instruction opcode."
- some website
Image

Post Reply