
**********************************************************************
files: 3DCK.TXT
**********************************************************************


** Transferring a 3DCK C64 .d64 file to a Spectrum .dsk file
   =========================================================

If it's still in raw d64 format then I probably wouldn't be able to do anything with it, but if it's been saved as a plain binary of the 3DCK data file then it should be possible to patch a tape file header onto it, which is much easier to deal with.

   =========================================================

Does this look familiar?

[img]http://www.users.globalnet.co.uk/~jg27paw4/pourri/kit-data0.gif[/img]

I've emailed the TAP file. There were two superfluous bytes at the start of the file which you sent which I had to remove.

Here's a bit of assembler which I used to calculate the parity bytes for the header & data blocks.

[code]
        ld bc,length	;   18 or  5633
        ld hl,start		;40002 or 40023
        ld de,0
loop:   ld a,e
        xor (hl)
        ld e,a
        dec bc
        inc hl
        ld a,b
        or c
        jr nz,loop
        push de
        pop bc
        ret
[/code]

Thanks to Mal Hrz for his excellent HxD hex editor which made constructing the TAP file a lot easier.

   =========================================================

I've never used 3DCK before, but after pressing various keys I discovered that holding down up-arrow displays a menu at the top from which various options can be selected with the arrow and 0 (zero) keys. The Test option under General goes a bit peculiar, but BREAK recovers the screen. When it's in animation mode as in the above picture it's rather slow at responding to the keys, but they eventually move the cursor around the various buttons at the bottom.

   =========================================================

The four Window parameters (reading downwards) need to be changed to something like 01/03/30/10, which then displays a correct view. The status area still gets messed up by the placing of Instrument 1, which causes the black bar that can be seen on the screen below.

[img]http://www.users.globalnet.co.uk/~jg27paw4/pourri/kit-data1.gif[/img]

It's set to x=10, y=18, length=20, variable=3, colour=1 (blue on black). Presumably that bar should fit in the Score box.

   =========================================================

I tried saving & loading a 3DCK disk data file in Spin, but I couldn't get that to work. If I formatted a new data disk using the 3DCK option, then Save would appear to work but Load always gave an I/O error. I also tried saving a data file to the side B data disk which comes with 3DCK, but that just locked up when I tried Save. The demo game on side B loads OK, so it must be possible to save to disk successfully. Both Save & Load with tape work OK with the supplied game. I'll do some more testing to see if I can get the disk option to work as well.

   =========================================================

3DCK disk Format, Save & Load work in RealSpectrum, and with the DSK file saved from that I can load the saved game into other emulators. So I've saved that game to a DSK file.

   =========================================================

All four files were the same size, so the other three didn't take long. Here's the conversion sequence to create a TAP file from a D64 extract:
   In a hex editor:
1. Delete the first two bytes.
2. Add one byte at the end for the data block parity byte.
3. Add these 24 bytes at the start.

[code]
 13 00 00 03 4B 49 54 44 41 54 41 31 2D 4B 00 16 00 60 00 80 E4 02 16 FF
{-----}-- -- ----------------------------- ----- -----       --{-----}--
 hblen hh ff name                          cdlen cdadd       hp dblen dd
[/code]

hblen & dblen in {} are TAP file block lengths; the rest is tape data.
hh = header flag = 0
ff = file type; 3 = CODE
name = 10-character file name
cdlen = CODE length        $1600 =  5632
cdadd = CODE start address $6000 = 24576
hp = header block parity byte
dd = data flag = 255
data block & data block parity byte follow (not shown)

4. Change the name where necessary.
5. If necessary, change cdlen/cdadd/dblen (not necessary in this case).
6. Save as whatever.TAP .
   On Spectrum:
7. CLEAR 24575 (or somewhere below CODE start address).
8. Load TAP file as binary data at (say) 40000.
9a.Assemble that bit of code which I posted earlier at (say) 30000 with length=18, start=40002.
9b.PRINT USR 30000 and note value for header block parity byte.
10.Repeat 9a-b with length=5633, start=40023 for data block parity byte. For the purposes of the calculation the data block length = CODE length + 1 for flag byte but excluding parity byte.
   In hex editor:
11.Update the header & data block parity bytes and save the TAP file again.
   On Spectrum:
12.Select TAP file and LOAD "" CODE to check that it's OK (no "R Tape loading error").

   =========================================================

"This is precisely the sort of thing that no-one ever believes!"

I did check the WoS Utilities page for something suitable, but it's only referenced in one of the FTP sub-directories, which I'd forgotten about, so I didn't find it. I tried it anyway, and it works OK, once the first two bytes have been removed from the D64 data extract, then; eg:

bintap kitdataz.bin kitdataz.tap KITDATA0-K 24576

creates a 3DCK TAP version of it.

   =========================================================

Here's what I did to create a stand-alone 3DCK game on disk in RealSpectrum. [b]NOTE[/b]: Whenever a disk is selected it defaults to "write protect" [b]on[/b]. Make sure you change it to "off" when selecting your new program disk. Note also that I'm still using the old DOS version of RealSpectrum; the options might be different for the Windows GUI version.

* ALT-F6: select "create empty image file" - your new program disk
* F6: select the new program disk
* In +3 BASIC, format "a:", then do a cat to check it's OK.
* Select and load 3DCK program disk and select the compiler option.
* Follow the prompts, switching disks with F6 when requested.

The compiler prompts:
* save to disk or tape? D
* insert destination disk (your new program disk); prepares that
* load data file from disk or tape? D
* file number
* insert data disk (with your game data files); reads that
* insert destination disk (your new program disk) again; writes that
* do you want a border? (I answered N here)
+ I expect that there'll be an intervening prompt here for file number & data disk if you answer Y for border.
* insert destination disk (your new program disk) again; writes that
* reset and load to run game

I used the demo game data that comes with 3DCK and this worked OK.

   =========================================================

By the way, that border file on the disk would seem not to be in SCREEN$ format, as the compiler doesn't load it. At least, it appears to but when the game is run the border is just black. To get the border included I had to save the screen from the 3DCK Test mode as an SCR file and then save that from +3 BASIC as a SCREEN$ to a regular +3 disk (ie. not the special 3DCK format data disk). I just put it on the disk which I'd already created for the compiled game and then ran through the compilation sequence again - although the new version shows a 1-line overlap between the bottom of the view window and the top of the border.

Another by the way - Once that 3DCK-format data disk has been created, then subsequent work can be done on [b]some[/b] other emulators. Spin won't create a 3DCK data disk, but it will read one created by RealSpectrum. I also tried Fuse and EightyOne, but they won't even read it.

   =========================================================

OK, I've sent a +3 disk image file with which the 3DCK compiler will work, plus answers to these questions. To summarise:
* It's not possible to compile to the 3DCK 'B' disk because all the free space is occupied by an invisible protected system file.
* If an emulator doesn't map punctuation characters to the normal PC keys then SymbolShift (usually Ctrl) needs to be used; ':' is SymbolShift-Z, '"' is SymbolShift-P.
* The compiler won't write to a 3DCK data disk; it needs a disk in standard +3 format.
* The compiler doesn't give back error messages if it can't access a file. It will either hang up if it can't read a file or just continue if it can't write a file.

   =========================================================

I'd never used 3DCK before. I didn't even know if it was possible to make the conversion. It seemed that it might work, so I thought that it was worth a try and it turned out OK. I love it when a plan comes together!

   =========================================================
