(1)Are DOS and Windows assembly different?
(2)How many registers do both 32bit and a 64 bit processors have speparetl? what is the size of them?
(3)To emulate a 16bit or 32bit program under a 64bit processor, does that processor have to physically support those old 16 and 32 bit versions? like,have registers of that bit versions?

if you can't answer all,try to answer at least one

i know Ax,Bx,Cx,Dx that are 16 bit
Sp , Bp 16 bit
Esp , Ebp 32 bit
SI , DI 16 bit
cs, ds, ss, es, fs, gs 16 bit

"Are DOS and Windows assembly different?"

Yes and no. DOS can only make use of the 16 bit instructions, whereas Windows also has access to 32 and (perhaps) 64 bit instructions. Also, operating systems perform various services on behalf of applications, such as writing stuff to disk. The interface between application programs and those operating system services is completely different in DOS and Windows, so the assembly code needed to access them is also different.

64 bit processors have all the 32 bit registers, but extended to 64 bits. For instance, the 32 bit eax register becomes the 64 bit rax register. In 64 bit mode the lower 32 bits of the 64 bit registers can still be accessed as the old 32 bit registers. In 64 bit processors there are also eight new 64 bit registers which have no 32 bit counterparts.

"To emulate a 16bit or 32bit program under a 64bit processor, does that processor have to physically support those old 16 and 32 bit versions? like,have registers of that bit versions?"

As I have just said all the old 32 bit registers are still available as the lower 32 bits of extended 64 bit registers. In similar manner, the 32 bit registers are themselves extended verisons of the original 16 bit registers, and the old 16 bit registers are available as the least significant 16 bits of the 32 bit register. So the original ax, bx, cx, dx, si, di, bp and sp registers became the 32 bit eax, ebx, ecx, edx, esi, edi, ebp and esp registers when 32 bit processors were introduced, and they, in their turn, became the rax, rbx, rcx, rdx, rsi, rdi, rbp and rsp registers when 64 bit processors were introduced. But also introduced with the 64 bit processors were eight new registers christened r8 thru r15.

The cs,ds,es,fs,gs and ss registers are still 16 bit even in 64 bit processors. The reason for that is that 16 bits are all that their specialised function requires.

thanks. very good answer.
are you telling that,in 64bit registers are just extended 32bit registered and there no separate 64bit regsiters?
there are 8 32bit registers. when it comes to 64 bit, still there are only 8 registers but extended to 64bits? or are there physically extra more resigers for 64bit registers?

Except for the r8 thru r15 registers which are new and physically distinct in the 64 bit processors, all the other 64 bit registers are extended versions of the 32 bit registers. Loading something into the 32 bit eax register has the same effect as loading it into the bottom 32 bits of the 64 bit rax register.

great.thanks

64bit processors also have more SSE registers that 32bit one don't have.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.