flat assembler
Message board for the users of flat assembler.

 Index > Main > [beginner] Very basic questions about assembly!
Author
arao6

Joined: 10 Jan 2013
Posts: 4
arao6
.

Hello!

You have no idea how long it took me to sign up. First I thought it was a captcha, then I realized it was a conversion, but I had H and G in my captcha...

Anyway, I just started learning asm and hex numbering. I can add hex and stuff using a calculator lol... I'm having trouble understanding the last sentence in this paragraph:

Quote:
Some x86 instructions require more than one byte. For example, the instruction mov ax, [1000] loads the ax register from memory location 1000. The encoding for the opcode is 11000110 or 0C6h. However, the encoding for mov ax,[2000]’s opcode is also 0C6h. Clearly these two instructions do different things, one loads the ax register from memory location 1000h while the other loads the ax register from memory location 2000. To encode an address for the [xxxx] or [xxxx+bx] addressing modes, or to encode the constant for the immediate addressing mode, you must follow the opcode with the 16-bit address or constant, with the L.O. byte immediately following the opcode in memory and the H.O. byte after that. So the three byte encoding for mov ax, [1000] would be 0C6h, 00h, 10h and the three byte encoding for mov ax, [2000] would be 0C6h, 00h, 20h

I understood everything except the last sentence. Since when is 10h equal to 1000h and 20h equal to 2000h?

Edit: it was 12 AM when I read that. I completely misread the part about the low order byte coming first.
10 Jan 2013, 06:05
LocoDelAssembly

Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly
Take a look at this. x86 is little-endian.
10 Jan 2013, 06:16
arao6

Joined: 10 Jan 2013
Posts: 4
arao6
LocoDelAssembly wrote:
Take a look at this. x86 is little-endian.

Sweet, that's a very helpful link. Thank you! Now it makes complete sense and I can continue my study
10 Jan 2013, 06:29
AsmGuru62

Joined: 28 Jan 2004
Posts: 1450
AsmGuru62
The phrase "Some x86 instructions require more than one byte" is not very well to use in this context.
It suggests, that opcode is always 1 byte and whatever comes next is an address or some other info.
However, full x86 instruction is much more than that:

1. Prefix(-es) may come BEFORE the instruction opcode
2. Opcode may be 1-3 bytes
3. MOD/R/M information
4. Offsets (like 1000h or 2000h) and immediate values
10 Jan 2013, 16:01
arao6

Joined: 10 Jan 2013
Posts: 4
arao6
Ah I see. That explains some irregularities that I noticed in IDA.

Question: what is movss? I have not been able to find much information about that instruction.
13 Jan 2013, 00:46
AsmGuru62

Joined: 28 Jan 2004
Posts: 1450
AsmGuru62
According to this:
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html

The link you need on that page is called:

"... Volume 2B - Instruction Set Reference M-Z"

MOVSS moves floating point values between XMM registers and memory.
13 Jan 2013, 01:32
arao6

Joined: 10 Jan 2013
Posts: 4
arao6
AsmGuru62 wrote:
According to this:
http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html

The link you need on that page is called:

"... Volume 2B - Instruction Set Reference M-Z"

MOVSS moves floating point values between XMM registers and memory.

Awesome, thanks.
16 Jan 2013, 05:24
DOS386

Joined: 08 Dec 2006
Posts: 1898
DOS386
arao6 wrote:
Question: what is movss? I have not been able to find much information about that instruction.

I'd suggest to begin with 8086 or 80386 assembly, and avoiding obscure (AAA, ABC, DAS, LES, BOUNCE, ...), system (ARPL, IRET, LIDCT, ...), and FPU (FILD, FIST, FLDCW, ...) instructions for now.

> [beginner] Very basic questions about assembly!

Understanding all instructions is not a good goal for now

http://home.myfairpoint.net/fbkotler/nasmdocc.html

Quote:
A.4.180 MOVSS: Move Scalar Single-Precision FP Value

MOVSS xmm1,xmm2/m32 ; F3 0F 10 /r [KATMAI,SSE]
MOVSS xmm1/m32,xmm2 ; F3 0F 11 /r [KATMAI,SSE]

MOVSS moves a single-precision FP value from the source operand to the destination operand. When the source or destination is a register, the low-order FP value is read or written.

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
03 Feb 2013, 17:58
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum