z80

ZXNet echo conference «real.speccy»

From Leonid Mishankov To All 10 August 1998

Hi everyone, people!
I have several subjects here - files in .z80 format (those that are used on the PC in
emuls), so maybe someone knows their format, but what goes where, because it seems like all the banks are somehow crammed in. There are a lot of cool gams, but here's how to install them on a regular car... :(


From Tim Kelly To All 11 August 1998

I greet you from the bottom of my heart, All!

Mon Aug 10 1998, Leonid Mishankov squeezed the keyboard, hoping that the following words would reach All:

LM> Several subjects appeared here - files in .z80 format (those that
LM> are used on the PC in emulators), so maybe someone knows their format, yes what
LM> where, because it seems like all the banks are somehow shoved in. There are a lot of cool gams
LM>, but here's how to install them on a regular car... :(

That's it, folks, maybe someone knows what should be done with them, to drag them to the spec
? I've been interested in this for a long time, I have a compact, there are about 200 toys in the z80.
Maybe I can ask someone in ZX.SPECTRUM?
I only know that their lengths can vary be different - in some way
testing, it looks like the pages are full?

[Team Kelly]
Hasta la vista.
Tim Kelly


From Roman Petrov To All 14 August 1998

Hello! Dear Tim!

At 22:46, Tuesday August 11 1998 there was such a thing that
Tim Kelly scribbled a letter All:

TK> That's it, people, maybe someone knows what needs to be done with them in order to drag
TK> onto the spec? I’ve been interested in this for a long time, I have a compact, there are 200
TK> toys in the z80. Maybe I should ask someone in ZX.SPECTRUM?
TK> I only know that their lengths can be different - in some way
TK> they are testing, it seems, the fullness of the pages?
z80 - they are packed.
And try asking Slava Mednonogov. He knows their format. That's for sure, otherwise how would he have written ASM80? I actually have the source code (in C), but
I’m lazy to dig into it, especially since I’m in the prime of my coding powers now ;-)

With respect, Roman aka Megus of Brainwave Association.

[Team ZX-Spectrum] [Team Agatha Christie] [Team Metallica] [Team Iron Maiden]


From Valerij Kozhevnikov To All 14 August 1998

TK> is testing how the pages are full, it seems?

Just don’t laugh, right? You definitely didn’t expect any help from me :)
Of course, I’m a creepy plushkin, so after searching through my wilds of catalogues, I desperately found THIS! A long time ago, someone threw it somewhere, but I didn’t understand that it was for a pussy and discovered it by accident. Then he systematically forgot to bang, and then completely lost it. And so, with a wise finder, I went through a bunch of names and found it!

WBR, Jason.

From Vyacheslav Mednonogov To All 16 August 1998

I noticed that if there is at least one non-0 byte in the page, then
the entire page is written. Theoretically, Lunter himself understands .z80 with pages that are not completely
filled, but other emuls do not always.
Therefore, the different page lengths are due to page compression in versions 2.xx
and 3.xx (the simplest method, only chains of identical bytes are packed)

RP> And try asking Slava Mednonogova. He knows their format. That's for sure,
RP> otherwise how would he have written ASM80? I actually have the source code (in C), but
RP> I’m lazy to tinker with it, especially since I’m in the prime of my coding powers now ;-)


=== Cut ===

.Z80 files
-----------

The old .Z80 file format (for versions before 1.45) looks like this:

Offset Length Description

0 1 Register A
1 1 Register F
2 2 Register pair BC (least significant first, i.e. C)
4 2 Register pair HL
6 2 Program counter (PC)
8 2 Stack pointer (SP)
10 1 Interrupt register I
11 1 Regeneration register R (Bit 7 - not significant)
12 1 Bit 0 : Equal to the 7th bit of register R
Bit 1-3: Border color
Bit 4 : 1- imprinted BASIC SamRam
Bit 5 : 1- data block compressed
Bit 6-7: Not significant
13 2 Register pair DE
15 2 Register pair BC'
17 2 Register pair DE'
19 2 Register pair HL'
21 1 Register A'
22 1Register F'
23 2 Register IY (Low First)
25 2 Register IX
27 1 Interrupt Trigger, 0=DI, otherwise EI
28 1 Interrupt Trigger IFF2 (no role)
29 1 Bit 0-1: Interrupt mode (0, 1 or 2)
Bit 2 : 1=emulation 2nd release of Spectrum
Bit 3 : 1=Double interrupt rate
Bit 4-5: 1=High video sync
3=Low video sync
0.2=Normal
Bit 6-7: 0=Cursor/Protek/AGF-joystick
1=Kempston joystick
2=Sinclair-left joystick
3=Sinclair-right joystick

For the sake of compatibility, if byte 12 is equal to 255, then it is taken to be equal to 1.
This 30-byte header is followed by 48 kilobytes of Spectrum
memory. If bit-5 of the 12th byte is 1, then the memory dump is in a compressed format. The compression method is very simple. All
sequences of five identical bytes are replaced. Instead
ED ED xx yy is written. Here ED ED is the prefix, xx is the repeat factor, and yy is the repeat byte. So, only
sequences of five repeats or more are encoded. The exception is
sequences of bytes equal to ED. Even if it is only two
bytes, they are still packed ED ED 02 ED. And the last rule: any
byte immediately following the ED is not packed into a common block.
For example,we have the sequence ED 00 00 00 00 00 00. It is not
packed as ED ED ED 06 00, but rather as ED 00 ED ED 05 00. The block
ends with the end marker 00 ED ED 00.

