Jump to content
IGNORED

DOS 2.5 How to return to DOS and make DUP.sys load


Recommended Posts

Hi, I want the user to be able to exit my application via keypress. OK, so I take care the stack pointer is where it was when my program started and I issue an RTS instruction.

 

Sadly, I'm using memory from $2000 up. I understand that area is used by DUP.SYS

 

So I have to get DOS to reload DUP.SYS after keypress so it can show the menu after returning. (just like it does when I press reset) How do I do that?

 

And what is the safest lomem address where I can load my program into? Maybe it's still enough space there for my code?

Edited by bugbiter
Link to comment
Share on other sites

In DOS 2.0s the minimum load address to avoid dup.sys reload is $3400 with the default number of buffers.

 

Put an 'RTS' at $3400 and the real run address somewhere else. This makes OS/A+ happy: the issue is that OS/A+ calls the first load address and then calls the run address you put at $2e0.

Link to comment
Share on other sites

Note that you need a segment below $3400 in order for DOS to detect that DUP.SYS needs to be reloaded. If you just overwrite MEMLO to $33FF, it'll just crash on return.

 

JMP (DOSVEC) is correct way to return to DUP/CP, but more correct is actually to JSR to JMP (DOSVEC) because the call can return! This happens if MEM.SAV is created on the disk and DOS hits an error trying to write to it, like running out of disk space:

ERROR-SAVING USER MEMORY ON DISK
TYPE Y TO STILL RUN DOS

If the user declines, DOS will return from the call.

 

OS/A+'s weirdness varies by version. I tested a few versions a while ago, and while 2.0 runs the first segment, 2.3 doesn't. 1.2, however, is really weird in that it expects a success/failure return code from INIT segments and will abort a program load if an INIT segment returns with N=1. This would have been a good idea if it was a standard, but it's not.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...