Author Topic: dsk a new dsk/sna cli manager  (Read 1324 times)

0 Members and 1 Guest are viewing this topic.

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
dsk a new dsk/sna cli manager
« on: 14: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  :
Code: [Select]

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 :
Code: [Select]

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 :
Code: [Select]
dsk -dsk empty.dsk -put -amsdosfile load.bas


You can get information from a file :
Code: [Select]


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 :
Code: [Select]

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) :
Code: [Select]

 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 :
Code: [Select]

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

Offline SkulleateR

  • CPC6128
  • ****
  • Posts: 184
  • Country: de
  • Liked: 102
  • Likes Given: 61
Re: dsk a new dsk/sna cli manager
« Reply #1 on: 19:53, 10 January 20 »
Nice, have to try this out on my MacBook soon  8)

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #2 on: 14:00, 13 January 20 »
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 :
Code: [Select]

./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

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.467
  • Liked: 1021
  • Likes Given: 257
Re: dsk a new dsk/sna cli manager
« Reply #3 on: 19:13, 13 January 20 »
create a new empty dsk (by default 39 tracks 9 sectors  :
Code: [Select]

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) ?

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #4 on: 13:13, 14 January 20 »
Right I’ll fix it in the next release.  :P

Offline Ygdrazil

  • Global Moderator
  • 464 Plus
  • *****
  • Posts: 486
  • Country: dk
  • Liked: 47
  • Likes Given: 247
Re: dsk a new dsk/sna cli manager
« Reply #5 on: 10:21, 03 February 20 »
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:

Code: [Select]
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

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  :
Code: [Select]

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 :
Code: [Select]

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 :
Code: [Select]
dsk -dsk empty.dsk -put -amsdosfile load.bas


You can get information from a file :
Code: [Select]


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 :
Code: [Select]

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) :
Code: [Select]

 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 :
Code: [Select]

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

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #6 on: 11: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 :
Code: [Select]
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.




Offline Ygdrazil

  • Global Moderator
  • 464 Plus
  • *****
  • Posts: 486
  • Country: dk
  • Liked: 47
  • Likes Given: 247
Re: dsk a new dsk/sna cli manager
« Reply #7 on: 13:15, 03 February 20 »

Hi @Sid_


Worked  ;D , thanks....


Regards,
Ygdrazil

Hi @Ygdrazil
If your binary file does not contain an Amsdos header, you need to set it by the commande line for instance :
Code: [Select]
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.

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #8 on: 17:20, 03 February 20 »
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 :
Code: [Select]
dsk -dsk filedsk.dsk -put -amsdosfile myfile.bin -type binary -force -exec #0  -load #170

Offline Ygdrazil

  • Global Moderator
  • 464 Plus
  • *****
  • Posts: 486
  • Country: dk
  • Liked: 47
  • Likes Given: 247
Re: dsk a new dsk/sna cli manager
« Reply #9 on: 19:41, 03 February 20 »
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




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 :
Code: [Select]
dsk -dsk filedsk.dsk -put -amsdosfile myfile.bin -type binary -force -exec #0  -load #170
« Last Edit: 20:12, 03 February 20 by Ygdrazil »

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #10 on: 20:16, 03 February 20 »
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.

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #11 on: 23:28, 03 February 20 »
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.

Offline Ygdrazil

  • Global Moderator
  • 464 Plus
  • *****
  • Posts: 486
  • Country: dk
  • Liked: 47
  • Likes Given: 247
Re: dsk a new dsk/sna cli manager
« Reply #12 on: 23:31, 03 February 20 »

@Sid_
Yes please  :D
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.

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #13 on: 23:36, 03 February 20 »

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #14 on: 22:42, 04 February 20 »
new version with a lot of bugs fixed. Thanks @Ygdrazil ^^:


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




Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 74
Re: dsk a new dsk/sna cli manager
« Reply #15 on: 15:21, 05 May 20 »
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.