CP/M 80 Emulators and Which One Works Best Running Aztec CZ80?

Started by BillBuckels, April 06, 2008, 07:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BillBuckels

For C128 Die-Hards use x128 when you can't get-on a Real C128

The Vice Emulator (x128.exe) runs CP/M 80 pretty well if you are comparing it to a C128 (from what I hear anyway). I do find however that it is cumbersome to set-up and not really very smooth if you compare it to the MyZ80 emulator.

If you are not running in Windows XP or some other Messy-DOS-Like environment you may not be able to use MyZ80, but if you are I would encourage you to give MyZ80 a try the same way that I gave x128 a try for the last week or so while I played with my Aztec CZ80 compiler. I have pretty much had it with CP/M 80 in x128 so...


For the rest of us there is MyZ80



I don't know if you have the full version of MyZ80 which Lee Bradley put together. It comes in a ZIP file called maxz80.zip.

http://primepuzzle.com/mouse/maxz80.zip

This is the same emulator as the demo version (written by Australian Simeon Cran who I believe now works as a Software Engineer at Microsoft after graduating and who wrote MyZ80 while a student, but I don't believe he maintains it anymore.) The demo version is quite crippled and not compatible diskwise with the full version so interested parties are probably better-off not to install the demo version at all and should just download Lee's full version. (One thing that is notably missing in the demo version is the SUBMIT command and in fact the demo version is so crippled that it is somewhat discouraging for anyone who doesn't know or remember much about CP/M 80 to do anything.)

Lee has added many programs to maxz80 and preconfigured all of this so the environment is large but excellent. To start, unzip maxz80 into a single directory (call it maxz80), open a DOS window, and type MyZ80.

A Z-System Tutorial Through Examples

http://primepuzzle.com/mouse/hints0.htm

MaxZ80 comes with a large empty C: drive disk image. Don't use it for creating a collection of programs. It is too large to even zip-up and send to a friend with programs on it, or to put on line as a preconfigured demo disk or anything like that. Fortunately MaxZ80 provides a mechanism for assigning the C: drive on start-up using an environment variable called C.DSK. Open a DOS prompt in the maxz80 directory. Type the following at the prompt where ANYNAME.DSK is the name of the disk image that you want to use:


SET C.DSK=ANYNAME.DSK


If the disk named does not exist it will be created with the smallest size possible. As programs and files are added (imported or written directly within the emulator) the disk image will grow as required. However the disk image size will not shrink when programs and files are deleted so when putting a demo disk or a collection disk together the best thing to do is to put all your files into the maxz80 directory. Then call myz80 with a non existent disk image named as the C: drive. When the files for the intended collection are imported (by you) they will be added to the new diskimage in as space efficient a manner as possible and the diskimage will be as small as it can be. Clean-up your files in the maxz80 directory afterwards

The following example shows how this can work by using a file list with myz80's submit command to create a new disk image filled with files. This  example is fairly long and can be skipped if you just want to try-out what I  have said on your own. This example is also not all that generic. (Oh Well.)

Go Ahead MakeMy.BAT


@echo off
if not exist c:\maxz80\*.* goto END
if "%CROOT%" == "" goto END
if "%1" == "Z80" goto BEGIN
cls
REM MAKEMY.BAT (C) Copyright Bill Buckels 2008
REM this batchfile assumes that maxz80 is installed in c:\maxz80
REM it further assumes that it is being run from within the
REM C:\AZ8106d\MyZ80 subdirectory from within the
REM Aztec C Z80 Build Environment under XP

REM create the main CPM submit file

echo ERA MAKEMY.SUB>MYMAIN.SUB
echo IMPORT MAKEMY.SUB>>MYMAIN.SUB
echo SUBMIT MAKEMY.SUB>>MYMAIN.SUB

REM finish the secondary CPM submit file
REM add the rest of the files
REM call this batch recursiveley to do so.

for %%f in (*.com) do call makemy.bat Z80 %%f
for %%f in (*.ovr) do call makemy.bat Z80 %%f

REM finish-off the submit file
REM so it automatically exits CPM when done
echo EXIT>>MAKEMY.SUB

REM we are done the prep-work now.
REM copy the baggage to the cpm emulator directory
copy *.com c:\maxz80\. >NUL
copy *.ovr c:\maxz80\. >NUL
copy MYMAIN.SUB c:\maxz80\. >NUL
copy MAKEMY.SUB c:\maxz80\. >NUL

REM start the emulator
REM this is the manual part.
REM the user needs to switch to drive C:
REM then IMPORT and SUBMIT MYMAIN.SUB
REM the rest is automatic.

SET C.DSK=AZSAMPLE.DSK
cd c:\maxz80\
echo This is the non-automated part of this process.
echo 1. After reading this, press a key. MYZ80 will start.
echo 2. You will then need to change to Drive C in MYZ80.
echo    Do this by typing C: then pressing the Enter Key.
echo 3. You will now need to build your disk.
echo    Do this by typing IMPORT MYMAIN.SUB them
echo    SUBMIT MYMAIN.SUB and press the Enter Key.
echo 4. The rest is automated beyond that point.
pause
cls
call MYZ80
SET C.DSK=


REM copy the finished disk back
copy AZSAMPLE.DSK C:\AZ80106d\MyZ80\. >NUL
cd C:\AZ80106d\MyZ80
cls
goto END

:BEGIN

REM this is the recursively called area

echo IMPORT %2>>MAKEMY.SUB

:END





Putting it Altogether



As you can see, the disk that MakeMy.Bat created for MyZ80 still has the submit files on it. That probably isn't a great practice because as you can also see, if you SUBMIT MYMAIN.SUB it will immediately erase MAKEMY.SUB and then try and import the latest copy. While this is true, it's not the point here...

The MyZ80 emulator has both import and export features. Unfortunately the x128 VICE emulator does not when it comes to CP/M. c1541.exe is missing this very important functionality and therefore only does half-a-job when it comes to actually supporting C128 disk images since it does not provide CP/M diskimage support.

Another thing that MyZ80 does is that it continues to expand the disk image rather than run out of room. So not only does MyZ80 create the disk if it does not exist... the x128 doesn't even read directories on a CP/M 80 .d64 disk image.

I really wonder why because the source for ctools is GNU and ctools seems to have no problems with creating CP/M 80 d64 images and adding and removing files to and from them. So it really begs the question... and VICE is so cool when it comes to C64 stuff!




hydrophilic

Ctools is a must for working with VICE and CP/M disk images as you stated.  CP/M is appearantly just another operating system (like GEOS or whatever) as far as VICE is concerned...

I modified VICE awhile back to support differnet disk images.  This allowed me to run some CP/M software released in TRS-80 disk images.  It work well enough for WordStar and Zork.  I don't remember what else I tried (it's been a while).

Anyway, knowing something about the way CP/M writes disks, I am amazed that MyZ80 is able to create an ever-expanding disk image.  I wonder how it does that.  Does it modify the Disk Parameter Block over time, or maybe it just creates a huge virtual disk at the start and only writes/expands the image file as needed?  (I'm guessing it's the latter.)

BillBuckels




Old 80 Revealed

The screenshots are of an earlier native mode compiler that I bundled with this cross-compiler. My main reason for doing so was to give you something else to play with if you got really bored with the other stuff!!!


ReadMe for OLD80

This directory contains Aztec CZ80 version 1.05 which amazingly fits on a
single sided C128 CPM 80 disk.

The down-side is that the C link library is pretty tiny:

**DIR**     supp8080    fprintf     fscanf      scan        fltlib     
fopen       fread       **DIR**     fseek       fgets       fputs       
getc        putc        ungetc      getbuff     setbuf      alloc       
format      callcpm     croot       open        read        write       
lseek       posit       **DIR**     blkio       rename      unlink     
atof        atol        atoi        block       atol        atoi       
block       string      toupper     closall     lsubs       fstub       

Two disk images are provided. AZ80105.DSK is for MyZ80 and AZ80105.D64 is
for the x128 Vice emulator.

Generally speaking you would not want to bother with a native mode cpm
compiler especially on the x128, however the MyZ80 emulator works pretty
well with this.

I am assuming you will have a SUBMIT command to use.

On the x128 emulator use the d81 diskimage also bundled with this lot to
boot cpm. Then put this d64 into drive B: Then to compile anything like
the exempl.c program that is on the d64 just type "A:SUBMIT CC EXMPL" and
press [Return]. Do yourself a favour and put the thing into WarpMode
directly after typing. However your keystrokes will repeat like crazy if
you try and run in warpmode during normal program execution.

On the MyZ80 emulator set the environment C.DSK=AZ80105.DSK and then start
MyZ80. Do this in a cmd window or in MS-DOS. Once inside MyZ80 type C: to
get on the C: drive that you have just assigned to AZ80105.DSK. Then type
"SUBMIT CC EXMPL" and press [Enter].

One more thing: This is pretty tight on disk space in x128 and you have a
copy of xdir on the image to determine just how tight. Use PIP to copy
part of your compiler to A: if you wish or the whole thing if you wish and
then copy it back to a d81 that you create on your own. To copy CII.COM
from B: to A: just type "PIP A:CII.COM=B:CII.COM" [Return] and when you
are done if you want to erase CII.COM from B: just "ERA CII.COM" [return].

Not wishing to write a book on the subject, please review all the
documentation I have provided on all of this and review the samples etc.
for further details.

Have Fun!

Bill Buckels April 2008


Quote from: hydrophilic on April 06, 2008, 12:12 PM
Ctools is a must for working with VICE and CP/M disk images as you stated.  CP/M is appearantly just another operating system (like GEOS or whatever) as far as VICE is concerned...

Understood, and also I understand ViceTEAM's POV. The thing works real well for what most people will ever use it for and it is pretty much a faithful hardware level emulator. I love it for that reason. I didn't want to start modifying anything either but admire anyone that is not as lazy as I am...

Quote
I modified VICE awhile back to support differnet disk images.  This allowed me to run some CP/M software released in TRS-80 disk images.  It work well enough for WordStar and Zork.  I don't remember what else I tried (it's been a while).

