GithubHelp home page GithubHelp logo

pelrun / dsk2cdt2disc Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 3.0 915 KB

Convert CPC DSK files to a tape image that will rebuild the disc when loaded.

C 57.39% Assembly 39.82% Makefile 2.80%
cpc cdt amstrad amstrad-cpc

dsk2cdt2disc's People

Contributors

cpcitor avatar fidergo-stephane-gourichon avatar pelrun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

cpcitor ynotzer0

dsk2cdt2disc's Issues

Write error when saving Pinball Dreams to disk

When I create a tape image for Pinball Dreams, the resulting tape causes a write error on track 2. A similar problem occurs on both sides of the disk. I have reproduced this problem in an emulator for the screenshot attached, to demonstrate that it is not an issue with my physical disk or drive. I am using version 2020.2
Disc_Error

Compilation warning.

Warning when compiling.

Compiling ./dsk2cdt-src/cdt.c
In file included from ./dsk2cdt-src/cdt.c:21:0:
./2cdt/src/2cdt.c: In function 'main_2cdt':
./2cdt/src/2cdt.c:1112:33: warning: passing argument 2 of 'ArgumentList_Execute' from incompatible pointer type [-Wincompatible-pointer-types]
  if (ArgumentList_Execute(argc, argv, OptionTable, printf, NonOptionHandler)==OPTION_OK)
                                 ^
In file included from ./2cdt/src/2cdt.c:34:0,
                 from ./dsk2cdt-src/cdt.c:21:
