• Please review our updated Terms and Rules here

Linux cpmtools on images created by ImageDisk?

AndersG

Experienced Member
Joined
Jan 18, 2017
Messages
57
Location
N60 E20
Is it supposed to work? I tested them on both DOS and Linux and cpmls just returns garbage, no matter what parameters I set?
 
Yes, it works. What is the .IMD file name and what CP/M Definition are you using?

Is your cpmtools built with libdsk or not?

Run the following in DOSBOX to get more information and create the .RAW files:

TD02IMD PG685-1.TD0 > PG685-1.TXT
imdu PG685-1.IMD PG685-1.RAW /B /E /D >> PG685-1.TXT
TD02IMD PG685-2.TD0 > PG685-2.TXT
imdu PG685-2.IMD PG685-2.RAW /B /E /D >> PG685-2.TXT

If you don't have the TD0 files just use the last command.

IMDU ZORBA1.IMD ZORBA1.RAW /E /B /D > zorba1.txt
IMDU ZORBA2.IMD ZORBA2.RAW /E /B /D > zorba2.txt
IMDU ZORBA3.IMD ZORBA3.RAW /E /B /D > zorba3.txt

Read the .TXT files.
Then use cpmtools on the .RAW image.

WITH libdsk:
cpmls -f zor1 -T raw,zor1 -d ZORBA1.RAW
cpmcp -f zor1 -T raw,zor1 ZORBA1.RAW 0:vt52.key /home/larry/IMDs/zorba

WITHOUT libdsk:
cpmls -f zor1 -d ZORBA1.RAW
man cpmls
man cpmcp

REF:
http://forums.debian.net/viewtopic.php?f=16&t=112244&hilit=[HOWTO]+Access


Larry
 
Last edited:
Thanks SO much for your help! The docs are a bit brief and there are several version on the internet, so your examples helped me a lot. I Used a Xerox 820 wordprocessing disk as sample. (I have a BBII, but the disks have gone missing over the years). Running IMDU against wordproc.imd produced:

Code:
IMageDisk Utility 1.18 / Mar 07 2012
IMD 1.17: 16/01/2010 16:20:45

word processing

130s21200 wp-a02.000 0981

Assuming 1:1 for Binary output
 0/0 250 kbps SD  18x128
      1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18 
      D   D   D   D   D   D   D   D   D   D   D   D   D   D   D   D   D   D  
 1/0  D   D   D   D   D   D   D   D   D   D   D   D   D   D   D   D   D   D  
 (Stuff deleted for brevity) 
39/0  DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5 DE5
40 tracks(40/0), 720 sectors (47 Compressed)

And with that, I came up with:
Code:
diskdef bbii
  seclen 128
  tracks 40
  sectrk 18
  blocksize 1024
  maxdir 64
  skew 0
  boottrk 3
  os 2.2
end

Had to try with boottrk from 0 and upwards until I got a legigible display. I guess that is the only way as IMD does not care about logical contents.

Code:
C:\Slask\cpm\images>..\cpmtools\cpmls -f bbii -d WORDPROC.RAW
XWS      COM : WSMSGS   OVR : WSOVLY1  OVR :
             :              :              : ↕⌂↕
BDIR     COM : PIP      COM : STAT     COM :
             :              :              :
             :
User 1
(garbage)

I did this with cpmtools on an Xp dosbox. Incidentally, xws.com is a Xerox-modified copy of wordstar that uses a special low-profile keyboard with function keys.

So I am making progress. Still have questions though :) How do I know if the DOS version of cpmutils is built with libdisk support? Assuming I can get a file into the RAW file, can I then write that to a floppy to read on the BB? Ie the purpose of the excercise is to get files to the BBII.
 
OK. Some progress here:
Code:
dev01:~/cpmutils/images # cpmls -f bbii -T imd -d WORDPROC.IMD
XWS      COM : WSMSGS   OVR : WSOVLY1  OVR :
             :              :              :
BDIR     COM : PIP      COM : STAT     COM :
             :              :              :
             :