My Trash-80 days were pretty uninteresting. I used trs-80's with a program called ABACUS to program CNC punch coordinates for my drawing packages. One job for Ford Motor in Dearborn, MI for some brackets that I designed resulted in a paper tape 90 feet long, so I made two just in case. Sure enough when the Gal who operated it read the first one into the 16K ram bank on the Houdaille Strippit turret press, the reader tore the tape in the last two inches or so...  Murphy was an optimist. 

A little while later (years or so) our accountant was using one of those old Tandy 1000 DOS machines with the wierd 720K 5 1/4" drives and his hard-disk would get flaky sectors from the keyboard cable shorting out... that really did go into the trash... a very large dumpster.

And finally when Tandy made the DEC station 210 which was a 286 that ran at 10MGHZ but needed the processor slowed down to 8MGHZ so the bus could handle 16 bit edge connectors on our Targa Boards without losing data due to poor frequency tolerances on their bus... What Trash! Hardly even fit for the Kiosk systems that they were used for by us. The client insisted on DEC because of their reputation...




Quote
Anyway, knowing something about the way CP/M writes disks, I am amazed that MyZ80 is able to create an ever-expanding disk image.  I wonder how it does that.  Does it modify the Disk Parameter Block over time, or maybe it just creates a huge virtual disk at the start and only writes/expands the image file as needed?  (I'm guessing it's the latter.)




