News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Sid_

dsk a new dsk/sna cli manager

Started by Sid_, 13:08, 10 January 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Sid_

Hello folks,
I would like to share this little tool to manage dsk and sna files.
You can create, add, extract and get informations from inner files from dsk.
You can check the sources on GitHub : https://github.com/jeromelesaux/dsk
And get the releases on GitHub : https://github.com/jeromelesaux/dsk/releases
Here some usage example :


create a new empty dsk (by default 39 tracks 9 sectors  :


dsk -dsk empty.dsk -format
DSK cli version [0.1]
Made by Sid (ImpAct)
Formating number of sectors (9), tracks (39)
Dsk file (empty.dsk)




You can create your own dsk tracks, head and sectors sizes :


dsk -dsk emptyextended.dsk -format -head 1 -track 42 -sector 9
DSK cli version [0.1]
Made by Sid (ImpAct)
Formating number of sectors (9), tracks (42)
Dsk file (emptyextended.dsk)



You can add your own file into dsk :

dsk -dsk empty.dsk -put -amsdosfile load.bas



You can get information from a file :


dsk -dsk y2020.dsk -info -amsdosfile y2020.bin
DSK cli version [0.1]
Made by Sid (ImpAct)
Dsk file (y2020.dsk)
Amsdos informations :
Filename:Y2020   BIN
Size:#34DE (13.22 Ko)
Size2:#34DE (13.22 Ko)
Logical Size:#34DE (13.22 Ko)
Execute Address:#6128
Loading Address:#6128
Checksum:#6A0
Type:2
User:0



You can get a file from the dsk :


dsk -dsk y2020.dsk -get -amsdosfile y2020.bin
DSK cli version [0.1]
Made by Sid (ImpAct)
Dsk file (y2020.dsk)
DSK path [y2020.dsk]
Action on DSK [get amsdosfile] on amsdos file [y2020.bin]
Extract file [y2020.bin]
Indice in DSK [0]



You can list the file content, here an example with a file basic (also available disassemble, ascii, hexadecimal) :


dsk -dsk y2020.dsk -basic -amsdosfile y2020.bas
DSK cli version [0.1]
Made by Sid (ImpAct)
Dsk file (y2020.dsk)
File y2020.bas filesize :160 octets
10 emile=&1000
20 MODE 2:INK 0,2:INK 1,23:BORDER 2
30 PRINT"original gfx by Manny Clark colored by Giovanny M. Gava?
40 OPENOUT"d":MEMORY &FFF:CLOSEOUT
50 LOAD"y2020.bin",emile:CALL emile



To finish the whole arguments :


dsk
DSK cli version [0.1]
Made by Sid (ImpAct)
No dsk set.
  -amsdosfile string
    File to handle in (or to insert in) the dsk.
  -analyze
    Returns the DSK header
  -ascii
    list the amsdosfile in ascii mode.
  -basic
    List a basic amsdosfile.
  -desassemble
    list the amsdosfile desassembled.
  -dsk string
    Dsk path to handle.
  -dsktype int
    DSK Type :
    0 : DSK
    1 : EDSK
    3 : SNA


  -exec int
    Execute address of the inserted file. (default -1)
  -force
    Force overwriting of the inserted file.
  -format
    Format the followed dsk.
  -get
    Get the file in the dsk.
  -head int
    Number of heads in the DSK (format) (default 1)
  -hex
    List the amsdosfile in hexadecimal.
  -info
    Get informations of the amsdosfile (size, execute and loading address).
  -list
    List content of dsk.
  -load int
    Loading address of the inserted file. (default -1)
  -put
    Put the amsdosfile in the current dsk.
  -remove
    Remove the amsdosfile from the current dsk.
  -sector int
    Sector number (format). (default 9)
  -sna string
    SNA file to handle
  -track int
    Track number (format). (default 39)
  -type string
    Type of the inserted file
    ascii : type ascii
    binary : type binary


  -user int
    User number of the inserted file.



For the moment the sna is just in read only, but it is planned to add this feature.


If you want some new features, report a bug etc, leave a message here or on GitHub.


Sid from Impact

SkulleateR

Nice, have to try this out on my MacBook soon  8)

Sid_

New version with main feature : fix bug and Sna handling added :
https://github.com/jeromelesaux/dsk/releases/tag/v0.2


I also added some examples of usage :


