Newsgroups: comp.os.cpm Path: utzoo!telly!problem!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Subject: Re: Z80 emulators Organization: D'Arcy Cain Consulting, West Hill, Ontario Date: Thu, 1 Nov 90 03:30:26 GMT Message-ID: <1990Nov1.033026.25743@druid.uucp> References: <9010292010.AA04870@nextasy2.eecs.wsu.edu> In article mrapple@quack.sac.ca.us (Nick Sayer) writes: >If anyone cares, I also have written a Z-80 interpreter and CP/M >system for unix, and it's currently in beta-test. It is painfully >slow, but that's to be expected, really. The BIOS is written in >C, but the BIOS table can be played with, if you want, and BIOS >can be moved "down" to make himem space available. The sudden interest here in CP/M emulators has got me back to work on mine. Perhaps everyone who has one in the works should get together and get something finished. Anyway, since everyone is describing the features of their stuff here is mine. --------------------- Canned speech starts here ------------------------- This is a quick overview of my CP/M emulator for Unix. I wrote a decoder for the 8080 instruction set. Eventually I will upgrade it to a full Z80 decoder. Whenever the PC is >= 0xfec0 it executes a return no matter what is in RAM at that location. Before calling the routine for each instruction I look at the PC and end the program if it is zero or perform a BDOS function if it is 0xfec0 or BIOS if it is >= 0xff00. Since the emulator ignores the contents of memory as far as instruction decoding is concerned, The system has the interesting property of being able to use all of memory except the first 0x100 bytes for user programs by putting the stack at 0xfffe. In fact the default stack when a program is run is set to 0xfff0. I use Unix commands to simulate some CP/M commands such as DIR, REN, TYPE and handle things such as SAVE internally. I use the Unix file system for drives. The user defines Unix directories to CP/M drive mappings. This allows CP/M to use the same file system as the Unix but does force CP/M conventions on the file names such as upper case, must have 1 and only 1 period, etc. It is easy to handle though since one can always link files as necessary, even from CP/M since I also include a '!' command to do Unix commands from within CP/M. Programs that use IN and OUT opcodes will fail. All I/O must go through the BDOS or the BIOS. The user can set up the following devices: Screen (CON out), keyboard (CON in), RDR, PUN and LST. The default for screen and keyboard is stdout and stdin. The user can set up Unix files for any of these devices. The file of course can be an actual file, a device or even a pipe to a command, even another CP/M command that has the keyboard reading from the same pipe. It's not quite finished yet but I am running simple programs with it now. All the 8080 opcodes are being emulated and some of the Z80. --------------------- End of canned speech -------------------------------- It is running programs now but it is just so slow that I am trying to improve the decoder. If I ever get it finished I will be sure to post it. -- D'Arcy J.M. Cain (darcy@druid) | D'Arcy Cain Consulting | I support gun control. West Hill, Ontario, Canada | Let's start with the government! + 416 281 6094 |