uweseimet / scsi2pi

Advanced performant SCSI/SASI emulation and tools for the PiSCSI/RaSCSI board
https://www.scsi2pi.net
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

Add a simple simh .tap file analyzer tool #101

Closed uweseimet closed 2 weeks ago

uweseimet commented 2 weeks ago

In order to help with adding support for simh .tap image files, a tool that displays the structure of these files will be helpful. The tool shall expect a .tap file as an argument and shall be called "s2psimh". s2psimh reuses code that is also used by the Tape class, which makes it convenient to implement it as part of the issue_100 branch.

s2psimh shall only be built when SCTP support is enabled for the build.

uweseimet commented 2 weeks ago

@Pacjunk s2psimh is part of the latest issue_100 branch and helps to get an overview on the .tap file structure. Correlating the output with the s2p logfile helps with detecting problems with s2p.

>./bin/s2psimh
SCSI Device Emulator and SCSI Tools SCSI2Pi (Simh .tap File Analysis Tool)
Version 4.1-devel
Copyright (C) 2024 Uwe Seimet
Usage: s2psimh [options] <SIMH_TAP_FILE>
  --dump/-d          Dump record contents.
  --limit/-l LIMIT   Limit record content dump size to LIMIT bytes.
  --version/-v       Display the program version.
  --help/-h          Display this help.
>./bin/s2psimh simh.tap -d -l 16
Offset 0: Class 0, good data record, record length 80 ($50)
00000000  56:4f:4c:31:56:34:37:53:45:43:20:20:20:20:20:20  'VOL1V47SEC      '
Offset 88: Class 0, good data record, record length 80 ($50)
00000000  48:44:52:31:56:34:37:53:45:43:55:50:44:30:33:30  'HDR1V47SECUPD030'
Offset 176: Class 0, good data record, record length 80 ($50)
00000000  48:44:52:32:46:30:38:31:39:32:30:38:31:39:32:20  'HDR2F0819208192 '
Offset 264: Class 0, tape mark
Offset 268: Class 0, good data record, record length 8192 ($2000)
00000000  00:01:00:04:01:00:01:00:01:00:00:00:00:00:00:00  '................'
...
Offset 205632: Class 0, good data record, record length 8192 ($2000)
00000000  00:01:00:04:01:00:02:00:07:00:00:00:00:00:00:00  '................'
Offset 213832: Class 0, tape mark
Offset 213836: Class 0, good data record, record length 80 ($50)
00000000  45:4f:46:31:56:35:30:53:45:43:55:50:44:30:33:30  'EOF1V50SECUPD030'
Offset 213924: Class 0, good data record, record length 80 ($50)
00000000  45:4f:46:32:46:30:38:31:39:32:30:38:31:39:32:20  'EOF2F0819208192 '
Offset 214012: Class 0, tape mark
Offset 214016: Class 0, tape mark
Offset 214020: Class 0, tape mark

My guess is that the first 3 records are related to labelling, and after a tape mark (which is a SCSI filemark) the actual data records for a SCSI tape block size of 8192 bytes follow.

Before using an existing file please ensure that there are no private/reserved items in the file, because s2p cannot handle them and will skip them. Maybe you can become familiar with the simh file format specification. You could then correlate the logfile output with the file contents, which would help with testing.