ZMP LInux/MacOS Build

- Added new ZMP application to Linux/MacOS Build
- More ZX cleanup
This commit is contained in:
Wayne Warthen
2021-08-23 14:43:55 -07:00
parent 17e36df0a0
commit 6aa216e040
39 changed files with 713 additions and 682 deletions

View File

@@ -139,6 +139,7 @@ cpm_word fcb_purge()
#endif
}
/* Generic 8MB disk definition */
static cpm_byte exdpb[0x11] = {
0x80, 0, /* 128 records/track */
@@ -154,61 +155,7 @@ static cpm_byte exdpb[0x11] = {
cpm_word fcb_getdpb(cpm_byte *dpb)
{
#ifdef WIN32
DWORD spc, bps, fc, tc;
unsigned bsh, blm, psh, phm;
char *hostd = drive_to_hostdrive(redir_cpmdrive);
if (!hostd) return 0x01FF; /* Can't select */
if (!GetDiskFreeSpace(hostd, &spc, &bps, &fc, &tc))
return 0x01FF; /* Can't select */
/* Store total clusters */
//if (tc > 0x10000L) tc = 0x10000L;
if (tc > 0xFFFFL) tc = 0xFFFFL;
psh = 0; phm = 0;
while (bps > 128) /* Get sector size */
{
bps /= 2;
psh++;
phm = (phm << 1) | 1;
}
bsh = psh; blm = phm;
while (spc > 1) /* Get cluster size */
{
spc /= 2;
bsh++;
blm = (blm << 1) | 1;
}
exdpb[2] = bsh;
exdpb[3] = blm;
exdpb[5] = tc & 0xFF;
exdpb[6] = tc >> 8;
exdpb[15] = psh;
exdpb[16] = phm;
#else
struct statfs buf;
cpm_word nfiles;
/* Get DPB for redir_cpmdrive. Currently just returns a dummy. */
if (!statfs(redir_drive_prefix[redir_cpmdrive], &buf))
{
/* Store correct directory entry count */
if (buf.f_files >= 0x10000L) nfiles = 0xFFFF;
else nfiles = buf.f_files;
exdpb[7] = nfiles & 0xFF;
exdpb[8] = nfiles >> 8;
}
#endif
/* Return the example dpb */
memcpy(dpb, &exdpb, 0x11);
return 0x11;
}
@@ -223,7 +170,7 @@ cpm_word fcb_getalv(cpm_byte *alv, cpm_word max)
memset(alv, 0xFF, max / 2);
memset(alv + (max / 2), 0, max / 2);
return max;
}
@@ -231,45 +178,7 @@ cpm_word fcb_getalv(cpm_byte *alv, cpm_word max)
cpm_word fcb_dfree (cpm_byte drive, cpm_byte *dma)
{
#ifdef WIN32
DWORD spc, bps, fc, tc;
DWORD freerec;
char *hostd = drive_to_hostdrive(drive);
if (!hostd) return 0x01FF;
if (!hostd) return 0x01FF; /* Can't select */
if (!GetDiskFreeSpace(hostd, &spc, &bps, &fc, &tc))
return 0x01FF; /* Can't select */
freerec = fc; /* Free clusters */
freerec *= spc; /* Free sectors */
freerec *= (bps / 128); /* Free CP/M records */
/* Limit to maximum CP/M drive size */
if (freerec > 4194303L) freerec = 4194303L;
redir_wr24(dma, freerec);
#else
struct statfs buf;
long dfree;
if (!redir_drive_prefix[drive]) return 0x01FF; /* Can't select */
if (statfs(redir_drive_prefix[drive], &buf)) return 0x01FF;
dfree = (buf.f_bavail * (buf.f_bsize / 128));
if (dfree < buf.f_bavail || /* Calculation has wrapped round */
dfree > 4194303L) /* Bigger than max CP/M drive size */
{
dfree = 4194303L;
}
redir_wr24(dma, dfree);
#endif
/* Return half of disk capacity */
redir_wr24(dma, 0x8000L); /* 8MB / 128 / 2 */
return 0;
}

View File

@@ -277,7 +277,11 @@ cpm_word redir_find(int n, cpm_byte *fcb, cpm_byte *dma)
while (n >= 0)
{
de = next_entry(hostdir, fcb, dma + 1, &st);
if (!de) return 0xFF;
if (!de)
{
closedir(hostdir);
return 0xFF;
}
--n;
}
/* Valid entry found & statted. dma+1 holds filename. */

View File

@@ -67,6 +67,9 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef WIN32
# define strcasecmp _stricmp
#endif
#ifdef __MSDOS__

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,9 @@ which is essentially just the zxcc command.
Please see http://www.seasip.info/Unix/Zxcc/ for more information on zxcc.
Note that this is a Win32 build. The code has not been updated to build as a 64-bit
binary. However, Win32 binaries run very nicely under 64 bit Windows.
To build under Open Watcom or Microsoft Visual C++, use the following command:
cl /Fe"zx.exe" zx.c cpmdrv.c cpmglob.c cpmparse.c cpmredir.c drdos.c util.c xlt.c zxbdos.c zxcbdos.c zxdbdos.c z80.c dirent.c
@@ -17,9 +20,9 @@ To build a debug version, use the following command:
cl /DDEBUG /Fe"zxdbg.exe" zx.c cpmdrv.c cpmglob.c cpmparse.c cpmredir.c drdos.c util.c xlt.c zxbdos.c zxcbdos.c zxdbdos.c z80.c dirent.c
WARNING: There seems to be a rare scenario that breaks zx under the Open Watcom build. CP/M allows a file to be accessed
under multiple FCB's without an error. Open Watcom will see this as an error. At present, the only tool I know of that does
this is M80.
WARNING: There seems to be a rare scenario that breaks zx under the Open Watcom build.
CP/M allows a file to be accessed under multiple FCB's without an error. Open Watcom
will see this as an error. At present, the only tool I know of that does this is M80.
December 5, 2014
@@ -43,5 +46,27 @@ March 15, 2017
- Implemented BDOS console status function.
- Set stdin and stdout to binary mode at startup.
August 21, 2021
- Incorporated filename case insensitivity changes from Curt Mayer
- Incorporated fixes from Tony Nicholson at https://github.com/agn453/ZXCC
- Emulation of CP/M BDOS function 60 (call resident system extension)
should be disabled and return 0xFF in both the A and L registers.
- Change cpm_bdos_10() to return an unsigned result to avoid buffer
size being interpreted as negative.
- Fix the emulation of Z80 opcodes for IN (HL),(C) and
OUT (C),(HL) - opcodes 0xED,0x70 and 0xED,0x71 respectively.
This is noted in Fred Weigel's AM9511 arithmetic processing unit
emulation from https://github.com/ratboy666/am9511 in the howto.txt
description. NB: I have not included Fred's am9511 support at this
time into ZXCC.
- Fixed parse_to_fcb function in zx.c to handle parsing second automatic
FCB from command line
- I have not been able to reproduce the multiple FCBs referring to a
single file issue with Watcom documented above. Perhaps I fixed it
and don't remember or I found a bug-fixed version of M80. Not sure.
Wayne Warthen
wwarthen@gmail.com
wwarthen@gmail.com
--WBW 4:09 PM 8/21/2021

View File

@@ -6,7 +6,7 @@
Windows command line. It is compatible with Windows XP and greater (both
32 and 64 bit).</p>
<p><em>zx</em> is basically a port of a subset of the zxcc package by John Elliott.
<p><em>zx</em> is basically a port of a subset of the zxcc program by John Elliott.
The GPLv2 licensing carries forward. Please refer to the
<a href="http://http://www.seasip.info/Unix/Zxcc/">
zxcc web page</a> for more information.</p>
@@ -15,7 +15,8 @@ zxcc web page</a> for more information.</p>
execution of the Hi-Tech C CP/M compiler under Unix, <em>zx</em> is slightly
more general and intended to allow running most CP/M tools. Specific
changes were incorporated to improve interactice console operation of
CP/M applications.</p>
CP/M applications. Additionally, Curt Mayer added case insensitivity
for filenames under Unix variants.</p>
<h2>Setup</h2>