News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

list file.....

Started by seymour_glass, April 28, 2006, 02:15:18 AM

Previous topic - Next topic

seymour_glass

ok, i am supposed to manually come up with the machine code produced by simple instructions like

add  val, ecx

Because some of the mod and r/m fields confuse me....can i manually double check these in a list file if i was to write a test?  If so, where at?

seymour

hutch--

seymour,

Two ways to do what you are after, get the Intel PIV manual and look up the opcode in DWORD size for copying a 32 bit register to a 32 bit memory operand or alternatively disassemble the code with this instruction and see what the hex opcode for the instruction is. To make it easy to find in the disdasembly, try it this way.


nop
nop
nop
mov val, ecx
nop
nop
nop


Then just search the disassembly for a sequence of NOP instructions.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

seymour_glass

i can get the opcodes...what i am looking for is

OD (opcode) 00 010 101 12345678  or 0D 15 12345678

the actual machine code that the statement is broken down into.

thank you for the help,
seymour

Tedd

You can get the assembler to output a listing by adding "/Sn /Sa /Flmylisting.txt" to the ML parameters, which will give you a nice long list and the instructions at the end.
00000000  89 0D 00000000 R     mov val,ecx

Or get yourself a nice disassembler and give it your test .exe :wink
00401000 890D00304000           mov     [403000h],ecx
No snowflake in an avalanche feels responsible.

Mark Jones

Maybe as a variation on what Hutch has said, you could include the other combinations of parameters (separated by NOPs) and disassemble that. Look up the MOV instruction in OPCODES.HLP and it should say what kinds of paramters it can take (reg,immed,or mem) and what is not supported (mem to mem). Have fun. :)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08