Hello, i just started with masm programming, but i dont really understand it quite well. First of all the code the book gives me doesnt compile right, and second: i dont fully understand the commands it uses. So if someone can help me fix the code and tell me what the function mean/do then that would be really great. Thanks for any help.
.386
.MODEL Flat, STDCALL
.CODE
M1: MOV AH,01H
INT 21H
JMP M1
END
w00,
The example you have posted is a mix of 32 bit Windows code and 16 bit DOS code and it will not work. I can post bits and pieces but you will find far more information with the MASM32 project which you can get at www.masm32.com .
It has various templates that work directly from the editor and 2 code generators that will build Windows skeletons so you have reliable working examples to start with.
The example you have posted is a mix of 32 bit Windows code and 16 bit DOS code and it will not work. I can post bits and pieces but you will find far more information with the MASM32 project which you can get at www.masm32.com .
It has various templates that work directly from the editor and 2 code generators that will build Windows skeletons so you have reliable working examples to start with.
w00,
The example you have posted is a mix of 32 bit Windows code and 16 bit DOS code and it will not work. I can post bits and pieces but you will find far more information with the MASM32 project which you can get at www.masm32.com .
It has various templates that work directly from the editor and 2 code generators that will build Windows skeletons so you have reliable working examples to start with.
The example you have posted is a mix of 32 bit Windows code and 16 bit DOS code and it will not work. I can post bits and pieces but you will find far more information with the MASM32 project which you can get at www.masm32.com .
It has various templates that work directly from the editor and 2 code generators that will build Windows skeletons so you have reliable working examples to start with.
Can you tell me how you know that some part is 16bit asm? I thought this was all 32bit asm...
btw, the beginning doesnt start with
.386
.MODEL Flat, STDCALL
i added that, it originally begins with
.MODEL SMALL
.CODE
...
...
etc
isn't
.model flat, stdcall = 32 bit
and
int 21h = 16 bit?
You'll definately not get int 16h to work on win2k or XP, that's for sure! (I had to learn the hard way! :)
.model flat, stdcall = 32 bit
and
int 21h = 16 bit?
You'll definately not get int 16h to work on win2k or XP, that's for sure! (I had to learn the hard way! :)
I dont understand why its 16bit. Im reading a book about 32bit asm :?
But ill just take your word for it, but how would you guys do this in 32 bit then?
btw the error that i got with compiling was
Warning: multiple ".DATA" sections found with different attributes.
nothing about 21H.
But ill just take your word for it, but how would you guys do this in 32 bit then?
btw the error that i got with compiling was
Warning: multiple ".DATA" sections found with different attributes.
nothing about 21H.
Of course MASM will not throw you any error as interrupts is valid in both 16bit and 32bit environment.
The way you are using int 21h is how you would use it in 16bit dos. In 32bit windows, interrupts are not used, instead API are used. Internally API will end up using syscall or sysenter or some interrupt.
Hope I clarify some doubts
The way you are using int 21h is how you would use it in 16bit dos. In 32bit windows, interrupts are not used, instead API are used. Internally API will end up using syscall or sysenter or some interrupt.
Hope I clarify some doubts