Академический Документы
Профессиональный Документы
Культура Документы
* Realvideo
Enabling realvideo:
-On Spectrum: rainbow effects on display & border, inves effects, snow effect, video out to file,
interlaced mode. Display drawn every scanline
-On ZX80/81: hi-resolution and non standard modes, loading/saving stripes, interlaced mode.
Display drawn every scanline
Without realvideo:
-On Spectrum: no rainbow, no inves effects, no snow effect, no video out, no interlaced. Display
drawn once per frame, supports simulated ZX80/81 Screen
-On ZX80/81: no hi-res, no loading/savig stripes, no interlaced. Display drawn once per frame, only
standard text mode
Rainbow Hi-res Inves Snow Video out Interlaced Load Stripes Simulated
ZX80/81
screen
Realvideo Y - Y Y Y Y - N
Spectrum
No realvideo N - N N N N - Y
Spectrum
Realvideo - Y - - Y Y Y -
ZX80/81
No real - N - - N N N -
ZX80/81
-Y: Supported
-N: Not supported
- - : Not aplicable
* Utilities:
1
SMPATAP Program to convert sound from a spectrum tape to .TAP files
TAPABIN Program to convert data from .TAP files to .BIN files
SP_Z80 Program to convert between SP and Z80 formats (only 48k)
LEEZX81 Program to convert sound from a zx81 tape to .P files
Others:
ZX81:
MAZOGS.P Mazogs Game for the ZX81, by Don Priestley
3DMONSTERMAZE.P 3-D Monster Maze for the ZX81, by J. K. Greye Software
SOUND.P Program that makes some different sound tones through the cassette
port
ZX80:
QS Defenda (Quicksilva 1981) Reconstruction.o: Defender from Quicksilva. Uses QS Sound
chip. You may try it with the real video option; it uses a 32 row display
Snapshot Files
The first versions of my previous emulator (ZXSpectr) worked only with SP files, from the
SPECTRUM emulator by Pedro Gimeno. Then, I created my own file format, called ZX, which is
derived from SP format but with more extra data (ZX header is like SP but with 256 bytes more). I
know there's an emulator which uses files with extension ZX, but they aren't related with my ZX
files.
The description of SP format is the following (I have copied it from SPECTRUM.DOC without
changing anything):
2
Offset Longitud Descripción
actualmente sólo genera programas de 49152
bytes)
4 1 palabra Posición inicial del programa (el emulador
actualmente sólo genera programas que comiencen
en la pos. 16384)
6 1 palabra Registro BC del Z80
8 1 palabra Registro DE del Z80
10 1 palabra Registro HL del Z80
12 1 palabra Registro AF del Z80
14 1 palabra Registro IX del Z80
16 1 palabra Registro IY del Z80
18 1 palabra Registro BC' del Z80
20 1 palabra Registro DE' del Z80
22 1 palabra Registro HL' del Z80
24 1 palabra Registro AF' del Z80
26 1 byte Registro R (de refresco) del Z80
27 1 byte Registro I (de interrupciones) del Z80
28 1 palabra Registro SP del Z80
30 1 palabra Registro PC del Z80
32 1 palabra Reservada para uso futuro, siempre 0
34 1 byte Color del borde al comenzar
35 1 byte Reservado para uso futuro, siempre 0
36 1 palabra Palabra de estado codificada por bits.
Formato:
Bit Descripción
15-8 Reservados para uso futuro
7-6 Reservados para uso interno, siempre 0
5 Estado del Flash:
0 - tinta INK, papel PAPER
1 - tinta PAPER, papel INK
4 Interrupción pendiente de ejecutarse
3 Reservado para uso futuro
2 Biestable IFF2 (uso interno)
1 Modo de interrupción: 0=IM1; 1=IM2
0 Biestable IFF1 (estado de interrupción):
0 - Interrupciones desactivadas (DI)
1 - Interrupciones activadas (EI)
3
ZX format has 6 versions, version 1 is the first one and version 6 is the one used now. Values
used on a version an higher are indicated with (v. [version]+), for example (v. 2+) for values used
on version 2 and higher, except from values used since version 1, which has not (v. [version]+)
indication.
Version 1, 2 and 3 works on ZEsarUX and ZXSpectr emulators. Version 4 and higher only works
on ZEsarUX.
Version 1 only allows saving Spectrum 48k snapshots.
Version 2 allows saving Spectrum 48k and Spectrum +2A Spanish.
Version 3 only have one more value, the Machine emulated, and two bits used in zx80/81 vsync.
Values not used in a version are normally saved as 255, for example, snapshot_day used on
version 4, on previous versions this value will be saved as 255.
4
Offset Field Description
23 reg_h_ BYTE
24 reg_f_ BYTE
25 reg_a_ BYTE
26 reg_r BYTE
27 reg_i BYTE
28 reg_sp WORD
30 reg_pc WORD
32 reservado1 WORD=0
34 border BYTE
35 reservado2 BYTE=0 In version 1 of header, it was a WORD an
reservado20 didn't exist.
36 bits_estado Bit Description
7-6 Reserved for internal use, always 0
5 Flash state: 0 - ink INK, paper PAPER. 1 - ink
PAPER, paper INK
4 Interruption pending
3 Reserved for internal use
2 Flip-flop IFF2 (internal use)
1 Interrupt mode: 0=IM1, 1=IM2
0 Flip-flop IFF1 (interrupt state):
0 – Interrupts disabled (DI)
1 – Interrupts enabled (EI)
The emulator only uses bit 5 (flash state), bit 1
(mode IM0/IM1 or IM2) and bit 0 (DI or EI)
5
Offset Field Description
disabled autofire, this field can be any value except 0
46 sonido BYTE 1 if sound is enabled (port 254)
47 bits_estado0 BYTE The meaning is the following:
Bit Description
7 Keyboard issue. Not used on ZEsarUX
6 1 if auto-fire enabled. Not used on version 3
5 0 if Flash refresh is enabled. Obsolete
4 1 if snapshot is 128k (version 2+)
3 To 1 if border changing is not possible using OUT 211,
value (version 2+)
2 Not used
1 1 if screen saver is enabled
0 CGA Palette (v. 2 only)
0=Black,Green,Red,Yellow
1=Cyan,Magenta,White
6
Offset Field Description
snapshots)
11=TK90X
12=TK90XS
13=TK95
14=ZX80
15=ZX81
16=Z88 (v.5+)
17=Jupiter Ace (v. 6+)
18=Amstrad CPC 464 (v. 6+)
19=Timex TS 2068 (v. 6+)
20=ZX-Uno (v.6+)
21=Chloe 140SE (v.6+)
22=Chloe 280SE (v.6+)
23=Prism (v.6+)
24=Spectrum 48k (Spanish) (v.6+)
72 bits_estado2 BYTE The meaning is the following:
Bit Description
7 1 if AY Chip enabled (v. 4+)
6 1 if 16k RAM block in C000H (for zx80, zx81) (v. 4+)
5 1 if 16k RAM block in 8000H (for zx80, zx81) (v. 4+)
4 1 if 8k RAM block in 2000H (for zx80, zx81) (v. 4+)
3 1 if wrx enabled (for zx80, zx81) (v. 4+)
2 1 if real video enabled (v. 4+)
1 1 if hsync generator is active (for zx80, zx81) (v. 3+)
0 1 if nmi generator is active (for zx80, zx81) (v. 3+)
7
Offset Field Description
79 snapshot_hour BYTE Hour when the snapshot was saved
80 snapshot_minute BYTE Minute when the snapshot was saved
81 zx8081ram BYTE Ram assigned to ZX80/81 (1..16), not counting
ram packs on 2000H, 8000H or C000H
82 invesrompoke BYTE Last value set as Inves low RAM Poke from
menu. 255 by default
83 invesuladelay Do NOT use. It was : BYTE Inves ULA delay factor. It
is not used since ZEsarUX 3.1 and must never be used
84 secondtrapaddress WORD Stdout second trap char address. Set to 0 if not
used
86 thirdtrapaddress WORD Stdout third trap char address. Set to 0 if not
used
88 stdout_simpletext_line BYTE Stdout/simpletext line width
width
89 stdoutcharfilter BYTE Stdout char filter (0=none, 1=Generic, 2=AD
adventures 42 char, 3=PAWS Spanish accents,
4=Hobbit)
90 joystick_type BYTE Joystick type emulation: (0=none, 1=kempston,
2=sinclair1, 3=sinclair2, 4=cursor, 5=cursor&shift,
6=opqa_space, 7=fuller, 8=zebra, 9=mikrogen,
10=zxpand) (10 on ZEsarUX 3.1 and higher)
91 lightgun_type BYTE Lightgun type emulation: (0=none, 1=sinclair1,
2=sinclair2, 3=kempston, 4=aychip)
Next values are used on version 5 and higher
92 z88_internal_rom_size BYTE. Z88 Internal ROM size (divided by 16384)
93 z88_internal_ram_size BYTE. Z88 Internal RAM size (divided by 16384)
94 z88_slots_type BYTE. Z88. Indicates which types of slots are
inserted. If some slot doesn't have card, type has no
sense. Value is codificated as:
Bit Description
6-7 Unused
4-5 Slot 3 Memory type
2-3 Slot 2 Memory type
0-1 Slot 1 Memory type
Type can be:
0: RAM
1: Hybrid RAM+EPROM (was used as ROM type on
ZEsarUX 2.0)
2: EPROM
3: FLASH
Note: EPROM, Hybrid EPROM+RAM or FLASH on
8
Offset Field Description
slot 3 are not saved on zx snapshots, but are indicated
here to warn user that it must be inserted manually an
eprom or flash
95 z88_slot1_size BYTE. Z88 Slot 1 size (divided by 16384)
96 z88_slot2_size BYTE. Z88 Slot 2 size (divided by 16384)
97 z88_slot3_size BYTE. Z88 Slot 3 size (divided by 16384)
98 z88_pb0 WORD. Z88 Blink register PB0
100 z88_pb1 WORD. Z88 Blink register PB1
102 z88_pb2 WORD. Z88 Blink register PB2
104 z88_pb3 WORD. Z88 Blink register PB3
106 z88_sbr WORD. Z88 Blink register SBR
108 z88_com BYTE. Z88 Blink register COM
109 z88_int BYTE. Z88 Blink register INT
110 z88_sta BYTE. Z88 Blink register STA
111 z88_epr BYTE. Z88 Blink register EPR
112 z88_tmk BYTE. Z88 Blink register TMK
113 z88_tsta BYTE. Z88 Blink register TSTA
114 z88_mapped_seg0 BYTE. Z88 Bank mapped to memory segment 0
115 z88_mapped_seg1 BYTE. Z88 Bank mapped to memory segment 1
116 z88_mapped_seg2 BYTE. Z88 Bank mapped to memory segment 2
117 z88_mapped_seg3 BYTE. Z88 Bank mapped to memory segment 3
118 z88_tim0 BYTE. Z88 Blink register TIM0
119 z88_tim1 BYTE. Z88 Blink register TIM1
120 z88_tim2 BYTE. Z88 Blink register TIM2
121 z88_tim3 BYTE. Z88 Blink register TIM3
122 z88_tim4 BYTE. Z88 Blink register TIM4
123 z88_rxd BYTE. Z88 Blink register RXD
124 z88_rxe BYTE. Z88 Blink register RXE
125 z88_rxc BYTE. Z88 Blink register RXC
126 z88_txd BYTE. Z88 Blink register TXD
127 z88_txc BYTE. Z88 Blink register TXC
128 z88_umk BYTE. Z88 Blink register UMK
129 z88_uit BYTE. Z88 Blink register UIT
Next values are used on version 6 and higher
130 ace_ram BYTE. KB of Jupiter Ace Ram. 3, 19 or 35
9
Offset Field Description
131 timex_port_f4 BYTE. Last out to port F4H
132 timex_port_ff BYTE. Last out to port FFH
133 bits_estado4 Bit Description
7 Not used
6 Not used
5 Not used
4 Not used
3 Not used
2 1 if Timex video support present
1 1 if ULAPlus mode active
0 1 if ULAPlus support present
Note: WORD values are saved LSB, I mean, low 8 bits first.
From “DATOS” memory bytes are saved, in a compressed way, explained later. If the saved
machine is an Spectrum 16kb, 48kb (with all variants), ZX80, ZX81 then data is saved from address
16384 until 65535. The exception here is ZX80/81 with 8KB RAM block enabled on 2000H. Then,
data is saved from address 8192 until 65536. On Jupiter Ace, data is saved from 8192 until 65535.
If it's 128k (Spectrum 128k,+2 and +2A machines), data are saved from RAM 0 until RAM 7.
The emulator generates a 48k file if it runs in /48k mode, or if it's in 48 BASIC mode, else 128k are
saved.
If it's Z88, data is saved the following way:
• Internal ROM
• Internal RAM
• Memory Slot 1 (if present)
• Memory Slot 2 (if present)
• Memory Slot 3 (if present)
Memory slots are saved only if they are present. Note that EPROM or FLASH cards on slot 3
are not saved, so they need to point to an eprom or flash file. EPROM or FLASH cards on slot 1 or
2 are saved. RAM cards are always saved.
Data on Z88 is saved on 16kb blocks, every block has a header with the following information:
• BYTE Bank number
• WORD Size of the following. So the 16kb block is compressed, it is needed to indicate the
size of the block
Data is normally saved in this order:
• Internal ROM: Bank 0, Bank 1, Bank 2... up to all the used internal ROM size. For example
if the internal ROM is 128kb size, we only save 8 blocks
10
• Internal RAM: Bank 20H, Bank 21H... up to all the used internal RAM size
• Memory Slot 1: Bank 40H, Bank 41H... up to all the used memory slot 1 size
• Memory Slot 2: Bank 80H, Bank 81H... up to all the used memory slot 2 size
• Memory Slot 3: Bank C0H, Bank C1H... up to all the used memory slot 3 size
Although the data is saved in this order, it can be saved in a different way, starting by internal
RAM and then the internal ROM for example
Since Version 6, when comes data, there are also additional parameters and headers depending on
the machine emulated:
z80_byte cpc_crtc_registers[32];
z80_byte cpc_border_color;
z80_byte cpc_last_selected_register;
4 blocks of 16 kb each compressed. Numbering blocks 0,1,2,3
If machine is ZX-Uno
z80_byte last_port_FC3B=0;
z80_byte zxuno_spi_bus[8];
z80_byte zxuno_spi_bus_index=0;
z80_byte next_spi_read_byte;
z80_byte zxuno_spi_status_register;
11
int last_spi_write_address; (24 bit)
int last_spi_read_address; (24 bit)
32 blocks of 16 kb each compressed. Numbering blocks 0-31
If machine is Prism
z80_byte prism_rom_page;
prism_ula2_border_colour
prism_ula2_palette_control_colour
prism_ula2_palette_control_index
prism_ula2_palette_control_rgb[3]
prism_ula2_registers[16]
z80_int prism_palette_two[256];
32 blocks of 16 kb each compressed. For RAM. Numbering blocks 0,2,4,6,...
2 blocks of 16 kb each compressed. For VRAM. Numbering blocks 240,242
Compressed data:
All data saved is compressed (except, logically, the ZX header), in the following way:
● If a byte is repeated more than 4 times, it is saved like:
221,221,byte to repeat,times repeated
● If there's a 221 byte just before the repetition, it is saved as:
221 before repetition,byte to repeat,221,221,byte to repeat,times repeated-1
12
The data saved is:
10, 221,221,20,6, 221,221,20,7, 4
13
Included utilities
In this chapter we use the SMP and the RWA audio files format.
SMP format was used in the audio edition program Fast Tracker, which it was the one I started to
do some tape conversion tests. This format is raw, mono, 8 bits unsigned, and at 11111Hz.
RWA is like the SMP format, but at 15600 Hz
Using audio conversion utilities you can convert wav files to smp and vice versa. For example,
in Linux, with the sox program, you can convert from .wav to .smp with the command:
sox file.wav -t .raw -r 11111 -b 8 -e unsigned -c 1 file.smp
SMPATAP
This program is used to read data from a SMP file and save it as a TAP file.
When we run the program, SMP file and TAP file must be written (both with extension). When it
loads a block, you must press any key except the N to save the block.
LEEZX81_UNIX
This program is used to read data from a SMP file and save it as a .P file.
When we run the program, SMP file and .P file must be written (both with extension).
TAPABIN
This program is used to extract data blocks from a TAP file and save them with BIN format.
When the program starts, you must specify the TAP and BIN files to use (both with extension).
When it reads a block, you must press any key except the N to save it. The file saved is the data get
from a block without flag and checksum; for example: if we want to save a Spectrum screen in BIN
format, we must save the block shown as: "Flag:255 Longitud:6912" and not the block:
"Bytes:Screen Longitud:6912 Inicio:16384", if not, we would save the header, I mean, 17 bytes.
SP_Z80
This program is used to convert files between SP and Z80 formats. You must specify the source
file and the target file (both with extension, always .SP or .Z80). It can only convert 48k files.
FILE_TO_EPROM
This program is used to write a file on a new Z88 eprom card. It creates a new eprom card with
the file you indicate in it.
14
15
Utilities in TAP format
SPED52.TAP
This tape includes an assembler/disassembler for ZX Spectrum 128k, with its source code. This
assembler (SPED) uses the whole 128k of memory. The SPED uses RAM1, and the object code
uses RAM 4; source code uses RAM "48" (5,2,0) and RAMs 6 and 7, having a maximum source
code of 74549 bytes (41781+16384+16384).
Sentences ORG and ENT are a bit different from other assemblers. ORG always indicates to
which address the object code is generated; normally, we assemble at 49152, which corresponds to
RAM 4. ENT indicates to which address labels are referred (in a relocatable program, ENT is often
0).
Operator $ always indicates to which address is referred the line where it is situated (indicated
with ENT). Operator !, that I have invented, shows where the object code is being generated
(indicated with ORG).
To see the listing while assembling, you must write in the source code the LST+ operator, and to
make it disappear, LST- .
The assembler can generate a debug info, that consists in a table with each memory address of
object code with its corresponding line of source code. This table uses RAM 7; we may see if 3rd
block of source code is used, debug info can't be used. The maximum size of the table is 16k (4096
lines). To tell the assembler create debug info, use the operator DPR+ in the source code (and to
disable it, DPR-).
When we go to the disassembler, if there's debug info, the original line of the source code will be
shown.
Label table uses RAM 3, having a maximum of 16k for labels (it means 1260 labels).
The editor also uses RAM 3, for copying text in a buffer to make the typical actions of
Copy/Paste/Move; the maximum is 16k of text.
I don't want to explain all the options, because it has some help screens (sorry, in Spanish) (in the
main environment and in the disassembler, key H; in the editor, Extended Mode and H). Also, you
have the source code to see the whole program.
Only one more thing, the SPED format. The assembler only recognizes source code with headers
of SPED format, which have a size of 34 bytes but they can be read from BASIC. The description
of the header is:
16
Offset Length Description
17 1 Checksum byte. It is used to cheat to BASIC and
tell the header is 17 bytes length; the header can
be read in a real Spectrum and in the emulator
18 1 Recording day of source code
19 1 Recording month of source code
20 1 Recording (Year-1980) of source code. It is
ready to year 2000!
22 2 Word which indicates the length of the second
text block. If there's not, is 0
24 2 Word which indicates the length of the third text
block. It there's not, is 0
26 9 9 Bytes to 255, used in future versions
After the header comes the text, formed by 1, 2 or 3 blocks with flag 255.
Text blocks are saved in ASCII format, setting bit 7 of a character to make a tabulator, and code
13 for line end. Of all the assemblers that I have for the Spectrum (SPED, GENS, TED), this
assembler uses the shortest text format.
CONVERSO.TAP
This program is a source code converter of formats GENS, TED and SPED. Possible
conversions are: GEN-> TED, GEN->SPED, TED->SPED. Source code is included, in SPED
format. Note: TED is a format of an editor/assembler which appeared in the MICROHOBBY
magazine, of Hobby Press.
REALDEBU.TAP
It consists on 2 disassemblers, one for 48k and the other for 128k. They are both like MONS.
Both source codes are included, in SPED format. They are both named as (R)EAL DEBUG, that's
because they control perfectly the R register, and some other disassemblers, like MONS, don't.
To know the keys of the 48k run the 128k disassembler, it has a help screen: there are only two
options that the 48k one doesn't have, RAM selection and Assembly.
The 128k disassembler uses RAM 1, plus a block of 256 bytes length placed below address
17
49152. To run it:
CLEAR can be whatever you want, but it must be below 49152. The "address" variable indicates
where the 256 bytes block is placed; it can be placed, for example, at 23296. If "address" is other
than 23296, then the CLEAR must be below "address".
CURSORDR.TAP
This is a painting program, the CURSOR DRAW, which also includes the source code in SPED
format.
18