z88dk forums

z80 Development Kit

You are not logged in.

  • Index
  •  » Misc
  •  » Target loading address for cp/m programs

#1 2020-04-05 21:19:57

jacotton
Member
Registered: 2017-11-24
Posts: 26

Target loading address for cp/m programs

<not certain where to land this>

I am working on a driver that will stay resident after loading.  This driver is being written in 'C' using the
zcc commands and tools.

In CP/M  2.2 and 3.0 there is the concept of loading an extension to CP/M and expecting it to stay in memory.
This is done by adjusting the base address of CP/M via altering the low address pointer etc....

Now for the problem.  I need to build and link my driver with a load address of say 8000 hex, and have all
the linking work out for that address.  Then a loader will be used to place the binary and call an initialization
routine.  After that the code should remain in memory and preform its driver functions until CP/M is restarted,
via reboot.

I don't see how this is done with z88dk.  I presume the crt0 will need to be tweeked, but how do I tell the compiler/linker
what my address should be ?

tnx
jc

Offline

 

#2 2020-04-05 22:19:29

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: Target loading address for cp/m programs

usually we leave support for the '-zorg='  parameter,  we missed it on the CP/M, because it looked quite a fixed location.
I know the original CP/M had options for having the TPA at different locations, but it was rarely used and the applications couldn't run easily on a machine like that,  so it's VERY unusual.
It's easy to add support for 'zorg', or you can edit the start-up code yourself: 
https://github.com/z88dk/z88dk/blob/mas … c_crt0.asm

What you already have is probably even better wink  If you build the program with adding the '-startup=2' parameter,  it will link your program at $8000 and will provide a relocation routine,  so you can load it as a normal  COM program.
This feature was useful with those computers doing odd memory paging to support high resolution bitmapped graphics and looks like a good option for you as well.

Stefano

Offline

 

#3 2020-04-05 22:32:21

jacotton
Member
Registered: 2017-11-24
Posts: 26

Re: Target loading address for cp/m programs

will the -zorg= work for CP/M or is that a lot of code work on the compiler ?

Offline

 

#4 2020-04-05 22:35:06

jacotton
Member
Registered: 2017-11-24
Posts: 26

Re: Target loading address for cp/m programs

well, it did not complain, but can't tell yet if that's working

Offline

 

#5 2020-04-05 22:50:25

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: Target loading address for cp/m programs

-zorg is missing, but it will be in very soon.

Can the other startup flag be useful in your case?

Offline

 

#6 2020-04-06 01:03:42

jacotton
Member
Registered: 2017-11-24
Posts: 26

Re: Target loading address for cp/m programs

Well, maybe.  The driver is about 33kb at the moment, so its optimistic that it will fit, will need to
reduce the size before I can test it.

-zorg would let me test the code sooner.

Offline

 

#7 2020-04-06 07:53:02

stefano
Administrator
Registered: 2007-07-16
Posts: 1580

Re: Target loading address for cp/m programs

Ok, -zorg is ready, it should be available tomorrow.
Otherwise you can pick the file from the link I provided already and replace the single file yourself (no need to rebuild).

Offline

 
  • Index
  •  » Misc
  •  » Target loading address for cp/m programs

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson