Skip to content

Commit

Permalink
Fixes to compiler driver for self-relocating and .SYM files
Browse files Browse the repository at this point in the history
  • Loading branch information
agn453 committed Aug 9, 2022
1 parent 03d3ae1 commit 826a0f1
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 101 deletions.
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ emulation using RunZ80, SIMH or ZXCC.
Each release is a consolidated milestone with various updates and
patches applied.

The latest release is V3.09-15 (see Modification History below).
The latest release is V3.09-16 (see Modification History below).

If you only wish to download the latest binary distribution, download
it from
Expand Down Expand Up @@ -1509,5 +1509,28 @@ versions LIB280C.LIB and LIB280F.LIB), and I've bumped the release
to V3.09-15.


## Fixes to the compiler driver

As reported by Mark Ogden, there are a couple of bugs in the compiler
driver program.

* The first is regarding the use of the self-relocating (-A) option,
where the code compiled for the linker should use the ```cpm``` psect
segment (as per the relocatable start-up module RRTCPM.OBJ); and

* If you specify a .SYM file on the command line without specifying
the overlay (-Y) option, the compiler driver tries to assemble a
non-existing temporary file.

The latest compiler driver (in cpm/C309-16.C) addresses both by passing
the ```cpm``` psect to the linker and ignores .SYM files unless the
overlay (-Y) option is specified.

The binaries for the compiler driver (in dist//C309-16.COM and
z280dist/C280-16.COM) have been updated as well as the binary distribution
library files to be release V3.09-16 (download link at the top of
this README file).


--
Tony Nicholson, Tuesday 24-May-2022
Tony Nicholson, Tuesday 09-Aug-2022
62 changes: 31 additions & 31 deletions cpm/BUILD-C.LOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,76 @@
10E>;
10E>date
A:DATE COM (User 0)
Tue 24/05/2022 11:10:10
Tue 09/08/2022 09:24:28
10E>;
10E>; Build Z80 version
10E>c -o -v c309-15.c
10E>c -o -v c309-16.c
A:C COM (User 0)
Hi-Tech Z80 C Compiler (CP/M-80) V3.09-14
Hi-Tech Z80 C Compiler (CP/M-80) V3.09-16
Copyright (C) 1984-87 HI-TECH SOFTWARE
Updated from https://github.com/agn453/HI-TECH-Z80-C
0:A:CPP -DCPM -DHI_TECH_C -Dz80 -I0:A: C309-15.C M:$CTMP1.$$$
0:A:CPP -DCPM -DHI_TECH_C -Dz80 -I0:A: C309-16.C M:$CTMP1.$$$
0:A:P1 M:$CTMP1.$$$ M:$CTMP2.$$$ M:$CTMP3.$$$
0:A:CGEN M:$CTMP2.$$$ M:$CTMP1.$$$
0:A:OPTIM M:$CTMP1.$$$ M:$CTMP2.$$$
0:A:ZAS -J -N -OC309-15.OBJ M:$CTMP2.$$$
0:A:ZAS -J -N -OC309-16.OBJ M:$CTMP2.$$$
ERA M:$CTMP1.$$$
ERA M:$CTMP2.$$$
ERA M:$CTMP3.$$$
ERA M:$CTMP5.$$$
0:A:LINQ -Z -Ptext=0,data,bss -C100H -OC309-15.COM 0:A:CRTCPM.OBJ C309-15.OBJ 0:A:LIBC.LIB
ERA C309-15.OBJ
0:A:LINQ -Z -Ptext=0,data,bss -C100H -OC309-16.COM 0:A:CRTCPM.OBJ C309-16.OBJ 0:A:LIBC.LIB
ERA C309-16.OBJ
ERA M:$$EXEC.$$$

10E>;
10E>; Now build Z280 version
10E>;
10E>; First a Z280 version using the Z80 LIBC.LIB (runs on Z80)
10E>c309-15 -o -v -ec280z80.com -dZ280 c309-15.c
E:C309-15 COM
Hi-Tech Z80 C Compiler (CP/M-80) V3.09-15
10E>c309-16 -o -v -ec280z80.com -dZ280 c309-16.c
E:C309-16 COM
Hi-Tech Z80 C Compiler (CP/M-80) V3.09-16
Copyright (C) 1984-87 HI-TECH SOFTWARE
Updated from https://github.com/agn453/HI-TECH-Z80-C
0:A:CPP -DCPM -DHI_TECH_C -Dz80 -DZ280 -I0:A: C309-15.C M:$CTMP1.$$$
0:A:CPP -DCPM -DHI_TECH_C -Dz80 -DZ280 -I0:A: C309-16.C M:$CTMP1.$$$
0:A:P1 M:$CTMP1.$$$ M:$CTMP2.$$$ M:$CTMP3.$$$
0:A:CGEN M:$CTMP2.$$$ M:$CTMP1.$$$
0:A:OPTIM M:$CTMP1.$$$ M:$CTMP2.$$$
0:A:ZAS -J -N -OC309-15.OBJ M:$CTMP2.$$$
0:A:ZAS -J -N -OC309-16.OBJ M:$CTMP2.$$$
ERA M:$CTMP1.$$$
ERA M:$CTMP2.$$$
ERA M:$CTMP3.$$$
ERA M:$CTMP5.$$$
0:A:LINQ -Z -Ptext=0,data,bss -C100H -OC280Z80.COM 0:A:CRTCPM.OBJ C309-15.OBJ 0:A:LIBC.LIB
ERA C309-15.OBJ
0:A:LINQ -Z -Ptext=0,data,bss -C100H -OC280Z80.COM 0:A:CRTCPM.OBJ C309-16.OBJ 0:A:LIBC.LIB
ERA C309-16.OBJ
ERA M:$$EXEC.$$$

10E>;
10E>; and the Z280 optimized version from it (only runs on a Z280)
10E>c280z80 -of2 -v -ec280-15.com c309-15.c
10E>c280z80 -of2 -v -ec280-16.com c309-16.c
E:C280Z80 COM
Hi-Tech Z280 C Compiler (CP/M-80) V3.09-15
Hi-Tech Z280 C Compiler (CP/M-80) V3.09-16
Copyright (C) 1984-87 HI-TECH SOFTWARE
Updated from https://github.com/agn453/HI-TECH-Z80-C
0:A:CPP -DCPM -DHI_TECH_C -Dz80 -DZ280 -I0:A: C309-15.C M:$CTMP1.$$$
0:A:CPP -DCPM -DHI_TECH_C -Dz80 -DZ280 -I0:A: C309-16.C M:$CTMP1.$$$
0:A:P1 M:$CTMP1.$$$ M:$CTMP2.$$$ M:$CTMP3.$$$
0:A:CGEN M:$CTMP2.$$$ M:$CTMP1.$$$
0:A:OPTIM -F M:$CTMP1.$$$ M:$CTMP2.$$$
0:A:OPTIMH -F M:$CTMP2.$$$ M:$CTMP5.$$$
516 bytes optimized away
1626 bytes replaced
0:A:ZAS -N -OC309-15.OBJ M:$CTMP5.$$$
515 bytes optimized away
1616 bytes replaced
0:A:ZAS -N -OC309-16.OBJ M:$CTMP5.$$$
ERA M:$CTMP1.$$$
ERA M:$CTMP2.$$$
ERA M:$CTMP3.$$$
ERA M:$CTMP5.$$$
0:A:LINQ -Z -Ptext=0,data,bss -C100H -OC280-15.COM 0:A:C280CPM.OBJ C309-15.OBJ 0:A:LIB280C.LIB
ERA C309-15.OBJ
0:A:LINQ -Z -Ptext=0,data,bss -C100H -OC280-16.COM 0:A:C280CPM.OBJ C309-16.OBJ 0:A:LIB280C.LIB
ERA C309-16.OBJ
ERA M:$$EXEC.$$$

10E>;
10E>c280-15 -o2 -v optimh.c
E:C280-15 COM
Hi-Tech Z280 C Compiler (CP/M-80) V3.09-15
10E>c280-16 -o2 -v optimh.c
E:C280-16 COM
Hi-Tech Z280 C Compiler (CP/M-80) V3.09-16
Copyright (C) 1984-87 HI-TECH SOFTWARE
Updated from https://github.com/agn453/HI-TECH-Z80-C
0:A:CPP -DCPM -DHI_TECH_C -Dz80 -DZ280 -I0:A: OPTIMH.C M:$CTMP1.$$$
Expand Down Expand Up @@ -103,12 +103,12 @@ Directory For Drive E: User 10
Name Bytes Recs Attributes Prot Update Create
------------ ------ ------ ------------ ------ -------------- --------------

C280-15 COM 24k 192 Dir RW None 24/05/22 11:20 24/05/22 11:20
C280Z80 COM 28k 208 Dir RW None 24/05/22 11:16 24/05/22 11:16
C309-15 COM 28k 201 Dir RW None 24/05/22 11:13 24/05/22 11:13
C280-16 COM 24k 192 Dir RW None 09/08/22 09:34 09/08/22 09:34
C280Z80 COM 28k 208 Dir RW None 09/08/22 09:30 09/08/22 09:30
C309-16 COM 28k 201 Dir RW None 09/08/22 09:27 09/08/22 09:27

Total Bytes = 80k Total Records = 601 Files Found = 3
Total 1k Blocks = 76 Used/Max Dir Entries For Drive E: 1134/2048
Total 1k Blocks = 76 Used/Max Dir Entries For Drive E: 1137/2048

10E>dir optimh.com [fu
A:DIR COM (User 0)
Expand All @@ -120,10 +120,10 @@ Directory For Drive E: User 10
Name Bytes Recs Attributes Prot Update Create
------------ ------ ------ ------------ ------ -------------- --------------

OPTIMH COM 20k 144 Dir RW None 24/05/22 11:22 24/05/22 11:22
OPTIMH COM 20k 144 Dir RW None 09/08/22 09:36 09/08/22 09:36

Total Bytes = 20k Total Records = 144 Files Found = 1
Total 1k Blocks = 18 Used/Max Dir Entries For Drive E: 1134/2048
Total 1k Blocks = 18 Used/Max Dir Entries For Drive E: 1137/2048

10E>;
10E>; Done
Expand Down
39 changes: 20 additions & 19 deletions cpm/C309-15.C → cpm/C309-16.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* processor is prohibited.
*/

#define VERSION "V3.09-15"
#define VERSION "V3.09-16"

/*----------------------------------------------------------------------*\
| Note by Jon Saxton, 3 May 2014. |
Expand Down Expand Up @@ -170,7 +170,7 @@ static char *tempm[] =
{
"-Ptext=0%xh,data",
"-Ptext=0,data,bss",
"-Ptext=0%xh,data,bss",
"-Pcpm=0,text,data,bss,stack",
};

#define tmpf1 temps[0]
Expand Down Expand Up @@ -398,16 +398,21 @@ int main(int argc, char **argv)
}
else if (cp && (strcmp(cp, ".SYM")==0 ))
{
c_as[c_as_idx++] = argv[0];
if (xp = rindex(argv[0], ':'))
xp++;
if (overlay)
{
c_as[c_as_idx++] = argv[0];
if (xp = rindex(argv[0], ':'))
xp++;
else
xp = argv[0];
*cp = 0;
strcat(strcpy(tmpbuf, xp), ".OBJ");
addobj(tmpbuf, 1);
strcpy(single, tmpbuf);
*cp = '.';
}
else
xp = argv[0];
*cp = 0;
strcat(strcpy(tmpbuf, xp), ".OBJ");
addobj(tmpbuf, 1);
strcpy(single, tmpbuf);
*cp = '.';
fprintf(stderr,"%s ignored as -Y option missing\n",argv[0]);
}
else
addobj(argv[0], 0);
Expand Down Expand Up @@ -500,15 +505,9 @@ void doit()
else
{
if (reloc)
{
segopt = xalloc(strlen(rsegs)+10);
sprintf(segopt, rsegs, cbase);
}
segopt = rsegs;
else
{
segopt = xalloc(strlen(nsegs)+1);
sprintf(segopt, nsegs);
}
segopt = nsegs;
}
flgs[flg_idx++] = segopt;
if (!outfile)
Expand Down Expand Up @@ -764,8 +763,10 @@ void assemble_sym(char *s)
if (c_as_idx > 1)
print(s);
i = 0;
/* Commented out - for symbols there's no code to optimize
if (optimize && !speed)
vec[i++] = "-J";
*/
if (nolocal)
vec[i++] = "-X";
if (cp = rindex(s, ':'))
Expand Down
Binary file removed dist/C309-15.COM
Binary file not shown.
Binary file added dist/C309-16.COM
Binary file not shown.
Binary file modified htc-bin.lbr
Binary file not shown.
Loading

0 comments on commit 826a0f1

Please sign in to comment.