about opcode 
Author Message
 about opcode

in the instruction of intel cpu:
MOV Reg,Imm      1011wrrr
                                      ^^^^
                          here is "Reg",but where "Imm" goes?
can anyone tell me where to specify the "Imm"?
thank you


Thu, 12 Jul 2001 03:00:00 GMT  
 about opcode
For the most complete information on this, check out the file
"OPCODES.LST" in Ralf Brown's interrupt list, which can be found at
ftp://ftp.cs.cmu/afs/cs.cmu.edu/user/ralf/pub/interrupt-list/.

According to the file, the basic format of instructions is:
<basecode> <postbyte> <offset> <immediate_operands>
Thus, the immediate value should be the last byte(s) of the
instruction.  For instance, 0B8h is the "basecode" for MOV AX, <imm16>,
and 0B8h/34h/12h means MOV AX, 1234h.

-- Derek

Quote:

> in the instruction of intel cpu:
> MOV Reg,Imm      1011wrrr
>                                       ^^^^
>                           here is "Reg",but where "Imm" goes?
> can anyone tell me where to specify the "Imm"?
> thank you



Thu, 12 Jul 2001 03:00:00 GMT  
 about opcode
|in the instruction of intel cpu:
|MOV Reg,Imm      1011wrrr
|                                      ^^^^
|                          here is "Reg",but where "Imm" goes?
|can anyone tell me where to specify the "Imm"?

The Imm is the last word/dword of the instruction. If the
opcode size is 32-bit, it's a dword, else it's a word.



Thu, 12 Jul 2001 03:00:00 GMT  
 about opcode

Quote:
>in the instruction of intel cpu:
>MOV Reg,Imm      1011wrrr
>                                      ^^^^
>                          here is "Reg",but where "Imm" goes?
>can anyone tell me where to specify the "Imm"?
>thank you

You specify the "Imm" in the next byte or bytes.  For example, "mov reg16,
imm16" is a three byte instruction.  If you wanted to (hand-)assemble the
following code:

mov ax,00FF

Your first byte would be

B8              ;mov ax, imm16 instruction

and your next two bytes would be the immediate data:

FF 00

So, the full assembly of the instruction mov ax,00FF would be B8 FF 00.  That's
three separate bytes

Hope this helps.

Rob

p.s. if you're wondering why the order of the bytes of the 16-bit immediate are
reversed in the machine code it's because Intel processors are little endian.
always reverse you're operand bytes and you'll be fine.



Thu, 12 Jul 2001 03:00:00 GMT  
 about opcode

Quote:

>For the most complete information on this, check out the file
>"OPCODES.LST" in Ralf Brown's interrupt list, which can be found at
>ftp://ftp.cs.cmu/afs/cs.cmu.edu/user/ralf/pub/interrupt-list/.

Derek,

This URL doesn't seem to work.  Are you sure this is the right URL?  (and if
not, can you repost the correct one because I'd like to check out that site)

Thanks

Rob



Thu, 12 Jul 2001 03:00:00 GMT  
 about opcode
Sorry!  (I was trying to type it from memory...  =)    )
The *real* address is:
ftp://ftp.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/interrupt-list/ .
(I tested it this time!)

Sincerest apologies,
-- Derek

Quote:

> >For the most complete information on this, check out the file
> >"OPCODES.LST" in Ralf Brown's interrupt list, which can be found at
> >ftp://ftp.cs.cmu/afs/cs.cmu.edu/user/ralf/pub/interrupt-list/.

> Derek,

> This URL doesn't seem to work.  Are you sure this is the right URL?  (and if
> not, can you repost the correct one because I'd like to check out that site)

> Thanks

> Rob



Thu, 12 Jul 2001 03:00:00 GMT  
 about opcode

Quote:

> in the instruction of intel cpu:
> MOV Reg,Imm      1011wrrr
>                                       ^^^^
>                           here is "Reg",but where "Imm" goes?
> can anyone tell me where to specify the "Imm"?
> thank you

After "1011wrrr" sure. It's 1, 2 or 4 bytes depending on
bit "w" and mode (16/32)


Fri, 13 Jul 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Opcode quiz

2. Diagnose OPCODE X'83'

3. Invalid opcode when using macros...???

4. Opcodes...

5. OPSYN opcode in ibm bal

6. opsyn opcode in ibm bal

7. OT: Z80 opcode question

8. Forth-83 coded do-loop built on for-next opcode

9. NEXT using pentium opcodes.

10. PASSM opcode allocation

11. Mindy NT 'Bogus Opcode'

12. IEEE 1149.1 boundary scan and HIGHZ opcode

 

 
Powered by phpBB® Forum Software