Willard,
Separately I'm working with Phil on getting BDS-C working from within CPM.
This bears some similarity with your project.
Small-C
* compile external to M100, obtain .CO program for running in M100 OS.
Main rom directly accessed.
BDS-C
* compile in CP/M, in modified M100. Run executable inside CP/M. Main rom
switched for access.
Where these projects intersect is that in your project you don't need to
switch the main rom in/out in order to access the M100 rom routines. Since
CP/M will run in Optrom space, one must switch main roms.
If however we can figure out a common way to "call" then we could have more
or less common C code that would compile and run in either system.
I can see similarities already. I have to use ML code to do the bank
switching, but I pass the call address as a parameter.
You have separate machine code routines for calling the main rom.
Lets take POSIT as an example
your call posit(x,y)
--> passes sends x and y to a short ml routine that does the call.
my equivalent routine is
rposit(hl) /* remote call to POSIT */
int hl;
{ romcall(0,hl,POSIT);
}
I pass the routine address + hl pre formatted to a separate routine that
does the trampoline into MAIN ROM.
romcall(a,h,addr)
char a;
int h, addr;
{ call(STDCALL,a,h,0,addr); /*Calls a machine code subroutine at
location addr, setting CPU*/
/*registers as follows:*/
/*HL <-- h; = subroutine address*/
/*A <-- a;*/
/*BC <-- b; */
/*DE <-- addr */
and finally STDCALL is a trampoline not unlike the "secrets of the rom
revealed" however modified to work here. It is a short ML routine manually
poked into ALTLCD,
So, lots of similarities here. Perhaps we could chat directly about how to
have a common set of calls where we substitute the libraries underneath
depending on environment.
cheers
Steve
On Mon, Nov 27, 2017 at 2:24 AM, Willard Goosey <[email protected]> wrote:
>
> I have uploaded the new version of my Model100 library for Small C-85
> to:
> http://www.sdc.org/~goosey/m100/m100smallc0.0.10.zip
> --and--
> my "Willard Goosey" personal library at club100.org, in the "linux
> cross development" directory.
>
> New to this version:
> More RAM file ROM calls, more cassette I/O calls, support for calling
> other .CO files in memory.
>
> It is my hope that this will be the last ALPHA release, so if you have
> any burning requirement for, eg, changing the order of a function's
> arguements, tell me now, because once this becomes BETA code, Linus's
> Law ("Don't break userspace") will be in effect.
>
> Willard
> --
> Willard Goosey [email protected]
> Socorro, New Mexico, USA
> I search my heart and find Cimmeria, land of Darkness and the Night.
> -- R.E. Howard
>