dsktool
Adding Files To Disk Images

Currently (as of version 0.4.2) only NADOL and Apple DOS images can have files added to them.

To add a file to an existing image, use the ”-a” or ”—add” command, followed by the name of the file to add.

For Apple DOS files, the default file type is a Text File?. If you wish to add some other file type, you can use the ”-t” or ”—filetype”, followed by EITHER a single letter (A for AppleSoft BASIC File?, B for a Binary File?, I for Integer BASIC File?, T for Text File?) or else a hex number that indicates the Apple DOS file type.

Example 1: adding a text file to an existing DOS image.

jonno@ubuntu:~/disks$ echo "This is a test"> test.txt
jonno@ubuntu:~/disks$ dsktool.rb --add test.txt SCRATCH.DSK
jonno@ubuntu:~/disks$ dsktool.rb -c SCRATCH.DSK
SCRATCH.DSK
sector order:   physical
filesystem:     dos
 A 0256 HELLO
 T 0256 TEST.TXT
jonno@ubuntu:~/disks$ dsktool.rb -e test.txt SCRATCH.DSK
This is a test
jonno@ubuntu:~/disks$

Example 2: copying the HELLO file from an existing DOS image to a new image.

jonno@ubuntu:~/disks$ dsktool.rb -e HELLO --raw -o HELLO ADT131.dsk
jonno@ubuntu:~/disks$ dsktool.rb --init dos33 --add HELLO -t A newdisk.dsk
jonno@ubuntu:~/disks$ dsktool.rb -e HELLO newdisk.dsk
10 PRINT CHR$ (4)"BRUN ADT" 
10
jonno@ubuntu:~/disks$

For Binary Files on Apple DOS images, you can use the ”-b” or ”—base” to set the “base address” (the address where DOS will load the file into when the file is BLOADed or BRUNed).

Example 3: adding a binary file to a DOS image, and setting the base address

jonno@ubuntu:~/disks$ dsktool.rb --add a.out --filetype B --base $2000 SCRATCH.DSK
jonno@ubuntu:~/disks$ dsktool.rb -c SCRATCH.DSK
SCRATCH.DSK
sector order:   physical
filesystem:     dos
 B 0512 A.OUT
 A 0256 HELLO
 T 0256 TEST.TXT
jonno@ubuntu:~/disks$