Well it is obviously the latter. I don't know if you even have the time or the inclination to play but the link that I have provided to Lee Bradley's distro of this thing gets you lots of goodies to put into the collection. It would also clear-up much of those questions and really highlight how extremely pitiful x128 really is when compared to something like this for cpm. Remember that I am a big fan on the C64 side of Vice...

MyZ80 - http://primepuzzle.com/mouse/maxz80.zip
Tutorial - http://primepuzzle.com/mouse/hints0.htm


On the CPM keyboard stuff especially x128 falls apart. Politely put there are timing issues, but since I never had a 128 and was once those guys with the 10 meg tandon external drives slung off the side of a 4.77 mghz Messydos box with a composite amber screen (at least it was a CGA so I could see snow and a BSaved Image or two) for all I know this is as good as the C128 got when it came to CP/M.

This guy Simeon Cran really did an amazing job on MyZ80... however like most things that are not worth anything in the business world including several hundred of my own programs (who counts eh?) he spent a lot of time and it looks like he walked away to Microsoft I think. Hope he makes some dough there anyway.

I was curious about one thing. I see that Bil Herd is still around. How about Von Ertwine? Imagine a time when an entire commercial OS could be written by a consultant at home! Or when a company would let him!

To me it really doesn't matter if I live to be 156 years old...  having lived through a time when I saw horse-drawn ice wagons in cities delivering to my neighbor's home in the days before everyone had a fridge, and through a time when one individual could do such a thing will stand-out in my memory to the end as long as it does not get flaky.

