Table of Contents

1. Introduction
1.1 Tips on how you should read this documentation
1.2 Copyright, Guaranty
1.3 What is a CPC?
1.4 What does CPCEMU offer you?
2. Installation of CPCEMU
2.1 Files which comprise the CPCEMU package
2.2 Requirements and Installation
2.3 Hints about memory and soundcards (DOS version only)
2.3.1 Using EMS Memory
2.3.2 Defining the BLASTER environment
2.3.3 Defining the ULTRASND environment
3. Differences between CPC and CPCEMU
3.1 Keyboard
3.2 Loading of programs, menus
3.2.1 Loading from Disk, Menus
3.2.2 Loading from and saving on cassette
3.2.3 Loading and Saving of snapshots
4. Changing the Configuration
4.1 The setup menu
4.2 The configuration file
4.3 Command Line Parameters
5. Data Transfer CPC <-> PC
5.1 Disk as a media
5.1.1 The disk transfer program CPCTRANS
5.1.2 The format- and copy-utility 22DISK by SYDEX
5.2 The parallel interface
5.3 The serial interface
5.4 Other possibilities
6. Supply, Support, and Acknowledgments
6.1 Where can I get CPC software?
6.2 News, exchange experiences
6.3 If you have questions or suggestions
6.4 Other Amstrad CPC emulators
6.5 Plans for future releases of CPCEMU
6.6 Acknowledgments
6.7 Registered trademarks
7. Internal Information about CPCEMU
7.1 Table of contents for chapter 7
7.2 Internal overview of CPCEMU features
7.2.1 The Z80 CPU (The Processor)
7.2.2 The Gate Array (The "Co-Processor")
7.2.3 The PAL (Programmable Logic Array)
7.2.4 The CRTC 6845 (Cathode Ray Tube Controller)
7.2.5 The PIO 8255 (Programmable Input Output)
7.2.6 The PSG AY 3-8912 (Programmable Sound Generator)
7.2.7 The FDC 765 (Floppy Disc Controller)
7.2.8 The Centronics printer interface
7.3 The Debug menu
7.4 The Memory Management
7.4.1 Another time: EMS configuration
7.4.2 How the Banking is done ?
7.5 ROM modifications
7.5.1 ROM bypass for the cassette
7.5.2 AMSDOS ROM modifications
7.6 Miscellaneous
7.6.1 Another time: The configuration file
7.6.2 The parallel adapter
7.6.3 CPCTRANS
7.7 Structure of selected CPCEMU files
7.7.1 Disc Images
7.7.2 Snapshot Files
7.7.3 AMSDOS Header
7.7.4 Poke Database:
7.8 Internal History
A. Appendix
A.1 Glossary
A.2 Bibliography
A.3 Index

1. Introduction



Welcome to the world of emulators!

What?! You want to know what CPCEMU is, and what you can do with this
strange program that has yellow writing on a blue screen, displaying
"Syntax Error" after every input?


To avoid long searching, here it is:
CPCEMU emulates an Amstrad CPC 464, 664 or 6128 with many
extensions. In other words, the program imitates the
behaviour of the older Amstrad computers on your new PC.

For what purpose?
Well, if you still have no idea, then you will not have any need for CPCEMU.

Some reasons:
- nostalgia (oh, how nice my good old CPC was ...)
- better performance compared to the original
- better environment to develop programs in
- e.g. for learning/trainig of the Z80 assembler language
- playing games
- work (yes, a CPC is good enough for simple word processing)
- [ ] <- insert other reasons
of your own.




1.1 Tips on how you should read this documentation



You should play around with the online help first, but if you need
in-depth or more precise information, read on...


I have tried to arrange the documentation in an orderly fashion. Should
you still have questions (after reading it several times!), you can
contact me. You can certainly do so, even if everything is perfectly
clear to you. See chapter 6 (Sources, Support, ...) on how you can reach
me.

In chapter 1 (Introduction) I describe how best to read this
documentation, who owns the copyright and some things about the CPC in
general.

In chapter 2 (Installation) it finally starts. You will be told how to
install and start CPCEMU.

Chapter 3 (Differences between the CPC and CPCEMU) deals with features of
the emulator you should know about, if you are familiar with a real CPC.
Mainly I will describe keyboard, disks, tapes and snapshots.

In chapter 4 (Changing the Configuration) I describe how to tailor CPCEMU
to your needs. Maybe then you will be able to run your favorite program.

In chapter 5 (Data Transfer CPC <-> PC) you find out how to get your old
CPC programs onto the PC. Further, the utilities that come with CPCEMU
are explained.

In chapter 6 (Sources, Support, and Acknowledgments) you will be told how
to optain the latest version of CPCEMU and who you can contact should you
have any questions.

Chapter 7 (Internal Information about CPCEMU) is for experts only. The
"official" part of the user manual ends with the previous chapter. I
describe how one goes about programming an emulator and what you need to
know to do it. The debug menu of CPCEMU is also explained, which allows
you to analyze the processor and memory at *any* time during the
emulation. Casual users should skip this chapter, at least during the
first reading.

Appendix A.1 contains a glossary with descriptions of the most important
technical terms. Appendix A.2 is the bibliography and A.3 the index.



1.2 Copyright, Guaranty


CPCEMU was developed by (see also section 6.3):

Marco Vieth
Auf dem Uekern 4
D-33165 Lichtenau
Germany

The versions for the other operating systems (e.g. Linux and Windows)
were developed on base of the DOS version by:

Rainer Loritz
Rosenbachweg 4/Whg. 1
D-37075 G÷ttingen

CPCEMU is Freeware, which means you can give the program to friends and
acquaintances for *free*. Archive maintainers are allowed to include
CPCEMU in their program collections for "downloading". Shareware
distributors are allowed to distribute CPCEMU, if they only take a small
fee for copying. Compared to Public Domain, Freeware does not mean that
it is "free" and you may do anything with it. We still retain the
copyright.

All software and documentation is provided "as is" without warranty of
any kind.


Although this program is freeware, we would certainly accept any sort of
support, technical or financial.
See chapter 6 for more details.



1.3 What is a CPC?


If you already know what a CPC is, simply skip this section and continue
reading with 1.4.




Still here?

I do not want to go into technical details now, but will rather give you
a retrospective view so that you may better understand what a CPC is.

CPC is an abbreviation for Colour Personal Computer. Computers of this
type were first built in 1984 by the british company Amstrad and sold
under different names in other countries.
It was the period of the home computer; Commodore C64, Sinclair Spectrum,
Atari 800XL, ... when the CPC 464 was unveiled. It had as much RAM as the
Commodore C64 (namely 64 KB), a built in cassette recorder and Locomotive
BASIC 1.0. It was followed up by the CPC 664 which had a built-in 3" disk
drive and a slightly extended Locomotive BASIC 1.1. The CPC 6128 came in
1985, with 128 KB RAM and nearly the same features as the CPC 664. 3"
disks were awfully expensive, but more stable than the 5.25" disks
(nearly as stable as today's 3.5"), and they were noticably faster versus
tape speed, very unlike the situation with the C64 ...
All three models were sold with either a colour or a green monitor, which
had the power supply built in. Later, two or three other models (the CPC+
for example) were introduced. The BASIC was with nearly 178 instructions
powerful and fast. One could program graphics, sound and even interrupt
handling all in BASIC without the use of PEEKs and POKEs. The software
supply increased dramatically over the years.




1.4 What does CPCEMU offer you?


The following is a short overview of what CPCEMU offers you. Subsequent
sections of the documentation will go into more detail.

CPC graphics in 3 different screen modes (X x Y x COLOURS):
DOS:
Mode 0: 180x200x16
Mode 1: 320x200x4
Mode 2: 640x200x2
(With VESA BIOS these graphics can be displayed in resolutions
ranging from 640x400x16 up to 1280x1024x16, depending on your
monitor and the VGA card used.)
Non-DOS:
The window size resp. screen resolution (in fullscreen mode)
is adjusted dynamically.

Sound:
DOS:
either through the PC-speaker, Soundblaster (3 channels + noise,
stereo), Soundblaster (3 channel FM sound, stereo)
or Gravis UltraSound (3 channels + noise, stereo)
Non-DOS:
output through soundcard (depends on driver) in stereo

Memory:
ROM: OS, BASIC, AMSDOS, up to circa 13 additional ROMs (with EMS)
RAM: 64KB, 128KB, up to 576KB Dk'tronics compatible RAM (with EMS)
(Non-DOS: no EMS necessary)

Disk: Special disk images, with the extension .DSK

Cassette: Standard files under DOS, e.g. CPC BASIC- and binary files
with the extensions .BAS and .BIN respectively.

Snapshots: You can make memory dumps of running programs in order to
continue them later. Snapshots have the extension .SNA .

Speed:
DOS:
On a 386/33 with EMS-memory, CPCEMU is faster than the original.
A realtime mode allows you to slow down the emulation to exact CPC
speed. This realtime mode works well on a 486DX2/66.
Non-DOS:
Critical is the quality of the graphics adapter and its device
drivers. In framebuffer mode, the speed is substantially lower.
Basically, a higher CPU power is needed than for the DOS version,
because much more overhead of the operating systems has to be
coped with. For original speed, _about_ 200-300 MHz (CISC) are
necessary. Exact tests haven't been made so far.




2. Installation of CPCEMU


In this chapter you will learn, how to install and start CPCEMU. Section 2.3
lists some points on why you should be using EMS memory and how to set up
the Soundblaster environment. Full user defined installation with the
configuration file is described later in chapter 4 (Changing the
Configuration).



2.1 Files which comprise the CPCEMU package


You have received the CPCEMUxx.xxx package with the following files:
(I have put the directories in brackets where you will find the files
after the installation.)

COPYMATE.ROM ROM with a copy program (ROM)
*CPC464.BAT CPC 464 startup file
CPC464.ROM ROM (firmware+BASIC) of a CPC 464 (ROM)
*CPC6128.BAT ditto, but for CPC 6128
CPC6128.ROM (ROM)
*CPC6128P.BAT ditto, but for CPC 6128 plus
*CPC664.BAT ditto, but for CPC 664
CPC664.ROM (ROM)
CPCADOS.ROM AMSDOS for all CPCs (ROM)
CPCEMU.CFG the configuration file for all CPCs (or CPCEMU0.CFG)
CPCEMU.DAT data file for CPCEMU
CPCEMU.DBF database with pokes
CPCEMU.EXE the emulator
CPCEMU.HLP the online help, try pressing F1...
CPCEMU.MSG the message file (required)
CPCEMU_D.TXT German documentation
CPCEMU_E.TXT English documentation (this file)
CPCEMU_F.TXT French documentation
CPCEMU_S.TXT Spanish documentation
CPCPARA.BAS Locomotive-BASIC program for the parallel adapter (UTILITY)
CPCPD1.DSK disk image with some example Public Domain programs (DISC)
CPCREC.BAS Locomotive-BASIC program to receive programs (UTILITY)
CPCT0.BAT batch file for CPCTRANS.EXE (example) (UTILITY)
CPCTRANS.CFG configuration file for CPCTRANS (UTILITY)
CPCTRANS.EXE transfer program for disk images (UTILITY)
CPMDISKS.DEF format definitions for 22DISK (UTILITY)
DESCRIPT.ION description file for 4DOS
FILE_ID.DIZ archive description for BBSes
INSTALL.BAT batch file for installation
*KCC.BAT KC compact startup file
PCPARA.EXE PC side of the parallel adapter (UTILITY)
README_D.TXT German Readme
README_E.TXT English Readme
README_F.TXT French Readme
README_S.TXT Spanish Readme
ROMGET.BAS Locomotive-BASIC program for saving ROMs (UTILITY)
SNA2GIF.EXE a snapshot to GIF converter: grab your CPC screens...
in unix-like operating systems (e.g. Linux) additionally:
cpc464 CPC 464 startup file
cpc664 CPC 664 startup file
cpc6128 CPC 6128 startup file

(* in DOS and Windows versions only)

The original Amstrad ROMs are included. The Firmware is copyright by
Locomotive Software; the BASIC is copyright by Amstrad. Amstrad and
Locomotive have given me permission to distribute the ROMs with CPCEMU.



2.2 Requirements and Installation


You will need at least (there is no upper limit of course)
- PC AT 386 with VGA graphics
- ALTERNATIVELY EITHER:
MS-DOS, possibly with EMS, or
Novell DOS (DRDOS) or
Windows 95 (or 3.1) DOS box or
OS/2 2.x DOS box.
OR:
Linux with glibc (libc6)
OR:
Windows 95,98,ME,NT or 2000 (XP not supported officially)
- If you want to start programs from within ZIP archives you will need
the program PKUNZIP in your DOS searchpath for extraction.
For Linux, "unzip" is included in most distributions.


The installation itself is very simple:
Copy the CPCEMUxx.ZIP archive onto your hard disc and decompress it with
'PKUNZIP CPCEMUxx.ZIP'. Run INSTALL.BAT to create the necessary
subdirectories. Start CPC464.BAT, CPC664.BAT or CPC6128.BAT depending on
what CPC you would like to emulate.
When starting it the first time, select your language by pressing "0"
for English or choose another one.
(The configuration is saved in the TMP directory as CPCEMU.CFG.)
After the configuration has been shown, the well-known yellow and blue
CPC opening screen appears.
You can quit the emulator with F12 and see the online help with F1.
It is best to try that now, before reading any further ...




If some errors occur during the configuration, you will be put into the
so-called debug-menu, which you can exit with 'q' <RETURN>. In such
cases, it is sometimes useful to redirect the start-up messages into a
file, e.g. with 'CPCEMU > INIT.TXT'. Then you are able to analyze the
problem later.



2.3 Hints about memory and soundcards (DOS version only)


The following will help you if you desire a particularly fast emulation
or if your soundcard is not recognized correctly.
If you use Windows 95 without special settings, you do not need to
worry about that. Windows 95 supports EMS for DOS boxes and sets the
BLASTER environment automatically, if you have a Soundblaster card.


2.3.1 Using EMS Memory


You should have hardware or emulated EMS on your PC (EMS=Expanded Memory
System). This speeds up the emulation in a significant way, especially
with BASIC. Simulated EMS is too slow.
All you need is EMM (Expanded Memory Manager) supporting the LIM 4.0
standard (LIM EMS 4.0).

If EMS usage is possible, a memory count 'EMS xxx Bytes ok.' will
appear during initialization.
Otherwise you will see "Sorry, using conventional memory".

Example under OS/2 2.x (settings for the window):
EMS_FRAME_LOCATION = auto
EMS_HIGH_OS_MAP_REGION = 32 (or more)
EMS_LOW_OS_MAP_REGION = 0 (or more)

Example under DOS in the CONFIG.SYS file:
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE 1024
...






2.3.2 Defining the BLASTER environment


In order to hear sound from your Soundblaster you must set the BLASTER
environment variable properly. Either use the program 'SET-ENV.EXE' (or
'SBTEST.EXE') included with your soundcard or modify AUTOEXEC.BAT
directly. In AUTOEXEC.BAT, you should have a line similar to the
following:
SET BLASTER=A220 I7 D1 T3

Where:
A specifies the base address (0x220)
I specifies the IRQ (7)
D specifies the DMA channel (1)
T specifies the type of the soundcard:
1 : Soundblaster 1.0/1.5
2 : Soundblaster Pro
3 : Soundblaster 2.0/2.5
4 : Soundblaster Pro 3/Pro 4.0
5 : Soundblaster Pro (Microchannel)
6 : Soundblaster 16

For version 2,4,5 & 6 stereo sound is enabled.

There are also some more parameters which will be ignored:
H specifies the 16 bit DMA channel for 16 bit cards (5)
M specifies the base address of the soundblaster mixer (224)
P specifies the port address for MIDI (330)



If you hear no sound, use A388 (instead of A220). This works for
Media Vision Pro Audio Spectrum 16 and possibly other sound cards
with SB emulation. It may also work with an Adlib Card.
(Joe Cotroneo)




2.3.3 Defining the ULTRASND environment


In order to get sound with your GUS (Gravis Ultrasound Classic/ MAX/
ACE), you must have the ULTRASND environment variable defined.

Your AUTOEXEC.BAT file should contain the following line:
SET ULTRASND=220,1,1,11,7

Where the meaning of the numbers is (in the order shown):

220 is the base address (0x220)
1 is the GUS DMA channel
1 is the SoundBlaster DMA channel
11 is the GUS IRQ
7 is the SoundBlaster IRQ

Important are the base address and the GUS IRQ. All other values must
be specified in order for the emulation to work properly.




3. Differences between CPC and CPCEMU


In this chapter, I describe those features that differentiate CPCEMU from a
real CPC. The section that follows will explain those keys on the keyboard
that have a special meaning during emulation, especially the function keys.
Afterwards you will be told how to load from disk or cassette.



3.1 Keyboard


Maybe you have already noticed that the function keys of the PC do not
map directly to those of the CPC. They cause some strange output which I
will describe below. Or maybe you have been looking for the COPY-key for
hours...
All CPC keys are really emulated somewhere, you can be sure of that. Here
the secrets are unveiled:

- ALT, ALTgr : COPY on a CPC {DOS}
Home/Pos1 {Non-DOS}

- PAUSE Key : suspends the PC, until it is pressed again. If the function
keys of the PC do not react anymore, you may have the PAUSE Key
enabled. {DOS only}

- Keypad : Depending on the "Num Lock" state, the keypad functions in a
different way. With "Num Lock" enabled, the keypad represents the
function keys of the CPC, otherwise it will emulate joystick 0. If you
want to use an analog PC joystick, you have to calibrate it first. (See
chapter 4 - Changing the Configuration).

- PrintScreen : create a screen shot ("screenshot.bmp") {Non-DOS only}

For completeness:
- Page up/down: Moves the whole CPC screen.
(Don't ask me for what purpose.)

And, of course, the function keys.
F1 : Online-Help Key. Could be the most important key when you start out.
F2 : Toggles between the CPC screen (normal view) and message screen
(that one with a red border). This screen may show some control
messages. {DOS only}
F3 : Insert a disk, see section 3.2.1
F4 : Toggle sound on/off
F5 : Load a snapshot (memory dump), see section 3.2.3
F6 : Save a snapshot, see section 3.2.3
F7 : Setup menu, see section 4.1
F8 : Hard reset, acts like a reset button on a CPC (or switching the CPC
off and back on again). Use this, if CTRL+SHIFT+ESC does not work
any more.
F9 : Allow/disable pallette update.
F10 : Debug menu, explained in chapter 7. If you stumble inadvertently into
this menu, press 'r' for R)un or 'q' for Q)uit.
F11 : Reserved for future use {fullscreen mode, Non-DOS only}
F12 : Exit the emulator




3.2 Loading of programs, menus


In this section you will learn how to load programs from disk, tape or
snapshots. Certainly the same goes for saving. How to use the menu is
described, too.



3.2.1 Loading from Disk, Menus


Under normal conditions AMSDOS (Amstrad DOS) is active, and all file
instructions use the disk.
You do not need to insert a real CPC disk into your PC drive every time
you access a file (apart from the fact that you may have 3" CPC disks
only).
To obtain better speed a CPC disk is contained inside a so-called disk
image. This file can be located anywhere on the hard disk (or on a high
density disk).

Here some BASIC AMSDOS instructions:
- CAT <RETURN> : displays the catalogue

- With 'RUN"<filename>"' you load and start a program.
You may omit the ending quotation marks. This instruction is useful
for BASIC programs having the extension .BAS, and in many cases for
binary programs with the extension .BIN .

A simple way to run a program:
1. Input the filename, e.g. 'disc' *without* pressing <RETURN>
2. Hold down the CTRL key and press cursor-left (the cursor moves
back to the first column now)
3. Still hold down the CTRL key and press the ENTER key on the keypad
(RUN"disc appears and the program will be loaded)

- LOAD"<filename>" loads a program without starting it. You can inspect
BASIC programs with LIST and start them with RUN. Usually binary
programs will not load with LOAD, but try using the MEMORY instruction
first, e.g. 'MEMORY &1fff'.

- SAVE"<filename>" saves a BASIC program. For binary programs you have
to specify some more parameters, e.g. 'SAVE"<filename>",b,&c000,&4000'
will save the screen.

- MERGE"<filename>" is also possible. It merges one BASIC program to
another already contained in memory.


Some special AMSDOS instructions are introduced by a vertical dash:
- |A, |B to select the drive (also possible with |DRIVE,0 or 1)
- |DIR,"<filename pattern>" to see the directory.
Important note: Use the following on a CPC 464:
a$="<filename pattern>" : |DIR,@a$
- |ERA,"<filename>" erases a file.
Important note: Use the following on a CPC 464:
a$="<filename>" : |ERA,@a$
- |REN,"<new name>","<old name>" to rename a file.
Important note: Use the following on a CPC 464:
a$="<new name>" : b$="<old name>" : |REN,@a$,@b$
- |TAPE to switch to the cassette. Described in the next section.
- |DISC to switch back to disk
There are some other instructions but they are not so important.



The Insert Disk Menu

Until now you can use only one disk, the one already "inserted" in
the drive. To insert another disk, simply press F3 and the following
menu appears:

Insert Disk
Drive Number 0
Side Select 0
Write Protected 0
Autostart 1

With the cursor keys <up/down> you can select a line. You can also do
that by typing in letters (go back with <DEL>). Change numbers with
the cursor keys <left/right> or with direct input of digits.
<RETURN> in any line (e.g. the first one) takes the changes. It would
be dismissed with <ESC>.
"Drive Number" is the desired drive (0=A, 1=B); "Side Select" is a
side switch for double sided disks, it has no effect when using a single
sided format.
With "Write Protected" you can mark a disk as write protected
(0=No, 1=Yes, write protected).
If "Autostart" is active, the first BASIC program on the disk is run
automatically after you have inserted the disk (alternatively: DISC.BAS).



The File-Selection Menu

Now press <RETURN> and a directory of the disk drive appears.
Select a new disk with the same methods as described above.

If there is already a disk lying inside the drive you do not need to
remove it first as in real life. This is automatically done.
At the bottom of the screen this disk is displayed.

You will see at most 15 files, if there are more, "[]" appears.
- <HOME> goes home to the first filename, <END> to the last one
- <Page up/down> scrolls in pages through the list
- <RETURN> takes the selected name, <ESC> escapes.
You can also select names directly by pressing a first letter.

When using the mouse, click "[]" for <page up>, "[]" for <page down>,
"[<]" for <cursor left>, "[>]" for <cursor right> and [ok] for <return>.
Use "[■]" as <ESC>. Use the right mouse button to mark a line.

".." is the parent directory; [A], [B], ... are the available drives.
Please select only floppy drives with a disk inserted. Otherwise
you could get some trouble.

It is also possible to insert disks from inside ZIP archives. Select
a ZIP archive by pressing <RETURN> and its directory is displayed as a
normal directory. If you select a file from inside a ZIP archive, it
is automatically extracted into a temporary file. For this feature
you will need the program PKUNZIP somewhere in the DOS searchpath,
or in the CPCEMU directory.
Temporary files are automatically deleted if they are not needed any
more. Changes are *not* written to the ZIP archive. If you save
something on a disk image inside a ZIP file, it will be lost after
you insert another disk. If you want to change disk images inside
ZIP archives, extract them before starting CPCEMU.

How to create disk images from CPC disks that you own is described in
chapter 5 (Data Transfer CPC <-> PC).




3.2.2 Loading from and saving on cassette


What actually is a cassette for CPCEMU?
Well, files on cassette are regular files in DOS directories.
After the '|TAPE' instruction the BASIC instructions for file handling
use the cassette. But only those starting not with "|".
Now you can use the instructions described in the section above
(CAT, RUN", LOAD", SAVE", MERGE") for cassette.
If you omit a filename, the file selection menu will appear which was
described in the previous section.
With SAVE"" you can either overwrite an existing file or create a new
one by specifying a new name in the last line "(new file)".

Certainly you can load programs from inside ZIP archives, saving
is ignored.

You only get such a fine cassette drive with the emulator!



3.2.3 Loading and Saving of snapshots


Snapshots are memory dumps that not only contain the actual memory
contents but also the internal states of the hardware chips, e.g. the
processor.
At any time you can interrupt the running program and save it as a
snapshot. Later you can load it, and continue at the same position you
were at when you interrupted it.
You create a snapshot with F6. Specify the snapshot size, if it is
64K or 128K. 128K snapshots only make sense if the second memory bank
is in use. In this case use "128K Snapshot = 1", with the meaning 1=Yes.

The file selection menu is the same as already described with the disk,
with the additional comments given for the cassette (3.2.1 and 3.2.2).

You can reload a snapshot with F5.




4. Changing the Configuration


In this chapter you will learn how to configure CPCEMU for your needs.
The setup menu is described as well as the configuration file and the
command line parameters.



4.1 The setup menu


This is the simplest way to make adjustments to CPCEMU. Nevertheless
this menu does not let you change all settings. To give an example, if
you want to use additional ROMs you must use the configuration file
described in section 4.2.

As already mentioned in the keyboard section, you get into the setup menu
with F7. The following menu then appears:

Setting: Value: Short explanation:
___Emulation
Emulation Delay 0
Emulation Speed 1
Interrupt Frequency 300
Interrupt Resume 1
Realtime 0

___Screen
Colour Screen 1
Multimode Update 0
Palette Change 1
Screen Offset 0
Video Mode 0
VSYNC Position 5

___Sound
Sound Enabled 1
Sound Device 2
SB Delay 35
SB Delay0 6
SB DMA buf 128
SB sample rate 0
SB Stereo 0

___Control
JOY0 Calibrate
JOY1 Calibrate
KBD Language 0
Mouse enabled 1

___PPI_Settings
Company Name 7
PPI 50Hz 1
PPI EXP signal 1

___Misc
Amsdos disabled 0
Amsdos speedup 1
Break mask 3
EMS Enabled 1
Language 0
Tape Bypass 1
CPC Type 2
Show Config
Load Configuration
Restart Emulation
Save Configuration
Poke Database database with cheats for games
DOS Shell
Continue


Select the settings as already described in 3.2.1.


Emulation Delay
This option allows you to slow down the emulation if it is too fast.
0 means no delay, 100 is a small delay, 300 some more ...

Emulation Speed
0 = slow Z80 emulation
1 = fast Z80 emulation {DOS only}

Interrupt Frequency
To change the frequency with which interrupts are generated.
On a real CPC this is always 300 Hertz. If you raise this value
many programs seem to run faster, but there is less computing power
between two interrupts. If you own a slow computer you may have
to lower this value to 100 or 200 sometimes. Possible values are
18 to circa 600.
For further information look at chapter 7.

Interrupt Resume
Another of these options one cannot explain without a lot of background
information. Without EMS (Expanded Memory) this option is 0 which means
that interrupts can be skipped. Certainly this is not desired, but
with 1 the emulation is getting too slow. With EMS this option is 1,
so CPCEMU tries to handle every interrupt.
Important note:
It seems that CP/M Plus only runs with EMS and this option = 0 !
For further information look at chapter 7.

Realtime
Enables the realtime CPC. The emulator inserts waits to be as fast
as a real CPC.

Colour Screen
Emulation of a green or colour screen by changing the palette.

Multimode Update
If programs use several modes simultaneously on the screen, switch on
this option. Then CPCEMU tries to handle it correctly.

Per default this option is switched off because it does not work
properly in all cases. {DOS}

Palette Change
Set this option to 0 to disable palette changes. This makes sense
if you cannot see anything because the screen flickers too much.
If you press the function key F8 to cause a hardware reset, this
option is reset to 1 automatically.
Hint: If palette update is disabled and you see completely wrong
colours, try pressing F2 twice.

Screen Offset
Specify the number of lines the CPC screen should be moved.
Usually you do not need this option. You get the same effect by
pressing <Page Up> and <Page Down>. Possible values: 0=no offset,
up to circa 25.

Video Mode {DOS only}
Set the video mode of the VGA card.
0 = 640x200x16 (default)
1 = 640x350x16
2 = 640x480x16
and if you have a VESA-BIOS, mostly:
3 = 800x600x16
4 = 1024x768x16
5 = 1280x1024x16
...
WARNING:
Do use modes >= 3 only, if you monitor supports them!
If it makes some strange noise, switch it off immediately!
But this should happen only with old monitors.

VSYNC Position
Commonly you will not need this option, but nothing will be damaged if
you try it. One time during the screen update there is a vertical
frame fly with a special bit set, the so-called VSYNC bit (vertical
synchronization). You can define the position, where the VSYNC should
occur. Possible values are 0 to 5. For further information look at
chapter 7.

Sound Enabled
Enables the sound output. 1=on, 0=off. You can also press the
function key F4 instead.

Sound Device {DOS only}
Set the sound output device.
0 = none
1 = PC speaker
2 = Soundblaster (Pro), FM sound
3 = Soundblaster (Pro), digital sound, thanks to Ulrich Doewich
4 = GUS (Gravis Ultrasound), thanks to Ulrich Doewich

SB Delay {DOS only}
Set the amount of delay after every write access to the soundcard.
With lower values (e.g. 0) the sound output is speed up. If problems
with the soundcard occur, use 35.

SB Delay0 {DOS only}
Another delay for the Soundblaster. Do not change it.

SB DMA buf {DOS only}
Set the DMA buffer size for Soundblaster digital sound.

SB sample rate
Set the sampling rate for Soundblaster digital sound.
0=22kHz, 1=44kHz

SB Stereo {DOS only}
Enable Stereo sound.

JOY0 Calibrate {DOS only}
You surely know it from other programs that you have to calibrate the
analog PC joystick first. Select this setting by pressing <RETURN>,
move the joystick to the upper left, then to the lower right.
Then some parameters are displayed. If you always want to use your
joystick then take note of these parameters and write them in the
configuration file (see next section). Nevertheless you have to repeat
the calibration if you change the clock.

JOY1 Calibrate {DOS only}
Same as Joy0_Calibrate, but for joystick 1.

KBD Language
With this option you can select the keyboard mapping for other countries.
0 = UK, default
1 = GR, "German-like" keyboard. Unfortunately it is impossible to have
a full German keyboard because SHIFTed keys cannot be mapped
to non-SHIFTed. But "Z" and "Y" are swapped, and some other characters
altered.
2 = FR, "French-like" keyboard. After the introduction of a German
keyboard the French will not stand in the rain. Some parts of the
AZERTY Keyboard are realized. But is has the same problems as
the German one.
3 = SP, "Spanish-like keyboard"

Mouse enabled
Enables mouse usage in different menus.

Company Name
Company name in the opening screen.
0 = Isp
1 = Triumph
2 = Saisho
3 = Solavox
4 = Awa
5 = Schneider
6 = Orion
7 = Amstrad

PPI 50Hz {DOS only so far}
The CPC can operate with
0 - 60 Hz, or
1 - 50 Hz (default in Germany, France)
During a reset bit 4 of port B PPI is checked and the CRTC is
initialized properly.
Let it on 50 Hz.

PPI EXP signal
Some Expansions cards set this signal.
On CPC 464 set, if a disc drive is connected.
On CPC 6128 always set.

Amsdos disabled
Forbids the initialization if the AMSDOS. This is useful if you
want to load programs from cassette without giving the instruction
'|TAPE' every time.
Certainly you could simply make a comment of the ROM_BLOCK line
for the AMSDOS (with ROM_BLOCK you specify the ROM to load), but
with the effect that no AMSDOS is present at all.
Using this option the AMSDOS is still present for some programs.

Amsdos speedup
Permits an AMSDOS ROM modification speeding up disk accesses.
This is done by minimizing the motor waiting times, not necessary
for the emulator.

Break mask
Only for debugging purposes. With the value 3 from the configuration
file some errors are suppressed, caused by illegal instructions.
Do not change this value!

EMS Enabled {DOS only}
Permits the usage of EMS memory (Expanded Memory System).
If no or not enough EMS memory is available, CPCEMU uses conventional
memory automatically.
For further information about EMS consult 2.3.1 and chapter 7.

Language
Language for help messages.
0=UK (English)
1=GR (German)
2=FR (French)
3=SP (Spanish)

Tape Bypass
Permit the usage of the cassette.
Further information about the TAPE bypass are in chapter 7.

CPC Type
Set desired CPC type
0 = CPC 464
1 = CPC 664
2 = CPC 6128
3 = CPC 464+ (?)
4 = CPC 6128+ (?)
5 = KC compact
In order to use type 3 to 5, you have to supply ROM images in CPCEMU.CFG
first.

Show Config
Permits the display of the configuration overview when starting the
emulator.

Load Configuration
Load another configuration file saved by "Save Configuration".
Some parameters may have no effect until you select "Restart Emulation".

Restart Emulation
After loading a configuration with "Load Configuration", you can
restart the emulation with the new values.

Save Configuration
Save the current configuration.
Note that you cannot overwrite the master configuration file CPCEMU.CFG.

Poke Database
You are just playing a game you cannot solve? Then try this selection.
If your game is in this list, you can make it easier by getting
infinite lifes, e.g. You can also extend the list (CPCEMU.DBF) by your
own pokes. See chapter 7 for a description of this file.

DOS Shell {DOS only}
Open a DOS shell with much free memory, which you can exit with 'EXIT'.

Continue
Take the values and continue with the emulation.
You get the same effect by pressing <RETURN> in any line with a value.





4.2 The configuration file


Now you will learn another way to configure CPCEMU.
At first CPCEMU reads the configuration file CPCEMU.CFG per default.
Note that when you start CPCEMU with a CPCxxx.BAT file, it is located
in the TMP directory. This enables user-defined configurations even if
CPCEMU is onto a CD ROM.
The structure of this file is described so that you will be able to
use your own ROMs, change the keyboard language permanently, etc...


Have a look at the file CPCEMU.CFG:

;CPCEMU.CFG - The Configuration File for CPCEMU (v1.5)
;Marco Vieth, 20.11.1997
;
;standard configuration for CPC 464, 664, 6128, 464+, 6128+, KC compact
;
SHOW_CONFIG=0 ;should the configuration be displayed?
CPC_TYPE = 2 ;CPC 6128, if no command line parameter -t
...

Already with these few lines you get the simple structure:
Comments start with a semicolon (";"). Options are changed by writing
a key-word followed by "=" followed by a <value>. The <value> depends
on the key-word and is either a string or a number. Numbers can be given
in decimal, hexadecimal ("0x") or binary ("%") notation.

When knowing the meaning of the key-words, you can adjust the values
with a text processing system for your own needs.


You already know most of the keywords from the setup menu.
First an alphabetical ordered list of all key-words:


#ENDIF
#IFCPC
AMSDOS_DISABLED
AMSDOS_SPEEDUP
BREAK_MASK
COLOUR_SCREEN
COMPANY_NAME
CPC_TYPE
DATA_FILE
DRIVE_A
DRIVE_A_AUTOSTART
DRIVE_A_SIDE
DRIVE_A_WRITEPROT
DRIVE_B
DRIVE_B_AUTOSTART
DRIVE_B_SIDE
DRIVE_B_WRITEPROT
EMS_ENABLED
EMULATION_DELAY
EMULATION_SPEED
HELP_FILE
INTERRUPT_FREQUENCY
INTERRUPT_RESUME
JOY0_CALIBRATE
JOY1_CALIBRATE
KBD_LANGUAGE
LANGUAGE
MOUSE_ENABLED
MULTIMODE_UPDATE
PALETTE_CHANGE
POKE_DATABASE
PPI_50HZ
PPI_EXP_SIGNAL
PRINTER
RAM_SIZE
REALTIME
ROM_BLOCK
ROM_PATH
SB_DELAY
SB_DELAY0
SB_DMA_BUF
SB_SAMPLE_RATE
SB_STEREO
SCREEN_OFFSET
SHOW_CONFIG
SNAPSHOT
SOUND_DEVICE
SOUND_ENABLED
TAPE_BYPASS
TAPE_PATH
TMP_PATH
VIDEO_MODE
VSYNC_POSITION


Following are the meanings of the new key-words:


- #ENDIF, #IFCPC
Some control instructions for conditional configuration depending on
the desired CPC:
#IFCPC <CPC type> ... #ENDIF
For <CPC type> all four types from "CPC_TYPE" are valid.
Consequently you need only one configuration file for all CPCs.
The batch files CPC464.BAT, CPC664.BAT and CPC6128.BAT set the
desired type with command line parameters. These are explained
in the next section.

- DATA_FILE = "<path+filename>"
Set the data file (CPCEMU.DAT).

- DRIVE_A = "<path+filename>"
Set the path to disk images. If you use a filename as path, this
disk is automatically inserted into drive A.
Section 3.2.1 described Loading and Saving on Diskette.

- DRIVE_A_AUTOSTART
When you insert a disk image the first BASIC program is run
automatically. DISC.BAS is always run if present.
You may use the AMSDOS command |DIR to see the first BASIC program.

- DRIVE_A_SIDE
With double sided formats, side 1 (B) is inserted.

- DRIVE_A_WRITEPROT
The disk image is inserted write protected, so it is read only.
This is especially useful if the disk image is on a read-only medium
(e.g. a CD-ROM).

- DRIVE_B = "<path+filename>"
Same as DRIVE_A, but for drive B.

- DRIVE_B_AUTOSTART
Same as DRIVE_A_AUTOSTART, but for drive B.

- DRIVE_B_SIDE
Same as DRIVE_A_SIDE, but for drive B.

- DRIVE_B_WRITEPROT
Same as DRIVE_A_WRITEPROT, but for drive B.

- JOY0_CALIBRATE = <xcen>, <ycen>, <xdead>, <ydead>
Define a joystick calibration for your analog joystick.
Use the values displayed after the joystick calibration in the
setup menu (see section 4.1).
This is a key-word with 4 values. You must always specify all of them.
4 times zero means not calibrated.

- JOY1_CALIBRATE = <xcen>, <ycen>, <xdead>, <ydead>
Same as JOY0_CALIBRATE.

- POKE_DATABASE = "<path+filename>"
Set the poke database file (CPCEMU.DBF).

- PRINTER = "<path+filename>"
Set the printer file where line printer outputs are collected.
It is cleared at every emulation start.
After quitting the emulator, you can send it to your printer
with 'COPY <filename> prn:'.
Print without a printer file with PRINTER="prn".
Use the first parallel port LPT1 directly with PRINTER="".

- ROM_BLOCK = <ROM-number>, "<filename>", <ROM-position>
Describe what ROM should be loaded and where.
Repeat this line for every ROM you want to load.
The maximum number of ROMs is circa 20, if you use EMS.

- <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 (e.g. 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).
The AMSDOS ROM has always the number 7.
255 : Lower ROM (e.g. OS; has only in emulator this
number).
- <filename> is a file in the directory ROM_PATH, which
contains the ROM.

- <ROM position> is naturally 0. If a file contains more ROMs, this
is the desired ROM position 0, 1, 2, ...
ROM_BLOCK = 255, "CPC6128.ROM", 0
ROM_BLOCK = 0 , "CPC6128.ROM", 1
The lower ROM and the foreground ROM are loaded one after another
from the same file.

- ROM_PATH = "<path>"
Set the path to ROM images. In the configuration file this path
is set to ".\ROM". The ROMs itselfs are defined with the key-word
ROM_BLOCK.

- SNAPSHOT = "<path+filename>"
Set the path to snapshots. If you specify a snapshot file as path name,
this snapshot is automatically started.
Look at section 3.2.3 for more details.

- TAPE_PATH = "<path>"
Set the path to tape files. In the configuration file this path is
set to ".\TAPE".
Look at section 3.2.2 for more details.

- TMP_PATH = "<path>"
Set the path for temporary files. They are mainly needed if you
select a file from inside a ZIP archive and CPCEMU needs to
extract it with PKUNZIP.




4.3 Command Line Parameters


As you know from other programs, it is also possible with CPCEMU to
use command line parameters. But currently there are only a few of them.


Execute CPCxxx.BAT with the following options:
/f : use the fast mode (default)
/s : use the slow mode
/d : use the debug mode, described in chapter 7
/x : disable EMS usage
/c <file>: specify another configuration file, overriding the
default CPCEMU.CFG. See section 4.2.
/t <type>: set the desired CPC type 464, 664, 6128, 464+, 6128+ or
KC compact with /t 0 to /t 5 respectively.
/h : displays a help screen

The option "/d" is automatically used, if an unknown option was specified.
Instead if "/" you can also use "-" known from UNIX.




5. Data Transfer CPC <-> PC


What can you do with a good emulator when you do not have any programs for
it or if you do not see any possibility to get programs from a CPC across
to the PC?
In chapter 6 (Supply, ...) some ftp sources are listed where
CPC software can be found.
This chapter deals with the data transfer of CPC software to the PC.
Some utilities for the different possible methods of doing this are
described (disk, with parallel or serial interface).




5.1 Disk as a media


This is the simplest way to get CPC software across to the PC. You only
need a CPC with a second drive of the correct size. Correct size means
that the disks must also fit in your PC drive. (If not, you could still
try to connect a 3" drive to your PC.) The PC is persuaded to recognize
the CPC formatted disk using a utility to read the CPC formatted disks.
This utility is called CPCTRANS.



5.1.1 The disk transfer program CPCTRANS


I have developed CPCTRANS to create disk images from CPC disks.
Standard CPC formats as well as double sided Vortex formats are
supported.
CPCTRANS is not intended to transfer copy protected formats!
When calling CPCTRANS without parameters you will get a short
overview.
CPCTRANS is similar to the DOS COPY-instruction:
'CPCTRANS <source> <destination> <options>'.
Examples:
'CPCTRANS B: DISK1.DSK' copies the disk in drive B to the disk image
DISK1.DSK. If it does not exist, it is created.
'CPCTRANS DISK1.DSK B:' writes the disk image back to the disk in
drive B.

The first command only runs for the DATA format.
For other formats you have to use an option:
/f 0 : DATA format (default)
/f 1 : DATA format, double-sided
/f 2 : SYSTEM format
/f 3 : SYSTEM format, double-sided
/f 4 : VORTEX format, double-sided
/f 5 : unknown, CPCTRANS tries to detect it
/f 6 : +3DOS
Note the space between "/f" and the number.
When using the double sided DATA- or SYSTEM-format, you can select
the side A or B in the disk menu (3.2.1).

When writing back a disk image, the disk in the drive must have
the same format! For simple formats you can use 22DISK, described
in the next section.

For copying the B-side of a disk, use the option "/s 1"
With 'CPCTRANS B: DISK1.DSK /s 1' only the B-side of the disk is
copied, with 'CPCTRANS DISK1.DSK B: /s 1' it is written back.

The option "/v" turns on "verify", so CPCTRANS checks if the copy
is correct. That is indeed a bit slower but increases security.

The option "/t <count>" sets the number of tracks to copy.
Normally it is 40 tracks, only for the VORTEX format it is 80.

The option "/q" (quick format) is a feature with which you can format
a disk image, instead of copying data onto it. Nevertheless you have
to specify a valid drive as first parameter, even if it is not used.
Example:
'CPCTRANS a: SYSTEM.DSK /f 2 /q' formats SYSTEM.DSK as a disk image
with SYSTEM format.



5.1.2 The format- and copy-utility 22DISK by SYDEX


This program is available as shareware. With correct definitions you
can use nearly all CP/M formats!
Unfortunately just the CPC formats are not included with the evaluation
copy of 22DISK. Therefore I have defined the formats in the file
CPMDISKS.DEF. You will find them in the UTILITY subdirectory.
What can you do with 22DISK?
You can transfer single files back and forth between DOS and non-DOS
formats, format disks and so on.
Copy the CPC files into the TAPE directory. Read section 3.2.2 for
an explanation how to load them.



5.2 The parallel interface


If you own a CPC without a second drive, you can do the data transfer
over the parallel interface. The original idea came from Gilles Molinari,
he had also written some Turbo Pascal programs. But maybe you belong to
the group of users, who do not have a Turbo Pascal compiler on their CPC,
so you could not do much with the Pascal source. Therefore I have
rewritten the utilities in Locomotive BASIC, and extended it by adding
the direction PC->CPC.
Thus it is possible to transfer files back and forth between CPC and PC!
The CPC and PC are coupled together via their parallel interfaces.

If you own a CPC 6128 with Centronics connectors and compare them with
a printer you will note that CPC and PC fit together excellently when
using a standard PC printer cable! But do not do that now, please read
further.
It seems that only Schneider CPCs have Centronics connectors. If you
have an Amstrad CPC 6128 with simple edge connectors or a CPC 464,664,
use the diagram at the end of this section.

First you have to jump over two hurdles:
1. constructing a simple adapter
2. input a short program into the CPC

Wait! Do not skip the rest!

Both steps are really simple, because
1. is possible without soldering and
2. is indeed very short (about 30 lines BASIC)

To step 2.
The program you need calls CPCREC.BAS and is in the UTILITY directory.
It is saved in ASCII, so you can send it to your printer without
problems and type it into your CPC.
It does its job like a thin rope sent through a pipe in order to
get a thick cable through it.
Here, the thin rope is CPCREC.BAS which receives files from the PC.
With this little utility you get CPCPARA.BAS (the thick cable) over
to the CPC. With CPCPARA.BAS you can receive and transmit. Then you
will not need CPCREC.BAS any more.
On the PC side you use PCPARA.EXE, also included in the UTILITY
directory.

But before you input CPCREC.BAS, have a look at step 1:


The parallel adapter

You need an adapter between the PC printer cable and the PC printer
connector.
This goes easiest with a RS-232 wiring box, which has a 25pin D-Sub
male (plug) and a 25pin D-Sub female (socket) connector.
By plugging short wires into the box you can realize any possible
connection between both sides. Usually such a box is used - as its
name already says - for adapting RS-232 interfaces. Serial connections
do not function at the first, you know.
We use the adapter the other way round, that is, the plug is for the PC
side and the socket for the printer cable.

Plug it together now:

Plug for the PC printer- Socket for the printer cable
connector (left side): (right side):

Pin 2 --------------- Pin 11
Pin 10 --------------- Pin 8
Pin 11 --------------- Pin 1
Pin 12 --------------- Pin 7
Pin 13 --------------- Pin 6
Pin 15 --------------- Pin 5
Pin 19 --------------- Pin 19


As you see, you do not need all the 25 wires, only 7 of them.

Although the wiring box is cheap if you buy it from a electronic
mail-order company, you can get it even cheaper by using a jumper box.
Then you have to solder the wires. The cheapest way is to buy a 25pin
D-Sub plug, a 25pin D-Sub socket, a box and some wires.

Now I presume you have connected the computers with the adapter and
CPCREC.BAS on your CPC.
What now?

1. On the CPC : Run CPCREC.BAS (after you have saved it)
2. On the PC : Run 'PCPARA /s CPCPARA.BAS'

Now it gets exciting, if no error messages appear on the PC screen, all
is OK, the file is on the CPC.

If the PC does not send anything and reports an error message the
connection may be incorrect.
If it is sending ("Sending block xx"), but some error messages appear
occasionally, your PC may be too fast or too slow. The direction
PC->CPC is very time crucial, you know.
On my 386/33 I must not have EMS memory installed, otherwise it is too
slow. On a very fast computer it could be necessary to use the turbo
switch.
Use the program under plain DOS, not OS/2 or Windows.

If it does not run at all, send me a note.
In the meantime you can type in the program CPCPARA.BAS which is
a little longer. The direction CPC->PC runs always, also under OS/2,
because it is nearly the same as printing. The PC behaves like a printer.

I assume that you have CPCPARA.BAS on your CPC now.
Transfer files from CPC to PC in the following way:
1. On the PC: Run 'PCPARA /r'.
2. On the CPC: Run CPCPARA, select S)end and input every file you want
to transmit. (Run 'PCPARA /r' for every file you want to transmit,
CPCPARA runs in an endless loop.)


Thus, use PCPARA in the following way:
- PCPARA /r : start PCPARA in receiving mode
- PCPARA /s <file> : sends <file> to the CPC, if you use 'TRM:' as
file, you will get a terminal.

All programs in the UTILITY directory display an overview about its
options if you call them without any parameters.


WARNING:
Even if the construction is very simple, I cannot guarantee that you
do not damage anything. If your CPC printer-port is damaged afterwards,
it is a pity and rather an unfortunate accident. Perhaps it would be
also damaged if you had simply connected a printer.
For example, I know a former CPC user whose keyboard did not work
properly any more one day. After the repair he was told that he
should not plug the joystick in while the computer is switched on!
(Well, I do so always ?!?)

To come back:
I have built the adapter successfully. And have even sometimes
"forgotten" to insert the adapter in the connection and have had no
problems.





Diagrams by David Chapeau, if your CPC has no Centronics connectors:

34 <- - - - - - - - 18 \
______________________ |
| ________________ | |
| |________________| | - | ---> Printer Connector (Female) to CPC
|______________________| |
|
17 < - - - - - - - - 1 |
|
|||||||||||||||||| |
|||||||||||||||||| \
|||||||||||||||||| > "CPC 6128 to DMP 2160" Cable
|||||||||||||||||| /
|||||||||||||||||| |
|
1 - - - - - - - - > 18 |
________________________ |
\ ______________ / |
\ |______________| / - | ---> Centronics Connector (Male)
\__________________/ |
|
19 - - - - - - - -> 36 /



18 < - - - - - - - - 1 \
________________________ |
\ ______________ / |
\ |______________| / - | ---> Centronics Connector (Female)
\__________________/ |
|
36 <- - - - - - - - 19 |
|
|||||||||||||||||| |
|||||||||||||||||| \
|||||||||||||||||| > PC Parallel Adapter
|||||||||||||||||| /
|||||||||||||||||| |
|
1 - - - - - - - - > 13 |
________________________ |
\ .................. / |
\ ................ / - | ---> Sub-D Connector (Male) to PC (LPT1)
\__________________/ |
|
14 - - - - - - - -> 25 /


13 < - - - - - - - - 1 \
________________________ |
\ .................. / |
\ ................ / - | ---> Sub-D Connector (Female)
\__________________/ |
|
25 <- - - - - - - - 14 |
|
|||||||||||||||||| |
|||||||||||||||||| \
|||||||||||||||||| > RS 232 "Wired Box"
|||||||||||||||||| /
|||||||||||||||||| |
|
1 - - - - - - - - > 13 |
________________________ |
\ .................. / |
\ ................ / - | ---> Sub-D Connector (Male) to PC (LPT1)
\__________________/ |
|
14 - - - - - - - -> 25 /



Printer Centronics Centronics Sub-D Sub-D Sub-D
Connector (Female) (Male) Connector Connector Connector

1 --------- 1 1 --------- 1 11 --------- 2
. . 8 --------- 10
. . 1 --------- 11
. . 7 --------- 12
17 --------- 17 14 --------- 14 6 --------- 13
18 --------- 19 19 --------- 19 5 --------- 15
. 21 --------- 20 19 --------- 19
. 23 --------- 21
. 25 --------- 22
34 --------- 35 27 --------- 23
29 --------- 24
30 --------- 25
31 --------- 16
32 --------- 15
33 --------- 18
36 --------- 17



CPCPARA -> PCPARA (v1.1) transfer speed:

Times to transfer a block of 0x4000 Bytes from CPC to PC with the
parallel adapter:

Source on CPC: bytes/s: bit/s:
File from floppy disk: 1600 12800

Block from memory: 2240 17920

Block from memory, no ints.: 2445 19560
(poke &b941,&c9 on CPC 6128)

The block sending was controlled in BASIC (inside CPCPARA):
defstr a:a="test.$$$":call sstr,@a
a=string$(&80):for i=1 to &80:call sstr,@a:next:call sbyte,0:stop


You can read further information about the parallel adapter in chapter 7.



5.3 The serial interface


If you own a serial interface for the CPC, you can certainly use it
for data transfer to the PC.



5.4 Other possibilities


There are some more fantastic ways to get the software onto the PC.

- Connect the 3" disk drive to the PC. Some (older) models should fit to
a 5.25" connection.

- With a detour over the the Spectrum+3: read the 3" disk on the
Spectrum+3, convert it in the Spectrum format and use a utility
to read it on the PC. This utility comes with the Spectrum emulator Z80
by Gerton Lunter.

- When is was necessary to get the ROM yourself, someone told me about
his way:
He took the ROM chip out of the CPC and inserted it instead of the VGA
BIOS. With a small program he was able to read the contents.

- Maybe you will find another way?




6. Supply, Support, and Acknowledgments


In this chapter you will read where to get CPC software and whom to ask in
the case of questions. Furthermore, I mention some other Amstrad emulators.


6.1 Where can I get CPC software?


This is no problem if you have access to the Internet.
As for Spectrum emulators, a number of "anonymous" archives exist
where you can get CPC software via FTP or WWW.


FTP

- ftp.nvg.unit.no:/pub/cpc, thanks to Arnt Gulbrandsen for
creating the site, and to Noel Llopis to maintain it,
one of the biggest archives for CPC programs;
send what you have in /pub/cpc/incoming
for the HTML frontend:
http://www.dcs.napier.ac.uk/~bsc4074/amstrad/amstrad.html

- sunshine.informatik.uni-wuerzburg.de:/pub/joscho/cpcemu
mirror of ftp.nvg.unit.no. Any questions, remarks and additions to
joscho@informatik.uni-wuerzburg.de
If you have problems connecting to Norway you can try this.

- ftp://ftp.lip6.fr/pub/amstrad, thanks to Remy Card,
ftp://ftp.lip6.fr/pub/amstrad/frontend/menu.htm (HTML front end with
the list of all files, size and description included).
All questions about this site should be directed to
roussin@genesis8.frmug.org
All files comes from 'Genesis, the 8bit generation BBS' (see below).

- ftp.demon.co.uk:/pub/cpm, thanks to Paul Martin
specific amstrad CP/M related files
Paul Martin (pm@nowster.demon.co.uk) will send anyone, who can give
him proof that they own an original Amstrad CP/M Plus disk, the binary
ROM images of his "CP/M Plus ROMs" for free.

- oak.oakland.edu : /Simtel/msdos/emulator/cpcemu15.zip

- other Simtel mirrors:
ftp.ibp.fr : /pub3/pc/SimTel/msdos/emulator/
ftp.demon.co.uk : /simtel/msdos.
ftp.uni-paderborn.de


WWW

- http://andercheran.aiind.upv.es/~amstrad
and an UK mirror: http://www.dcs.warwick.ac.uk/~divine/~amstrad/

- ...and many more not listed here.


BBS

- Aspects (2:250/107) : +44 1617920260, in United Kingdom, sysop Dave
Gorski, V32b, CPCEMU v1.2, programs (mostly in basic),

- Genesis the 8bit generation (2:320/220) : +33 1 53 95 32 43
(modem/ISDN) & 44 (modem), Paris (FRANCE), sysop : Emmanuel Roussin.
Last versions of emulators, qwerty and azerty 6128 ROMs, freeware,
shareware, PD, disk zines, pokes, solutions, demos and a few
commercial games (with the permission of their authors).
For the moment, there is about 68 Mo of compressed programs. For
fido users, you can file request ALLFILES.ZIP, and then what is
interesting you. Many thanks to Kangaroo, Tom&Jerry and Juggler for
the files they sent me.

