News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_erikarn

what tools are people using to modify .dsk images under Linux?

Started by erikarn, 08:25, 29 January 13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

erikarn

Hi all,


It's been a few years since I tinkered with emulators (i've been spoilt with real hardware for too long) ..


What do people use these days for editing disk images? Not just creating them (libdsk seemed to do this fine) but also reading/writing/removing files from inside the disk image?


I use a variety of unix platforms (linux, freebsd, macosx) so it'd be nice if said tools were somewhat portable and in C/C++.


Thanks!


arnoldemu

Quote from: erikarn on 08:25, 29 January 13
Hi all,


It's been a few years since I tinkered with emulators (i've been spoilt with real hardware for too long) ..


What do people use these days for editing disk images? Not just creating them (libdsk seemed to do this fine) but also reading/writing/removing files from inside the disk image?


I use a variety of unix platforms (linux, freebsd, macosx) so it'd be nice if said tools were somewhat portable and in C/C++.


Thanks!
I use cpcxfs. It is downloadable from Unofficial Amstrad WWW Resource (look in downloads).
Works fine for me under linux :)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

ralferoo

I use iDSK, which I had to modify to work under work under Linux as it seemed to only work as-is on MacOS. My changes were fairly minimal and available here: ralferoo/cpctools · GitHub

I'm not sure I'd particularly recommend iDSK if there are other alternatives though - the command line syntax is slightly different to that described in the help message and it sometimes seems quite fussy about extracting files from a disk image, although it seems to be fine creating images.

mahlemiut

I usually just use managedsk under Wine.  Works for me :)
- Barry Rodewald

00WReX

I also use ManageDSK.

Just as an FYI, the last "advertised" update appears to be "ManageDsk_v0.20g".

I checked recently by modifiying the download URL and discovered a "v0.20h" version.

A google search does not find this release but it does appear to have an important bug fix.

http://ldeplanque.free.fr/ManageDsk/ManageDsk_v0.20h.zip

Version 0.20h (02/06/2012)
--------------------------
- Fixed bug when renaming files


Cheers,
Shane
The CPC in Australia...
Awa - CPCWiki

erikarn

Quote from: arnoldemu on 10:26, 29 January 13
I use cpcxfs. It is downloadable from Unofficial Amstrad WWW Resource (look in downloads).
Works fine for me under linux :)


Did you have to write up a replacement Makefile? It only has a windows makefile by default.


I'm no stranger to Makefiles and C code; I just don't want to duplicate effort. :)

krusty_benediction

Hi!

Quote
I use a variety of unix platforms (linux, freebsd, macosx) so it'd be nice if said tools were somewhat portable and in C/C++.
I need to work on a project where I use Linux and my co-developer uses Windows.
So I have written a quick'n dirty Makefile which correctly works with the two systems.
I planned to release it later in a more beautifull way, but while it is not done, here it is (at the end of message), even if half of it is not deserved for file manipulation. Minor modifications may be needed for your purpose.
As some tools have evolved (vasm for example) since the first version of this file, some piece onf code could be wrong.

Anyway, some actions are done with the same tools under linux and windows (assembling, putting breakpoints in a snapshot, cruncher, ...), while other are done with different tools (dsk manipulation).
If I remember well, the linux tools have been retrieved thanks to this script (in a Makefile in an upper folder): Octoate/AmstradCPCToolchain · GitHub
and manually download for windows.

Quote
What do people use these days for editing disk images

- windows: hideurmaker, CPCDiskXP and iDSK
- linux: hideurmaker, iDSK with modifications from the cpcsdsk project (cpcsdk - Collection of tools for helping cross-development for the Amstrad)

The makefile then provides several function which can be called with, and most of them are related to file modification:

$(call function param1, param2, ...)


The function name is self explicit, but its implementation may depend of the OS:
COMPRESS_FILE
GET_FILE_FROM_DSK
CREATE_DSK
PUT_FILE_INTO_DSK
SET_HEADER

(I do not need other functions for democoding)

and there are rule to automatically:
  - assemble a file
  - compress a file
  - create a symbol source file





######################################################
# Common Makefile instruction for building CPC demos #
######################################################

#BUG Current limitation: may only work with powershell/github client


# TODO clean this file and create one file specific to Linux and one file specific to windows

#The aim of this configuration file is to write portable things.
# Tools can be different between linux and windows
#TODO write function to put and remove files from dsk

ifdef SystemRoot
   RM = del /Q
   FixPath = $(subst /,\,$1)
   AWK=..\wintools\awk.exe
else
   ifeq ($(shell uname), Linux)
      RM = rm -f
      FixPath = $1
      AWK='awk'
      PATH := ../bin/:$(PATH)
   endif
endif


# Assembler name. Can be vasmz80_oldstyle or sjasmplus2
ifdef SystemRoot
ASSEMBLER=..\wintools\vasmz80_oldstyle.exe
else
ASSEMBLER?=vasmz80_oldstyle
endif

# Compressor name. Only exomizer for the moment
ifdef SystemRoot
COMPRESS=..\wintools\exomizer.exe
else
COMPRESS=exomizer
endif


ifdef SystemRoot
SNA_MANAGER=..\wintools\createSnapshot.exe
else
SNA_MANAGER=createSnapshot
endif