./2cdt/src/opth.h:62:5: note: expected 'const char **' but argument is of type 'char **'
 int ArgumentList_Execute(const int argc, const char **argv,OPTION *pOptionTable, ERROR_FUNCTION pOutputError, int (*pNonOptionHandler)(c
     ^

Will offer pull request.

Read error handling

If CALLBCA1 fails with a read error, it isn't being passed back to BASIC and exomizer then crashes the machine.

Return CALLBCA1's return value in another parameter and handle as appropriate.

Fix handling of non-standard track size tables

The extended dsk specification says the track size table in the DIB should be uint16_t, but I've now seen multiple images where the table is uint8_t instead and storing the high byte only.

Format and read/write GAP#3 values are different, but we only get one

Looks like we get the format GAP#3 in the disk image. I'm setting both to this value, but the read/write value appears to normally be about half the format one. (42 for a format GAP#3 of 80/82).

That means there's probably a risk of overwriting the ID of a following sector. Easiest fix is just to set the default write GAP#3 value when we get an expected format one; the trick is figuring out what behaviour to use in the other cases. Pinball Dreams, which triggered this in the first place, seems to use 42 for the format gap!

Need to find some weird formats (Bigbonzo's worth a look) to test against.

loader.txt is line-ending sensitive

Dsk2cdt depends on loader.txt having dos line endings (crlf) to build properly. A build on a unix system will produce CDTs that throw "Line too long" errors on the CPC when used.

Running unix2dos on loader.txt will work around the issue.

Build instructions fail to mention dependency `z80-unknown-coff-as`.

src/readme.txt reads:

Download exomizer and 2cdt and extract somewhere
Edit Makefile and change EXOMIZER_PATH and 2CDT_PATH
to point to the appropriate directories

This is insufficient. Makefile assumes availability of a Z80 assembler named z80-unknown-coff-as.

z80-unknown-coff-as ./dsk2cdt-src/rsx.s -o rsx.o
make: z80-unknown-coff-as: Command not found
Makefile:26: recipe for target 'rsx.bin' failed
make: *** [rsx.bin] Error 127
make: Target 'dsk2cdt' not remade because of errors.

This is locally fixed on Debian and Ubuntu by installing package z80-binutils.

This very bug can be fixed by updating the build instructions.

Timing

Not enough time left between blocks if run without remote control or a cdt player that pauses between them. Gotta give enough time to write the track without missing the start of the next block on the tape.

Build failure, '_binary_rsx_bin_start' undeclared

Hello.

Summary

Building dsk2cdt2disc fails with several undeclared identifiers.

Observed on Ubuntu 16.04 AMD64.

First error :

./dsk2cdt-src/loader.h:43:28: error: '_binary_rsx_bin_start' undeclared (first use in this function)

How to reproduce

Run the attached straightforward script build_dsk2cdt2disc.sh.txt

Expected

Produces something executable, no error.

Observed

(... lines showing fetching dependencies and launching compilation ...)
make 2CDT_PATH=../../2cdt EXOMIZER_PATH=../../exomizer209
+ make 2CDT_PATH=../../2cdt EXOMIZER_PATH=../../exomizer209
Compiling ./dsk2cdt-src/dsk2cdt.c
In file included from ./dsk2cdt-src/dsk2cdt.c:16:0:
./dsk2cdt-src/dsk2cdt.c: In function 'main':
./dsk2cdt-src/loader.h:43:28: error: '_binary_rsx_bin_start' undeclared (first use in this function)
 #define rsx_bin_start      _binary_rsx_bin_start
                            ^
./dsk2cdt-src/dsk2cdt.c:194:28: note: in expansion of macro 'rsx_bin_start'
     CDT_add_file(pCDTFile, rsx_bin_start, (size_t)rsx_bin_size, BAUDRATE_NORMAL, &header);
                            ^
./dsk2cdt-src/loader.h:43:28: note: each undeclared identifier is reported only once for each function it appears in
 #define rsx_bin_start      _binary_rsx_bin_start
                            ^
./dsk2cdt-src/dsk2cdt.c:194:28: note: in expansion of macro 'rsx_bin_start'
     CDT_add_file(pCDTFile, rsx_bin_start, (size_t)rsx_bin_size, BAUDRATE_NORMAL, &header);
                            ^
./dsk2cdt-src/loader.h:45:28: error: '_binary_rsx_bin_size' undeclared (first use in this function)
 #define rsx_bin_size       _binary_rsx_bin_size
                            ^
./dsk2cdt-src/dsk2cdt.c:194:51: note: in expansion of macro 'rsx_bin_size'
     CDT_add_file(pCDTFile, rsx_bin_start, (size_t)rsx_bin_size, BAUDRATE_NORMAL, &header);
                                                   ^
./dsk2cdt-src/dsk2cdt.c:122:3: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result]
   fread(dib, 0x100, 1, fin);
   ^
./dsk2cdt-src/dsk2cdt.c:144:7: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result]
       fread(track, tracksize, 1, fin);
       ^
Makefile:31: recipe for target 'dsk2cdt.o' failed
make: *** [dsk2cdt.o] Error 1

Additional information

Script content:

#!/bin/bash

set -euxv
export LC_ALL=C

rm -rf temp_build_area
mkdir temp_build_area
cd temp_build_area

wget -S http://cpctech.cpc-live.com/download/2cdt.zip || curl -O http://cpctech.cpc-live.com/download/2cdt.zip
unzip 2cdt.zip

wget -S http://csdb.dk/getinternalfile.php/141751/exomizer209.zip || curl -O http://csdb.dk/getinternalfile.php/141751/exomizer209.zip
( mkdir exomizer209 ; cd exomizer209 ; unzip ../exomizer209.zip ; )

git clone https://github.com/pelrun/dsk2cdt2disc

cd dsk2cdt2disc/src/

make 2CDT_PATH=../../2cdt EXOMIZER_PATH=../../exomizer209

Fix bps/N field calculations

This field is currently being treated as the high byte of the sector size, when it's apparently actually log2(bps)-7, the direct value out of the DPB. I don't know why this wasn't caught before, although the result is the same for standard 512-byte sectors, and any unusual images that still worked may have incorrectly filled this field.

Have also seen an instance (Red Sunset) where the logbps in TIB[0] is 0, but 2 in all the associated SIBs.

Aesthetics

Write the disk image name into the loader along with the side.
Make the sector number display a bit less ambiguous.

Build fails because makefile does not link opth.o.

Build fails with this error:

cdt.o: In function `SetTZXBlockWriteMethodOptionHandler':
.../dsk2cdt2disc/src/./2cdt/src/2cdt.c:940: undefined reference to `ArgumentList_GetNext'
cdt.o: In function `SetDataMethodOptionHandler':
.../dsk2cdt2disc/src/./2cdt/src/2cdt.c:983: undefined reference to `ArgumentList_GetNext'
cdt.o: In function `SetFileTypeOptionHandler':
.../dsk2cdt2disc/src/./2cdt/src/2cdt.c:997: undefined reference to `ArgumentList_GetNext'
cdt.o: In function `SpecifySpeedWriteOptionHandler':
.../dsk2cdt2disc/src/./2cdt/src/2cdt.c:903: undefined reference to `ArgumentList_GetNext'
cdt.o: In function `SetInitialPauseOptionHandler':
.../dsk2cdt2disc/src/./2cdt/src/2cdt.c:966: undefined reference to `ArgumentList_GetNext'
cdt.o:.../dsk2cdt2disc/src/./2cdt/src/2cdt.c:1042: more undefined references to `ArgumentList_GetNext' follow
cdt.o: In function `main_2cdt':
.../dsk2cdt2disc/src/./2cdt/src/2cdt.c:1112: undefined reference to `ArgumentList_Execute'
collect2: error: ld returned 1 exit status
Makefile:20: recipe for target 'dsk2cdt' failed
make: *** [dsk2cdt] Error 1

ArgumentList_GetNext and ArgumentList_Execute' are part of 2cdtand compiled toopth.o`.

Will offer pull request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.