Exiting from DOS programs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Exiting from DOS programs

Post by M-Saunders »

Lo all,

I'm writing a small 16-bit operating system in assembler, with rudimentary DOS compatibility (http://mikeos.sourceforge.net). Small DOS COM programs and games run OK, but most of them don't exit back to the OS correctly.

As I understand it, there are three ways a DOS program can hand control back to the OS:

1) Int 20h
2) Int 21h with AH = 0
3) Int 21h with AH = 4Ch

My OS handles these fine, and I've written test DOS COM programs to confirm they work. However, some things just refuse to quit, or end up with a black screen.

Is there anything else I should be aware of? Do some really old (as in, MS-DOS 1.x era) programs just JMP back somewhere into the OS? Or is there another method of exiting DOS programs that I'm not handling?

Sorry if the solution is staring me in the face, but I'm stumped!

Thanks in advance,
Mike
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Post by bubach »

In a simple COM program, a RET might be used instead of any interrupt.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Post by M-Saunders »

Ah yes, I forgot to mention that I do handle apps finishing with RET too (indeed, that's how native MikeOS programs terminate).

Mike
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Post by bubach »

So, you'r sure that it's working right up until they try to exit? Have you tried the bochs debugger?
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Post by M-Saunders »

I haven't tried Bochs yet -- just wanted to see if there was something obvious before I delve into that. But I'll give Bochs a go later. Thanks!

M
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Remember Google Code Search is your friend :wink:
Just click on the link at the top of this page :shock: .
http://digg.com/security/MS_DOS_6_0_app ... ode_Search
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Post by M-Saunders »

Ooh, better not look at that, or MikeOS will be tainted! We've all seen what happened when SCO thought its code was being misused... :-)

M
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

:lol: :lol: :lol:
PS: I was always told that most of Dos was writte in C :?
User avatar
Touch
Member
Member
Posts: 56
Joined: Sun Oct 22, 2006 10:33 am
Location: England

Post by Touch »

OOh... MikeOS cannot be MS related :shock:
"We cannot trust the sword in the hands of a n00b!" - Southpark
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Post by M-Saunders »

Until I create the company Mike-o-Soft... :-)

M
User avatar
Touch
Member
Member
Posts: 56
Joined: Sun Oct 22, 2006 10:33 am
Location: England

Post by Touch »

:lol: :lol:

You wouldn't do that, I know you wouldn't... Or would you? :?: :?:
"We cannot trust the sword in the hands of a n00b!" - Southpark
User avatar
Candy
Member
Member
Posts: 3883
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

M-Saunders wrote:Until I create the company Mike-o-Soft... :-)

M
Wouldn't try that. A guy named Mike Rowe got into trouble choosing the most obvious name.
User avatar
Touch
Member
Member
Posts: 56
Joined: Sun Oct 22, 2006 10:33 am
Location: England

Post by Touch »

Lol.. So the O and the soft are copyrighted... M$ ARE SOOOO SAD!
"We cannot trust the sword in the hands of a n00b!" - Southpark
User avatar
Touch
Member
Member
Posts: 56
Joined: Sun Oct 22, 2006 10:33 am
Location: England

Post by Touch »

:shock: :shock:

Wow they really are, according to BBC news:

BBC M$ report
"We cannot trust the sword in the hands of a n00b!" - Southpark
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Candy wrote:
M-Saunders wrote:Until I create the company Mike-o-Soft... :-)

M
Wouldn't try that. A guy named Mike Rowe got into trouble choosing the most obvious name.
I heard he got a Xbox and other goody's out of it :wink:
See here: http://itvibe.com/news/1217/
I would say he got a bad deal, as Lindows got 20 Million :lol:
http://www.geeknewscentral.com/archives/002945.html
Post Reply