This .Z80 file format was used by versions of the emulator before 1.45.
Starting with version 2.0, in connection with the support of memory print files
taken from the 128th Spectrum, a new format has appeared. this new format
is used for all prints, no matter 48 or 128. But the emulator
still understands the old format.

Despite the fact that the emulator understands the old format, it itself never
produces .Z80 files in the old format. But if desired, the new format
can be converted to the old one (of course only for 48K files) if
you use the ConvZ80 utility.

The new format starts with the same 30-byte header as
given above. But now bits 4 and 5 of the flag byte (12th) no longer
have a value, and bytes 6 and 7 are equal to zero, which indicates that this
is a file in a new format.

The first 30 bytes are followed by additional:

Offset Length Description

* 30 2 Length of the additional block (see below)
* 32 2 Program counter
* 34 1 Hardware mode (see below)
* 35 1 In emulation mode, SamRam contains the bit
state of the chip 74ls259.
In 128K mode it contains the lastoutput to
port 7FFD.
* 36 1 Contains 0FF if Interface-1 ROM is imprinted
* 37 1 Bit 0: 1 if R register emulation is enabled
Bit 1: 1 if LDIR emulation is enabled
* 38 1 Last output to port 7FFD.
* 39 16 Contents of music registers coprocessor
55 2 Clock counter (low)
57 1 Clock counter (high)
58 1 Flag byte. Used by Spectator
(Spectrum emulator for QL computers)
When loading, the Z80 ignores it, and when unloading
sets it to 0.
59 1 0FF, if the Gordon ROM is printed
60 1 0FF, if the M128 ROM is printed. Must be 0.
61 1 0FF if 0-8191 is RAM
62 1 0FF if 8192-16383 is RAM
63 10 Keys defined as a custom
joystick.
73 10 Keyboard data for the keys specified
above.
83 1 Device type "Gordon". 0=Disciple + Epson,
1=Disciple + HP, 16=Plus D
84 1 INHIBIT button status of Disciple
interface: 0=interface disabled, except joysticks
: 0FF=connected
85 1 INHIBIT flag of Disciple
interface: 0=ROM can be typed;
: 0FF=cannot be typed.


The value of the contents of position 30 is equal to 23 for emulator version 2.01
and equal to 54 for version 3.0. Positions marked with "*",
correspond to header version 2.01 andare interpreted by version 3.0 exactly
in the same way, except for byte 34:

Number Value in version 2.01 Value in version 3.0

0 48k 48k
1 48k + If.1 48k + If.1
2 SamRam 48k + M.G.T.
3 128k SamRam
4 128k + If.1 128k
5 - 128k + If.1
6 - 128k + M.G.T.

The high byte of the clock counter counts clock cycles modulo 4. Immediately
after the ULA generates its interrupt (every 20
milliseconds), it is equal to three and is incremented by one every
five emulated milliseconds At these 1/200 second intervals
the low byte of the counter counts from 17472 to zero, giving 69888
clock cycles per frame.

Byte 60 must be zero because the contents of the Multiface 128's RAM are not stored in the print file. If M128 was imprinted when the print was saved, the emulated program will most likely not
work when it is next loaded.

Bytes 61 and 62 are functions of other flags, such as bytes 34, 59, 60, and 83.

After the header are blocks of memory, each of which contains packed
data of a 16-kilobyte block. Compression is performed according to the old scheme,
with the exception of the end marker, which is now missing.
The structure of the memory block is as follows:

Byte Length Description

0 2 Data length (without this three-byte header)
2 1 Pageblock number
3 [0] Packed data

Page numbering depends on the hardware mode:

Page In 48 mode In 128 mode In SamRam mode

0 48K ROM ROM (old) 48K ROM
1 Interface-1 ROM, Disciple ROM or Plus D ROM,
according to what is specified
2 - ROM (new) SamRam ROM (BASIC)
3 - page 0 ROM SamRam (monitor,..)
4 8000-bfff page 1 Regular 8000-bfff
5 c000-ffff page 2 Regular c000-ffff
6 - page 3 Shadow 8000-bfff
7 - page 4 Shadow c000-ffff
8 4000-7fff page 5 4000-7fff
9 - page 6 -
10 - page 7 -
11 Multiface ROM Multiface ROM

In 48K mode, pages 4,5 and 8 are unloaded. In SamRam mode,
pages from 4 to 8 are saved. In 128K mode - all pages from 3 to 10. End
marker missing.

=== Cut ===

Warm greetings, Slava!

From Tim Kelly To All 16 August 1998

RP> exactly, otherwise how would he write ASM80? I actually have the source code
RP> (in C), but I’m lazy to dig into it, especially since my coding powers are now in full swing
RP> ;-)

:) Fame is present here, according to unspecified data :) So he will
tell... :)

From Tim Kelly To All 16 August 1998

VK> Why were you silent?

:)

VK> Just don’t laugh, right? You definitely didn’t expect any help from me
VK> :)

VK> I am, of course, a terrible plushkin, therefore, after rummaging around in my wilds of catalogs,
VK> I desperately found THIS! It’s been a long time since someone threw it somewhere, but I didn’t realize that it was for a puss and accidentally discovered it. Then he systematically forgot to bang, and then completely lost it. And so, with a wise finder, VK went through a bunch of names and found it!

:)) Thank you, I hope the real people won’t be offended...

From Tim Kelly To All 17 August 1998

I greet you from the bottom of my heart, All!

Let’s probably finish with the subject. The information has been uploaded - use it.
The discussion, if anyone wants, can be continued in ZX.SPECTRUM
You’ll be in a minute and send me some emuls here :)