mov eax,ebx
change to
mov ax,bx
Why ?
:)
change to
mov ax,bx
Why ?
:)
If you're using MASM be sure you have specified at least a .386 processor. You probably used .286 and got the following error :
error A2085: instruction or register not accepted in current CPU mode
error A2085: instruction or register not accepted in current CPU mode
Yes,I did it.
I have specified at least a .386 processor.
No error single.
Still useless.
I have specified at least a .386 processor.
No error single.
Still useless.
First specify processor, then model flat:
"stdcall" is optional, but will set all your PROCs to stdcall, which is more optimal than the C calling convention, which iirc is the default. The order of processor and model selection is important, though...
.586p
.model flat,stdcall
"stdcall" is optional, but will set all your PROCs to stdcall, which is more optimal than the C calling convention, which iirc is the default. The order of processor and model selection is important, though...
I see !
Thank you !
But I have another problem.
.model small
.stack
.data
num dd 12345678h
.386
.code
main proc near
mov ax,@data
mov ds,ax
mov eax,num <----------- When I disassembly , here is " DB 66. " Why ?
mov ah,4ch
int 21h
main endp
end main
:alright:
Thank you !
But I have another problem.
.model small
.stack
.data
num dd 12345678h
.386
.code
main proc near
mov ax,@data
mov ds,ax
mov eax,num <----------- When I disassembly , here is " DB 66. " Why ?
mov ah,4ch
int 21h
main endp
end main
:alright:
As I remember, 66h was one of the 32-bits prefixes under real mode. So it's not a problem in your code (in fact it wouldn't work without it).
Ah, so you want a 16bit program but still be able to use 32bit registers - you should have specified this (as well as posted in The Heap, as main is mainly for win32 apps).
QvasiModo is right - and you ought to get yourself a better debugger. If all else fails, perhaps http://members.tripod.com/~ladsoft/grdb.htm will do the trick... might be better free 16bit debuggers around, I dunno.
QvasiModo is right - and you ought to get yourself a better debugger. If all else fails, perhaps http://members.tripod.com/~ladsoft/grdb.htm will do the trick... might be better free 16bit debuggers around, I dunno.
It has the exact same meaning in protected mode. The only differences between RM and PM are how segments work, how exceptions work, the checking of privilege levels and whether or not you can activate paging.
Anyway, the disassembly in DOS debug won't be of much help to you when dealing with programs written for the 286 and up. I think there are a few shareware disassemblers and debuggers you could use instead, as well as some that you have to buy (or "borrow" from a friend ;))
Anyway, the disassembly in DOS debug won't be of much help to you when dealing with programs written for the 286 and up. I think there are a few shareware disassemblers and debuggers you could use instead, as well as some that you have to buy (or "borrow" from a friend ;))
QvasiModo is right. under realmode, 32bit operations are prefixed with 0x66, whereas 16bit operations are prefixed with 0x66 in pmode.
To be correct it's not about "real" and "protect" modes - 66h is about "default operand size". In real mode default operand size is always 16 bit. In protect mode however default operand size can be either 16 or 32 bits (depends on bit D in segment descriptor) . 66h is switch for the current comand only between default full size and alternative full size (16<->32)
16 and 32 bit GP registers are encoded in instruction the same way, the only thing that help processor to understand wich one shoul be used (ax or eax, di or edi for example) is to check what is "current default operand size" and if there is prefix 66h. So we shouldn't mixed up terms "real"\"protect" and "default operand size"\"default adress size". They are not complitelly the same things.
16 and 32 bit GP registers are encoded in instruction the same way, the only thing that help processor to understand wich one shoul be used (ax or eax, di or edi for example) is to check what is "current default operand size" and if there is prefix 66h. So we shouldn't mixed up terms "real"\"protect" and "default operand size"\"default adress size". They are not complitelly the same things.
Oh, I see!
Thanks you!
I 'll get the GRDB instead of the free DOS debbuger.
Thanks you!
I 'll get the GRDB instead of the free DOS debbuger.
StrawHatBoy,
The code you posted is DOS code and it cannot be run in 32 bit PE files under protected mode programming. Since OEM Win95 in 1995, dos interrupts cannot be used any longer and you use Windows APIs instead to gain the functionality.
If you have the MASM32 project, have a look at the 32 bit code design in it, its standard 32 bit Windows code that does build correctly.
You don't use segments either in 32 bit flat memory model code.
The code you posted is DOS code and it cannot be run in 32 bit PE files under protected mode programming. Since OEM Win95 in 1995, dos interrupts cannot be used any longer and you use Windows APIs instead to gain the functionality.
If you have the MASM32 project, have a look at the 32 bit code design in it, its standard 32 bit Windows code that does build correctly.
You don't use segments either in 32 bit flat memory model code.
Why do the people use the protected mode ?
The protected mode is better than the real mode ?
The protected mode is better than the real mode ?
Protected mode is, well, protected mode. This allows nifty things like running each program in a separate access space, ensuring that one crashing app can be terminated without bringing the whole system down. It also allows for easy virtual memory support, and easy use of 32bit address space (breaking free from the segment:offset addressing, without hacks like unreal/voodoo mode).
It seems difficult.
I am a beginner.
I am still learning the 16 bit .
Programming is a long road.
I am a beginner.
I am still learning the 16 bit .
Programming is a long road.
In my opinion, 32bit is easier to work with than 16bit... and you don't have to understand protected mode when you're just starting.
Have a look at http://www.madwizard.org/dl.php?file=tutors.win32asm
Have a look at http://www.madwizard.org/dl.php?file=tutors.win32asm
Did you write the demoscene with 32bit?
:)
:)
Got this years back
Attachment