- ZNODE 51 : + 49 89 961 45 75, in Germany, from 15:00 to 3:00 CET
(MEZ), up to V32b, CPC files

- ...and some more.



6.2 News, exchange experiences


Do you always want to have the latest version of CPCEMU?
Do you want to be informed if a new one is released?

Meanwhile we have set up a newsgroup especially for the CPC!
It is called

comp.sys.amstrad.8bit.

Here you will find discussions about CPCs (and also CPCEMU), and
you can talk about your experiences with CPCs.

There is an FAQ (frequently asked questions) available to this
newsgroup
(ftp://ftp.lip6.fr/pub/amstrad/amstrad.htm, FAQ in HTML).


If you cannot read the newsgroup for any reason, write me an email.
You will find my address in the next section.
Certainly you can also use normal mail to ask me (or David, see below),
but please do not forget the return postage.

If you send me a contribution, I feel obliged to send the latest version
to you at least one or two times.




6.3 If you have questions or suggestions



Then you can write directly to me:

Marco Vieth
Auf dem Uekern 4
D-33165 Lichtenau
Germany

Phone/FAX: +49-5292-1366 (only on week-ends)

Internet: cpcemu@hotmail.com
(ali@uni-paderborn.de only valid until 10/01/98)

As you have probably already gathered while reading the Internet
address, I have studied Computer Science at the University of
Paderborn. I completed it in spring 1997.



In case you speak or write English (I presume so 'cause you're reading
this) you also can write to David Cantrell:

David Cantrell
116, London Road
Bexhill-on-sea
East Sussex
TN39 4AA
England

Phone: +44-1424-221015

Internet: david@diablo.eimages.co.uk
ftp://ftp.eimages.co.uk/users/davidc/cpc/
http://www.ThePentagon.com/NukeEmUp/uaug


David offered to help a little to answer the "pile of letters".
He has scanned firmware manual for the CPC, so everyone can get it
in an electronical form.




Although this program is Freeware, I would certainly accept any sort of
support, financial or technical.
(30-50 Deutschmarks would be appropriate.)
(That is around 20-33 US$ or 13-21 British pounds.)

Even if you send no money, I normally respond to all letters and try
to keep in mind all suggestions (I am sure David will do the same).
So do not hesitate to send your comments.



6.4 Other Amstrad CPC emulators


At the beginning of 1994 I thought that CPCEMU was the only emulator
for the Amstrad CPC. Now I know of three other:

- SIMCPC:
Presumably the first CPC emulator written.
CPC Emulator for PC/XT/AT (c) 1989, 90 by GHE, Aachen.
It is only black and white, but with additional ROMs;
only a "beer humour".

- CPC2PCxx:
In development since October 1993 by Paco Lopez (Spain), and
Is available from some sites now. It is written completely in
protected mode and uses the same disk format as CPCEMU.

- CPE:
In development by Bernd Schmidt. By using a special 50 hertz
screen mode, some colour blocks are exactly reproduced.
A special 256-colour CPE2 shows exact colour blocks with more
than 50 hertz.
Also supported: Multi modes, overscan.
Latest version: v5.2.



6.5 Plans for future releases of CPCEMU



- overscan
- improved multi modes
- screen centering in higher video modes
- fast hardware scrolling
- US keyboards have no "<>", ALTgr
- simulate the expansion port of the CPC
- load CPC disks directly
- load CPC tapes directly (over printer port or Soundblaster card)
- transfer whole disk images with the parallel adapter
- volume control for the Soundblaster
- digiblaster emulation
- customizable joystick keys
- use mouse as joystick
- auto detection of .SNA and .DSK

Maybe this is never done since I do some "real" work now...



6.6 Acknowledgments


- Special thanks to Juergen Weber, not only for many hints and
suggestions, but 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


- Also thanks to Bernd Schmidt. Because Bernd wrote his own emulator,
we have had the same problems many times. Only if you try to write
such an emulator yourself can you imagine, which details cause problems.
There is no CPC documentation available, which gives a whole
specification. Most parts of the CPC behaviour are detected by
experiments with a real CPC.

- Thanks to Ulrich Doewich for including Gravis UltraSound sound output
in the emulator and reading through the documentation. Ulrich wrote
a similar tool like CPCTRANS. Look out for CPDREAD which can read also
copy protected disks.

- Thanks to Emmanuel Roussin for his untiring engagement for the CPC.
He did the essential steps for setting up the newsgroup and lent me
his Multiface II for months, so that I could include in the emulator
somehow.

- Thanks to Arnt Gulbrandsen for his JPP source, where I found
ideas for the keyboard handler and the joystick routine.
By the way, JPP is a very good Spectrum emulator.

- Thanks to Martin Zacho for supplying a joystick routine.

- Thanks to Fernando J. Echevarrieta Fernandez for pointing out first
that version v0.8 did not emulate a CPC 664.

- Thanks to Gilles Molinari for his transfer program for the parallel
adapter.

- Thanks to Paul Martin for correcting the English documentation for
version 1.0.

- Thanks to Mark Haigh-Hutchinson for his engagement in making programs
from the company Vortex public domain.

- Thanks to Martin Young for his outstanding ideas about emulating a Z80.

- Thanks to Linh Hsiesh for many ideas for improvements, most of which
should have been incorperated by now.

- Thanks to Fred Harris for writing a letter to AMSTRAD about the ROMs.

- Thanks to Amstrad, especially to Cliff Lawson for allowing me to
distribute the BASIC ROM. Amstrad retains the copyright.

Amstrad plc, Brentwood House,
169 Kings Road, Brentwood,
Essex CM14 4EF

- Thanks to Richard Clayton from Locomotive for allowing me to distribute
the Firmware ROM. Locomotive retains the copyright.

- And thanks to the many users for sending me suggestions or having
ideas. Without them CPCEMU would hardly have reached version 1.0

- (Please excuse my English.)




6.7 Registered 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
Soundblaster by Creative Labs
...





------------------------------------------------------------------------------



7. Internal Information about CPCEMU



This chapter gives some background information and answers the question,
"WHY shall I do this or that now?"
The powerful debug menu is also described. You will also find the structures
of disk images and snapshot files.
This information is not intended for CPCEMU users without knowledge of
what is inside a CPC. Maybe it will be useful sometime.
I have put this information at the end, even after the trademarks, in an
attempt to show its "relative insignificance".
If you have no fun reading unintelligible sentences and unarranged
information, do not read further!
Skip directly to the Appendix.



WARNING: Go on reading at your own risk !





7.1 Table of contents for chapter 7




7.2 Internal overview of CPCEMU features



How compatible is CPCEMU really?



7.2.1 The Z80 CPU (The Processor)


+ All Z80 instructions are emulated, including so-called illegal ones.
You have the choice between a slow Z80 emulation written in C and a
fast Z80 emulation written in assembler by Juergen Weber.
With the COCPU 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. Obviously this was
only used during program development.
You can activate the slow emulation in the debug menu.
+ Additional instructions 'ED FC xx' only the emulator knows.
Among them the user break 'ED FC FC USER &BCFC'.

- No exact timing of the instructions but time calibration in realtime
mode.



7.2.2 The Gate Array (The "Co-Processor")


+ All 32 colours of the CPC (27 different ones)
+ All three screen modes (X x Y x COLOURS):
mode 0 = 160x200x16
mode 1 = 320x200x4
mode 2 = 640x200x2
+ ROM banking (16KB OS, 16KB BASIC, 16KB AMSDOS and additional ROMs)

- Colour beams flicker



7.2.3 The PAL (Programmable Logic Array)


The PAL is logically at the same address as the gate array but
in hardware separated from it.

+ RAM banking (128 KB, up to 576 KB) with EMS or conventional memory.
With emulated EMS, the blocks are mapped by the hardware, so the speed
is OK. CPCEMU gives you a Dk'tronics compatible RAM expansion
with up to 576 KB.

- Without EMS, RAM banking is very slow, since memory blocks must be moved
around in the PC memory. Besides you have only 128 KB RAM.




7.2.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.
+ Different character sizes (1..7) with CRTC register 9
+ Multi modes (they use some other registers)

- Overscan is not yet supported



7.2.5 The PIO 8255 (Programmable Input Output)


+ Keyboard (connected to the PSG)
+ VSYNC emulation: A bit which is set between two interrupts during a
screen refresh. You can change the position.
+ The cassette is very fast, a ROM bypass allows access to any DOS file.

- VSYNC bit is set too long
- Cassette ports are not emulated, so most of cassette copy programs
which access the ports directly do not run.


7.2.6 The PSG AY 3-8912 (Programmable Sound Generator)


+ Either through the PC speaker (awful, since 3 channels are
multiplexed into one and the volume cannot be changed), a GUS card
or a Soundblaster card. Either digital sound with full noise or
the Adlib compatible FM part without noise.

- No digital-sound or too slow.


7.2.7 The FDC 765 (Floppy Disc Controller)


+ All necessary FDC commands to control two drives A and B
(including sector read/write, seek/format track, read sector-ID, ...)
Very flexible disk formats (up to 18 sectors per track).
Including double sided formats, e.g. VORTEX.

- Complicated copy-protected formats are not supported.



7.2.8 The Centronics printer interface


+ Printer output also with 8-bit printer patch, to a file defined
by PRINTER.




7.3 The Debug menu


The complete register set of the CPU is displayed and can be modified.
You can "dump" the memory, disassemble or modify it. You can load or
save areas in memory. And the most interesting thing:
You can single-step through programs!
(Similar to a real debugger.)

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 available commands, use the capitalized
letters.
The next two lines show the actual values of the Z80 registers.
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.)


Preliminaries

Parameters in special brackets are optional [opt].
Use only hexadecimal values, e.g. <address> = 0000-ffff
"<ret>" indicates that you are in a special mode. You may press
<return> to continue. <String><Return> leaves this mode
(use e.g. 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.


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 e.g. 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 (actually disassemble):
a [<address>] : disassembles 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 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.
If you press <Return> after the filename prompt, the well-known
file selection menu appears ...
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
includes an 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 display 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.


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

You can also write '<register><space><hex-value>'.
You can modify all displayed registers, i.e.
AF, BC, DE, HL, IX, IY, SP, PC, IR, AF', BC', DE', HL',
and also IFF1, IFF2 and IMD.





7.4 The Memory Management



7.4.1 Another time: EMS configuration


You need an expanded memory manager supporting the LIM 4.0 standard
(LIM EMS 4.0). This memory manager must supply extended EMS-pages in any
region, as CPCEMU will look for 6 physical pages on continuous addresses.
If EMS usage is possible, a memory count 'EMS xxx Bytes ok.' will appear
during initialization.

You were told to use the following settings under OS/2:

EMS_FRAME_LOCATION = auto
EMS_HIGH_OS_MAP_REGION = 32 (or more)
EMS_LOW_OS_MAP_REGION = 0 (or more)

What does that mean?
Low region is for EMS pages in conventional memory. If CPCEMU
is to use such pages, use at least 6*16KB = 84KB.

High region is for EMS pages above 640K, additional to the
standard frame of 64KB. Use at least 2*16KB = 32 KB.


For DOS, you were told to include the following lines in your CONFIG.SYS:

DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE 1024
...

Modify the 1024, depending on the available memory of your computer.

Annotations:
EMM386 supplies several additional pages in conventional memory.
The minimum address can be changed with the option /B=<segment>
(default is 4000).
With /P<number>=<segment> it is possible to change the segments of
physical pages.




7.4.2 How the Banking is done ?


Banking is to enable some home computers to have RAM and ROM at the
same address. So read is from ROM and write is to RAM. The Amstrad
CPC has 64K RAM and a 16K ROM at 0-3fff and a second one at c000-ffff:

0 RAM 0000-3fff
1 RAM 4000-7fff
2 RAM 8000-bfff
4 RAM c000-ffff
L ROM 0000-3fff
U ROM c000-ffff

The main idea is to have different segments and offsets for reading,
and writing. For every read access, a read offset is added to the
desired address, and the same is done with a write offset for writing.

state 0 state 1

block 5 M L c W 0 <
block 4 M W C c W C c | swap at
block 3 M W 8 b c W 8 a c | state
block 2 M W 4 b c W 4 a c | change
block 1 M W 0 b L a c <
block 0 M U b U a


(M = conventional memory or physical EMS-pages)

a = lower ROM enabled, upper ROM enabled
b = lower ROM disabled, upper ROM enabled
c = lower ROM enabled, upper ROM disabled
W = lower ROM disabled, upper ROM disabled

To flip between the two states, the '0' and 'L' block must be
swapped. For RAM banking a new '0' must be swapped with the old
one. ROM select is done by copying the new ROM to 'U'.

With EMS memory, all banking is done by the EMS hardware (or its
emulation). This improves the emulation speed in BASIC and CP/M
Plus. Now you understand why 6 continuous physical EMS pages are
needed; the standard frame with 4 pages is not enough.





7.5 ROM modifications



7.5.1 ROM bypass for the cassette


After the '|TAPE' command, or if the AMSDOS ROM is disabled, the
cassette is addressed. Cassette access is transformed into file
access in a single directory. This redirection is done by a ROM bypass.
With 'TAPE_BYPASS=1' you enable the ROM bypass of the tape vectors.
If CPCEMU finds a known ROM from a CPC 464/664/6128, the ROM is
modified accordingly. The bypass is necessary if you want to use the
cassette.

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 available:
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 : CASSETTE INIT (BC65)
77 : CASSETTE IN OPEN (BC77)
7A : CASSETTE IN CLOSE
7D : CASSETTE IN ABANDON
80 : CASSETTE IN CHAR
83 : CASSETTE IN DIRECT
86 : CASSETTE RETURN
89 : CASSETTE TEST EOF
8C : CASSETTE OUT OPEN
8F : CASSETTE OUT CLOSE
92 : CASSETTE OUT ABANDON
95 : CASSETTE OUT CHAR
98 : CASSETTE OUT DIRECT
9B : CASSETTE CATALOG

In addition to that, you can use the user break instruction
ED FC FC USER &BCFC. It stops the emulation at once.



7.5.2 AMSDOS ROM modifications


- With 'AMSDOS_DISABLE=1' you forbid the initialization of the AMSDOS.
Then patching of tape vectors by the AMSDOS ROM is disabled. (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 the AMSDOS ROM.)
Sector instructions are not affected, they always address the disk.

- 'AMSDOS_SPEEDUP=1' enables a AMSDOS ROM modification, which
minimizes the motor waiting times to render a faster disc access.
(The things are managed by DOS, so we do not need the delay loops.)
The following bytes are modified in the AMSDOS ROM:
poke &C5D4,&01 :'motor load time
poke &C5D8,&01 :'format track 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




7.6 Miscellaneous




7.6.1 Another time: The configuration file


Maybe you remember that comments start with a semicolon ';', and
can start anywhere on a line. The rest of the line is ignored.
Blanks, tabs, newlines and ';' are delimiters, and it does not
matter how many you use.
Many of the definitions have the syntactical form
<key-word> '=' <value> {T}
{T} is a sequence of at least one delimiter.
Example:
ROM_PATH = ".\ROM"

<number> can be given decimal, hexadecimal (with 0x) or binary (%).
<pathname> may have a length of up to 80 characters and
<filename> up to 20 characters.

Some supplementary information to selected key-words:


BREAK_MASK = <number> (3)

For debugging purpose only.
Some events interrupt the normal emulation. With this flag,
you can disable such events. Use with caution!
Leave all bits on except those for such events you do not want
to occur.
b2 = 0 -> disable display of port errors (use 3)
The meaning of the bits can change in future!





7.6.2 The parallel adapter


First, the construction of the adapter, now with functional description:


PC D-SUB Cent. CPC Function
-------------------------------- ---------------------------
GND 19 ---- 19 GND GND
BUSY 11 <--- 1 -STROBE Synchro (Data available)
-ACK 10 <--- 8 D6 |
PE 12 <--- 7 D5 | Data
SELECT 13 <--- 6 D4 |
-ERROR 15 <--- 5 D3 |
D0 2 ---> 11 BUSY Synchro (Ready to receive)


Direction CPC->PC

Normally the adapter is designed for this direction only. Sending
on a CPC is on principle the same as printing on a line printer.
If the PC sets Not-BUSY, the CPC writes a nibble (4 bit of a byte)
to the port, sets STROBE as sign that the data is there, and clears
it afterwards. So the PC only needs to clear BUSY (with D0), wait
for STROBE (his BUSY line) and take the nibble (from the input-lines
printer->PC), and set BUSY.
Question: Why not sending 8 bits parallel?
Answer:
1. The PC printer port must be reprogrammed for input and I am not
sure if that is possible on all PCs and
2. The CPC has a 7 bit printer port only.


Direction PC->CPC

One day I thought about the possibility of sending data in the other
direction. Unfortunately the CPC has only one single input line at
the printer port, namely the BUSY signal. So it would not improve the
situation if you try to design a better adapter for this direction.
Thus take what you have already and make the best out of it by
developing a clever protocol.
A serial interface also has one data line for each direction.
But, a serial interface uses hardware synchronization, usually with
a quartz, and both peers have to use exactly the same baud rate
(e.g. 1200 baud).
It is hard to do that with software only.
What should I do?
The idea is to utilize the speed advantage of the PC over the CPC.
Each byte is split into 8 bit and transmitted serial, the PC has
to set the BUSY line accordingly.
During this 8 bit the CPC gives its maximum speed and the PC has to
conform with it. The CPC writes a "bit request" with one assembler
instruction. Now the PC must react promptly by setting the BUSY line
accordingly the next bit. Since with the following-but-one (?)
instruction the CPC will read it.
In order to not disable the interrupts during the whole transfer,
for every byte a "connection" is established.
The CPC says "Hey, send something to me!", and the PC answers
"Ok, I'm waiting until you want it." by toggling the BUSY-line.
The whole story is protected with timer, so no peer can hang when
waiting on a signal never sent.
Thus you can escape the programs with <ESC> or <CRTC>+<BREAK>
any time.




7.6.3 CPCTRANS


Another option not mentioned is "/d 0" or "/d 1". With 1 a special
double-step mode is selected, on 80 track drives every second track
is skipped when working with 40 track disks.
This option should be unnecessary, because CPCTRANS switches
automatically to double-step when detecting a 5.25" 360 KB disk.

Normally it is very simple to read or write sectors by using the BIOS.
But the BIOS cannot handle B-sides of disks with head-mark=0.
So I had to program the FDC functions myself, with the aid of
the MINIX source as an outline. Unfortunately the MINIX source contains
some errors, and the timing in critical sections was done by
simple delay loops possibly outlined for a 8086 processor.




7.7 Structure of selected CPCEMU files



7.7.1 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.
The new extended disk format is intended for some copy protected disks.
Parts which are new in the extended format are marked with *E*
(from our Extended DISK Format Proposal, Rev.5).


The Disc Information block
Byte (hex): Meaning:
00 - 21 "MV - CPCEMU Disk-File\r\nDisk-Info\r\n"
("MV - CPC" is characteristic)
*E* "EXTENDED CPC DSK File\r\n\Disk-Info\r\n"
*E* ("EXTENDED" is characteristic)
22 - 2F unused (0)
*E* DSK creator (name of the utility) (no ending \0 needed!)
30 number of tracks (40, 42, maybe 80)
31 number of heads (1 or 2)
32 - 33 size of one track (including 0x100-byte track info)
With 9 sectors * 0x200 bytes + 0x100 byte track
info = 0x1300.
*E* unused (0)
34 - FF unused (0)
*E* high bytes of track sizes for all tracks
(computed in the same way as 32-33 for the normal format).
For single sided formats the table contains track sizes
of just one side, otherwise for two alternating sides.
A size of value 0 indicates an unformatted track.
Actual track data length = table value * 256
Keep in mind that the image contains additional 256 bytes
for each track info.


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 number of tracks-1)
11 head number (0 or 1)
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)
*E* sector data length in bytes (little endian notation)
This allows different sector sizes in a track.
It is computed as (0x0080 << real_BPS).


