Steve Nickolas <
usot...@buric.co> writes:
>OK, this is going to get weird. The tl;dr of it is that I'm wondering if
>there's a tool to create self-decompressing (like what upx does) binaries
>for CP/M-80 (i.e., a CP/M executable cruncher).
PopCom! is one such.
Apparently I've lost track of where CP/M archive mirrors are these days,
but you can download a copy, and documentation in Japanese (looks like
Shift-JIS encoding), from
https://www.asahi-net.or.jp/~am9y-mn/fswlist.htm
>I've been working on porting some games to a system (Nabu) that runs CP/M
>3.1 - the call at 5 is to $BA06. (There are two other unofficial ports of
>CP/M, both of 2.2, and one of them I'll probably need to figure out the
>equivalent value; the other I don't care about.)
>
>For one of them, I've been working on trying to expand it from the source
>version's (MSX) 76 levels to the full 150. I don't think there's memory
>to have all 150 and still enough room to load the program from CP/M.
[...]
>But I was wondering about whether, using an executable cruncher, I could
>try to include the whole set of 150.
I'm not sure how much PopCom will help you increase your maximum program
size on your CP/M 3.1 system, though?
(Disclaimer: I only ever used a banked 3.1 system with loads of memory,
so I had a massive TPA and never had to understand any of this stuff
properly. So I may have misunderstood. Also I haven't thought about any
of this for a very long time.)
Machine-translating the PopCom docs:
"When a programme compressed with PopCom! is executed, it is not limited
by the TPA size when PopCom! is executed."
Looking at this CP/M 2 description
http://www.gaby.de/cpm/manuals/archive/cpm22htm/ch5.htm
I can see how PopCom can increase effective program size, because the
definition of TPA (limiting the loaded program's size) doesn't include
the CCP, but your program can re-use the CCP's space once it's loaded.
So I guess PopCom lets you increase your program size by the size of the
CCP (however much that is), since PopCom can uncompress into space that
was occupied by the CCP during loading.
However, on CP/M 3, I think that restriction on loaded program size
is reduced to the LOADER (not the whole CCP), which is documented as
being "three pages long" (= 384 bytes IIRC).
(
http://www.cpm.z80.de/manuals/cpm3-pgr.pdf pp17-8)
So I think PopCom can only increase your maximum program size by that
much on CP/M 3? (And I don't know how much of that PopCom's own
overheads might eat.)
Other tidbits machine-translated from POPCOM.DOC, in case they avoid
wasting your time:
"PopCom! can be used with CP/M of 47K or more (TPA 42K or more).
However, a CPU equivalent to Z80 or higher is required."
"It also uses only the minimum amount of memory required for
decompression, so if the source programme is one that does not destroy
CCP, the compressed programme will also work without destroying CCP in
most cases."
It looks like your TPA is 46.25 kbyte or thereabouts, so I guess PopCom
will work on your system.