Computing.Net > Forums > Programming > Assembly Program Not Working

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Assembly Program Not Working

Reply to Message Icon

Name: Chad Johnson (by ChadJohnson)
Date: July 4, 2004 at 16:13:52 Pacific
OS: Win2K
CPU/Ram: n/a
Comment:

I am learning x86 assembly, and when I run the following program in debug, it works fine and prints the character 'A'.

MOV AH,02h
MOV DL,2Ah
INT 21
INT 20

However, when I run this program with the following source

.MODEL SMALL
.CODE

MOV AH,02h
MOV DL,2Ah
INT 21
INT 20

.EXIT
END

and run it though masm and the linker, nothing prints on the screen.

masm test.asm
link test.obj

Any ideas?



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: July 4, 2004 at 16:41:53 Pacific
Reply:

You are running the DEBUG version from a DOS command prompt so it works. INT 20 and INT 21 are DOS interrupts.

Compiling it and running under Win2000 won't work because there is no DOS to process the interrupts. You could well be corrupting your memory running DOS interrupts from Windows.

Stuart


0

Response Number 2
Name: Chad Johnson (by ChadJohnson)
Date: July 4, 2004 at 19:37:26 Pacific
Reply:

What can I do about it besides running in pure DOS mode?

Where can I find equivalent Windows interrupts/functions?


0

Response Number 3
Name: StuartS
Date: July 4, 2004 at 20:03:27 Pacific
Reply:

The equivalent in Windows is the API - Application Programming Interface. How you call the API with assembler I have no idea.


Using the API is usually done with a high level language like C++. Assembly language programming is fraught with problems as Windows 2000/XP will not allow you to to talk directly to the hardware which is what you are trying to do with your snippet of code.

Windows is not a good environment to go poking around with assembly code but it can be done.

Have a look at these links:

http://www.geocities.com/thestarman3/asm/win32/index.html

http://www.masm32.com/

Stuart


0

Response Number 4
Name: Chad Johnson (by ChadJohnson)
Date: July 4, 2004 at 21:15:55 Pacific
Reply:

thanks!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Assembly Program Not Working

program not working www.computing.net/answers/programming/program-not-working/13425.html

Stored Procedure not working if OLE www.computing.net/answers/programming/stored-procedure-not-working-if-ole/10101.html

Variable not working. www.computing.net/answers/programming/variable-not-working/15353.html