if we do mov ax, 1 ...and then we store that on some place in memory, is that physiclly 01 00 00 00 or is it done in 2 compliment of that number?
Hi First of all, there are no 2s compliments or anything like that when you store a value. Second of all, you're doing a 16-bit move (on ax), so it would be stored like 01 00 (little endian), not 01 00 00 00. However, if you were doing a 32-bit move (let's say on eax), it would be 01 00 00 00.
Thank for the answer!, but i read in books that values are represented in 2. comp.(for fixed point numbers)...
A WORD is a WORD is a WORD. It's up to YOU how it is interpeted, wether FFFF is -1 or 65535 or even "CAT." The CPU has built in instructions to handle words (and DWORDS too) by interpeting them as 2's compliment, but an interpatation doesn't change a value. Just how it's handled. So if you move 1 into ax, then move ax to memory address X, '01' will be stored at X, and '00' at X+1 to make up the two bytes in ax. Note it stores the smallest portion first. This is called 'little endian.' Usually you don't care, unless you are say storing a dword into a character string.
well ok, if 2. comp. is just for the processor...how is then stored 32 bit value but that is negative in memory? 1 is 01 00 00 00, what is -1? there must be some rule mr.annoying
Hi well if 00.00.00.01 is "1" then 00.00.00.00 is "0" and FF.FF.FF.FF is "-1" and FF.FF.FF.FE is "-2" see now? but take care because FF.FF.FF.FF is also the higest 32 bit number (unsigned i mean) it all depends on HOW YOU THINK of it :) (and use it of course) and yeah bytes for numbers are stored in "reverse order in memory" , i mean number: 0a.0b.0c.0d will be stored as: 0d.0c.0b.0a in memory but then again please read AOA :) it will help a lot :) PS. ignore the dots between the numbers... they are there for easy reading only This message was edited by BogdanOntanu, on 3/13/2001 9:36:18 PM This message was edited by BogdanOntanu, on 3/13/2001 9:38:03 PM
As you can see it is all in how you look at something. 30h can be the number 3 or 48 dec. as well as 0FFFFFFFFh can be -1 or 4,294,967,295 then there is also octal, and ect. it all depends on how you want to use it. in ASM you have more rights with how to use them in VB or VC you don't have rights to simply but a int into a CHAR varible. This is something that VB and VC users have to get a use to when learning to program in ASM...
thank you for the answer, now that i know this it's seems logic, i indeed am programming in c and c++,it can make your brainz to think a little different as on asm. Thank you for support etc:)