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

0 Members and 1 Guest are viewing this topic.

Offline Sid_

  • CPC464
  • **
  • Posts: 14
  • Country: fr
  • Liked: 14
  • Likes Given: 10
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

  • CPC664
  • ***
  • Posts: 124
  • Country: de
  • Liked: 61
  • Likes Given: 39
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_

  • CPC464
  • **
  • Posts: 14
  • Country: fr
  • Liked: 14
  • Likes Given: 10
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.443
  • Liked: 1001
  • Likes Given: 252
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_

  • CPC464
  • **
  • Posts: 14
  • Country: fr
  • Liked: 14
  • Likes Given: 10
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