Bill

BillBuckels

How MyZ80 Handles CP/M Disks

Quote from: hydrophilic on April 06, 2008, 12:12 PM
Anyway, knowing something about the way CP/M writes disks, I am amazed that MyZ80 is able to create an ever-expanding disk image.  I wonder how it does that.  Does it modify the Disk Parameter Block over time, or maybe it just creates a huge virtual disk at the start and only writes/expands the image file as needed?  (I'm guessing it's the latter.)

As I said in my previous reply "It is obviously the latter". However what is perfectly obvious to me is perfectly obvious to me so for your ongoing amusement and entertainment may I commend to you the following next installment in this; The Ancient Epistle of the Aztecs:

The following is excerpted from MYZ80.DOC written by Simeon Cran, the author of MyZ80. I have posted this document in its entirety in the CP/M forum which is where some of this discussion also probably belongs.

However since this discussion also relates heavily to configuring Aztec C to run under CP/M so you C128 guys can create CP/M programs that will run on a real C128 when done, I see no point in you torturing yourselves by testing your programs in the x128.exe emulator or even on a real C128 running in CP/M mode until you have finished your development cycle.

In order to make my point completely on this I have provided the necessary framework including x128 diskimages within my Aztec-C distribution for you to remember how bad the C128 really was when it came to writing and testing programs for CP/M, and have also provided MyZ80 disk images to provide you with a really good alternative. The rest is of course up to you.

Quote from: Simeon Cran. (Author and designer of the MYZ80 package)
DISK FILE

CP/M stores data on disks.  In  order to  satisfy CP/M's  need for particular  disk  formats,  MYZ80  emulates  the  real  CP/M  disk structure and stores the resultant data on your DOS disk. The data for each emulated CP/M disk is held in  a DISK  FILE. Usually  the disk files  are  called A.DSK,  B.DSK and  C.DSK, however  you may change the default names of the disk files with a  setting in  the DOS enironment block or by using the MyZ80 CHGDSK.COM utility.

SHRINKING

Because the MYZ80 virtual disks are able to hold over  8 megabytes of data, and because CP/M expects to be able to access all of that data at any time, disk files would normally have to be at  least 8 megabytes in size all the time. 

This would take up a lot  of your hard disk space and  would be  extremely wasteful  when your  disk files don't hold much useful data.  MYZ80 solves  this problem  by only storing useful data and returning dummy blank sectors to CP/M in return for any requests for data from unused parts of the disk.

As you add more data to your MYZ80 disk files  you will  find that they grow, however when you delete files from the MYZ80 disk files they will not shrink automatically. This is a feature, not  a bug! You can shrink disk files that have had data removed from them  so that MYZ80 will return the dummy blank sectors for the  previously used sectors  using the  SHRINK.COM utility.   

Note well  however, that disk files can only be shrunk down  to the  highest block  of data in use on the disk.  SHRINK.COM will tell you which file owns the highest block of data so that you can delete that file or move it  in  order  to  allow  further  shrinking  of  the  disk  file.  SHRINKING does  not "pack"  your disk  files, it  simply frees  up previously  allocated  blocks  that  are  no  longer  being  used.  SHRINKING is  not necessary,  except to  save space  on your  hard disk.

* MYZ80.DOC - Simeon Cran. (Author and designer of the MYZ80 package)

hydrophilic

Thanks for clarifying that.  Although I'm not into CP/M developement, I can imagine how nice it must be to run on a modern PC with an emulated 8M disk!  I think CP/M is interesting in the way it allows various disk formats but stupid in that the format info is not present on the disk.

Appeantly Microsoft learned from this because the first sector of their FAT disks tells you the disk layout.  However, the flexibility to create different formats is a bit of an illusion -- there is a finite number of formats that MS-DOS will accept even if all the parameters are valid (try making a disk with 1 or 3 copies of the FAT, nope DOS won't like it).  I'm still not sure why they'd create a disk system that appears to support arbitrary formats but actually does not.  I'm not an expert in MS-DOS, but from disassembling the drive routines, they seem very generic and able to handle arbitrary formats.  It's the higher-level routines which cry foul when they see something they don't like.

Oooops, went way off topic there.  Thanks again for satisfying my curiosity.