and:
Code:
dev01:~/cpmutils/images # cpmcp -f bbii -T raw WORDPROC.RAW text.txt 1:TEXT.TXT


dev01:~/cpmutils/images # cpmls -f bbii -T raw -d WORDPROC.RAW
XWS      COM : WSMSGS   OVR : WSOVLY1  OVR :
             :              :              :
BDIR     COM : PIP      COM : STAT     COM :
             :              :              :
             :
User 1
TEXT     TXT : T)

But I cannot seem to copy when I use an IMD:


Code:
dev01:~/cpmutils/images # cpmcp -f bbii -T imd WORDPROC.IMD text.txt 1:TEXT.TXT
dev01:~/cpmutils/images # cpmls -f bbii -T imd -d WORDPROC.IMD
XWS      COM : WSMSGS   OVR : WSOVLY1  OVR :
             :              :              :
BDIR     COM : PIP      COM : STAT     COM :
             :              :              :
             :
User
1
T)
 
I see one difference in your definition from what I have:
# XER2 Xerox 820 - SSSD 48 tpi 5.25" - 128 x 18
diskdef xer2
seclen 128
tracks 40
sectrk 18
blocksize 1024
maxdir 32
skew 5
boottrk 3
os 2.2
end

Your skew might also be something other than 0. You will have to view an ASCII file to be sure.

If you don't have cpmtools built for libdsk, your command can be shortened to:

Code:
cpmls -f bbii -d WORDPROC.IMD

To find out if libdsk is supported in cpmtools use:
Code:
dskscan
dsktrans
dskdump
dskform
dskid
dskutil

any of the above commands to see if they are located. If you use Linux then use:

Code:
man dskscan
man dsktrans
man dskdump
man dskform
man dskid
man dskutil

If the command isn't found, then cpmtools isn't built with libdsk.

Larry
 
Last edited:
I was under the impression that libdsk was required to manipulate IMD files? That is why I use libdsk.

Anyway. I can use cpmutils to add a file to a RAW image, but not to an IMD one. Would that be normal?

Yes, skew or interleave is probably something else than 0. I will correct that, but it should work anyway, but slower as the computer looks for the actual sector numbers?
 
Last edited:
libdsk isn't really required, but it does give some added features. I've been looking (searching) for how I used dsktrans,
or at least how it should work. If you have a .RAW image with the files updated so that your added files exist on the .RAW
image, dsktrans would be a good way to create the .IMD file type.

I've also used SAMDISK to copy a .RAW file to a .IMD file, or I sure believe I have. But, I haven't located my exact scripts
yet. Still searching. I typically keep a file with some cryptic name so I can duplicate that previous work easily.
But, I haven't found it.

If you can get the files you from the .IMD's to the .RAW format and copied to some subdirectory, then you can create
another .RAW image and use the remove tool to delete unwanted files, and copy the ones you want to that .RAW image.

Then try using SAMDISK to convert from .RAW to .IMD type file. Then write the IMD file and test.
dsktrans should do the same. I'm sure I've used it before as a test. Just have to locate the correct document by using grep
with the correct command string.

I was under the impression that libdsk was required to manipulate IMD files?
NO!
I can use cpmutils to add a file to a RAW image, but not to an IMD one. Would that be normal?
YES

NAME
dsktrans - Copy from one floppy or image file to another

SYNOPSIS
dsktrans [-itype TYPE] [-otype TYPE] [-iside SIDE] [-oside SIDE]
[-icomp COMP] [-ocomp COMP] [-idstep] [-odstep] [-retry COUNT] [-format
FMT] [-first CYLINDER] [-last CYLINDER] [-comment TEXT] [-comment
@FILE] [-md3] [-logical] [-apricot] [-pcdos] [-noformat] INPUT-IMAGE
OUTPUT-IMAGE
DESCRIPTION
Dsktrans copies floppy discs or images, optionally converting image
types. This is a high-level copy which assumes that the disc has a
straightforward geometry; all the tracks are assumed to have the same
layout of sectors, and interleave is not preserved. See dskdump(1) for
a slower but more accurate copy which may preserve more of these
details.

Larry
 
Last edited:
OK. This is what I tried:

Convert file to raw format:

Code:
C:\Slask\cpm\images>..\imd\imdu CPM.IMD CPM.RAW /B /E
IMageDisk Utility 1.18 / Mar 07 2012
IMD 1.18: 17/11/2012 22:03:33
xerox 820 cp/m
130s22100 (ds) cp/m-rev 3.000 1281
Assuming 1:1 for Binary output
CPM.RAW already exists - proceed(Y/N)?Y
 0/0 300 kbps SD  18x128
40 tracks(40/0), 720 sectors (44 Compressed)


Code:
dev01:~/cpmutils/images # dskid CPM.IMD
CPM.IMD:
  Driver:      IMD file driver
  Sidedness:     Alt
  Cylinders:     40
  Heads:          1
  Sectors:       18
  First sector:   1
  Sector size:  128
  Data rate:     DD
  Record mode:   FM
  R/W gap:     0x2a
  Format gap:  0x52

  Drive status:  0x20
  Comment:       xerox 820 cp/m
                 130s22100 (ds) cp/m-rev 3.000 1281


dev01:~/cpmutils/images # cpmls -f bbii -T raw  -d CPM.RAW
STAT     COM : DDT      COM : XSUB     COM : CBIOS    MAC
M80      COM : INIT     COM : DUMP     COM : COPY     COM
SYS          : SUBMIT   COM : L80      COM : SYSGEN   COM
R/           : MR"  : PIP      COM : ED       COM
User 14
M
M I : MLI!* P+Q

Removed some files:

Code:
cpmrm -f bbii -T raw CPM.RAW L80.COM

Copied in new file:

Code:
cpmcp -f bbii -T raw CPM.RAW text.txt 0:TEXT.TXT

Code:
cpmls -f bbii -T raw  -d CPM.RAW
STAT     COM : DDT      COM : XSUB     COM : TEXT     TXT
INIT     COM : DUMP     COM : COPY     COM : SYS
SUBMIT   COM : SYSGEN   COM : R/           : MR"
PIP      COM : ED       COM
User 14
M
M I : MLI!* P+Q

Convert back to IMD:
Code:
C:\Slask\cpm\images>..\imd\bin2imd CPM.RAW CPMNEW.IMD N=40 SS=128 DM=2 SM=1-18 /
18 /1
BINary-2-IMageDisk 1.18 / Mar 07 2012

Problem is that the disk when written works just fine, boots and all, it also thinks it has a file by that name, but when I type or dump it, is empty. But cpmcpy can copy it from the IMD file??

Tried dsktrans:

Code:
dev01:~/cpmutils/images # dsktrans -itype raw -otype imd CPM.RAW CPMNEW.IMD

Identifying disc: Bad forma
t.

Tried samdisk:
Code:
C:\Elektronik\cpm\images>samdisk CPM.RAW CPMNEW.IMD
Error: unrecognised image format
 
Correction: I can copy the file intact from the RAW image, but not aftrer conversion to IMD so it must be failing there.
 
OK. Seems to work now, but...

1. Copy to RAW: imdu X820CPM3.IMD CPM3.RAW /B /E
2. Copy resulting file to Linux
3. Check that it looks right: cpmls -f bbii -Traw -d CPM3.RAW
4. Delete some files: cpmrm -f bbii -T raw CPM3.RAW L80.COM
5. Copy in a text file: cpmcp -f bbii -T raw CPM3.RAW text.txt 0:TEXT.TXT
6. Is it there?: cpmls -f bbii -Traw -d CPM3.RAW
7. Copy it out just to check: cpmcp -f bbii -T raw CPM3.RAW 0:TEXT.TXT text2.txt
8. Copy file to DOS machine
9. Convert to IMD: bin2imd CPM3.RAW CPMNEW3.IMD N=40 SS=128 DM=2 SM=1-18
10. Write floppy

But, hey! It works :)
 
Your directory listings should be sane, not like this:

