How to create real disks from D64 files?

Modding and Technical Issues

Moderator: Moderators

User avatar
Mike
Herr VC
Posts: 4839
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How to create real disks from D64 files?

Post by Mike »

Here's my stab at it: d64trans (download):

Code: Select all

10 POKE55,0:POKE56,29:CLR:POKE36879,27:FORT=828TO935:READA:POKET,A:NEXT
11 :
12 INPUT"SRC DEV.";SD:INPUT"FILE? #{3 LEFT}";S$:PRINT:IFS$<>"#"THENS$=S$+",S,R"
13 INPUT"DST DEV.";DD:INPUT"FILE? #{3 LEFT}";D$:PRINT:IFD$<>"#"THEND$=D$+",S,W"
14 OPEN14,SD,15,"I":OPEN15,DD,15,"I"
15 OPEN2,SD,2,S$:OPEN3,DD,3,D$
16 FORT=1TO35:READA:N$=LEFT$(MID$(STR$(T),2)+"********************",A)
17 FORS=0TOA-1:PRINTLEFT$(N$,1);:N$=MID$(N$,2)
18 IFS$="#"THENPRINT#14,"U1 2 0"+STR$(T)+STR$(S):PRINT#14,"B-P 2 0"
19 IFD$="#"THENPRINT#15,"B-P 3 0"
20 SYS828,2,3
21 IFD$="#"THENPRINT#15,"U2 3 0"+STR$(T)+STR$(S)
22 NEXT:PRINT:NEXT
23 CLOSE2:CLOSE3:CLOSE14:CLOSE15
24 END
25 :
26 DATA 32,241,215,32,106,3,160,0,132,251,32,207,255,164,251,145,55,200,208,244,32,204
27 DATA 255,32,241,215,32,137,3,160,0,177,55,132,251,32,210,255,164,251,200,208,244,76
28 DATA 204,255,134,252,162,5,134,251,166,252,32,198,255,176,1,96,162,29,142,15,144,32
29 DATA 204,255,198,251,208,236,162,5,76,55,196,134,252,162,5,134,251,166,252,32,201
30 DATA 255,176,1,96,162,26,142,15,144,32,204,255,198,251,208,236,162,5,76,55,196
31 :
32 DATA 21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21
33 DATA 19,19,19,19,19,19,19,18,18,18,18,18,18,17,17,17,17,17
34 :
35 REM ** D64TRANS WRITTEN 2015-03-29 BY MICHAEL KIRCHER
Please write protect the media in the source device!

1. To write a *.d64 to disk, give its full name (including the extension) on the source device, and '#' as file name on the destination device. The target must have been formatted beforehand.

2. To create a *.d64 from a disk, give '#' as file name on the source device, and the full name on the destination device. Make sure the target file name does not already exist.

3. By giving '#' as file names on both source and destination device, the program can be used as dual drive disk copier.

The progress is indicated by lines showing the track number and stars for each copied sector.

When a *.d64 is referenced by name, be sure you have not inadvertently changed into/mounted that *.d64!
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: How to create real disks from D64 files?

Post by orion70 »

Thank you so much Mike! Only two things:

- If I understand correctly, I have to put the program in the dir where all the D64 files reside, then launch it (outside of any D64 image - only staying in their dir), and specify the full FILENAME.D64 (case sensitive?) as source, no device number. As a destination, I have to simply state the device number.
e.g. in my case I have MIKE.D64 in drive 8, to be copied to a real disk in drive 10. Then:
(change to disk images directory)
(launch program)
SRC DEV? MIKE.D64
DST DEV? 10
...is that correct?

- Shame on me, my old external drive is gone forever. There, I kept the original D64s of Infocom adventures as made by TNT (load disk and several story disks). IIRC, some time ago you gave me the opportunity to transform each adventure into a single D81 (loader + story) with one of your miracle programs. Do you still have the original D64s to send back? Otherwise, I have no way to make real disks from them :oops:.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: How to create real disks from D64 files?

Post by orion70 »

Auto-answer to the first question: the correct sequence to copy from a D64 should be (standing in the appropriate dir but OUTSIDE of the D64 itself):
SRC DEV? 8
FILE? MIKE.D64
DST DEV? 10
FILE? # (leave the default hash)
Image
(seems to work in VICE :))
User avatar
Mike
Herr VC
Posts: 4839
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How to create real disks from D64 files?

Post by Mike »

orion70 wrote:Auto-answer to the first question: the correct sequence to copy from a D64 should be (standing in the appropriate dir but OUTSIDE of the D64 itself):

Code: Select all

SRC DEV? 8
FILE? MIKE.D64
DST DEV? 10
FILE? #
(... leave the default hash)
Yes, that's how it's supposed to be done. On real hardware, with the SD2IEC as drive #8, a directory with the collection of your *.d64 files, and d64trans.prg in that same directory; and with your CBM drive as drive #10 the prompts should be answered this way.

Though, in VICE you can't have both True Drive Emulation on (judging from the two drive indicators in the bottom-right corner) and mount a PC directory in VDrive containing the *.d64 file. Presumably the program only wrote junk to drive #10 in your screenshot.
- Shame on me, my old external drive is gone forever. There, I kept the original D64s of Infocom adventures as made by TNT (load disk and several story disks). IIRC, some time ago you gave me the opportunity to transform each adventure into a single D81 (loader + story) with one of your miracle programs. Do you still have the original D64s to send back? Otherwise, I have no way to make real disks from them. :oops:
I'm sorry, but at that time I only got one *.d64 from you for a proof of concept for the transfer to *.d81, and I didn't even keep that one.

