bugbiter Posted June 20, 2016 Share Posted June 20, 2016 (edited) 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 June 20, 2016 by bugbiter Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted June 20, 2016 Share Posted June 20, 2016 (edited) An indirect jump through $0A will also do it, avoiding the need to worry about the stack pointer: JMP ($0A). $2000 is a generally accepted safe place to start your application code. Edited June 21, 2016 by flashjazzcat 1 1 Quote Link to comment Share on other sites More sharing options...
jhallen Posted June 23, 2016 Share Posted June 23, 2016 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. Quote Link to comment Share on other sites More sharing options...
phaeron Posted June 24, 2016 Share Posted June 24, 2016 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. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.