Using RAM Hooks with DOS

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
tjewell
Posts: 347
Joined: Mon Oct 19, 2009 4:58 pm
Location: Cambridge, England

Using RAM Hooks with DOS

Post by tjewell »

Hi all,

I was just tinkering with some old code of mine that made use of input/output RAM hooks ($167/$16A) on my lovely new DOSPlus system, and noticed that instead of the RTS I was expecting to see, DOS had written them over with JSRs of its own. I didn't know it did that! (I never had DOS back in the day). In fact, looking at http://dragon32.info/info/memmap.html, I see it does it to all the RAM hooks.

Why does it do this? Should my code adapt to being under DOS, and pass control to that address rather than simply RTS? What happens if I just overwrite these vectors (which my code had been doing quite happily until I just noticed!)?

Cheers, Tony
pser1
Posts: 1668
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: Using RAM Hooks with DOS

Post by pser1 »

Hi Tony,
The DosPlus has its own input - output routines!
If you look at the code in these two entries, you will see that if the device number is zero or negative, then
it simply returns. This works for Screen (0), Tape (-1) and Printer (-2)
The new DosPlus routines are used to read/write from/to disk files another way, see DosPlus manual.

You can freely overwrite those two hooks with JMP xxxx to the new routines you have created, but in case
you decide to do nothing, then you should better end with the JMP xxxx you have overwritten.
To be consistent with the new DosPlus disk functions, in case the device number is positive and greater than
zero then the old JMP should have to be called too unless you have created a different procedure for them.

cheers
pere
Post Reply