However, since all my old program did was writing a 1:1 sector copy of the original *.d64 into a CBM partition ("DIRECT ACCESS") of the *.d81, it should be possible to copy back those contents from the *.d81 to the *.d64, also with d64trans. Both 1541 and 1581 understand the same sector access commands.

Mount the *.d81 on your SD2IEC, insert a formatted disk into your 5 1/4" CBM drive, and then enter these lines:

Code: Select all

SRC DEV? 8
FILE? #
DST DEV? 10
FILE? #
Note this only supposed to work in this special case. In general, copying from a 1581 media to a 1541 media will just result in a non-working target disk.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: How to create real disks from D64 files?

Post by orion70 »

Great Mike. You were right about every aspect. In my try with VICE, the program only apparently did write to drive 10, instead only garbage was created. Also, d64trans worked perfectly, albeit v e r y s l o w l y :) , on the real hardware. Last, I will try the direct disk transfer between a d81 in drive 8 and a real 1541. But here's a question: the d81 disks were created each with its own loader plus the story disk, so the sum is often more than the canonical 170k :? . That's why I don't expect this method to work...
User avatar
Mike
Herr VC
Posts: 4839
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How to create real disks from D64 files?

Post by Mike »

orion70 wrote:But here's a question: the d81 disks were created each with its own loader plus the story disk, so the sum is often more than the canonical 170k :? . That's why I don't expect this method to work...
Ah, ok, I remember. No problem still.

You'd copy the loader from the *.d81 to the first side of the disk in the 1541 with the file based copy, and then copy the story disk from the same *.d81 to the flip side of the disk in the 1541 with the sector copy in d64trans. :)

During the file copy step, the CBM partition will be ignored, but that's exactly what we want!
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: How to create real disks from D64 files?

Post by orion70 »

Good. But if I copy to the flip side of a 1541 diskette with d64trans, wouldn't it be necessary to delete the loader file from the d81 beforehand? Otherwise, d64trans would be copying the whole disk, wouldn't it?
So:
- copy loader file to side A of drive 8
- delete copy file from the d81
- d64transfer the rest of d81 to side B of drive 8
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: How to create real disks from D64 files?

Post by orion70 »

..aaand DONE! :D
Now I have a complete retro setup, no annoying modern IEC devices*. Complete with about 20 diskettes, including the Zork series (story disks directly copied from d81 via d64trans). The rest was happily copied with the other program, also provided by Mike. So the first thank you goes to you Mike, and the other to all my friends here in Denial, who awakened my interest in the VIC again.
You can't imagine how this is helping me, in a bad moment for my private life.

*Well, sometimes it's easier to use the Mega-cart than single carts or memory expansions :mrgreen:
User avatar
Mike
Herr VC
Posts: 4839
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How to create real disks from D64 files?

Post by Mike »

orion70 wrote:..aaand DONE! :D

Now I have a complete retro setup, no annoying modern IEC devices. Complete with about 20 diskettes, including the Zork series (story disks directly copied from d81 via d64trans). The rest was happily copied with the other program, also provided by Mike. So the first thank you goes to you Mike, and the other to all my friends here in Denial, who awakened my interest in the VIC again.
I'm pleased to read you got it working, but it shouldn't have been necessary to delete the loader file from the *.d81 prior to transferring the story disk (side) with d64trans. d64trans would have transferred only the story disk data anyway - see this diagram for explanation:

Image

This is a complete *.d81, with 80 tracks along the horizontal axis and 40 sectors along the vertical axis. For informational purposes, the directory of the *.d81 is located in track 40 (which is the dark blue stripe), and the directory of the former *.d64 is located in track 18 (red stripe - but it can't be used by the 1581 due to its different structure - and anyway, it doesn't need to be accessed).

Now, what my earlier "story+loader" disk combiner did was:

- create a CBM partition in tracks 1..35 of the *.d81 (yellow, orange and red portions of the diagram above),
- sector-copy the *.d64 of the story disk into the *.d81 (orange and red portions of the diagram), and finally
- file-copy the *.d64 of the loader disk into the *.d81 - the files of that *.d64 then ended up somewhere in the light blue portions of the *.d81

The loader portion of the game is again accessed as normal file(s) with the LOAD command. The Infocom interpreter then accesses the story disk portion within the CBM partition with sector commands, in the same way as if the story disk had been mounted: both the story disk and its copy in the CBM partition share the same sector layout.

When you create the two disks back from the *.d81, the following happens:

- d64trans *only* copies the orange and red contents sector wise from the *.d81 to the *.d64 - it ignores the loader 'portion' of the *.d81! - and thus recreates the story disk.
- filecopy *only* takes the files contained in the light blue portion of the *.d81 - the CBM partition file is ignored - and thus recreates the loader disk.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: How to create real disks from D64 files?

Post by orion70 »

Thank you Mike for your thorough explanation! The graphical rendition of the disk partitions is very effective. I could have used the two programs on the same d81, indeed. But manually copying the loader file allowed me to put it in the "text adventures" disk, saving a floppy. :)
Post Reply