Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"They ought to make butt-flavored cat food." --Gallagher


devel / comp.os.cpm / Tools for inspecting z80pack core files

SubjectAuthor
o Tools for inspecting z80pack core filesPaolo Amoroso

1
Tools for inspecting z80pack core files

<1bad5dc3-f910-4efa-b0e3-3791ef05557en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2900&group=comp.os.cpm#2900

  copy link   Newsgroups: comp.os.cpm
X-Received: by 2002:a05:622a:110:: with SMTP id u16mr20318496qtw.63.1636890175777;
Sun, 14 Nov 2021 03:42:55 -0800 (PST)
X-Received: by 2002:aca:58d6:: with SMTP id m205mr39080283oib.126.1636890175538;
Sun, 14 Nov 2021 03:42:55 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.cpm
Date: Sun, 14 Nov 2021 03:42:55 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=5.94.139.184; posting-account=uOUOHg4AAADo8AO9B3SI43ekV3AA6lU0
NNTP-Posting-Host: 5.94.139.184
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1bad5dc3-f910-4efa-b0e3-3791ef05557en@googlegroups.com>
Subject: Tools for inspecting z80pack core files
From: paolo.am...@gmail.com (Paolo Amoroso)
Injection-Date: Sun, 14 Nov 2021 11:42:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 84
 by: Paolo Amoroso - Sun, 14 Nov 2021 11:42 UTC

When running z80pack with the -s option, the emulator saves the machine state to the file core.z80. The simple binary format of the core file is documented by the code of the save_core()[1] function in file sim0.c of z80pack's source tree.

I wrote two Bash scripts for inspecting core files. These very simple tools are essentially wrappers around hexdump that pass the proper arguments to isolate the right parts of the file and format the output. The scripts work for me and may be a starting point for further enhancements.

The first script, z80regs, prints the values of the registers stored in a core file. Here's the source:

#!/bin/sh

# Print the Z80 register values in a z80pack core file
# # Usage:
# # z80regs [filename]
# # where filename is optional and defaults to core.z80

CORE=${1:-core.z80}

hexdump $CORE -v -n 27 -e \
'1/1 "A : %02X" 1/1 " F : %02X"'\
'1/1 "\tB : %02X" 1/1 " C : %02X"'\
'1/1 "\tD : %02X" 1/1 " E : %02X"'\
'1/1 "\tH : %02X" 1/1 " L : %02X\n"'\
'1/1 "A`: %02X" 1/1 " F`: %02X"'\
'1/1 "\tB`: %02X" 1/1 " C`: %02X"'\
'1/1 "\tD`: %02X" 1/1 " E`: %02X"'\
'1/1 "\tH`: %02X" 1/1 " L`: %02X\n"'\
'1/1 "I: %02X" 1/1 "\t\tIFF: %02X" 1/1 "\t\tR: %02X\n"'\
'1/2 "PC: %04X" 1/2 "\tSP: %04X\n"'\
'1/2 "IX: %04X" 1/2 "\tIY: %04X" "\n"'

A sample run shows what the output looks like:

$ z80regs
A : 00 F : 6A B : 00 C : 00 D : 00 E : 67 H : 00 L : 61
A`: 7A F`: 00 B`: 35 C`: 67 D`: C5 E`: 00 H`: 00 L`: 00
I: 1E IFF: 19 R: 0B
PC: 713C SP: 00AB
IX: F400 IY: 0000
$

The second script, z80mem, dumps the contents of the memory stored in a core file. The source:

#!/bin/sh

# Dump the contents of memory in a z80pack core file
# # Usage:
# # z80mem [filename]
# # where filename is optional and defaults to core.z80

CORE=${1:-core.z80}

hexdump $CORE -v -C -s 27

A sample run:

$ z80mem
0000001b 00 00 00 00 00 24 00 5b 05 90 8b 57 11 21 24 00 |.....$.[...W.!$.|
0000002b 0e 11 16 61 1e 7a 3e 00 b9 ca 23 00 7a 46 b8 d2 |...a.z>...#.zF...|
0000003b 1e 00 7b b8 da 1e 00 78 d6 20 77 23 0d c3 09 00 |..{....x. w#.....|
[...]
0000fffb 49 e5 2d ec 06 a8 5d 03 ff 27 cc 6b 6d 14 0c ee |I.-...]..'.km....|
0001000b e7 83 32 a5 6d d0 54 fd 31 2a 95 a6 4a 8e 8d 93 |..2.m.T.1*..J....|
0001001b 73 ba 7f 7a 62 dc 7d 62 04 4a cd 71 5e |s..zb.}b.J.q^|
00010028
$

[1] https://github.com/udo-munk/z80pack/blob/master/z80core/sim0.c#L428

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor