Author Topic: Files corrupted when extracted from DSK  (Read 518 times)

0 Members and 1 Guest are viewing this topic.

Offline kolleykibber

  • CPC664
  • ***
  • Posts: 50
  • Country: gb
  • Liked: 40
  • Likes Given: 31
Files corrupted when extracted from DSK
« on: 15:15, 28 May 21 »



I'm trying to pull some files off a DSK image.  They are Maxam/Protext text files. Every time I try the ASCII files are corrupted (as I expect are the BIN files too). I've tried the DSK tool and RetroVirtualMachine on a mac.


I've tried a couple of different DSK files and get the same odd results. Usually the files are truncated, or sections of other files are inserted. The images read and run fine on the CPC and Emulators.


Is there a preferred tool for doing this kind of thing?

Offline SkulleateR

  • 464 Plus
  • *****
  • Posts: 461
  • Country: de
  • Liked: 225
  • Likes Given: 129
Re: Files corrupted when extracted from DSK
« Reply #1 on: 15:19, 28 May 21 »
I also use RVM (Mac) for this and never had any corrupted file ... works fine here ... can you upload an example DSK file ?


Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 17.027
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 4093
  • Likes Given: 7407
Re: Files corrupted when extracted from DSK
« Reply #2 on: 15:23, 28 May 21 »
Can you post an image if it's not a personal one?


[EDIT] had left the page open while SkulleateR was asking the same :D

Offline kolleykibber

  • CPC664
  • ***
  • Posts: 50
  • Country: gb
  • Liked: 40
  • Likes Given: 31
Re: Files corrupted when extracted from DSK
« Reply #3 on: 16:09, 28 May 21 »
Thanks for the quick replies! It's the v61.dsk file served up here:


https://www.cpcwiki.eu/imgs/a/af/BBS_Terminal_Source.zip


Just tried a fresh download, extract from RVM and if you look at BBSPROG. At the end there is :


Code: [Select]

,1
   LD (DY),HL
   ret      ;save Cursor pos in DY



If you load the same file from the DSK with Protext in the CPC, It finishes with 'end.'
« Last Edit: 16:17, 28 May 21 by kolleykibber »

Offline SkulleateR

  • 464 Plus
  • *****
  • Posts: 461
  • Country: de
  • Liked: 225
  • Likes Given: 129
Re: Files corrupted when extracted from DSK
« Reply #4 on: 16:19, 28 May 21 »
Hmm, just took the ANSI. file and it extracted fine with RVM ...

Offline kolleykibber

  • CPC664
  • ***
  • Posts: 50
  • Country: gb
  • Liked: 40
  • Likes Given: 31
Re: Files corrupted when extracted from DSK
« Reply #5 on: 16:25, 28 May 21 »
The ANSI comes back with ok text, but a row of non printing characters added here (Using BBEDIT).



Could you give BBSPROG a go please?


Offline SkulleateR

  • 464 Plus
  • *****
  • Posts: 461
  • Country: de
  • Liked: 225
  • Likes Given: 129
Re: Files corrupted when extracted from DSK
« Reply #6 on: 16:32, 28 May 21 »
First of all I loaded up ANSI in Protext (Disk Version) on my CPC and there is no "end" there ... it's exactly the same as the extracted version ...


will try the other one ....

Offline SkulleateR

  • 464 Plus
  • *****
  • Posts: 461
  • Country: de
  • Liked: 225
  • Likes Given: 129
Re: Files corrupted when extracted from DSK
« Reply #7 on: 16:54, 28 May 21 »
Ok, this seems to be a file format thingy ? I just releaded the ANSI file onto an empty DSK file and the file is correct, even without the symbols at the end ....


UPDATE : there seem to be some codes inside the txt files that influences the export, I tried with old CPCEXT (MS-DOS) to extract the ANSI file and it only extracts 8KB from 22KB and stops then ....
« Last Edit: 17:38, 28 May 21 by SkulleateR »

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.806
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 1304
  • Likes Given: 3038
Re: Files corrupted when extracted from DSK
« Reply #8 on: 17:43, 28 May 21 »
Just tried a fresh download, extract from RVM and if you look at BBSPROG. At the end there is :


Had a quick run.. used an emulator and printed the file using FutureOS and this is what I got...



1 PRINT "Starting>>>"




ORG &5000
nolist


;       &400   BUFFER START
;   &1000   BUFFER END
;   &1060   SCROLL BACK START
;   &2000   Char/ansi fornt buffer
;   &3000   CHARSETS
;   &4000   DIRECTORY BUFFER
;   &4800   XMODEM
;   &4C00   CRC TABLES


;   &5000    graphics start
;   &7000   programme start
;   &9000   global data




;graphics unit start
gu equ &5000


;----------------------------------


org &6b00
   write "b:termdata.bin"
   read  "common"         ;common data




;---------------------------------


org &7000       
   write "b:termexc.bin" 
     read "main"
       read  "menus"
       read  "file"
       read  "xmodem"
       read  "rs232"
     read  "dataprog"


;----------------------------------
end.

http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)

Offline kolleykibber

  • CPC664
  • ***
  • Posts: 50
  • Country: gb
  • Liked: 40
  • Likes Given: 31
Re: Files corrupted when extracted from DSK
« Reply #9 on: 18:43, 28 May 21 »
Thanks for all the testing!




I think i'll try to manually remove each file, sanitise it and then drop it into a new DSK and get it assembling.

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.806
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 1304
  • Likes Given: 3038
Re: Files corrupted when extracted from DSK
« Reply #10 on: 20:32, 28 May 21 »
Or try to load and then save it using Maxam's Editor for example.
Sometimes load/save does eliminate crazy (control) codes.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)

Offline mv

  • Supporter
  • CPC464
  • *
  • Posts: 44
  • Country: de
  • CPCBasic, CPCemu, CPC 6128
  • Liked: 96
  • Likes Given: 75
Re: Files corrupted when extracted from DSK
« Reply #11 on: 20:28, 06 June 21 »
I think the garbage at the end of the file comes from DSK file extraction tools that do not correct the file length for ASCII.

In the AMSDOS directory the size of a file is only stored as the number of 128 byte records:
https://www.cpcwiki.eu/index.php/Disk_structure
Rc stores the number of 128 byte records of the last used logical extent.

Non-ASCII files have an AMSDOS header with the "Real length" of the file:
https://www.cpcwiki.eu/index.php/AMSDOS_Header

ASCII files do not have such a header, &1a is used as an EOF marker in the last record (of up to &80 bytes) and the file is truncated.

CPCBasic does the job when drag&drop ZIP or DSK files onto the CPC screen window.
https://benchmarko.github.io/CPCBasic/cpcbasic.html?database=storage

(Just found a bug in the CPCBasic debug message, which should look like...
fnOnLoad: file: bbstext. meta: CPCBasic;A;0;683; imported
DiskImage.ts:633 readFile: ASCII file length 7680 truncated to 7594)

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.806
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 1304
  • Likes Given: 3038
Re: Files corrupted when extracted from DSK
« Reply #12 on: 20:27, 07 June 21 »
And Prowort files (+ some others) have file lengths precise to the byte (see DIR entry expansion). None of the PC tools does understand that.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)