Annotations:
The sector data must follow the track information block in the
order of the sector IDs. No track or sector may be omitted.
With double sided formats, the tracks are alternating,
e.g. track 0 head 0, track 0 head 1, track 1 ...
Use CPCTRANS to copy CPC discs into this format.



7.7.2 Snapshot Files


Snapshot files consist of a 0x100-byte header and a memory dump.

The Snapshot header:
Byte (hex): Meaning:
00 - 07 'MV - SNA' (as characteristic)
08 - 0F unused (0)
10 snapshot version (2, former 1)
11 - 1A Z80 register AF, BC, DE, HL, R, I
1B - 1C Z80 flags IFF0, IFF1 (0=disabled, 1=enabled)
1D - 24 Z80 register IX, IY, SP, PC
25 Z80 interrupt mode IMD (0 - 2)
26 - 2D Z80 register AF', BC', DE', HL'
2E Gate Array: ink number register
2F - 3F Gate Array: ink value register (0, 1, ..., 15, 16)
40 Gate Array: multi configuration register
41 Gate Array: RAM configuration register
42 CRTC: address register
43 - 54 CRTC: data register (0, 1, ..., 17)
55 Upper ROM number
56 - 59 PIO: port A, port B, port C, control port
5A PSG: address register
5B - 6A PSG: data register (0, 1, ..., 15)
6B - 6C memory dump size (64K or 128K)
(the following parameter exist only from snapshot version 2.0 onwards:)
6D CPC type where the snapshot was generated
(0=CPC 464, 1=CPC 664, 2=CPC 6128, 3 = unknown)
6E interrupt number (0..5), the latest interrupt
during a screen update cycle.
6F - 74 6 multimode bytes, thus screen modes (0..2)
for the interrupts 0..5.
75 - FF unused (0), maybe later for emulator configuration





7.7.3 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 is found 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.
The bytes 12, 15-16, 1A-1B, 40-42, 43-44 are necessary.


7.7.4 Poke Database:


An entry (one line) consists of 7 parts, each surrounded by '"',
separated by commas.
1. part number (1 character, 0-F):
The first entry has number 0 and can be selected.
If a program needs more than one poke, following entries have the
numbers 1, 2, ...
2. Name of program (up to 20 characters)
3. Description (up to 20 characters)
4. Type (1 character):
('t'=Tape, 'd'=disk, 'a'=all), currently ignored.
5. Address of poke (4 characters, hexadecimal):
Specifies the memory location to be modified
6. Byte for the poke (2 characters, hexadecimal or '??'):
If '??', you have to input a value, e.g. number of lifes.
7. Old byte (2 characters, hexadecimal or '??'):
Allows to check, if the poke modifies the correct environment.
If the byte at the address differs form old_byte, a warning is
displayed. There is no check when using '??'.

Example:
"0","Devils Crown","inf oxygen","t","863b","00","??"
"1","","","t","863c","00","??"
"2","","","t","863d","00","??"

There are three pokes for the program "Devils Crown", all working
together. Old values are unknown so old byte is '??'.
You can omit name and description in following entries.