cpmls -f bbii -Traw,bbii -d CPM.RAW
STAT COM : DDT COM : XSUB COM : CBIOS MAC
M80 COM : INIT COM : DUMP COM : COPY COM
SYS : SUBMIT COM : L80 COM : SYSGEN COM
R/ : MR" : PIP COM : ED COM
User 14
M
M I : MLI!* P+Q

I think you still have something incorrect in your definition.
You should be able to get a good listing from the .RAW file.

You can also use hexedit to view the .RAW file and locate the directory:
hexedit kayii01.raw

00001400 00 53 55 42 4D 49 54 20 20 43 4F 4D 00 00 00 0A .SUBMIT COM....
00001410 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001420 00 4D 45 4E 55 20 20 20 20 44 41 54 00 00 00 01 .MENU DAT....
00001430 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001440 00 52 45 41 44 45 52 41 20 42 41 4B 00 00 00 09 .READERA BAK....
00001450 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001460 00 53 4B 20 20 20 20 20 20 43 4F 4D 00 00 00 1A .SK COM....
00001470 05 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001480 00 46 49 58 4B 45 59 20 20 43 4F 4D 00 00 00 51 .FIXKEY COM...Q
00001490 07 08 09 0A 0B 0C 00 00 00 00 00 00 00 00 00 00 ................
000014A0 00 4D 4F 56 43 50 4D 20 20 43 4F 4D 00 00 00 4C .MOVCPM COM...L
000014B0 0D 0E 0F 10 11 00 00 00 00 00 00 00 00 00 00 00 ................
000014C0 00 4D 49 4C 45 53 54 4F 4E 43 4F 4D 00 00 00 62 .MILESTONCOM...b
000014D0 12 13 14 15 16 17 18 00 00 00 00 00 00 00 00 00 ................
000014E0 00 58 53 55 42 20 20 20 20 43 4F 4D 00 00 00 06 .XSUB COM....
000014F0 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001500 00 45 44 20 20 20 20 20 20 43 4F 4D 00 00 00 34 .ED COM...4
00001510 1A 1B 1C 1D 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001520 00 41 53 4D 20 20 20 20 20 43 4F 4D 00 00 00 40 .ASM COM...@
00001530 1E 1F 20 21 00 00 00 00 00 00 00 00 00 00 00 00 .. !............

Once your directory listing is sane, you need to locate a large .ASM (.M80) or .TXT file, and save it. Then look through it's
content to make 100% sure it's all there and is sane. If the SKEW is off there could be missing sections or mixed up sections.

Modify the SKEW until the listing is sane.


I stumbled across this BLOG, which kind of explains the usage of BIN2IMD. It has an error in the Definition. MAXDIR =64
https://virtuallyfun.superglobalmegacorp.com/2013/12/05/sage-cpm-disk-fun/#comment-177828

Larry
 
Last edited:
So basically, skew should be correct when I see a good listing from an untouched IMD, ie:

Code:
dev01:~/cpmutils/images # cpmls -f bbii -Timd  -d X820CPM3.IMD                  STAT     COM : DDT      COM : XSUB     COM : CBIOS    MAC
M80      COM : INIT     COM : DUMP     COM : COPY     COM
SUBMIT   COM : L80      COM : SYSGEN   COM : PIP      COM
ED       COM
 
There is probably a better way to do this, but to create a disk from a bunch of files, I first downloaded them to a dir and then:

