flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Redragon 24 Sep 2005, 19:37
Im no big asm programmer, but i was asking the same kinda question as this before, ive found all this while searching the net.. mabye this will help
[DATA REGISTERS - 32bit] EAX - the accumulator EBX - the base register ECX - the counter register EDX - the data register [ADRESS REGISTERS - 32bit] ESI - the source register EDI - the destination register ESP - the stack pointer register EBP - the stack base pointer register [CONTROL REGISTERS - 32bit] CR0 CR1 CR2 CR3 [TEST REGISTERS - 32bit] TR4 TR5 TR6 TR7 [DESCRIPTOR REGISTERS - 32bit] GDTR - the global descriptor table register LDTR - the local descriptor table register IDTR - the interrupt descriptor table register [SEGMENT REGISTERS - 16bit] CS - code segment - points to the active code segment DS - data segment - points to the active data segment SS - stack segment - points to the active stack segment ES - extra segment - points to the active extra segment [POINTER REGISTERS - 16bit] IP - instruction pointer - points to the offset of the next instruction SP - stack pointer - points to the offset that the stack is using BP - base pointer - used to pass data to and from the stack [GENERAL PURPOSE REGISTERS - 16bit] AX - accumulator register - mostly used for calculations & for input/output BX - base register - only register that can be used as an index CX - count register - register used for the loop instruction DX - data register - input/output and used by multiply and divide [INDEX REGISTERS - 16bit] SI - source index - used by string operations as source DI - destination index - used by string operations as destination ================================================ to answer your CS DS question, normally CS and DS are NOT used in 32bit programming, their used in 16bit (real mode) and, in real mode you can NOT use AX,CX, or DX to hold an offset. FS and GS are extra segment registers |
|||
![]() |
|
vid 25 Sep 2005, 09:10
you may also occur name "MSW" - machine status word i think, which is lower 16 bits of CR0 (MSW was it's name on 286).
|
|||
![]() |
|
shoorick 26 Sep 2005, 05:55
register usage may depend on what os you are using: if you code under windows you should preserve ebx, esi and edi in your functions, called by winapi, and remember, that eax, edx and ecx can be destroyed while calling api functions: eax is used to return result, 64-bit result can be returned in edx/eax, ecx is often used as counter and just not restored.
|
|||
![]() |
|
revolution 26 Sep 2005, 06:51
wht36: You are correct, you can use eax,ebx,ecx,edx,edi,esi and ebp "willy-nilly". Don't bother to use DS. CS, ES, FS, GS or SS in a protected OS unless you like to see general protection faults. Use R8-R15 "willy-nilly" if you have 64 bit. Use mmx0-mmx7 when you don't use ST(0)-ST(7) and vice-versa, use ST(0)-ST(7) when your not using mmx0-mmx7. Use XMM0-XMM7 whenever you feel like it and XMM8-XMM15 for 64 bit. CR?, TR?, ?DTR, MSR and MTTR probably are not going to be available to you for normal programming tasks.
|
|||
![]() |
|
wht36 26 Sep 2005, 16:03
Thanks! Sigh, I guess I will continue fooling around with my old registers for now (back to push and pop, push and pop...).
Looks like the other registers is too special. Perhaps if my old computer finally breaks down, I will upgrade and use MMX... ![]() Still, it's a pity so many registers are special and not available for normal programming. |
|||
![]() |
|
ronware 26 Sep 2005, 17:28
Welcome to the wonderful world of the Intel x86 family
![]() |
|||
![]() |
|
jdawg 03 Dec 2005, 09:17
Depending on the current CPU privelege level you are allowed to use any registers you please. If you code to 16bit format, you can also increase the number of valid instructions you are allowed without switching levels. U should check out Intel, and AMD's sites, they have downloadable coverage of everthing you could ever want to know about the IA32/64 architechure, including system development. They cover every register available to you and what CPU models those registers are available on.
|
|||
![]() |
|
roticv 03 Dec 2005, 12:29
Hmmm the debug registers are missed out
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.