Appendix B fileformats

Z80 File

contents of a z80 file follows the orginal header-save format:
 
32 bytes headerblock memory dump rest-bytes

 
headerblock: 
WORD      aadr  address of the first byte                     LSB_FIRST
WORD      eadr address of the last byte                      LSB_FIRST
WORD      sadr startaddress of the program                   LSB_FIRST
char [6]  copyright user depend string, mostly used for author-notification
BYTE      type type information - theres no strict definition what letters to use. Most common are the following: 
C - exeCutable( start it with command J [SAdr] 
B - Basic              M - Memorydump/Machinecode 
D - (hex)Dump/Document s - AssemblerSource
P - Pascal-source      b - tiny-basic-source
T - Textfile
char [3]  headermark headermark used for cassette-interface to detect first block. Its 0xd3 0xd3 0xd3 = ´...´
char [16] filename  16-Bytes "all characters are possible" filename

memory dump contains at least eadr-aadr+1 bytes.

Regarding to special implementations of save-algorithms length of rest-bytes not always zero. the intension was: save all data you get! don´t lose anything!
Let have a look at 2 examples - Each block of a Z1013 file contains 32 bytes netto data. That means: if you save from 0x100 to 0x200, length is 257 bytes and savefile has to use 9 blocks of data (with 32 bytes per block) and with header (1 block) the z80 filelength is 320 bytes.
Another problem: when you convert a KC87 - basic file to z80. Each block contains 128 bytes of data. So you may think filelength is rounded to the next 128-border. But the first block contains only 115 byte of data. Lets see structure of the first block:

char [3]   headermark
char [8]   filename
WORD       filelength
BYTE [115] data

For compatibility with z1013 hc-basic I´ve added a block (from 0x2bc0 to 0x2c00) of 41 bytes, that contains information about filelength.

z1013keys.txt

To prevent to load a keyboard-layout every-time you change the running program, just edit the file z1013keys.txt
The keyword "LAYOUT:" follows the layout-file you can use the fullpath filename or a relative filename ( relativ to directory you start the emu). After the layout-file was set, a list of filenames follows until fileEOF or next keyword "LAYOUT:".
Detection of the layout-file to use depends only on filename. Not path information is required.

Example:

LAYOUT:
./system/oldkeys.z80
ghost.z80
LAYOUT:
/var/z1013emu/system/wizard_keys.z80
wizard_of_danger.z80

z1013emu.conf    or   .z1013emu.rc

the name of the configuration file depends on the emulators name. So if executable has the name emuV126.exe you have to name your config file emuV126.exe.conf or .emuV126.exe.rc or you make a symbolic link. If the executable is named z1013emu, after the emulator starts it will take a look into local directory and look for a file called z1013emu.conf, then it will look for $HOME/.z1013emu.rc. If there´s no config file found it will look for /etc/z1013emu.conf.
The contens of this config-file referns close to the commandline options. See -h for a complete list of options. Sometimes there are shortcuts for a special optionnames. In config-file only the long optionname has been used. Instead of k = keyboard.z80 you have to write keyboard = keyboard.z80
 
 
long optionname  argument comments
rc  = filename filename to the config file - seldom used, because you reroute to another config-file
help  = YES emulator prints only the long-help and exits; usually this option is set to NO or missing
quiet  = YES the emulator produces no messages - exept error messages
debug =YES print debug messages
display = displayname  X server to contact eg localhost:0.0 - if you dont need it don´t use it
version  = YES print out the version and compile date then exits; usually this option is set to NO or missing
zoom = 1 userscreen size is { (zoom+1)*256 x (zoom+1)*256 }
filename = soft/digger.z80 initially load an z1013-file - don´t use it with -st or -status - you can also autostart a basic-file (see -bi)
auto = YES if -filename options is set, program will be started ; use it only in conjuction with -filename
readop = 50 intension was: synchonize time for a read-cycle with time for write [lower ist faster]
writeop = 50 intension was: synchonize time for a write-cycle with time for read [lower ist faster]
stepop = 1 step over 1 Opcode(s), then ask for any request from system              [lower ist better, higher is faster]
monitor = system/monitor.z80 filename of the monitor-rom to load - if there´s no special purpose use monitor.z80
charset = system/charset.z80 charset-rom to load. ther where different charsets available if packed original.z80 and charset.z80 
best = NO enables high-quality-charset for zoom==1&2 - Say NO if you want to look at a real Z1013
keyboard = system/keyboard.z80 filename of the keyboard table to map keys; common used file is keyboard.z80
font = fixed use xfontsel to choose your prefered font - for menus and texts
basic = system/kc_basic_dump.z80 filepath to a complete initialized basic interpreter - used for -f 
software = soft path to z1013 software ; it´s used when you open "LOAD" dialog
norandom = NO everytime you starts the emulator a new random seed ist generated use NO to forbid a random seed
status = sokoban_lvl6_stat.bin filename to a saved emulatorstatus- it will be restored after emulator starts - don´t use with -f or -filename
printer = output.txt enables printer support: appends every byte, thats printed, to filename output.txt ; if output.txt not exists it will be created

a config file from /etc/z1013.conf may looks like this:

#[YES|NO] yes disables output messages - except errors
quiet   = NO
#[YES|NO] no disables debug informations
debug   = NO
# [0|1|2|3|4...] windowsize dx,dy=(zoom+1)*256 pixel
zoom    = 2
stepop  = 0
writeop = 50
readop  = 50
monitor  = /var/z1013emu/system/monitor.z80
# USE [original.z80|charset.z80]
charset  = /var/z1013emu/system/original.z80
# NO SHOWS THE TRUE CHARSET, AND NO FUNKY FONT
best     = NO
keyboard = /var/z1013emu/system/keyboard.z80
basic    = /var/z1013emu/system/kc_basic_dump.z80
software = /var/z1013emu/soft
printer  = output.txt

z1013save.txt

The Emulator has now a new save mechanism. You can save a memory area (eg. savegames).

You can use it by pressing F11 (be careful! It overwrites the old contents. So make sure, you REALLY WANT to save.) or patch the programs like this:

turtle_player.z80:
...
07A3 C3 00 10   JMP 1000
...
1000 ED FE 02   Emu-Exeption 02 - means SaveMemoryArea()
1003 21 DA EC   LD HL,EC21 - copied from 07A3
1006 C3 A6 07   JMP 07A6 - next intruction
...

The contents of the "z1013save.txt" follows like this:
SAVEGAME:
3f00 3fff turtle_save.z80
turtle_player.z80
SAVEGAME:
...
After keyword SAVEGAME: the adresses of memory areas follows then the filename you want to save to.

Hobbes 99/5/5