./dsk -help
  -amsdosfile string
    File to handle in (or to insert in) the dsk.
  -analyze
    Returns the DSK header
  -ascii
    list the amsdosfile in ascii mode.
  -basic
    List a basic amsdosfile.
  -cpctype int
    CPC type (sna import feature):
    CPC464 : 0
    CPC664: 1
    CPC6128 : 2
    Unknown : 3
    CPCPlus6128 : 4
    CPCPlus464 : 5
    GX4000 : 6
    (default 2)
  -desassemble
    list the amsdosfile desassembled.
  -dsk string
    Dsk path to handle.
  -dsktype int
    DSK Type :
    0 : DSK
    1 : EDSK
    3 : SNA


  -exec string
    Execute address of the inserted file.
  -force
    Force overwriting of the inserted file.
  -format
    Format the followed dsk.
  -get
    Get the file in the dsk.
  -head int
    Number of heads in the DSK (format) (default 1)
  -help
    display extended help.
  -hex
    List the amsdosfile in hexadecimal.
  -info
    Get informations of the amsdosfile (size, execute and loading address). Or get sna informations.
  -list
    List content of dsk.
  -load int
    Loading address of the inserted file. (default -1)
  -put
    Put the amsdosfile in the current dsk.
  -remove
    Remove the amsdosfile from the current dsk.
  -screenmode int
    screenmode of the importing file in sna. (default 1)
  -sector int
    Sector number (format). (default 9)
  -sna string
    SNA file to handle
  -track int
    Track number (format). (default 39)
  -type string
    Type of the inserted file
    ascii : type ascii
    binary : type binary


  -user int
    User number of the inserted file.


