News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ervin

cpctelera CDT and DSK files

Started by ervin, 02:47, 09 October 15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ervin

Hi there.

I seem to remember reading something a little while ago, about cpctelera automatically putting files into CDT and DSK files.
I'm not talking about the normal .BIN file being put onto the CDT/DSK (which cpctelera does indeed do automatically), but other files, like a BASIC loader program.

Is my memory correct? Was this actually discussed?
If memory serves, we can put files into a certain folder, and they will automatically be put onto the CDT/DSK at the end of a successful compilation phase.

Though I could of course be mixing things up with something else I read!
???

ervin

#1
Found it!!!
Migration of Cpcrslib to Cpctelera

I had to update my installation of cpctelera (it was quite old!), and then I needed to create a new project using cpct_mkproject, but then I was able to simply copy all my files from the old project folder to this new one.
I can now use the DSKFILESDIR functionality, and I do indeed have a .BAS file being put into the DSK.
:)

However, I also need the .BAS file to be put into the associated CDT.

Is this something I'll need to do manually?
If so, can anyone recommend a good tool (I'm using Windows 7) to do this?

Thanks.

ervin

I think I've found the answer to the CDT problem as well!
CDTMaster

AMSDOS

2CDT also allows you to add additional files to a CDT, but I think the trick there is to Add the relevant file to tape as you're adding those files.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

ronaldo

Hi @ervin,

   It's somewhat funny to see you asking and getting auto-anwers  :D . You're quite fast in doing things and don't give a chance to others to answer you ;) .

   CPCtelera actually adds files to DSK as you've already found. The problem with adding files to CDT is only about designing a way for the user to easily specify the order and parameters, as files in the CDT are stored sequentially. DSKs doesn't have this problem, as they can be stored in whatever order, and that lets you configure a folder populated with files, which is simple from the user point of view. Doing the same for CDTs is not possible, and becomes more complicated to the user. I need to invest more time in user-interface design for this.

   That takes me to the other part: next time I can sit down and develop new functionalities for CPCtelera, I'm planning to redesign the user interface (the building system). It has been a great advance having a more or less automated system, but I think it's time for an improvement. It needs to be more flexible and ready to easily implement new features. It also has to be easier to manage, to save more time to developers.

   By now, as @AMSDOS suggests, you also hace 2CDT, which is the tool CPCtelera uses to create the CDTs. You may add rules to your Makefile to automatically create your custom CDT file every time you type in 'make'. Just have to understand the parameters required for running 2CDT and create a rule like this:

##-------------------------------------------------------------------------------------------------------------------
## GENERATE A COMPLETE CDT FILE
##   This rule generates a blank CDT file and then populates it with all the files of this project in the
## appropriate order.
##   0) CDT file has to be added to TARGET variable to be automatically generated. This has to be done BEFORE
##      global_main_makefile.mk is included. So, you'll find 2 lines to do this previously on this file
##   1) Adds game loader    (BASIC File)
##   2) Adds loading screen (SCR file, data to be loaded directly to video memory in MODE 0)
##   3) Adds game binary    (BINARY file with the game)
##-------------------------------------------------------------------------------------------------------------------

## Game Loader File, in BASIC. Files on a CDT can have a completely different
## name from its original name, up to 16 characters (and no extension is required)
FILE1             := assets/dsk_files/PCLIMBER.BAS
FILE1_NAMEONCDT   := mygreatgame

## Loading Screen. Binary file that has to load directly to screen
## so it will load to 0xC000 by default. RunAddress won't be used
FILE2             := assets/dsk_files/SCREEN.SCR
FILE2_NAMEONCDT   := screen.scr
FILE2_LOADADDRESS := C000
FILE2_RUNADDRESS  := C000

## Game binary file. Loading Address and run address depend on the
## game and may vary every time the game is compiled. These 2 values
## are stored in LOADADDR and RUNADDR variables, generated during
## compilation. Note that FILE3_LOADADDRESS and FILE3_RUNADDRESS are
## defined with = instead of := to make them macros and not pre-calculated
## values. LOADADDR and RUNADDR have no value previous to the execution of
## the rule.
FILE3             := obj/game.bin
FILE3_NAMEONCDT   := game
FILE3_LOADADDRESS = $(LOADADDR)
FILE3_RUNADDRESS  = $(RUNADDR)

## This rule generates the Custom CDT file every time FILE1, FILE2 or FILE3 are
## changed. This is done creating a Blank CDT and adding the files sequentially.
## If more files were to be added, a for-each construct could be used for simplicity.
$(CUSTOM_CDT_FILE): $(FILE1) $(FILE2) $(FILE3)
    $(call     CREATEBLANKCDT,$(CUSTOM_CDT_FILE))
    $(call  ADDBASICFILETOCDT,$(CUSTOM_CDT_FILE),$(FILE1),$(FILE1_NAMEONCDT))
    $(call ADDBINARYFILETOCDT,$(CUSTOM_CDT_FILE),$(FILE2),$(FILE2_NAMEONCDT),$(FILE2_LOADADDRESS),$(FILE2_RUNADDRESS))
    $(call ADDBINARYFILETOCDT,$(CUSTOM_CDT_FILE),$(FILE3),$(FILE3_NAMEONCDT),$(FILE3_LOADADDRESS),$(FILE3_RUNADDRESS))


As you can read in this code, you have to add mygame.cdt to TARGET variable in order for this rule to be triggered. This is done easily with this code inserted between includes:

##
## PROJECT CONFIGURATION (you may change things there to setup this project)
##
include cfg/build_config.mk

##
## This is to automate the generation of a custom CDT file. We have to add the file
## we want to generate (mygame.cdt) to TARGET variable. This has to be done BEFORE
## global_main_makefile.mk is included, as TARGET variable is used there. Bellow you
## will find detailed code to generate this CDT file and add Amstrad files to it.
##
CUSTOM_CDT_FILE := mygame.cdt
TARGET          := $(TARGET) $(CUSTOM_CDT_FILE)

##
## USE GLOBAL MAKEFILE (general rules for building CPCtelera projects)
##
include $(CPCT_PATH)cfg/global_main_makefile.mk


  All this code has been added to Platform Climber's Makefile as an example. Also, here you are some documentation about CPCtelera's makefile macros.

ervin

Yes indeed, I like figuring things out on my own; problems keep nagging away at my brain until I solve them.
:laugh:

Thanks so much for that incredibly helpful reply @ronaldo.
Absolutely brilliant stuff.

No doubt it will help lots of others too.



ervin

Quote from: ronaldo on 13:04, 09 October 15
You're welcome, man :D

Seriously, I owe you a really great game for all the help you've given me!
8)

Powered by SMFPacks Menu Editor Mod