News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Saving BASIC text file to .cdt

Started by santi.ontanon, 21:41, 16 May 24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

santi.ontanon

Hi!

I am trying to save a little BASIC program I wrote on a text file in my computer to a .cdt file to load it on an emulator, and I am having troubles. I can easily add it to a .dsk file with something like

./idsk test.dsk -i test.bas -t 0 -n
and that works fine!

But if I try to add it to a .cdt file, with something like this:

./2cdt -s 0 -n -r test test.bas test.cdt
When I then open an emulator and try to load the file with LOAD"", I just get a "Memory full" message from the BASIC interpreter, and if I "LIST", nothing was loaded.

What am I doing wrong? haha 

Jean-Marie

Generally, I use the Autotype from clipboard feature on Caprice Forever emulator. It can be painfully slow if the Basic listing is long, but that's a "no-brainer" method.
For some reason, you'll have to check on the Expert Mode from the Help menu first, or the feature won't show up.
You can then create a tape file from the menu, and save your basic listing onto it.
You have the equivalent method on WinApe, but it doesn't seem to work any longer on Windows 11; in my case, it displays some garbled characters. 

santi.ontanon

Thanks for the suggestion!! This would be definitively enough for my use case for now. Unfortunately "Caprice Forever" is a Windows-only application, and I do not have access to any Windows machine. All my machines at home and at work are Linux/Mac. I tried running it with wine, but it does not seem to work either... hmm... I can run caprice32 no problem (I compiled it from source and it runs, but it does not seem to have that feature).

santi.ontanon

Is the problem that the basic file to load into the .cdt has to be tokenized BASIC, rather than a text file? (surprising, since I can save a text file to a .dsk and load it fine though).

Jean-Marie

If you have a Memory full error displayed, that could mean the file header is incorrect and was created for a binary content rather than a Basic one. A basic file must have a flag set up accordingly, and a start address equal to 170h.
You can test your luck with WinAPE which is said to work correctly with WINE.

Jean-Marie

I managed to have it working with ACE/DL emulator, which has a Linux version.
You must first save your Basic file in a text format with a BAS extension. Give it a short name, and no spaces nor special characters.
Press F12 to display the menu, then select Floppy & Drives, then Create new floppy in Drive A.
Press F12 again, click again on Floppy & Drives, then on Manage Floppy in Drive A.
From there, you can drag & drop your file in the window, and it will be written directly on the disk.
Finally, press F4 to save the DSK file.
Important: you must tick on the ASCII Import checkbox before dragging the file.

santi.ontanon

Thanks again! I'll give this emulator a try too! 

But actually, I just figured it out using 2cdt! Finally!! What I was missing is to save the block in "cpctxt" format! Thanks a lot for the help though, I've discovered a couple of new emulators I didn't know! (I'm relatively new to the CPC world, as I do most of my development for MSX, and I am not very familiar with the CPC tools!)

MoteroV4

In case it helps you, this is an example of "maketape.sh" with "2cdt" tool that I used a while ago to create the "cdt" that I presented to CPCRetrodev:

#!/bin/bash
# Los nombres de los archivos, son sensibles a Mayúsculas
# NOTA: los ficheros BAS hechos con editor no llevan cabecera AMSDOS. Crear el diskete normalmente,
# cargarlos en Winape y grabarlos con save "nombre.BAS", para convertirlos de ASCII a binario (BAS).
# Aparte ocupan la mitad. Y en ASCII tardaban mucho en cargarse, antes de convertirlos en BAS.
# Finalmente extraerlos del diskete con CPCDiskXP. Usar estos para empaquetarlos en la distribución
# final en disco y en cinta. Se distinguen porque van en letras mayúsculas.
# Para compilar Proyecto en Cinta: ./maketape.sh

ICDT=$CPCT_PATH/tools/2cdt/bin/2cdt
TARGET=memtrainer.cdt

# Crear un nuevo fichero CDT con el nombre de mi "target"
$ICDT -n . $TARGET > /dev/null

# Fuentes de ficheros a insertar en el CDT
#cargador
SOURCE1=MEMTRAIN.BAS
#pantalla
SOURCE2=MEMTRAIN.SCR
#basic ppal.
SOURCE3=SIMON.BAS
#fuentes
SOURCE4=SPACEAGE.FNT
#sprites y ASM
SOURCE5=SIMONBIN.BIN
#musica
SOURCE6=SIMBUFER.BIN


$ICDT -r Memtrainer $SOURCE1 $TARGET
$ICDT -r memtrain.scr -L 0xC000 $SOURCE2 $TARGET > /dev/null
$ICDT -r simon.bas $SOURCE3 $TARGET > /dev/null

$ICDT -r spaceage.fnt -L 0xA074 -X 0xA074 $SOURCE4 $TARGET > /dev/null

$ICDT -r simonbin.bin -L 0x6000 -X 0x9452 $SOURCE5 $TARGET > /dev/null

#$ICDT -r simbufer.bin -L 0x5000 -X 0x05786 $SOURCE6 $TARGET > /dev/null
$ICDT -r simbufer.bin -L 0xC000 $SOURCE6 $TARGET > /dev/null
Released cpc games: Memtrainer, El Gerente (Remake)

santi.ontanon

Thanks!! Yeah, that's very useful!

Powered by SMFPacks Menu Editor Mod