Code:
#! /bin/sh
for file in ddboot1/*
do
  cpmcp -f bbii -T raw DDBOOT1.RAW "$file" 0:"$(basename ${file^^})"
  rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
done

Where DDBOOT1.RAW is an empty image. Naturally do I have to split up into multiple dirs in case the files do not fit.
 
Last edited:
I typically use the .RAW image to get the skew correctly. And then I view a couple of .TXT, .M80, .ASM files to make sure
they are sane and complete.

I've tried the CPM.RAW you emailed, and I can not get a good directory listing. But, I think it's because I'm running a non published
test version from Michael. I need to send him the .RAW image, along with my definition (same as yours) and see if he can
locate the problem.

I typically use something like:
cpmcp -f ims3 -T raw,ims3 IMSTD1.RAW 0:DSKF5.PKG /home/larry/IMDs/imstbdos
cpmcp -f cpm86-720 720CPM86.IMG 0:AUTOEXEC.SUB /home/larry/dbase
cpmcp -f cpm86-144feat 144CPM86.IMG 0:AUTOEXEC.SUB /home/larry/dbase
cpmcp -f cpm86-720 720CPM86.IMG 0:*.SUB /home/larry/dbase
cpmcp -f cpm86-144feat 144CPM86.IMG 0:*.* /home/larry/dbase

cpmcp -f cpm86-144feat 144CPM86.IMG /home/larry/dbase/*.* 0:


Larry
 
OK. Let me send you my latest try. Seems to work. I was able to run the programs I had copied there. Now, if I was able to write directly to the IMD file or be able to do the conversion RAW<>IMD on Linux, then that would certainly help :)

Was not able to format though, but that is another issue. Will ask in the disk thread :)
 
What version of cpmtools are you using? I've rebuilt my Version 2.21 (not released yet - version) without libdsk
and I still can't get it working. I did download another upgraded - not released version, but haven't done a file by file
comparison on those versions yet.

Thanks.

Larry
 
on Linux:

cpmtools-2.20 libdsk-1.4.0

diskdef bbii
seclen 128
tracks 40
sectrk 18
blocksize 1024
maxdir 32
skew 5
boottrk 3
os 2.2
end


On Xp:
C:\Slask\cpm\images>..\imd\imdu X820CPM3.IMD CPM3.RAW /B /E
IMageDisk Utility 1.18 / Mar 07 2012
IMD 1.18: 17/11/2012 22:03:33
xerox 820 cp/m
130s22100 (ds) cp/m-rev 3.000 1281
Assuming 1:1 for Binary output
0/0 300 kbps SD 18x128
40 tracks(40/0), 720 sectors (44 Compressed)

diskdef bbii
seclen 128
tracks 40
sectrk 18
blocksize 1024
maxdir 32
skew 5
boottrk 3
os 2.2
end

This is what seems to work for me now. Ie I can delete all files from a RAW, put in new, convert to IMD, write to floppy and read it and execute the files on the BBII.
 
Anders,
I was pretty sure I had used the libdsk command "dsktrans" to create .RAW, and .IMD images. But, as
I searched through my history files with grep, I didn't find any commands. So, I eventually remembered
that I had posted somewhere about how I did it with John Elliott's help. I searched the VCF and found this
posting (#15):

http://www.vcfed.org/forum/showthre...oat-CP-M-disk-images/page2&highlight=dsktrans

It should get you going, if you use this bbii libdsk definition in your /home/loggeduser/.libdskrc file.

# libdsk data below
[bbii]
description = XER2 Xerox 820 - SSSD 48 tpi 5.25" - 128 x 18
cylinders = 40
heads = 1
secsize = 128
sectors = 18
secbase = 1
datarate = SD

You will also have to apply the patch file to libdsk 1.4.0


Larry
 
I tested without the patch and it appears to work. I guess my problem was that I did not have any .libdskrc at all:

Code:
dev01:~/cpmutils/images # dsktrans -itype raw -otype imd -format bbii DDBOOT1A.RAW TEST.IMD
Input driver: Raw file driver
Output driver:IMD file driver
dev01:~/cpmutils/images # cpmls -f bbii -Timd  -d TEST.IMD
ASM      COM : BB2CPM60 COM : BB2FORMT COM : BIOS     ASM
BIOS     DOC : CBIOS    ASM : CPM60    COM : DDT      COM
DEBLOCK  ASM : DISKDEF  LIB : DUMP     ASM
dev01:~/cpmutils/images #
 
Anders,
OK, the patch was for the TRS-80 Model II and I wasn't sure if it was needed or not. I see that John
now has Version 1.4.2 available for libdsk.

GOOD DEAL! Glad you got it working.


Larry
 
Back
Top