[comp.os.cpm] Help on overlays etc

dave@ips.oz.au (Dave Horsfall) (04/18/91)

Hello all.  Can someone give me a brief guide to writing overlays and
TSR-like programs for CP/M?  None of the books I have mention the topic,
and user groups died out long ago...  The system is a reasonably standard
CP/M 2.2 system (ZCPR-2 I think), running on a Z80 platform - the Australian
"Microbee", if you've ever heard of it.  Nice little box...

I gather one has to fiddle the top-of-memory pointer after relocating oneself
for the former, and trapping the keyboard-request jump for the latter, but
there my knowledge runs out.  What other things should I have to do?

Since I'm stuck with twin floppies (no provision for a disk without EXTENSIVE
modification), I'd like to use the 64Kb RAM disk that comes with the BIOS as
a small (but fast) paging area of sorts.

Thanks.

-- 
Dave Horsfall (VK2KFU)         VK2KFU @ VK2RWI.NSW.AUS.OC
dave@ips.OZ.AU                  ...munnari!ips.OZ.AU!dave

jm59@prism.gatech.EDU (MILLS,JOHN M.) (04/19/91)

In article <1991Apr18.135845.4914@ips.oz.au> dave@ips.oz.au (Dave Horsfall) writes:
>Hello all.  Can someone give me a brief guide to writing overlays and

I think the information you need is in DRI's CP/M 2.2 Modification Guide,
but basically you have to do three things:

  (1) write your code so that it can install itself just under the
      [current] low-end of CP/M: since this is unknown until the TSR
      is invoked, it is easier to write for (say) a Z80 with some relative
      addressing than for an 8080/5 without such capability;
  (2) you must create a "thread" for whatever BDOS or BIOS calls you want
      to intercept, into a screening routine of your own -- probably
      you want to copy them all, and put a new set of pointers in their
      place which hits the corresponding targets in your TSR; and
  (3) you have to adjust the free-memory pointer so that the next TSR to
      be invoked doesn't clobber the earlier one(s).

The Sybex book _Mastering CP/M_ includes utilities to (for example) divert
printer output to a disk file.  These are probably reasonable examples.
I don't know if any compilers for CP/M give you enough control to do these
things.  Assembly language is probably required.

WARNING>> This is all conjecture: I never actually wrote a CP/M TSR.<<

Regards -jmm-

-- 
MILLS,JOHN M.
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!jm59
Internet: jm59@prism.gatech.edu