home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-07 | 36.4 KB | 1,109 lines |
- ****************************************************************************
- * *
- * Documentation for CPCEMU (v0.8) - the CPC-Emulator for the PC *
- * *
- ****************************************************************************
-
- This is the english documentation for CPCEMU , for the german one consult
- CPCEMU_G.DOC.
-
-
- If you have questions or suggestions, write to
-
- Marco Vieth
- Auf dem Uekern 4
- 33165 Lichtenau
- (Germany)
-
- Or by e-mail :
- ali@uni-paderborn.de
-
-
-
- 1. IMPORTANT :
- ==============
-
- CPCEMU is Copyright 1993 by Marco Vieth, Auf dem Uekern 4,
- 33165 Lichtenau, Germany.
- Telephone: (...) 05292/1366
- Internet address:
- ali@uni-paderborn.de
-
- This document and the files listed herein may be freely copied
- without charge, provided copyright notices are left intact. All
- software and documentation is provided "as is" without warranty
- of any kind.
-
- Although this program is freeware, I would certainly accept
- any sort of support, financial or ideal.
-
-
-
- 2. INTRODUCTION:
- ================
-
-
- 2.1 For what purpose is an emulator ?
- --------------------------------------
-
- There was (and is) much discussion about speed augmentation
- of older computers, p.ex. by replacing a slow CPU by a faster
- one, but mostly this is impossible (maybe caused by timing-
- problems).
- So why don't we take a much more powerful system as platform
- for running an emulation ?
- With progress in developement of new computer systems our
- old one is automatically improved, not only in speed, also
- concerning ergonomy (p.ex. 70 Hz screen, comfortable keyboard)
- and other advantages (p.ex. a hard-disc).
- Besides, it is a great pity not to be able to use your self-
- written programs on the new computer any more.
- Some years ago, I thought of an EPROM-simulator for testing
- EPROM-code in RAM. This is no problem with this emulator.
- It is at least fascinating to see old programs running on a
- total different computer.
- This all (and much more) offers you an emulator like CPCEMU.
-
-
- 2.2 What is a CPC ?
- --------------------
-
- To keep it short:
- The AMSTRAD-CPC (Colour Personal Computer) has an 8 bit design
- with Z80A CPU, 3" disc drive, the operating systems AMSDOS
- (sometimes called as Advanced MSDOS, but it is rather
- AMSTRAD DOS), CP/M 2.2 and CP/M Plus.
- A powerful BASIC is implemented, with wich you can utilize
- most hardware qualities.
- For more information consult appendix "Information about the
- CPC" (A1.6).
-
-
- 2.3 What is CPCEMU ?
- ---------------------
-
- CPCEMU is the first emulator of the CPC computers you can take
- seriously.
- On a 386/33, the emulation is nearly as fast as the original,
- provided that you use little banking.
-
- CPCEMU is written in C and assembler, using Borland 3.1 (with
- 80386 code) and TASM.
-
-
-
- 3. REQUIREMENTS FOR CPCEMU :
- =============================
-
-
- 3.1 Hard- and software requirements :
- -------------------------------------
-
- - PC (at least a 386, as usual no limits to more)
- - VGA graphics
-
- - MSDOS (DRDOS hardly supposed) or
- - OS/2 2.x dos-box
-
-
- 3.2 Files which comprise the CPCEMU package :
- ----------------------------------------------
-
- CPCEMU.CFG configuration-file (6.4)
- CPCEMU_E.DOC this file
- CPCEMU_G.DOC german documentation
- CPCEMU.EXE the executable (4.1)
-
- CPCPD1.DSK example-disk with PD-programs (6.2)
-
- CPCREAD.C source to CPCREAD.EXE
- CPCREAD.EXE programm for reading CPC-disks (6.2)
-
- CPMDISKS.DEF file with CPC-format-definitions for
- 22DISK (4.2.1)
-
- INSTALL.BAT installation program (4.1)
-
- PARALLEL.PAS transfer program for a parallel interface
- (4.2.2)
-
- README_E.DOC englisch README
- README_G.DOC german README
-
- ROMGET.ASC CPC-BASIC programm to save the ROMs (4.2.1)
-
- Z80CPC.ROM the "Need-ROM" (4.3)
- Z80DISK.ROM the program "Copymate" (not used)
- (Replace this ROMs by the original ones.)
-
-
- 4. INSTALLATION :
- =================
-
- 4.1 Installation of CPCEMU :
- -----------------------------
-
- Maybe you have done it already :
- Simply copy the archive CPCEMUxx.xxx into a directory of your
- hard-disc and decompress it.
- After that, use INSTALL.BAT, which creates the three
- subdirectories ROM, TAPE, DISC with the necessary files in it,
- where CPCEMU looks for ROM-images, "tape"-files and disc-images.
- Now you can start CPCEMU.EXE, but wait ...
-
-
- 4.2 How to get a ROM ?
- -----------------------
-
- Problem :
- ---------
- The original CPC-ROMs are NOT enclosed !
- Unfortunately, AMSTRAD has not allowed me to include them. For
- more information look at appendix "Letter from AMSTRAD" (A1.7).
- So you are forced to get the ROMs from somewhere else.
- In the following some possibilities :
-
- 4.2.1 If you have a CPC with 5.25" or 3.5" disc-drive :
- --------------------------------------------------------
- With the 22DISK-utility by SYDEX you are able to read and write
- user-defined formats. I have included a specification for the
- CPC-formats.
- Simply copy the file ROMGET.ASC (a program to save the CPC-ROMs)
- onto a CPC-disc, run to your CPC and run the program.
- The ROMs OS, BASIC and AMSDOS are saved automatically (if
- present). Back on the PC, copy them into the directory .\ROM .
- If you own other ROMs, you can also copy them, after a small
- modification of ROMGET.ASC . Besides, you can "rescue" all
- your CPC-programs in this way.
-
-
- 4.2.2 With a parallel interface :
- ----------------------------------
- After you have constructed a special centronics-cable and joined
- CPC and PC together, you can use the transfer-program written by
- Gilles Molinari. In the file PARALLEL.PAS you can find the two
- pascal-sources getfile.pas and sendfile.pas .
-
-
- 4.2.3 With a serial interface :
- --------------------------------
- I think, it is as easy as the other possibilities, but I have
- not tried it.
-
-
- 4.2.4 Nothing of the kind :
- ----------------------------
- Well, what can you do to enjoy a CPC ?
- - Type the ROM in your computer, maybe from a CPC-ROM-listing.
- - Write your own small operating system (that's only for
- professionals, I think, but I would be glad to receive a copy)
- - Write an advertisement in a computer-magazine with the
- following writing:
- "Who can copy me the CPC-ROM ?"
- ( In a special magazine, someone tries this already the second
- time, it seems, he didn't succeed yet. Why not ? )
- - Ask AMSTRAD for the ROMs (maybe you've more success)
- But I cannot recommend this really.
- Be inventive ...
- ... and use the "Need-Rom" so long.
-
-
-
- 4.3 The "Need - ROM" :
- ---------------------
-
- For people suffering want (those without the CPC-ROMs),
- I have included a so-called "Need-ROM".
- It is located in the .\ROM-directory after installation and
- is used automatically, if no other ROMs are present under the
- same name.
- It contains only a program, which is total independend from
- the original ROMs (except for thr character-set).
- It is certainly not a satisfactory replacement.
-
-
-
- 5. THE SOFTWARE - CPC :
- ======================
-
-
- 5.1 The first time :
- ---------------------
-
- Congratulations, you have mastered the biggest hurdle before
- using the emulator ingeniously.
- (Therefore you have copied the CPC-ROMs into the .\ROM -
- directory.)
- Execute CPCEMU.EXE, the configuration is loaded, the memory
- is initialized and -- fasten your seat-belts -- the software-
- CPC starts ...
- (To get back to reality, consult appendix
- "Command line parameters" (A1.1).)
-
- The CPC-opening-screen appears and you can do all you know from
- a real CPC.
- F10 interrupts the emulation (you get into the debug-menu),
- 'r' continues and 'q' quits.
- Consult appendix "The Debug-Menu" (A1.2).
- However, you must consider some features ...
-
-
-
- 6. FEATURES :
- =============
-
-
- 6.1 The Keyboard :
- -------------------
-
- Maybe you have already noticed that some keys react in a
- different way you have expected them to do. The supposed
- output on the screen differs from the lettering on the
- key you have pressed.
- The reason is that the CPC-keyboard-layout is physically
- mapped to that of the PC. This enables all key-combinations.
- If necessary, you must "try and error" with the motto
- "searching and finding".
- There are really all CPC-keys located somewhere (even one
- more, the "secret key").
-
- 6.1.1 Special Keys :
- ---------------------
- - ALT, ALTgr : COPY
-
- - F1 - F12 : special functions, in detail :
- F1 : Help (possibly this text appears)
- F2 : toggles between CPC-screen (standard view) and
- message-screen (that one with a red border). On the
- latter some messages appear, among other things the
- cassette - catalogue.
- F3 : Insert a disk. A file from DISC_PATH is displayed
- and you can select it with 'A' <Ret> or 'B' Ret
- for drive A or B. (Not very comfortable.)
- Please don't use this, if the disc is currently
- in use.
- F4 - F7 : reserved for future usages
- F8 : hard-reset (like reset-button for CPC)
- (use this, if CTRL/SHIFT/ESC hangs)
- F9 : reserved for future usage
- F10 : debug-menu (look at appendix "The debug-menu"
- (A1.2) )
- F11 - F12: reserved for future usages
-
- - At this point, you will maybe ask, where to find the CPC -
- function-keys. Try the Keypad :
- With 'Num-Lock on', the keypad represents the function-keys of
- the CPC, otherwise the joystick.
-
- - The joystick :
- In addition to the keypad you can use an analog PC-joystick.
- Include "USE_JOYSTICK = YES" in the configuration-file (see
- below). Then you can use a joystick, if one is present.
- Note, that you can always use the "keypad-joystick".
- ( Unfortunately, my current joystick-routine is too slow,
- so you can only use the fire-buttons .)
-
- - The PAUSE-Key holds the PC until it is pressed again.
-
-
- 6.2 The Disc-Drive :
- ---------------------
-
- Disc-accesses managed by the FDC (Floppy Disc Controller) are
- redirected to a file specified in the configuration-file
- (see below : DISC_PATH + DRV_A respectively DRV_B).
- By using the program CPCREAD you can create such files from
- CPC-discs yourself.
- The file CPCPD1.DSK contains some example PD-programs.
- Look at appendix "Structure of Disc-Images" (A1.4).
-
-
- 6.3 The Tape :
- ---------------
-
- After the '|TAPE'-command, or if you don't own an AMSDOS-ROM,
- the "tape" is addressed. Tape-access is transformed into file-
- access in the directory TAPE_PATH (see configuration-file).
- By the way, the CATalogue appears on the message-screen
- (use F2 to toggle view).
- Non-ASCII files have included a preceding AMSDOS-header.
- Look at appendix "Structure of the AMSDOS-header" (A1.5).
- This bypass is realized by a ROM-modification, which is
- described in appendix "Function of the ROM-bypass" (A1.3).
- At this point you only need to know, that for cassette-usage
- this bypass must be enabled by the entry 'TAPE_BYPASS = YES'
- in the configuration-file ...
-
-
- 6.4 The Configuration - File :
- -------------------------------
-
- Now the mystic configuration-file is described, but it is not
- mystic at all.
-
- In general :
- ------------
- The configuration - file CPCEMU.CFG should be located in the
- same directory as CPCEMU.EXE .
- Comments are introduced by a semicolon ';', the rest of the
- line is ignored.
- Blanks, tabs, newlines and ';' are delimiters, they can be used
- between identifiers and values as many as you like.
- Many of the definitions have the syntactical form
- <identifier> {T} '=' {T} <value> {T}
- {T} is a sequence of at least one delimiter.
- Example :
- 'ROM_PATH = .\ROM'
- Not allowed is 'ROM_PATH=.\ROM' because of missing delimiters.
- If you don't want to (re-)define an identifier, make a comment
- by writing a ';' in front of it; not allowed is
- 'ROM_PATH = <nothing>' .
-
- The following constructs are used sometimes :
- <number> can be given decimal or hexadecimal (with 0x).
- <pathname> may have a length up to 60 characters and
- <filename> up to 20 characters.
-
-
- Valid identifiers :
- -------------------
- The values in brackets are default-values, if the referred
- identifier is not redefined.
-
- SHOW_CONFIG = {YES,NO} (YES)
- To suppress the configuration-message after starting the
- emulation. If some errors occured during startup, the
- configuration is always displayed.
-
- ROM_PATH = <pathname> (.\ROM)
- Sets the path to ROM-images. (See also identifier ROM_BLOCKS.)
-
- TAPE_PATH = <pathname> (.\TAPE)
- Sets the path to "tape"-files.
- (Also used in debug-menu during load, save; look at appendix
- "The Debug-Menu" (A1.2).)
-
- DISC_PATH = <pathname> (.\DISC)
- Sets the path to disc-images. (See also ident. DRV_A, DRV_B.)
-
- DRV_A = <filename> (DISC1.DSK)
- The disc actually inserted in drive A (a disc-image file
- in the DISC_PATH - directory).
-
- DRV_B = <filename> ()
- Same as DRV_A, but for drive B.
-
- PRINTER = <filename> (PRINTER.PRN)
- A file in TAPE_PATH for lineprinter output.
- It is created at every emulation-start.
-
- TAPE_BYPASS = {YES,NO} (YES)
- Enables (or disables) the ROM-bypass of the tape-vectors, if
- a known ROM from a CPC 464/664/6128 is found.
- This bypass is necassary, if you want to use tape - files.
- Look at "The Tape" (6.3) and appendix "Function of the
- ROM-bypass" (A1.3).
-
- DISC_BYPASS = {YES,NO} (NO)
- Enables (or disables) the AMSDOS-ROM-bypass to suppress
- patching of tape-vectors by the AMSDOS-ROM.
- (So the tape-vectors are still pointing to tape, although
- the AMSDOS-ROM is initialized.)
- This is necessary, if you want continue loading from tape
- after a disc-reset, but without giving the '|TAPE'-command
- first.
- (It is done by 'poke &CCF2,&18 : poke &CCF3,&05' in
- AMSDOS-ROM.)
- Sector-instructions are not affected, they always address the
- disc.
-
- DISC_SPEEDUP = {YES,NO} (YES)
- Enables (or disables) a AMSDOS-ROM modification, which
- minimizes the motor waiting times to render a faster disc-
- access. (The things are managed by DOS, so we needn't the
- delay loops.)
- (The following bytes are modified in AMSDOS-ROM :
- poke &C5D4,&01 :'motor load-time
- poke &C5D8,&01 :'format trk-time
- poke &C5D9,&01 :'short wait
- poke &C5DA,&01 :'short wait
- poke &C602,&01 :'only 1 retry on error
- poke &C784,&01 :'fast seek
- poke &C7E2,&01 :'fast seek )
-
- USE_JOYSTICK = {YES,NO} (YES)
- Enables (or disables) a PC-joystick, if present.
- You can always use the "keypad-joystick".
-
- VSYNC_CT = <number> (1)
- Sets the count, how often the PIO-port B must be asked, until
- the vsync-bit toggles. In reality, this bit is only set
- during vertical frame-fly. Possible values range from 1 to 255.
-
- GENINT = <number> (300)
- Sets the frequency of interrupt gereration (in Hz).
- In a CPC it is always 300 Hz. On slow computers, this value
- may be decreased to 100 (and SCR_UPD_CT to 2).
- Possible values are 18 Hz to ca. 600 Hz.
-
- SCR_UPD_CT = <number> (6)
- Sets the screen-update counter. Every <number> interrupts the
- screen is updated, if necessary. With GENINT = 300 and
- SCR_UPD_CT = 6, the screen is updated 50 times per second.
- (Valid values: 1-255).
-
- PORT_B = <value> (0x3F)
- Sets the input-value "lying" at port B of the PIO.
- You can disable the printer, or select another company name.
- By changing this value to 0x3B, you get "Schneider" instead
- of "Amstrad" (0x3F) on the opening screen.
-
- Meaning of the bits:
- b7 = 0 (TTL-signals from tape; not used)
- b6 = 0 (0 = printer ready, 1 = busy)
- b5 = 1 (EXP-signal)
- b4 = 1 (1 = vsync with 50 Hz or 0 = with 60 Hz; not used)
- b3,b2,b1 = 111
- select company :
- Isp (000), Triumph(001), Saisho(010), Solavox(011),
- Awa(100), Schneider(101), Orion(110), Amstrad(111)
- b0 = 1 (vsync : toggles between 0 and 1 in the emulator,
- the duration depends on VSYNC_CT.)
-
-
- ROM_BLOCKS = <number> {T} (0)
- <ROM-number> {T} <filename> {T} <offset> {T}
- (repeat this line <number> - times !)
-
- Describes, which ROMs should be loaded :
-
- - <number> is the number of ROMs to load. Every ROM has a size
- of 0x4000 bytes. (<number> ranges from 0 to ca. 8, depending
- on the free memory left.)
-
- - <ROM-number> is the number assigned to the ROM, that means,
- it is selected by 'OUT &DF00,<ROM-number>' .
- Possible values are :
- 0 : Foreground-ROM (p.ex. BASIC)
- 1 - 251 : Background-ROMs. On a CPC 664/6128, the ROMs
- 1-15 are automatically initialized during reset
- (on a CPC 464 only 1-7).
- 255 : Lower-ROM (p.ex. OS; has only in emulator this
- number).
-
- - <filename> is a file in the directory ROM_PATH, which
- contains the ROM.
-
- - <offset> is a number of bytes preceiding the ROM-image in
- file <filename>. An AMSDOS - header is overread automatically,
- so don't take any regard to it. With an offset it is possible
- to load several ROMs from the same file.
- If you inspect the lines
- 255 Z80CPC.ROM 0x0000
- 0 Z80CPC.ROM 0x4000
- you maybe notice, that the lower-ROM and the foreground-ROM
- are loaded one after another from the same file.
-
-
-
-
- 6.5 Compatibility of the emulator (or: what is supported) :
- ------------------------------------------------------------
-
- 6.5.1 The Z80 - CPU :
- ----------------------
-
- All Z80-instructions, also so-called illegal ones.
- You have the choice between a slow Z80-emulation written
- in C and a fast Z80-emulation written in assember by
- Juergen Weber.
- With the "CO-CPU" - technique, every Z80-instruction is
- emulated simultaneously by the slow and the fast version,
- so it gets very slow, but by comparing the registers after
- each instruction many errors are found. Certainly this was
- only used during program-developement.
-
-
- 6.5.2 The Gate - Array :
- -------------------------
-
- - all 32 colours of the CPC (27 different ones)
- - all three screen-modes (x, y, colours) :
- mode 0 = 160x200x16
- mode 1 = 320x200x4
- mode 2 = 640x200x2
- - ROM-banking (16KB OS, 16KB BASIC, 16KB AMSDOS and
- additional ROMs)
-
-
- 6.5.3 The PAL (Programmable Logic Array) :
- -------------------------------------------
-
- - RAM-banking (8*16KB = 128KB)
- Banking can get very slow, since memory blocks must be swapped.
- Perhaps EMS-memory would help ...
-
-
- 6.5.4 The CRTC 6845 (Cathode Ray Tube Controller) :
- ----------------------------------------------------
-
- - screen-base and -offset for hardware-scrolling
- - several screen-sizes from 0x0 to 80x25 with CRTC-registers
- 1 and 6.
-
-
- 6.5.5 The PIO 8255 (Programmable Input-Output) :
- -------------------------------------------------
-
- - Keyboard (connected to PSG)
- - vsync-emulation
-
-
- 6.5.6 The PSG (Programmable Sound Generator) :
- -----------------------------------------------
-
- (no sound yet)
-
-
- 6.5.7 The FDC (Floppy Disc Controller) :
- -----------------------------------------
-
- - all necessary FDC-commands to control two drives A and B
- (including sector read/write, seek track, read sector-ID, ... ;
- format track is suppressed.)
- - very flexible disc-formats (up to 18 sectors per track).
- Create them with CPCREAD.
-
-
- 6.5.8 The Tape :
- -----------------
-
- - very fast by ROM-bypass.
- Access files in TAPE_PATH (see configuration-file)
-
-
- 6.5.9 The Centronics :
- -----------------------
-
- - Printer output to the file PRINTER in TAPE_PATH
- (see configuration-file).
- You can also use the 8-bit printer-patch !
-
-
-
- 6.6 Incompatibilities (or: what's not supported) :
- ---------------------------------------------------
-
- - overscan (at most for some silly demos)
- (will never be implemented - too slow)
- - several screen-modes on the same screen (flickering)
- - sound (not a single tune)
- - PC-joystick (only the fire-buttons)
- - OS/2 dos-box : flickering during set_palette (no hsync aviable)
- - program Copymate : load/save impossible, since it uses a trick
- to detect the number of sectors per track
-
- - please report all bugs you find !
-
-
-
-
- A1. APPENDIX :
- ===============
-
-
-
- A1.1 Command line parameters :
- -------------------------------
-
- You can start CPCEMU.EXE on several ways by using options,
- introduced by '-' or '/', p.ex 'CPCEMU.EXE /s' .
-
- The following options are aviable:
- CPCEMU /f : starts CPCEMU in fast-mode (default)
- CPCEMU /s : starts CPCEMU in slow-mode
- CPCEMU /d : starts CPCEMU in debug-mode
- (Consult appendix "The Debug-Menu" (A1.2).)
- CPCEMU /h : displays a help-screen
-
- The option '/d' is automatically used, if an unknown option
- was specified.
-
-
-
- A1.2 The Debug - menu :
- ------------------------
-
- The complete register-set of the CPU is displayed and can
- be modified. You can "dump" the momory, disassemble or
- modify it. You can load or save areas im memory.
- And the most interesting thing:
- You can single-step through programs !
- (Similar to a real debugger.)
-
- A1.2.1 Overview of the debug-menu :
- ------------------------------------
-
- R)un T)race S)tep A)ssem D)ump I)nput L)oad saV)e M)ode F)ast Q)uit
- AF=0000 BC=0000 DE=0000 HL=0000 IX=0000 IY=0000 SP=0000 PC=0000 IR=0000
- AF'=0000 BC'=0000 DE'=0000 HL'=0000 IFF1=0 IFF2=0 IMD=0 NZ NC PO P
- 0000 : 01 89 7F LD BC,&7F89
- -f->
-
- The first line displays the aviable commands, use the capitalized
- letters.
- The next two lines show the actual values of the Z80-register.
- The next one disassembles the actual instruction at PC position
- and the last is a prompt waiting for your input.
- ('f' indicates that you are using the fast-CPU.)
-
-
- A1.2.2 Preliminaries :
- -----------------------
- Parameters in special brackets are optional [opt].
- Use only hexadecimal values, p.ex <address> = 0000-ffff
- "<ret>" signals you, that you are in a special mode. You may
- press <return> to continue. <String><Return> leaves this mode
- (use p.ex. b<return>).
- Commands are letters, mostly followed by an optional address.
- Between the letter and this address must be a blank or tab.
- Without an address, PC (program-counter) is assumed as default.
-
-
- A1.2.3 Overview of the commands :
- ----------------------------------
-
- R)un :
- r [<address>] : starts emulation from PC or an optional address.
- Examples:
- -f-> r starts emulation from PC
- -f-> r 100 sets PC to 0x100 and starts emulation
-
- T)race (trace into) :
- t [<address>] : executes only the actual displayed instruction.
- Use <return> to continue in this mode, and so on.
- <string><return> goes back to normal mode.
- All single-step-commands are executed by the slow-CPU (even if
- "-f->" is displayed), since there is no counter in the fast-CPU
- any more.
-
- S)tep (step over) :
- s [<address>] : executes the next instruction.
- Rather all instructions, until PC is equal to the following
- instruction. This can take a long time p.ex after a 'Ret'.
- In this case F10 helps (as usual).
- All single-step-commands are executed by the slow-CPU (even if
- "-f->" is displayed), since there is no counter in the fast-CPU
- any more.
-
- A)ssemble (rather disassemble) :
- a [<address>] : disassemblies the next 16 instructions.
- Use <return> to continue in this mode, and so on.
- <string><return> goes back to normal mode.
-
- D)ump :
- d [<address>] : shows an hex-ascii-dump of the following 256
- 256 bytes from address (or PC).
- Use <return> to continue in this mode, and so on.
- <string><return> goes back to normal mode.
-
- I)nput (modifying memory) :
- i [<address>] : shows the actual memory-address with its current
- value, which you can take by <return> or change by <hex-value>
- <return>.
- Leave this mode by using an invalid number like '-1' :
- -1<return> .
-
- L)oad (loading a program) :
- l [<address>] : prompts you for a filename <name> and loads it
- from the directory TAPE_PATH to <address>
- An AMSDOS-header is recognized.
- Look at Appendix "Structure of the AMSDOS-header".
- Examples:
- -f-> l<return> demo<return> :
- loads file 'demo' to the actual PC
- -f-> l a000<Return> myprog<Return> :
- loads file 'myprog' to address 0xA000
-
- saV)e (saving a program) :
- v [<address>] : prompts you for a filename <name> and the
- length of the memory-block. This block is saved from <address>
- (or PC), as binary-file in the directory TAPE_PATH, which means
- with an AMSDOS-header.
- Look at Appendix "Structure of the AMSDOS-header".
- Example:
- -f-> v<return> demo<return> 4000<return> :
- saves file "demo" from PC with length 0x4000.
-
- M)ode (changing the display-mode) :
- m : Changes dislay-mode : register-display, instruction-
- disassembling on/off.
-
- F)ast (selecting the type of emulation) :
- f : Flips between the fast Z80-emulation (developed in assembler
- by Juergen Weber, default) and the slow one (written in C).
- The prompt toggles between "-f->" for fast and "-s->" for slow.
- All r, s, t-commands refer to the selected type of emulation.
-
- Q)uit (leaving the program) :
- q : quits the emulator.
-
-
- A1.2.4 Manipulation of registers :
- -----------------------------------
-
- In addition to the one-letter-commands you can change register-
- values with the syntax: '<register>=<hex-value>'
- Examples:
- - af=345 : set register AF to 0x0345
- - pc=a000 : set program-counter to 0xA000
-
- Here, '=' is handled as delimiter, so no additional blanks are
- necessary (and you can also write '<register> <hex-value>').
- You can modify all displayed registers, thus
- AF, BC, DE, HL, IX, IY, SP, PC, IR, AF', BC', DE', HL',
- and also IFF1, IFF2 and IMD.
-
-
-
- A1.3 Function of the ROM - Bypass :
- ------------------------------------
-
- Some special instructions are implemented in the Z80-emulation.
- They call special functions only supplied by the emulator.
- They are entered directly in ROM, so it is still possible to
- patch the RAM-vectors.
-
- The following instructions are aviable :
- ED FC xx USER &BCxx (only valid for some RAM-vectors)
- Similar to a call-instruction to an internal function.
- The following values for xx are legal :
- 65 : CAS INIT (BC65)
- 77 : CAS IN OPEN (BC77)
- 7A : CAS IN CLOSE
- 7D : CAS IN ABANDON
- 80 : CAS IN CHAR
- 83 : CAS IN DIRECT
- 86 : CAS RETURN
- 89 : CAS TEST EOF
- 8C : CAS OUT OPEN
- 8F : CAS OUT CLOSE
- 92 : CAS OUT ABANDON
- 95 : CAS OUT CHAR
- 98 : CAS OUT DIRECT
- 9B : CAS CATALOG
-
- In addition to that, you can use the user-break-instruction
- ED FC FC USER &BCFC , it stops the emulation at once.
-
-
-
- A1.4 Structure of Disc - Images :
- ----------------------------------
-
- Disc-image files consist of a 0x100-byte disc-info block and
- for each track a 0x100-byte track-info block, followed by the
- data for every sector in that track.
-
- A1.4.1 The Disc - Information block :
- --------------------------------------
- Byte (hex) : Meaning:
- 00 - 21 MV - CPCEMU Disk-File\r\nDisk-Info\r\n
- (as characteristic)
- 22 - 2F unused (0)
- 30 number of tracks (40, 42, maybe 80)
- 31 number of heads (1, 2 not yet supported)
- 32 - 33 size of one track (including 0x100-byte track-info)
- With 9 sectors * 0x200 bytes + 0x100 byte track-
- info = 0x1300.
- 34 - FF unused (0)
-
- A1.4.2 The Track - Information block (for every track) :
- ---------------------------------------------------------
- Byte (hex) : Meaning:
- 00 - 0C Track-Info\r\n
- 0D - 0F unused (0)
- 10 track - number (0 to num.of tracks -1)
- 11 head - number (0) (maybe 1 later)
- 12 - 13 unused (0)
- Format-track-parameters:
- 14 BPS (bytes per sector) (2 for 0x200 bytes)
- 15 SPT (sectors per track) (9, at the most 18)
- 16 GAP#3-format (gap for formatting; 0x4E)
- 17 Filling-byte (filling-byte for formatting; 0xE5)
- Sector-info (for every sector at a time):
- 18+i track-number \
- 19+i head-number | sector-ID-information
- 1A+i Sector-number |
- 1B+i BPS /
- 1C+i state 1 error-code (0)
- 1D+i State 2 error-code (0)
- 1E+i , 1F+i unused (0)
-
- Annotations:
- The sector-data must follow the track-information-block
- in the order of the sector-IDs. No track or sector may be
- omitted. Use CPCREAD to copy CPC-discs into this format.
-
-
- A1.5 Structure of the AMSDOS - Header :
- ----------------------------------------
-
- Byte (hex:) Meaning:
- 00 user-number (0 , possible values 0-15)
- 01 - 0F filename+extension (possibly filled with 0)
- 10 block-number (0)
- 11 last-block-flag (0)
- 12 file-type (0=basic, 1=protected basic, 2=binary,...)
- 13 - 14 length of block (0)
- 15 - 16 load-address (0-FFFF)
- 17 first-block-flag (0)
- 18 - 19 logical length (0-FFFF)
- 1A - 1B entry-address (0-FFFF)
- 1C - 3F free for the user (0)
- 40 - 42 real length of file (1-FFFFFF)
- 43 - 44 checksum of bytes 00-42
- 45 - 7F unused (random values from sector-buffer)
-
- Annotation:
- A header stands at the beginning of every non-ASCII file. It
- is identified by calculating the checksum.
- Bytes 00-3F originate from the "cassette-area", where files
- were divided up into blocks.
- Necessary are the bytes 12, 15-16, 1A-1B, 40-42, 43-44 .
-
-
- A1.6 Information on the CPC :
- ------------------------------
-
- It is possible to write several books about this topic,
- maybe in a later doc.
-
-
-
- A1.7 Letter from AMSTRAD :
- ---------------------------
-
-
- I have written the following letter to AMSTRAD:
-
-
- Dear Sirs,
- I would like to offer you the most outstanding program ever
- written !
-
- It is a CPC-emulator on PC.
-
- You might say, "CPC, that home-computer we designed years ago,
- that is over !"
- But there are many people still using it, potential customers
- of Amstrad-PC's. An emulator would be another reason to buy a
- PC, they can continue using the old well known programs during
- a transitional period.
- For people who already have a PC it is fascinating, too. I was
- totally surprised to see the CPC-opening screen on a complete
- different computer the first time. It drives me to improve the
- emulation (in former times it was only black and white ...),
- so today I would call it a "software CPC". Certainly, it can
- be improved. Some more details of the emulator are enclosed.
-
- Unfortunately I cannot continue programming the emulator
- without support (I am only a student). All programs I have
- ever written are Public Domain, also the current version of
- CPCEMU.
- If you are interested, I can send you the emulator for testing.
-
- If not (but I do not think so), I need to know, under which
- legal condition I can include the original Amstrad-CPC-Rom
- to make a shareware package.
- (Some people asked me for that.)
-
- .
-
- I have received the following answer :
-
- .
-
- Dear Mr Vieth
-
- Thank you for your recent letter concerning the CPC.
-
- Please be advised that the CPC ROM is protected by copyrights
- and therefore regretfully we are unable to offer any assistance
- in this matter.
-
- We are sorry we have been unable to assist you on this occasion
- and regret the inconvenience caused.
-
- .
-
- So I'm not allowed to enclose the ROMs.
- But who has the copyright ?
-
-
- A1.8 History of program developement :
- ---------------------------------------
-
- A1.8.1 Z80EMU (only a Z80 with less CPC) :
- -------------------------------------------
- - v1.0 (1991)
- first version in pascal (only Z80-emulation)
- - v1.2 (12.8.1992 - 16.8.1992)
- first version in C (translated with TPTC)
- Z80-problems: P-flag set with ADD HL..., DAA, ldir;
- Z-flag set with BIT... Z,S-flags set with Rotate; ROMs possible
- - v1.3 (18.8.1992)
- port-adressing wrong in lo-byte.
- New memory-management (128 KB RAM, 32 KB ROM)
- - v2.0 (18.8.1992 - 22.8.1992)
- Co-CPU-technique implemented to find errors
- (mit separated memory for the CO-CPU).
- Z80-problems: H-flag set after AND... ; CPI... sets N-Flag;
- Screen colours blue and yellow (former black and white)
- - v2.1 (25.8.1992 - 27.8.1992)
- All pens, colours from the CPC in all modes; only the viewing
- screen is written to.
- Co-Z80-error: alle (ix+zz) with negative distance were wrong !
- Forgotten to take 'signed char'.
- - v2.2 (30.8.1992 - 3.9.1992)
- New keyboard-routine, set palette without flickering (hsync).
- "Need-Rom" with Copymate introduced.
- - v2.3 (15.9.1992 - 19.9.1992)
- FDC-emulation for sector load/save.
- Co-Z80-error: LD XH... was LD H...
- - v2.3b (19.9.1992)
- Screen-update only on blocks 0..3 (not 4..7);
- Port FCxx same as FBxx (for CP/M Plus). At that time, I
- didn't know that OUTI... pre-decrements the B-register.
- - v2.4 test (25.10.1992)
- Only R-register-emulation, if desired (per define);
- Now screen-update every n.interrupt and not for every single
- byte written in memory.
- (Still very slow, it's written in C).
- New memory-management with blocks aligned to segments.
- - v2.5 test (31.10.1992)
- Changed memory-management. Hardware-scrolling and different
- screen-sizes possible.
- - v2.6 test (5.11.1992)
- New keyboard-handler by Arnt Gulbrandsen: all key-combinations
- possible. Screen-update in assembler.
- - v2.7 test
- Unsuccessfully tried to include the fast-Z80-emulation by
- Juergen Weber.
- - v2.8
- Improved Screen-update: Only changed parts are modified on
- the screen.
- - v2.9
- Timer-handler with 300 interrupts. Fast-emulation runs only, if
- no ROM (banking) is needed.
-
- A1.8.2 CPCEMU (now a CPC) :
- ----------------------------------
- - v0.2 (23.12.1992), following Z80EMU v2.9
- After nearly 4 hours with the Turbo-Debugger I've found the
- error hanging the fast-emulation: pushed ES instead of DS.
- - v0.3 (28.12.1992 - 29.12.1992)
- Set N-flag for INI,OUTI. CPI in fast-Z80 set wrong flags.
- RL(HL) used read-segment(DS) instead of write-segment(ES).
- LD A,R now produces random-numbers;
- All Tape-routines implemented (but wrong CAS IN CHAR).
- - v0.4 (1.1.1993)
- IN A,(n): A to b8..b15 (instead of B); RAM-configuration 0xc3:
- corrected to 0,3,2,7 (for CP/M Plus).
- KC-Compact (a CPC-compatible from former DDR) uses port
- EE00 - EE3D, but for what ?
- - v0.5 (28.1.1993 - 8.2.1993)
- INIR,... R-register-incrementation depends on B, not on BC.
- CAS IN CHAR corrcted (wrong patch for CPC 6128).
- - v0.6 (23.3.1993 - 24.5.1993)
- Somemone mentioned that the OUTI-instructions pre-decrement
- the B-register !
- Now C-parts also in 386-code (with Borland C++ v3.1)
- Disk-image-files now suffix .DSK.
- CPCREAD.PAS corrected (head not initialized with 0)
- and translated to CPCREAD.C .
- Pio-8255-port-addressing improved (can read, even if port
- is programmed for output, ...)
- - v0.7 (26.7.1993 - 29.8.1993) (inoffiziell)
- Tatally new source, modularized, ...
- Configuration-file, more ROMs possible.
- Changed company-name from 'Schneider' to 'Amstrad'.
- (The user can choose now.)
- RAM-banking-error removed.
- New documentation in german.
- - v0.8 (30.8.1993 - )
- Slow-emulation: parity-instructions improved by using a table
- not only for parity.
- Z80: ED xx with illegal xx is ignored.
- New documentation in english.
-
-
-
- A1.9 Acknowledgments :
- -----------------------
-
- - Special thanks to Juergen Weber, not only for many hints and
- suggestions, especially for the fast Z80-Emulation from his
- CP/M-emulator ZSIM.
-
- Juergen G. Weber
- Wiesentalstrasse 1
- 74523 Schwaebisch Hall
- Federal Republic of Germany
-
- email: weberj@dia.informatik.uni-stuttgart.de
-
-
- - Thanks to Arnt Gulbrandsen for his JPP source, where I found
- ideas to the keyboard-handler, and the joystick-routine.
- By the way, JPP is a very good emulator for the Spectrum.
-
- - Thanks to Gilles Molinari for his transfer program.
-
- - Thanks to AMSTRAD fow answering my letter.
- (It was my first business(?) letter).
-
- - And thanks to the many users for sending me suggestions or
- having ideas ...
-
- - (Please excuse my english. This is the first doc.)
-
-
- A1.10 Trademarks :
- -----------------------------
-
- CP/M, CP/M 2.2 and DRDOS are trademarks of Digital Research.
- MS-DOS is a trademark of Microsoft.
- IBM PC, PC-XT, PC-AT and OS/2 are trademarks of International
- Business Machines.
-
- CPC, AMSDOS by Amstrad,
- BORLAND C, TASM (Turbo Assembler) by Borland,
- 22DISK by SYDEX
- ...
-
-
-
- A1.11 Address of AMSTRAD :
- ---------------------------
-
- Amstrad plc, Brentwood House,
- 169 Kings Road, Brentwood,
- Essex CM14 4EF
-
-
-
- A1.12 The author :
- -------------------
-
- Marco Vieth (22),
- Student at the University of Paderborn
- (7.class ?) (WS 93/94)
-
-
-
- Have fun !
-
-
- ----------------------
-