ifdef SystemRoot
ADD_BRK_TO_SNA=..\commontools\BRK2SNA.exe
else
ADD_BRK_TO_SNA=../commontools/BRK2SNA.exe
endif
# DSK manipulation tool. Only iDSK for the moment.
# Other tools may be usefull.
# TODO make the thing work also under windows
#
ifdef SystemRoot
DSKTOOL=..\wintools\iDSK
SHELL=cmd
else
DSKTOOL?=iDSK
endif
# Tool to add header on file. :http://downwater.free.fr/?rubrique=utilitaires
HIDEUR=hideur
SHELL=/bin/sh

.SUFFIXES: .asm, .o, .exo
VPATH= src

# Assemble a file
# ###############

#TODO build here a .lst file compatbile between vasm and sjasmplus
%.o %.lst: %.asm
# Assemble using sjamsplus2 (private assembler based on sjasm)
ifeq (, $(findstring WINDOWS,$(PATH)))
@echo -e '\033[0;34m\033[1mCompile \033[4m$<\033[0m\033[1m\033[0;34m\033[1m to \033[4m$@\033[0m \033[0m'
endif
ifneq (, $(findstring sjasmplus2,$(ASSEMBLER)))
$(ASSEMBLER) --inc=src --sym=$(notdir $(<:.asm=.sym)) --lst=$(notdir $(<:.asm=.lst)) --raw=$@ $<  > compilation.log && exit 0; \
cat compilation.log ; \
        rm $@; \
exit 255
endif
# Assembling using vasm
ifneq (, $(findstring vasmz80,$(ASSEMBLER)))
$(ASSEMBLER) $(ASMFLAGS) -L $(notdir $(<:.asm=.lst))  -Fbin -o $*.o $< > compilation.log && exit 0; \
cat compilation.log ; \
rm $@ ; \
     exit 255
  ifneq (, $(findstring WINDOWS,$(PATH)))
$(ASSEMBLER)  $(ASMFLAGS) -Ftest -o  $*.lst $<
  endif
endif


# Build a complete list of symbols when required
# ONLY works with Powershell :(
%.sym: %.lst
ifdef SystemRoot
sed -e "s/ \././" $^ | ..\wintools\awk.exe "{print $$1, \"equ\" ,$$2, $$3}" | sed -e "s/^\*.*//" -e "s/(//" -e "s/)//"  -e 's/sec=.*//' -e 's/ LAB 0x/ 0x/' -e "s/.*equ *$$//" -e "s/.*equ [^0].*//" >$@
else
vasm_symbols.py  $^  > $@
endif

# Compress a file
#################
ifdef SystemRoot
COMPRESS_FILE = $(COMPRESS) raw -c -o $(2) $(1)
else
COMPRESS_FILE = @echo "\033[0;32m\033[1mCompress \033[4m$(1)\033[0m\033[1m\033[0;32m\033[1m to \033[4m$(2)\033[0m"; \
$(COMPRESS) raw -c -o $(2) $(1)  > /dev/null;
endif

%.exo: %.o
$(call COMPRESS_FILE,$<,$@)

%.exo: %.bin
$(call COMPRESS_FILE,$<,$@)


# Amsdos file management
########################

#
# AMsdos file types
AMSDOS_BASIC=0
AMSDOS_ENCRYPTED_BASIC=1
AMSDOS_BINARY=2

# Macro to extract a file from a DSK
# Usage $(call GET_FILE_FROM_DSK, dsk, file)
GET_FILE_FROM_DSK = @echo '\033[1mExtract $(2) from $(1)\033[0m'; \
    $(DSKTOOL) $(1) -g $(2) 2> /dev/null > /dev/null;

# Macro to create a new DSK
# Usage $(call CREATE_DSK, dsk)
ifdef SystemRoot
CREATE_DSK =  $(DSKTOOL) $(1) -n
else
CREATE_DSK = @echo "\033[1mBuild DSK $(1)\033[0m"; \
     $(DSKTOOL) $(1) -n > /dev/null 2>/dev/null;
endif

# Macro to put a file into a DSK
# header must be set
# Usage $(call PUT_FILE_INTO_DSK, dsk, file)
ifdef SystemRoot
PUT_FILE_INTO_DSK = ../wintools/CPCDiskXP -File $(2) -AddToExistingDsk $(1)
else
PUT_FILE_INTO_DSK = @echo "\033[0;35m\033[1mAdd $(2) to $(1)\033[0m" ; \
    $(DSKTOOL) $(1) -i $(2) -f 2> /dev/null > /dev/null;
endif




# Macro set a header to a file
##############################
#
# Usage: $(call SET_HEADER, source, destination, type, load, exec)
# load and exec are called like xffff and xffff
# TODO test for other type of files !
ifdef SystemRoot
SET_HEADER=copy $(1) $(2) && ..\wintools\CPCDiskXP.exe -File $(2) -AddAmsdosHeader $(subst x,,$(4)) -AmsdosEntryAddress $(subst x,,$(5))
else
SET_HEADER = echo '\033[0;31m\033[1mSet header to \033[4m$(1)\033[0m'; \
     $(HIDEUR) $(1) -o $(2) -t $(3) -l $(4) -x $(5) 2> /dev/null  > /dev/null;
endif

# Launch AFT
############
AFT:
../wintools/Aft.exe



Powered by SMFPacks Menu Editor Mod