from Opcode #7

displacement imm value (if any) follows immideatly after
part of opcode, size of it specifyed in field mod of
00-no displacement
01-8 bit displacement value
10-32 bit displacement value)
Now let's answer 3 simple questions:
How processor knows:

---------------------------------------------------


MOV EBX,[3]
8B 5C 81 03
byte modr/m 5C ; 81 -SIB ; 03 - displacement.
in bynary:
01 011 100
mod 01 - means that displacement used and it has 1 byte size.
codr 011- code for EBX register
memr 100 - if 100 code is used in memr field it means
that byte SIB is present and it follows the byte modrm.
It relaited only to "mem" modes (00,01,10)
and only to field memr.
Note: 100 does not mean here !
------------------------------------------

....


lesson in 5 mins, I'll say somemore later....
Posted on 2003-03-07 03:11:30 by scientica
I cannot Understand it. :stupid:

What about this ?



add ax,cx
add =00. ax,cx=000-001

add ax,cx <=> 01 C1
0000-0001-11-000-001

0000: used for Instruction Function.
0001: Last bit used for sign. 1=16-bit. 0=8-Bit.
11 : We're talking about. Bit mod.
000 : mnemonic.
000 : mnemonic

Bit mod are set to 11, what happen if I set it to 01 or 10 ?.


Im still wait my Dictionary tobe found before I read another tutorial.
Posted on 2003-03-07 04:46:17 by realvampire
scientica,
Very good!
All your answers and explonation are right.
-------------------------
realvampire,
Why all your code is 16 bit address as oprand size mode?
Could you switch in 32 bits?

Bit mod are set to 11, what happen if I set it to 01 or 10 ?


In this very tread is artical (post) that start with words:
"what mods 10,01,00 are about"
All you need to read this thread, you haven't done it, no matter that you
keep talking that you did.

Despite of being wrong - you're the bravest man here
'cause you tried to answer the questions first :)
Posted on 2003-03-07 05:52:04 by The Svin

scientica,
Very good!
All your answers and explonation are right.

Thanks! I'm happy that I answered correctly :) (I don't think I'll have the same reult in my physics test :rolleyes: )
Posted on 2003-03-07 08:46:35 by scientica
realvampire,Why all your code is 16 bit address as oprand size mode?
Could you switch in 32 bits?


Okay, I'll try it.


add eax,ecx
add 32-Bit = 66 01
eax,ecx = C1. 11-000-001

add eax,ecx
add =66 00. eax,ecx=000-001

add ax,cx <=> 66 01 C1
0000-0001-11-000-001

0000: used for Instruction Function.
0001: Last bit used for sign. 1=16/32-bit. 0=8-Bit.
11 : We're talking about. Bit mod (I'll read it on this thread).
000 : mnemonic. 0=A.
001 : mnemonic 1=C.



Anybody have Indonesia-English Dictionary?

Despite of being wrong - you're the bravest man here
'cause you tried to answer the questions first


Thanks sVin :grin:



Mov eax,eax <=> 8BC0 <==> Borland Delphi, GobugAll.
Mov ax,ax <=> 8BC0 <==> Emu8086.


I cannot Understand it, why it all the same? :confused:
Posted on 2003-03-07 18:55:46 by realvampire




Mov eax,eax <=> 8BC0 <==> Borland Delphi, GobugAll.
Mov ax,ax <=> 8BC0 <==> Emu8086.


I cannot Understand it, why it all the same? :confused:

It's because (IIRC :] ) Emu8086 is emulating the 8086 (not the 80386 or above), which is a 16-bit processor. I think the (80)386 was the first intel CPU that did 32-bits, but haven't read any historical documents on computers.
Posted on 2003-03-12 14:28:36 by scientica
heya The Svin,
i got a little question regarding ModR/M

i understood it pretty well, thnx to your utility!
however, is this an exception CODE :

62 C1 ; bound eax,ecx
binary: 11 00010 11 000 001

bit d = 1
bit w = 0
mod = 11
000 - eax
001 - ecx

acouring to bit d/w (10) the menemonic should be:
bound al, cl

hoever, disassembler will put this menemonic "bound eax,ecx"
how come this an exception, if it suppose to follow the rules, it should be 8 bit regs. ??
Posted on 2003-03-23 14:07:57 by wizzra
BOUND instruction had no bits d or w.
1. Operand size always full. (its about w bit)
2. Second operand always memory that to 2 full size values.
Order of operands always the same:
field cod/r specifys register that has value to check.
field mod/r specifys memory pointer wich points to 2 boundries
values to compare with.
And more important there can not be two registers.
First operand always register, second - memory pointer.
So instruction bound reg,reg is illegal and your disasm showing
you mnemonic for opcode that does not exist.
Posted on 2003-03-23 15:38:28 by The Svin
thats odd,
put 62C1 for example in Ollydbg, and it shows BOUND EAX, ECX normally, however assembling Bound eax, ecx is illigal :P
that's a bug? or the cpu just ignores it? (thus its included in the instruction set)
Posted on 2003-03-23 15:43:10 by wizzra
CPU would rise "illigal opcode" exeption.
Posted on 2003-03-23 16:15:12 by The Svin
I just want stress that not all opcodes has d+w bits.
And practically all "1 code block" opcode are listed in
last app preview in other thread
Posted on 2003-03-23 17:53:28 by The Svin
Test code default doesnot set the d Bit.
What is the Opcode for mov eax,? is it 67 8B C0?;)
Posted on 2003-03-26 04:57:44 by realvampire
Nay,
It is 8B 00
Posted on 2003-03-26 05:50:41 by roticv
8B00. Yup thats right, but maybe I can write it like I wrote before, use a Prefix.
Im hoping it work and made it more understandable (Even add the clock cycle)



Some explanation for newbie:
8 : 1000
B : 1011
0 : 0000
0 : 0000

1000-10-1-1-00-000-000

Byte D and W is set.
:grin:
Posted on 2003-03-26 16:46:40 by realvampire
New educational app.
It assumes you are familar with coding reg fields.
Focuses on bits d and w
If not - I'd recommend first train yourself with two previous apps.
Questions and bugreports are wellcome.
Posted on 2003-03-26 18:31:06 by The Svin
I will Put this on my Package and redistribute it. :grin: This is great. :alright:
Posted on 2003-03-27 01:13:39 by realvampire
this all stuff is discussed in "Art of Assembly" book.
Posted on 2003-03-29 16:37:25 by ti_mo_n
I've seen "this staff disscussed" even before R.Hyde book.
And all answer you could find in Holly Bible.
Posted on 2003-03-31 08:57:48 by The Svin
Where is the error, in my head or elsewhere?

As you can see on the image below I have errors after pressing , but when I input 33F3 and 31DE in Olly...
Please tell me have I made something wrong, and what.
Posted on 2003-04-01 11:22:13 by scientica
Tanx, for bugreport.
Funny bug, set bit instead of comlement
everything works OK if user codes bits without
wrong or accidental pressing buttons that should
be 0. After the button pressed, bit remains set
no matter what you see and how many times
you pressing the button :)
I tested it myself untill 120 right results - everything
OK in display and debugger, then accidently set
bit to 1 that should be 0, end after changing button to 0
the bit remained 1 :)
If not this mistake I could have trace the bug for internity :)
Thanks again, scientica,
you've been very helpfull.
Here is fixed app. Please, report if you find something wrong
again.

Moderators - please, delete previous attach of the app.
I can not do it.
Posted on 2003-04-01 17:01:43 by The Svin