Here sample usages :
* Create empty simple dsk file : dsk -dsk output.dsk -format
* Create empty simple dsk file with custom tracks and sectors: dsk -dsk output.dsk -format -sector 8 -track 42
* Create empty extended dsk file with custom head, tracks and sectors: dsk -dsk output.dsk -format -sector 8 -track 42 -dsktype 1 -head 2
* Create empty sna file : dsk -sna output.sna
* List dsk content : dsk -dsk output.dsk -list
* Get information on Sna file : dsk -sna output.sna -info
* Get information on file in dsk  : dsk -dsk output.dsk -amsdosfile hello.bin -info
* List file content in hexadecimal in dsk file : dsk -dsk output.dsk -amsdosfile hello.bin -hex
%!(EXTRA string=
* Put file in dsk file : dsk -dsk output.dsk -put -amsdosfile hello.bin -exec #1000 -load 500


* Put file in sna file (here for a cpc plus): dsk -sna output.sna -put -amsdosfile hello.bin -exec #1000 -load 500 -screenmode 0 -cpctype 4

gerald

Quote from: Sid_ on 13:08, 10 January 20
create a new empty dsk (by default 39 tracks 9 sectors  :


dsk -dsk empty.dsk -format
DSK cli version [0.1]
Made by Sid (ImpAct)
Formating number of sectors (9), tracks (39)
Dsk file (empty.dsk)

Shouldn't the default be 40 tracks (0 to 39) ?

Sid_

Right I'll fix it in the next release.  :P

Ygdrazil

Hi @Sid_

Very nice tool. I especially like the feature where you can list basic programs :-) Neat! Also this tool seem very simple to use.

I am having some difficulties putting my own files on the dsk images.. though!

The files show up in the directory, but is listed as zero length and when i try to load them on real CPC or in an emulator it gives me a syntax error.

I put my files on the generated DSK image:


dsk -dsk filedsk.dsk -put -amsdosfile myfile.bin -type binary -force


What am I missing!?... Hope you can guide me in the right direction....

Regards,
Ygdrazil

Quote from: Sid_ on 13:08, 10 January 20
Hello folks,
I would like to share this little tool to manage dsk and sna files.
You can create, add, extract and get informations from inner files from dsk.
You can check the sources on GitHub : https://github.com/jeromelesaux/dsk
And get the releases on GitHub : https://github.com/jeromelesaux/dsk/releases
Here some usage example :


create a new empty dsk (by default 39 tracks 9 sectors  :


dsk -dsk empty.dsk -format
DSK cli version [0.1]
Made by Sid (ImpAct)
Formating number of sectors (9), tracks (39)
Dsk file (empty.dsk)




You can create your own dsk tracks, head and sectors sizes :


dsk -dsk emptyextended.dsk -format -head 1 -track 42 -sector 9
DSK cli version [0.1]
Made by Sid (ImpAct)
Formating number of sectors (9), tracks (42)
Dsk file (emptyextended.dsk)



You can add your own file into dsk :

dsk -dsk empty.dsk -put -amsdosfile load.bas



You can get information from a file :


dsk -dsk y2020.dsk -info -amsdosfile y2020.bin
DSK cli version [0.1]
Made by Sid (ImpAct)
Dsk file (y2020.dsk)
Amsdos informations :
   Filename:Y2020   BIN
   Size:#34DE (13.22 Ko)
   Size2:#34DE (13.22 Ko)
   Logical Size:#34DE (13.22 Ko)
   Execute Address:#6128
   Loading Address:#6128
   Checksum:#6A0
   Type:2
   User:0



You can get a file from the dsk :


dsk -dsk y2020.dsk -get -amsdosfile y2020.bin
DSK cli version [0.1]
Made by Sid (ImpAct)
Dsk file (y2020.dsk)
DSK path [y2020.dsk]
Action on DSK [get amsdosfile] on amsdos file [y2020.bin]
Extract file [y2020.bin]
Indice in DSK [0]



You can list the file content, here an example with a file basic (also available disassemble, ascii, hexadecimal) :


dsk -dsk y2020.dsk -basic -amsdosfile y2020.bas
DSK cli version [0.1]
Made by Sid (ImpAct)
Dsk file (y2020.dsk)
File y2020.bas filesize :160 octets
10 emile=&1000
20 MODE 2:INK 0,2:INK 1,23:BORDER 2
30 PRINT"original gfx by Manny Clark colored by Giovanny M. Gava?
40 OPENOUT"d":MEMORY &FFF:CLOSEOUT
50 LOAD"y2020.bin",emile:CALL emile



To finish the whole arguments :


dsk
DSK cli version [0.1]
Made by Sid (ImpAct)
No dsk set.
  -amsdosfile string
       File to handle in (or to insert in) the dsk.
  -analyze
       Returns the DSK header
  -ascii
       list the amsdosfile in ascii mode.
  -basic
       List a basic amsdosfile.
  -desassemble
       list the amsdosfile desassembled.
  -dsk string
       Dsk path to handle.
  -dsktype int
       DSK Type :
          0 : DSK
          1 : EDSK
          3 : SNA


  -exec int
       Execute address of the inserted file. (default -1)
  -force
       Force overwriting of the inserted file.
  -format
       Format the followed dsk.
  -get
       Get the file in the dsk.
  -head int
       Number of heads in the DSK (format) (default 1)
  -hex
       List the amsdosfile in hexadecimal.
  -info
       Get informations of the amsdosfile (size, execute and loading address).
  -list
       List content of dsk.
  -load int
       Loading address of the inserted file. (default -1)
  -put
       Put the amsdosfile in the current dsk.
  -remove
       Remove the amsdosfile from the current dsk.
  -sector int
       Sector number (format). (default 9)
  -sna string
       SNA file to handle
  -track int
       Track number (format). (default 39)
  -type string
       Type of the inserted file
          ascii : type ascii
          binary : type binary


  -user int
       User number of the inserted file.



For the moment the sna is just in read only, but it is planned to add this feature.


If you want some new features, report a bug etc, leave a message here or on GitHub.


Sid from Impact

Sid_

Hi @Ygdrazil
If your binary file does not contain an Amsdos header, you need to set it by the commande line for instance :

dsk -dsk filedsk.dsk -put -amsdosfile myfile.bin -type binary -force -exec 0  -load 368



where -exec is the execution address (#0) and -load is the load address (#170) of the file.
Hope this help you.




Ygdrazil


Hi @Sid_


Worked  ;D , thanks....


Regards,
Ygdrazil

Quote from: Sid_ on 10:44, 03 February 20
Hi @Ygdrazil
If your binary file does not contain an Amsdos header, you need to set it by the commande line for instance :

dsk -dsk filedsk.dsk -put -amsdosfile myfile.bin -type binary -force -exec 0  -load 368



where -exec is the execution address (#0) and -load is the load address (#170) of the file.
Hope this help you.

Sid_

I saw that it was not able to set the addresses by hexadecimal value.
It's now possible by uploading the last version :


https://github.com/jeromelesaux/dsk/releases/tag/v0.3




You can to the same with the followed commande line :

dsk -dsk filedsk.dsk -put -amsdosfile myfile.bin -type binary -force -exec #0  -load #170

Ygdrazil

#9
Hi @Sid_

I must be doing things wrong or have i found some bugs!?
-Remove does not work - dsk replies that the file I want to remove already exists.-Also puting the same file in the dsk image twice, makes the filesize double in the dsk image.
-When doing info on a file in a dsk image, the program sometimes says the length is 0 byes (unstable)....
I have tried it on two different laptops (ubuntu).

I wonder if have installed the dsk tool the right way, well is there anything else to do other then to unzip the file into the path!?Otherwise nice tool, just what I have been waiting for  ;)
Regards,Ygdrazil




Quote from: Sid_ on 16:20, 03 February 20I saw that it was not able to set the addresses by hexadecimal value.
It's now possible by uploading the last version :


https://github.com/jeromelesaux/dsk/releases/tag/v0.3




You can to the same with the followed commande line :

dsk -dsk filedsk.dsk -put -amsdosfile myfile.bin -type binary -force -exec #0  -load #170


Sid_

For the file size dsk takes the file size from the catalogue.
It mustn't change.
The remove is implemented, let me check the code this evening and doing some tests to be sur that's a bug or not. The remove action just set the catalogue to zero.
I'll do furthers tests and will check that.

Sid_

I find the bug for the remove action.
It's fixed, if you want a new binary tell me, I 'll post the link here.
Thanks for this report.

Ygdrazil


@Sid_
Yes please  :D
Quote from: Sid_ on 22:28, 03 February 20I find the bug for the remove action.
It's fixed, if you want a new binary tell me, I 'll post the link here.
Thanks for this report.



Sid_

A new version is available here https://github.com/jeromelesaux/dsk/releases/tag/v0.7
A lot of bugs fixed in disassembler and add a new binary for older windows (arch 386) like windows xp.
Thanks @rgiot to find out those issues.




Sid_

I added the possibilities to list basic, list in hexadecimal, disassemble check amsdos headers on standalone file also.
If you are interested in those features, tell me, I will release this version.




Sid_

The new version is available and can be downloaded here :
https://github.com/jeromelesaux/dsk/releases/tag/v0.8


Now you can add amsdos header, display basic, hexadecimal and disassemble a standalone file.
Feel free to report any bugs.


Sid

Sid_

for instance, here I would like to display amsdos header from a file :


dsk -info -amsdosfile ironman.scr
DSK cli version [0.8.rc]
Made by Sid (ImpAct)
Amsdos informations :
   Filename:IRONMANSCR
   Size:#7E10 (31.52 Ko)
   Size2:#7E10 (31.52 Ko)
   Logical Size:#7E10 (31.52 Ko)
   Execute Address:#0
   Loading Address:#170
   Checksum:#517
   Type:0
   User:0


Sid_

new release with a bug fix on import and export ascii files.


https://github.com/jeromelesaux/dsk/releases/tag/v0.12


Sid_

H here:
new version of this tool is available. This version add the vendor format and the export, import for raw data (custom your dsk data).
To download it go to this page : https://github.com/jeromelesaux/dsk/releases/tag/v0.14


To use those new features :
for importing a raw file (without amsdos header ^^) : dsk -dsk mydsk.dsk -rawimport -track 0 -sector 0 -amsdosfile data.bin, this will import the content of data.bin starting at the track 0 and sector 0 on the dsk.
Similar command for exporting : dsk -dsk mydsk.dsk -rawexport -track 0 -sector 0 -amsdosfile data.bin -size "#4000", this will export the dsk data starting at the sector 0 track 0 of size #4000 into the data.bin file.

[/size][size=78%]Enjoy this new version. [/size]

Sid_

a new version is available, I fixed the filename export with special char in the dsk.
An &= 127 fixed it ;).
You can download it here : https://github.com/jeromelesaux/dsk/releases/tag/v0.15


Now you will have no more issue when you will use dsk -dsk my file.dsk -get -amsdosfile "*"

Sid_

A new version of dsk tool is available, fixing big bugs when importing binary files in an existing dsk. 
SNA Version 2 and 3 is implemented now for a futur use.
You can download it here : https://github.com/jeromelesaux/dsk/releases/tag/v0.18

Enjoy this version. 

Sid_

Hi all, 
for the new year, a lot of bugs are now fixed on dsk tool. 
 - extraction of all files from DSK 
 - set user on file when insert it in a DSK
You can find the new version here : 
https://github.com/jeromelesaux/dsk/releases/tag/v0.22

Enjoy this new version and I wish you a happy new year ;) .


Powered by SMFPacks Menu Editor Mod