Hi all

I recall that there where other tutorials about the Opcodes layout written by
The Svin... besides the #7

Unfortunately and to my greatest shame i can not find them anymore :mad:

Since i have started writting my own assembler...
I think they could be interesting...

Anybody knows where can i find those tutorials/demos?
Posted on 2003-12-16 07:23:49 by BogdanOntanu
Opcode#1 http://www.asmcommunity.net/board/index.php?topic=8963
Opcode #2 http://www.asmcommunity.net/board/index.php?topic=8967
Opcode #3 http://www.asmcommunity.net/board/index.php?topic=8982
Opcode #4 http://www.asmcommunity.net/board/index.php?topic=9062
Opcode #5 http://www.asmcommunity.net/board/index.php?topic=9063
Opcode #6 http://www.asmcommunity.net/board/index.php?topic=9741
Opcode #7 http://www.asmcommunity.net/board/index.php?topic=10554
Opcode #8 http://www.asmcommunity.net/board/index.php?topic=14153

You want I can give you a brief introduction. Let us get into how the opcodes look like:



Look into Intel Manual Volume 2: B-6. It shows what are the instruction format like. Modrm is there only if required by the instruction format, and SIB is only there depending on the bits. Displacemenet is only present depending on the mod value of modr/m or if the instruction format requires it like the jmp xx and jcc xx. Immediate is there only if the instruction format requires it. There are many rules in the opcodes encoding, but I suppose most of them are covered by The Svin.

Just remmeber that the order of encoding is
For 32bit registers:
EAX = 000
ECX = 001
EDX = 010
EBX = 011
ESP = 100
EBP = 101
ESI = 110
EDI = 111

For 16bit registers:
AX = 000
CX = 001
DX = 010
BX = 011
SP = 100
BP = 101
SI = 110
DI = 111

For 8bit register:
AL = 000
CL = 001
DL = 010
BL = 011
AH = 100
CH = 101
DH = 110
BH = 111

For mmx register
mm0 = 000
mm1 = 001
mm2 = 010
mm3 = 011
mm4 = 100
mm5 = 101
mm6 = 110
mm7 = 111

For SSE register
xmm0 = 000
xmm1 = 001
xmm2 = 010
xmm3 = 011
xmm4 = 100
xmm5 = 101
xmm6 = 110
xmm7 = 111

In my opinion the encoding of sse instructions are abit weird. Oh well..

PS: I can continue babbling more about the opcode format.
Posted on 2003-12-16 07:58:16 by roticv
Thank you Roticv,

I will check them out now, besides i am keeping Intel instruction encodings document open

The assembler is only doing:
-some simple instructions
-include files
-db/w strings, dd, dw
-labels
-jumps

I just started encoding the jumps :grin:
A long way to go i guess
Posted on 2003-12-16 09:21:45 by BogdanOntanu
Hey BogdanOntanu,

I think it should not be too difficult until you reach those opcodes that make use of modrm... :grin:
Posted on 2003-12-16 10:07:38 by roticv
FAQ stuff above links to Opcode # tutorials.
Posted on 2003-12-16 18:53:53 by evil__donkey
Yes Mod/R/M will surely "make my day" :grin:
Posted on 2003-12-16 19:12:06 by BogdanOntanu
Hi,

there's a great online book about opcodes (in fact it's about writing a disassembler).
It's currently on pre-release but if you're interested on opcodes you should take a look:

http://aod.anticrack.de/

The above link is just the front end, you'll find nothing interesting, but take a look for the final release.

Here's a direct link to the PDF book (PDF book with some nice programs):

http://aod.anticrack.de/ArtOfDisassembly_2003_11_18.zip

Hope you'll find it interesting !

Regards, Neitsa.
Posted on 2003-12-18 05:28:55 by Neitsa