7.8 Internal History



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: ADD HL..., DAA, LDIR set the P-flag incorrectly. BIT...
set the Z-flag incorrectly, rotate instructions set the Z-flag and S-flag
incorrectly; possible to use ROMs now.
- v1.3 (18.8.1992)
wrong port addressing: low byte incorrect. New memory management with
128 KB RAM, 32 KB ROM
- v2.0 (18.8.1992 - 22.8.1992)
implemented COCPU technique to find errors (the COCPU uses separate
memory and is only active in a special debugging mode). Z80 problems:
AND... set H-flag incorrectly, CPI... set N-flag incorrectly. Formerly,
the screen was only black and white, now it is blue and yellow as you
know from a real CPC.
- v2.1 (25.8.1992 - 27.8.1992)
Emulation of all pens, colours in all modes. Writing only to the active
screen which you can see. COCPU found an error: all instructions
containing (IX+zz) with a negative distance were wrong ! Forgotten to
take "signed char".
- v2.2 (30.8.1992 - 3.9.1992)
New keyboard routine, set palette without flickering (waiting for HSYNC).
"Need-ROM" with COPYMATE introduced.
- v2.3 (15.9.1992 - 19.9.1992)
FDC emulation for sector load/save. COCPU found an error: LD XH,... was
LD H,...
- v2.3b (19.9.1992)
Do screen update only if the screen is on RAM blocks 0..3 (and not 4..7);
Made port FCxx an alias for FBxx (for CP/M Plus). At that time, I did not
know that OUTI... predecrement the B-register.
- v2.4 test (25.10.1992)
Only R-register emulation if desired (per "DEFINE"); Now screen update
every nth interrupt and not for every single byte written in memory.
(Still very slow, because all is done 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 from Arnt Gulbrandsen: all key combinations
possible. Screen update in assembler.
- v2.7 test
Unsuccessfully tried to include the fast Z80 emulation from Juergen
Weber.
- v2.8
Improved Screen update: Only changed parts are modified on the screen.
- v2.9
Using PC Timer to generate interrupts with 300 Hertz. Fast emulation runs
only, if no ROM (banking) is needed.

CPCEMU (now a CPC)
- v0.2 (23.12.1992), following Z80EMU v2.9
After nearly 4 hours analyzing with the Turbo Debugger I have found the
error hanging the fast emulation: PUSH ES instead of PUSH 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 (in DS) instead of write segment (in ES). LD A,R now
produces random-numbers; All Tape routines implemented (but wrong
CASSETTE 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. CASSETTE IN
CHAR corrected (wrong patch for CPC 6128).
- v0.6 (23.3.1993 - 24.5.1993)
Someone mentioned that the OUTI-instructions predecrement the B-register!
Compiling the C parts in 386 code (with Borland C++ v3.1). Disk images
have the suffix .DSK. CPCREAD.PAS corrected (head not initialized with 0)
and translated to CPCREAD.C. Port addressing of the PIO improved (the CPU
can read, even if the port is programmed for output, ...)
- v0.7 (26.7.1993 - 29.8.1993) (unreleased)
Totally new source, modularized, ... Configuration file, more ROMs
possible. Changed company name from 'Schneider' to 'Amstrad'. (You can
choose between several names.) RAM banking error removed. New
documentation in German.
- v0.8 (30.8.1993 - 9.9.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.
- v0.8a (10.9.1993 - 15.9.1993)
Fatal error in fast emulation: If an DD CB xx instruction is executed and
an interrupt occurs, the instruction is ignored!
- v0.8b (16.9.1993 - 21.9.1993)
Implemented a "real" VSYNC, if VSYNC_CT = 0. Corrected PIO port A
problem: OUT &F400,xx with Port A in input mode was ignored. New joystick
routine from Martin Zacho.
- v0.8c (22.9.1993 - 13.12.1993)
Checked documentation with "ispell". Emulation did not start, if
"USE_JOYSTICK=1" and a joystick was not present (PUSH AX at wrong
position). Slow Emulation: DAA corrected (brackets were missing since
v0.8). Wrong patch for CPC 664 in interrupt routine. This patch replaced
EI with NOP to avoid the problem with EI (enable interrupts one
instruction later). Now correct for all CPCs.
- v0.8d (14.12.1993 - 29.12.1993)
FDC emulation rewritten for double sided formats. CPCTRANS replaces the
old CPCREAD and allows you to read Vortex-disks after you have installed
the patch 720KB.COM. Beside that, you can write disk images back to disk.
New fileselect when pressing F3. Some port address aliases introduced,
e.g. &7000 - &7f00 to address the gate array, &0c00,&1c00,&2c00,&3c00,
&bc00 for the CRTC. Emulation of the R-register enabled.
- v0.9 alpha (30.12.1993 - 20.1.1994)
EMS memory possible with a special EMS/UMB-configuration. Binary digits
in the configuration file. RAM-banking addressing corrected: emulator
accepted &d0-&ff as &c0-&c7. Now up to 576 KB RAM with EMS.
- v0.9b (21.1.1994 - 31.1.1994)
Usage of EMS simplified by extended EMS (or LIM EMS 4.0) with more than
4 physical EMS pages. File-select added to 'l' (debug menu), RUN" .
- v0.9c (1.2.1994 - 29.4.1994)
Some awful PC speaker sound (disable it with F4). File select also with
'v'; this English documentation corrected; Soundblaster sound (can be
improved); new CPCTRANS with command line parameters, direct FDC access;
parallel adapter tested and the software improved. Fast Z80: INC (HL),
DEC (HL), INC (IX+n), DEC (IX+n) for RAM below ROM corrected. PgUp,PgDn
move oversized screens; parts of overscan screens are displayed.
Now possible: 64K snapshots.
- v0.9d (30.4.1994 - 12.5.1994)
Interrupts during DI are not forgotten, and they are not enabled directly
after an EI instruction any more. New color functions: now without snow
under OS/2. Fast Z80: speed up code fetch.

- v1.0 (13.5.1994 - 20.5.1994)
Improved screen part: different character sizes from 1 to 8. File select
added to SAVE" , added fast select by pressing a letter. Improved
CPCTRANS with a verify option. A new setup menu, if you press F7. So you
can disable colour flickering.

- v1.0a (21.5.1994 - 9.6.1994)
Improved setup menu with direct input or cursor keys, added German
keyboard layout, added simple delay option. Correct display of smaller
screen sizes (without parts of the bigger ones). Improved fast Z80 part:
faster RRA,RLA, ... faster CB xx instructions. Added more illegal
instructions (ED xx). LD D,XH and LD YL,YH were missing ! Corrected CPDR,
CPIR with BC=0 (0 means 65536 on a Z80, but it is 0 for the 80x86 REPE
prefix!). DAA flags corrected. New software for the parallel adapter:
Now it is possible to send to the CPC. Thanks to Bernd Schmidt for
pointing out that an interrupt increments the R-register by 1. With his
help, the PIO port C register emulation has been improved.

- v1.1a (10.6.1994 - )
A new era of CPCEMU has arisen: Amstrad has allowed the use of the ROMs!
Changing in the configuration file: ROM_BLOCKS -> ROM_BLOCK, DISC_BYPASS
-> DISABLE_ADOS, no space separating '=' needed, Changings in sound part,
graphics part: vertical size by VGA-CRTC. Joystick calibration is in the
setup menu now, tape routines for saving are improved. FDC part improved:
now you can use COPYMATE. Insert non-data format disks without read error
(without a seek to track 0). Another delay in CPCTRANS, I hope, you will
not need the turbo switch any more; formatting of disk images. Corrected
PIO port C another time: it is cleared after out &7f00,n. Major changes
in the configuration file: Now with conditional configuration (#IFCPC,
#ENDIF). Some tokens changed (VSYNC_CT -> /, DISC_PATH -> /, SNAP_PATH ->
SNAPSHOT, DRV_A -> DRIVE_A, DRV_B -> DRIVE_B). Load programs from inside
ZIP archives. You will need PKUNZIP.

- v1.1b (17.8.1994 - 2.9.1994)
Multimodes introduced, that means different screen modes on the same
screen. The screen update is partitioned in up to 6 areas, each one is
updated when an interrupt occurs. (Can be improved.) Possible now: 128K
Snapshots, extended for multimodes. CPCPARA improved: Now you can
transfer binary files with header. CPC 6128 Plus detection included.
More port aliases included.

- v1.2 (3.9.1994 - )
This version was released. Mainly there are some changes with
the help menu.

- v1.2a (27.9.1994 - ) (was available as UPD12A.ZIP)
File Select: Only the available drives are displayed.
And: With the driver ANSI.SYS the background of some text was black.
TMP_PATH: You can specify a drive without path.
DOS Shell (F7): CPCEMU is swapped to XMS, EMS or disk first, so you
have much memory in the DOS shell. (This feature is taken from the
Public Domain Program SWAP300.ZIP by Marty Del Vecchio.)
Screen update could be corrupted, if the screen width was not
divisible by 4.
Another CPCEMU version to get even more speed: C2.EXE. It uses a
different memory management with two EMS frames with 64KB each.
One for reading and one for writing. But it runs only with EMS.
The ROMs are also (c) by Locomotive Software, not only Amstrad.

- v1.2b ( )
There was no stereo sound on a Soundblaster Pro even if the
configuration said so. If no Soundblaster was found there was no
sound at all until you use USE_SB=0.
Fast-Z80: Changed some word accesses to byte accesses. That's a bit
slower but does not crash the computer every time you do a word
access at address 0xffff.
Fast-Z80: Problem with EI HALT DI corrected: The address to HALT was
pushed instead that one of DI.
corrected English documentation
improved CPCPARA and PCPARA v1.1: adapter test, much more speed CPC->PC:
approx. 1600 bytes per second reading from disk! (486/66), statistics.
So you can transfer 16KB in 10 seconds! Thanks to Klaus Weber for
pointing out, that it was much too slow.
In PCPARA there was a DELAY(1) after every nibble to wait a millisecond.
This is not necessary.

- v1.2c (28.2.1995 - ) (was available as UPD12C.ZIP)
Parts of CPCEMU rewritten in C++. This allows inline functions and
improved interfaces to keep a better overview over the project.

- v1.2d (16.3.1995 - ) (only for mailing list 'subscribers')
Fast-Z80: Internal changes not visible to the user, except a little
speed improvement. All data is kept in the data segment now instead
of the code segment.
Finally introduced the absolutely necessary mode for fast computers:
'realtime CPC' (Selectable from the setup menu or REALTIME=1).

- v1.3 (16.4.1995 - )
Poke database for easy poking, French documentation, FDC format
command (re-format disk images of the same size),
new menu system with mouse support (MOUSE=1),
insert disk images with read-only DOS attribute (insert them as read
only), debug menu: 'find' added

- v1.3a (30.4.1995 - ) (was available as UPD13A.ZIP)
With version v1.3 Boulder Dash did not run, even if it did with v1.2.
The interrupt mode 2 of the Z80 was not simulated correctly
(PUSH/POP forgotten). The slow Z80 emulation had a similar bug.
CPCTRANS: Option -f 6 enabled.

- v1.3b (20.5.1995 - ) (was available as UPD13B.ZIP)
Some users mentioned that there was no Soundblaster sound output since
version 1.3.

- v1.4a0 (21.3.1996 (v1.3c); published in the German magazin c't 6/97)
GUS sound support by Ulrich Doewich; online help in English, German,
French and Spanish;
complete French documentation thanks to Jean-Pierre MARQUET;
support for 2 joysticks; VESA video modes for higher resolutions;
improved setup menu and configuration file; load and save
configurations added to the setup menu; improved FDC routines for
non-standard formats; Extended disk format;
user-configurable colours and keys;
improved CPCTRANS (v2.3); new SNA2GIF (v1.1);
fast Z80 emulation: sometimes the screen was not completely cleared
after a reset (problem with HALT);

- v1.4a1 (4.4.1996)

- v1.4a2 (5.7.1996)


- v1.5b0 (8.6.1998; published in the German magazin c't 12/98)
perfect Soundblaster sound support by Ulrich Doewich (digital sound
with noise);
partial Spanish documentation v1.3-v1.4, thanks to Ismael Salvador Igual;
autostart of BASIC programs from disk images;
4DOS descriptions in file selection menus;
online help now allows topics including spaces;
path names in configurations are saved relative;
set data rate with CPCTRANS v2.3g;
SNA2GIF v1.2: user-configurable colour palette, better auto-scale;
CPCPARA v1.2: possible to disable fast sending (e.g. for Vortex);
extended poke database;
allow to use the VESA video modes even if they are not reported by
the VESA bios (needed for noname S3Virge cards with standard S3 BIOS);
The start scripts CPCxxx.BAT use a configuration file under %TMP
(this allows CPCEMU to reside on a CD-ROM);

- v1.5b1
Complete Spanish documentation v1.5 thanks to Gerardo Brise˝o;
Complete French documentation v1.5 thanks to Jean-Pierre MARQUET;
Joystick problem correced (joystick did not work with v1.5b0);
file selection: now up to 1500 directory entries (formerly 500);
direct printer port access when using PRINTER="";
early VSYNC clear removed (Platoon had no keyboard with v1.5b0 Realtime);
when EMS was in use you could not load a 128K snapshot with a RAM
configuration different from &C0 (e.g. &C2 used by CP/M Plus);
CPCPARA v1.2: the flag to disable fast sending had 'negative logic';



CPCEMU is written in C++ and assembler, using Borland C 3.1 with 386
optimization and Turbo Assembler. For Debugging the Turbo Debugger
was used.
The colours were composed with the program VGAMETER by J. Stephen
Shattuck, Jr., with the CPC connected to a TV by a Scart adapter.



------------------------------------------------------------------------



(From this point you can continue reading without danger.)



A. Appendix




A.1 Glossary


Here some computer terms are explained. I do not claim to give complete
or precise definitions. The terms are described with the view to the CPC.
References are marked with "╗".


386/33 (AT 386/33)
Short term for ╗PC AT with 80386 processor, clocked with 33 MHz.
Because of the "high" clock rate it should be a 386DX with a real 32
bit data bus, not the cheap 386SX with a 16 bit data bus.

AMSDOS (Amstrad DOS)
╗DOS developed by ╗Amstrad, for the ╗CPC computers.

Amstrad
British computer manufacturer, who has designed the ╗CPCs.

Archive
Storage of files.
Or: One file, including several other.
In ╗ZIP archives the files are compressed before including them.

ASCII (Abbreviation for: American Standard Code of Information Interchange)
On a computer all characters, numerals are represented internal as numbers.
Most computers use ASCII, with the letter "A" coded as 65. ╗PC and ╗CPC
also use ASCII. In ╗Locomotive-BASIC you can save an ASCII file by typing
'SAVE"<filename>",A'.

Basis Address
This you have to specify in many ╗setups if you own a soundcard.
CPCEMU looks for an ╗environment variable.

BASIC (Abbreviation for: beginners all purpose symbolic instruction code)
Widely used, easy to learn programming language for home- and personal
computers. Former every computer had had his own BASIC dialect.
Modern BASIC allows structured programming, so you are not forced to
program "spaghetti code" any more.
Also the ╗CPC has its own BASIC, the Locomotive BASIC by a company of
the same name.

Batch File
Contains instructions you normally type in your computer. If you call
such a file, the instructions are executed one by one, even if you input
them.

BASIC File
See ╗File.

BBS

Binary File
See ╗File.

BLASTER environment variable
See ╗environment variable.

C64:
Home computer by the company Commodore with 64 KB ╗RAM, very popular.
Because of the huge software supply it was "the game computer" for many
years. Later it was pushed aside from the Commodore AMIGA, but despite
its old technique it survived longer.

Clock frequency
Clock the processor is connected to. It determines the speed of the
processor in a significant way. Today's 486DX2/66 processors are clocked
internally with 66 MHz.
The Z80A in the ╗CPC is clocked with 4 MHz, running actually with 3.3 MHz
because he has to wait periodically for the screen update.

Command line parameter
Parameter you give in the command line after the file you want to call.

Configuration
Here: Configure a program for his own needs.
You can do that with the ╗Setup or a configuration file.

CPC (Abbreviation for: Colour Personal Computer)
Developed by the company ╗Amstrad, was available in different types.
Please read the introduction again.

CPC printer port
Centronics interface of the ╗CPC to connect a printer.
Unfortunately the CPC designers were too economic: It has only 7 bits.
With a short wire it was possible to extend it to 8. For this the
cassette port was "misused", not needed when printing.

CPC firmware manual
A book about the ╗CPC, especially describing the operating system
interface of the CPC.

CPC newsgroup
A newsgroup only for the ╗CPC. It is called "comp.os.amstrad.8bit"
and was created in august 1994.

CP/M Plus (Abbreviation for: control program for microcomputers)
Operating system from the company Digital Research, mainly for 8 bit
microcomputers. Widely used until IBM decided to use MS-DOS for its PCs.
CP/M Plus (CP/M 3.0) was the successor of CP/M 2.2 and was included
in the software package of the ╗CPC 6128.

CTRL/SHIFT/ESC (control/shift/escape)
"Three finger combination" on a ╗CPC to cause a reset. It is similar to
the reset combination 'CTRL/ALT/Del' on a PC. Some programs block
such a reset so you have to turn off the computer or use the reset
button. The CPCs had no button, but it was easy to build one.
In CPCEMU the function key F8 is the reset button.

Cursor
Character on the screen which shows you the current writing position.
Somewhere on the keyboard there are cursor keys to move the cursor
around.

D-Sub
Connectors with a special form.

Dk'tronics
British company offered hardware extensions for the ╗CPC, e.g.
memory extensions.

DMA (Abbreviation for: Direct Memory Access)
Direct access to the computer memory without using the processor.
Used with disk drives, but to be cheap not implemented in CPCs.
The Soundblaster card can also use a DMA channel, getting digital
sound data "through" it.

DOS (Abbreviation for: disk operating system)
Disk oriented operating system, e.g. AMSDOS, DRDOS, MS-DOS.
Today it is a synonym for MS-DOS.

DOS Search Path
DOS uses a path along subdirectories to find a file.
It is set with the ╗environment variable 'PATH'.

DRDOS
MS-DOS compatible ╗DOS by the company Digital Research.

E-Mail (Abbreviation for: Electronic Mail)
Using a computer as mail-box.

EMM (Abbreviation for: Expanded Memory Manager)
Similar to ╗EMS.

EMS (Abbreviation for: Expanded Memory System)
Memory extension for the ╗PC, to get around the 640KB memory limit.
With the banking technique other memory pages are mapped in an EMS
window. EMS was developed by Lotus, Intel and Microsoft, thus it is
called LIM-EMS.
There is hardware-, emulated and simulated EMS.
Special memory cards supply hardware EMS, mainly used on old PC XTs.
On a PC AT with at least a 80386 processor it is possible to have
emulated EMS by using the paging mechanism for banking.
This sort is supplied by EMM386.EXE and should be used to speed up CPCEMU.
Simulated EMS is too slow, it has to copy the memory pages.

Emulate
Imitate a system (hard- or software) by another one.
The imitating system computes the same results on the same data as
the imitated system.
CPCEMU emulates a ╗CPC on a ╗PC.

Emulator
The system ╗emulating another one.

Environment variable

File
Collection of data belonging together. On the ╗CPC there are files of
different types, e.g BASIC files with BASIC programs usually having the
extension '.BAS', ASCII files with any text, and binary files with any
bytes, usually having the extension '.BIN'.
Binary files can contain machine programs or other data.

Format definitions
Definitions of disk formats.

FTP (Abbreviation for: File Transfer Protocol)
A protocol to transfer files in computer networks.
Also, the program running this protocol is called "FTP".

Hardware
Parts of a computer you can "touch", e.g. periphery like printer,
monitor; internal it is the processor and other ╗hardware chips.

Hardware chips
Components inside the computer, e.g. processor, memory chips, floppy
disk controller, ...
Inside the CPC there are the Z80 processor, the Gate Array, the CRTC
6845 for addressing the screen memory, the PIO 8255 for input/output,
the sound chip PSG AY 3-8912, the floppy disk controller FDC 765, ...

Hardware scrolling
Moving the screen without having the processor to copy from one part
to another. The processor has to modify only the screen base address,
the rest is done by a hardware chip.

Initialize
Fill the memory with special values, so variables are defined.

Interface
Connection of a computer to its periphery or from one program to another.
Thus there are hard- and software interfaces.
The so-called Centronics interface is a parallel interface, transmitting
the bits of a byte parallel. With serial interfaces it is necessary to
transfer the bits one after another.

Internet
An Internet is composed of several sub-networks of computers.
Here: *The* Internet, a worldwide computer network for communication.

Interrupt
If the processor gets a signal with higher priority, it interrupts
the running program and calls a special interrupt handler. When
finished it continues with the interrupted program. On a PC there
are different interrupt signals, e.g. when you press a key, when a
timer runs off, when data from the serial interface has arrived
(e.g. when you move the mouse), when the soundcard just played its
last sample and needs more data, ...
The Z80 in the CPC is interrupted 300 times a second.

Interrupt number IRQ (IRQ=Abbreviation for: Interrupt Request)
On a PC, different ╗interrupts have different numbers.
For example, the keyboard interrupt has number 9, the timer interrupt
has number 8. If you press a key, the keyboard sends an interrupt
request to the processor, so it is informed.

Jumper box
An adapter box to realize any connection between two connectors by
using short wires which must be soldered.
See also ╗Wiring Box.

Keyboard handler
A program called when the keyboard generates an ╗interrupt. The handler
gets the number of the key which is pressed or released.

LIM standard (Abbreviation for: Lotus Intel Microsoft)
Memory expansion (╗EMS), developed by Lotus, Intel and Microsoft.

Locomotive
British company which wrote the ╗BASIC of the ╗CPCs.

Mailing list
A service from me, for which I add your email address to a list.
So you will be informed about news concerning CPCEMU.

Microchannel
Special bus architecture.

MS-DOS (Abbreviation for: Microsoft Disk Operating System)
Operating system, developed by the company Microsoft for 16 bit
processors (8086). The most popular operating system for the PC.
Still in use on the 32 bit processors 80386 and 80486.

Multi Modes
Programming technique to have different screen modes simultaneously
on the screen. The screen mode is changed during a screen refresh more
than one time. On the CPC you get zones with high resolution, few
colours and low resolution, many colours.

Multiface II (Abbreviation for: Multipurpose Interface)
A hardware extension for the CPC. Allows to interrupt any program at any
time to analyze or save it.
Developed by the British company Romantic Robot.

Number representations
Depending on the selected base, there are different representations
for the same number.
Well known is the decimal representation with basis 10 and digits 0 to 9.
Computers use the binary representation (base 2) with digits 0 and 1.
Programmers like the hexadecimal representation with base 16, because
16 is a power of 2 (2 powered with 4). Then the representations can
be easily computed into each other. Besides a byte needs only 2 digits
(0 to 9, A to F) in the hexadecimal notation.

OS (Abbreviation for: Operating System)
A program needed to use the computer. It provides basic functions to
application software. New operating systems do complicated tasks like
program scheduling in multitasking systems, ...

OS/2 DOS box
A window under the 32 bit operating system OS/2 by IBM, where you
can run DOS programs. The so-called DOS compatibility box.

Overscan
The border surrounding the writable area on the screen.
On a PC it is very small but you can change its colour, e.g. in CPCEMU
with 'BORDER 10'. On the CPC the overscan is much wider, so
programmers have looked for possibilities to write to it. With a
programming trick it is possible to write to the whole screen.
This programming technique is called overscan.

Parameter
Variable with a fixed meaning, the behaviour of the program relies on it.

PC (Abbreviation for: Personal Computer)
Computer with a microprocessor as processor (or CPU=central processing
unit). Today a synonym for the IBM PC with 8086 or 8088 processor.
PC AT (advanced technology) are computers with a 80286, 80386 or 80486
processor.

PEEKs and POKEs:
╗BASIC instructions to modify the memory directly.
'PEEK(<address>)' is used to read a byte from memory,
'POKE <address>,<number>' modifies the memory. Programs with many PEEKs
and POKEs are hard to understand, but sometimes it is necessary to
break through the limits of BASIC, especially if the BASIC only has few
instructions.

PKUNZIP
Program by PK-Software to decompress ╗ZIP files.

RAM (Abbreviation for: Random Access Memory).
Memory chip. Memory of the computer.
The CPCs have 64KB RAM (kilo bytes) or 128KB. With hardware extensions
they could have up to 576KB RAM.

ROM (Abbreviation for: read-only-memory).
Memory chip. Memory that can only be read but not changed.
It is available directly after switching on the computer.
The CPCs have 16KB ROM ╗OS, 16KB ROM ╗BASIC and 16KB ROM for the AMSDOS.

ROM Image
File with the contents of a ╗ROM. If you read out a ROM and write the
bytes into a file you will get a ROM image.

RS-232
Serial Interface to connect monitors or printers to the computer.
(RS 232 C).

Schneider
German company, which sold the CPCs in Germany.

Screen mode

Setup
Changing ╗parameters of a program, so it behaves differently.
You can tell the setup, that you have a soundcard, that you want to use
a joystick, ...

SIMTEL
A big software archive in the USA.
The SimTel Software Repository is maintained by Coast to Coast
Telecommunications, Inc. (CCT) on its host computer on the Internet
located at "SimTel.Coast.NET". This archieve is mirrored (copied)
to other sides. One mirror site is Oakland University located at
"OAK.Oakland.Edu".

Snapshots
A memory dump completed by internal states of the ╗hardware chips.
It contains a complete momentary state description of the computer.
If the snapshot is reloaded, the computer is set back to the state
described in the snapshot.
Thus it is similar to a real snapshot, only inside the computer.

Software
Programs of a computer system.

Soundblaster
Soundcard of the company Creative Labs.

Spectrum
The Sinclair Spectrum is a home computer developed by the company Sinclair.

Turbo Pascal compiler
Pascal is a higher programming language which allows structured
programming, today used in many schools.
If one talks about Pascal, he means mostly Turbo Pascal, even if this
is only an extended Pascal by the company Borland. The Turbo Pascal
compiler is particular fast because it compiles the program in one pass.

Utility
Useful program.

VGA (Abbreviation for: Video Graphics Array)
Graphics standard on the PC. Successor of CGA (Colour Graphics
Adapter), MCGA (Multi Colour Graphics Adapter) and EGA (Enhanced
Graphics Adapter). Extended to SVGA (Super VGA) with higher resolution.

VGA-BIOS (Abbreviation for: VGA Basic Input Output Operating System)
The operation system for the ╗VGA graphics card.

Windows
Something you can put on ╗DOS.

Wiring box
A adapter to realize any connection between two connectors by using
short wires. In comparison to the ╗jumper box, the wires need not be
soldered.

Z80
An 8 bit processor developed by the company Zilog. It is upwards
compatible to Intel's 8080 and was very popular.
In the ╗CPC there is the Z80A which is clocked with 4 MHz.

Z80 instructions
Machine instructions which the ╗Z80 understands.
They are only number columns, so to remember them more easily mnemonics
were introduced, which are translated by an assembler into binary code.
The instruction "LD A,B" loads register A with the contents of register B
and is the same as the binary code 0x78.


ZIP
A special process to compress files.
The ╗archives have the extension "ZIP".





A.2 Bibliography



The CPC manual is indispensable for CPC beginners:
- Spital Ivor und Perry, Roland und Poel, William und Lawson,Cliff:
CPC 6128 Benutzerhandbuch, Schneider Computer Division 1985,
Originalausgabe (c) 1985 (my one contains 1895)
by AMSOFT, AMSTRAD Consumer Electronics plc and Locomotive
Software Ltd.

An excellent commented ROM listing, with starting chapters dealing
especially with the software side of the CPC:
- Janneck, Joern W. und Mossakowski,Till: ROM-Listing CPC 464/664/6128,
Markt & Technik Verlag 1986

On the contrary: unfriendly composed, rarely commented, dealing more with
the hardware side:
- Brueckmann, Englisch, Gertis: CPC 464 Intern mit kommentiertem
ROM-Listing, Data Becker 1985

Good to learn C, with many exercises:
- Kellay, Al and Pohl, Ira: A Book on C, Second Edition, 1990 by
Benjamin/Cummings Publishing Company, Inc.

The C++ standard book:
- Stroustrup, Bjarne: The C++ Programming Language, Second Edition,
Addison-Wesley, 1992

Another nice C++ book:
- Eckel, Bruce: C++ Inside & Out, 1993 by Osborne McGraw-Hill

Hints, how to write an understandable and good manual, gives:
- Boedicker, Dagmar: Handbuch-Knigge, Software Handbuecher schreiben
und beurteilen. Wissenschaftsverlag 1990





A.3 Index


The numbers behind the entries show you the chapter where they are described.

(not complete)

#ENDIF 4.2
#IFCPC 4.2
22DISK 5.1.2
Adapter, parallel 5.2
AMSDOS_DI 4.2
AMSDOS_SPDUP 4.2
BLASTER Environment 2.3.2
BREAK_MASK 4.2
Cassette 3.2.2
COLOUR 4.2
Configuration file 4.2
CPC 1.3
CPC Newsgroup 6.2
CPCEMU.CFG 4.2
CPCPARA.BAS 5.2
CPCREC.BAS 5.2
CPCTRANS.EXE 5.1.1
Debug Menu 7.3
DELAY 4.2
Disk 3.2.1
Disk Image 3.2.1
DRIVE_A 4.2
DRIVE_B 4.2
EMS_EI 4.2
EMS Memory 2.3.1
Function key 3.1
INT_FREQ 4.2
INT_RESUME 4.2
JOY_CALIBRATE 4.2
KBD_LANGUAGE 4.2
Keyboard 3.1
Menus 3.2.1
Multi Mode 4.1
MULTIMODE 4.2
PCPARA.EXE 5.2
PIO_PORT_B 4.2
PRINTER 4.2
RAM_SIZE 4.2
ROM_BLOCK 4.2
ROM_PATH 4.2
SBLASTER 4.2
SB_DELAY 4.2
Setup menu 4.1
SHOW_CONFIG 4.2
SNAPSHOT 4.2
Snapshot 3.2.3
SOUND 4.2
Soundblaster 2.3.2
TAPE_BYPASS 4.2
TAPE_PATH 4.2
TMP_PATH 4.2
VSYNC Bit 4.1


------------------------------------------------------------------------------
logout
------