|
CPCEMU - Internal
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
-
- 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
-
- Overview of the debug menu
- Preliminaries
- Overview of the commands
- Manipulation of registers
- 7.4 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
7.2 Internal overview of CPCEMU features
How compatible is CPCEMU really?
7.2.1 The Z80 CPU (Ther 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 = 160 x 200 x 16
- mode 1 = 320 x 200 x 4
- mode 2 = 640 x 200 x 2
- simple multi modes
- 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 Dktronics 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 fiN)d 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
Overview of the commands
- R)un:
- r [<address>] : executes only the actual displayed instruction. 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 (see also appendix "Structure of the AMSDOS header"). 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.
- fiN)d (Find a byte string):
- n : Same as I)nput, input the byte string to find. Use "??" (or "?") as placeholder for an arbitrary byte. This only makes sense within the byte string
Then the avtive 64KB memory is searched for the string and all matching adresses are output.
- 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-valuet>" 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 0 <
block 4 M W C c 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 W L a c <
block 0 M U b W 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 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,
- <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:
- The PC printer port must be reprogrammed for input and I am not sure if that is possible on all PCs and
- 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, Im 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 inch 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"
("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 (sector ID information) |
19+i |
head number (sector ID information) |
1A+i |
sector number (sector ID information) |
1B+i |
BPS (sector ID information) |
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 quotation marks, separated by commas.
- 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,...
- Name of program (up to 20 characters)
- Description (up to 20 characters)
- Type (1 character):
("t"=Tape, "d"=disk, "a"=all), currently ignored.
- Address of poke (4 characters, hexadecimal):
Specifies the memory location to be modified.
- Byte for the poke (2 characters, hexadecimal or ??):
If "??", you have to input a value, e.g. number of lifes.
- 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) (inofficial)
- 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 - 16.8.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 © 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. Thats 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.)
Chapter 8. Appendix
© Marco Vieth, Mai 1998
Marco Vieth, 19.04.2008 14:14:56
|