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?
Posted on 2001-03-13 17:25:00 by Geecko
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.
Posted on 2001-03-13 17:51:00 by comrade
Thank for the answer!, but i read in books that values are represented in 2. comp.(for fixed point numbers)...
Posted on 2001-03-13 17:58:00 by Geecko
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.
Posted on 2001-03-13 18:13:00 by Ernie
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
Posted on 2001-03-13 18:54:00 by Geecko
Hi well if is "1" then 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
Posted on 2001-03-13 20:31:00 by BogdanOntanu
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...
Posted on 2001-03-14 13:39:00 by Zcoder
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:)
Posted on 2001-03-14 17:46:00 by Geecko