News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_TCMSLP

Recommended Linux cross-dev tool chain?

Started by TCMSLP, 13:10, 02 November 12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TCMSLP

Hi All,

After familiarising myself with Z80 assembler I'm now keen to start coding.

Can anyone recommend a nice simple tool chain for Linux -> CPC cross dev?

I see various recommendations for PASMO, mentions of Caprice Reloaded (with build in assembler/debugger), cpcsdk, Z80ASM, ZASM ... so many options I don't know where to start.

When I have a working assembler, can I dump the assembled code directly into an emulators memory, then call it from BASIC?   Is so, how do I transfer the data?  Is it easier if I create a .dsk (or similar) and load it this way?   

Once I have the code in an emulated CPC, how would I save this to a .dsk or .cdt for testing on a real CPC?   I'm assuming I'd need to dump the code section of memory to disk/tape (using a basic SAVE with memory address and code length?), then write a BASIC bootloader to load and execute this code from disk/tape?

As you can tell, I'm clueless.   Can anyone recommend a simple build/test process for a newbie?   I'm happy with an emulated solution for now - but any ideas on using a real CPC would be good too.   Should I invest in a 6128 with HxC interface?

Thanks,

Steve (TCM)

arnoldemu

I use pasmo to build the binary.
Normally I use "--amsdos" to put a header on it. I use "end <address>" in pasmo to define the execution address. Where <address> is a label in my code. The binary data can be executed.

I then use cpcxfs to put this into a dsk, or 2cdt to put it into a tape. Both should take files with headers and generate the appropiate executable data which you can run on the cpc.

You can use these in an emu to check it works here.

Then when you're ready for testing on a real machine, I use playtzx to convert the cdt to an au file which I play with audacity through the pc speakers and load onto the cpc.

for the disc, you could use dsktools, or cpcdiskxp (under windows) to write to a 3.5" disc.
or you could just put the dsk onto the sdcard and use it with hxc. (I don't have one of these so I can't say how to do that under linux, may just be a simple mount and cp).

Then you can load this into your cpc.

I use pasmo because it's closest to maxam assembler syntax which is the one I used on the cpc back in the day.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

TCMSLP




Awesome.  Thankyou - this is *exactly* what I was looking for. 


;D

Octoate

Under Linux I am working with vasm / vlink as assembler, iDSK to transfer the compiled files into a DSK file, exomizer to compress data, AFT to transfer DSK images via CPC Booster to my CPC and gfx2crtc to convert PNG graphics into CPC format. The only problem, which I have, is the emulator. Currently I am using WinApe or WinCPC with Wine, but a good CPC emulator for Linux would be great. Unfortunately I never managed to get CPCReloaded compiled on my system.
--

ralferoo

Much the same as everyone else, but I've put my makefile up here so you can see exactly how I use things: http://ranulf.net/sugarlumps-makefile (there's some legacy stuff here that wasn't in my demo too)

I do most of my development in WinCPC using Wine, so the makefile first converts .asm to .compat to fix the sources to a form that pasmo likes.
I then optionally use MegaLZ to compress the image and stick a decompressor at the start.
I then either use iDSK to copy the files to a disk image, or use a slightly modified 2cdt to make a .cdt file.
If I want to play this direct to a 464 with a tape adapter, I then take the .cdt file and use (again slightly modified) playtzx to convert to .au and sox to make a .wav file as playtzx seems to create bad wav files directly. From there it's just aplay to play it through the sound card.

If you want the modified sources to any of my tools, I'll stick them into an archive when I have time. Mostly, they're just me playing around with different ideas for encoding tape data, but there were a couple of bugs I encountered too, but I can't now remember what they were!

arnoldemu

Quote from: ralferoo on 18:04, 02 November 12
Much the same as everyone else, but I've put my makefile up here so you can see exactly how I use things: http://ranulf.net/sugarlumps-makefile (there's some legacy stuff here that wasn't in my demo too)

I do most of my development in WinCPC using Wine, so the makefile first converts .asm to .compat to fix the sources to a form that pasmo likes.
I then optionally use MegaLZ to compress the image and stick a decompressor at the start.
I then either use iDSK to copy the files to a disk image, or use a slightly modified 2cdt to make a .cdt file.
If I want to play this direct to a 464 with a tape adapter, I then take the .cdt file and use (again slightly modified) playtzx to convert to .au and sox to make a .wav file as playtzx seems to create bad wav files directly. From there it's just aplay to play it through the sound card.

If you want the modified sources to any of my tools, I'll stick them into an archive when I have time. Mostly, they're just me playing around with different ideas for encoding tape data, but there were a couple of bugs I encountered too, but I can't now remember what they were!
I would be interested in the sources so I can update these tools.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

TCMSLP

Excellent - thanks again for all your help.   What a fantastic community this is  :D

Steve / TCM

TCMSLP

OK - I have source code, I compile with pasmo (using --amsdos option), I add to a floppy image using iDSK.

Within an emulator (in this case arnold_tng), I can load the resultant binary from floppy image.

However, using "run program.bin" the screen clears and it simply prints "Basic 1.1 - Ready".

If I do the following:-

load "program.bin", &b000
call &b000

... the code then runs as expected.  The tutorials I've read seem to suggest the AMSDOS header should result in a directly executable binary?   Although, the tutorials I've looked at use pasmo without any switches and add the AMSDOS header in other floppy management tools.

I've also tried using pasmo to create tape images (cdt etc with and without the cdtbas - basic loader options) but ArnoldTNG won't read any of these tape images.

This is one of the tutorials I've looked at: Introduction to programming in assembler with Pasmo

Am I missing something here?  I'm guessing I need a basic loader - but I can't see any option in pasmo or iDSK.


Steve / TCM

arnoldemu

Quote from: TCMSLP on 23:48, 06 November 12
OK - I have source code, I compile with pasmo (using --amsdos option), I add to a floppy image using iDSK.

Within an emulator (in this case arnold_tng), I can load the resultant binary from floppy image.

However, using "run program.bin" the screen clears and it simply prints "Basic 1.1 - Ready".

If I do the following:-

load "program.bin", &b000
call &b000

... the code then runs as expected.  The tutorials I've read seem to suggest the AMSDOS header should result in a directly executable binary?   Although, the tutorials I've looked at use pasmo without any switches and add the AMSDOS header in other floppy management tools.

I've also tried using pasmo to create tape images (cdt etc with and without the cdtbas - basic loader options) but ArnoldTNG won't read any of these tape images.

This is one of the tutorials I've looked at: Introduction to programming in assembler with Pasmo

Am I missing something here?  I'm guessing I need a basic loader - but I can't see any option in pasmo or iDSK.


Steve / TCM
Use "--amsdos" as a command-line switch to add the header.
Then at the end of your file you need to add "end <label>" to define the execution address.

e.g.


org &100
start:


end start


this will do it :)

btw, &b000 is too high.

You need to use between &0040 and &a700 to be safe.

there are some system variables around &b000.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

ralferoo

Quote from: arnoldemu on 18:19, 02 November 12
I would be interested in the sources so I can update these tools.
Sorry for the delay, mega busy week...

Looks like the changes weren't all that significant, just moving the help text around to make it less verbose in normal use: my changes to 2cdt · 127f3da · ralferoo/cpctools · GitHub

I've also got some other changes on a different machine which I'm not sure are particularly useful: more fiddling with 2cdt · b382684 · ralferoo/cpctools · GitHub - this was mostly an attempt to get rid of the half second pause at the end of the last block, but also seems to reduce the number of pilot tones.

I've also got a small fix for playtzx which increases the (arbitrary) block limit of 2048 to 204800, although in practice this will be of no use to most people... but I was experimenting with cdt files containing raw pulses and very soon hit that limit!

I've also got a patched version of iDSK in the same repository that fixes the compile errors under linux.

cpcitor

Once a forum discussion brings interesting facts or conclusions, everyone wins if those are included in the wiki.
As a first step, I added a "Integrated toolchains" section mentioning this thread in Programming:Cross Development - CPCWiki
Feel free to review/criticize/correct.

Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

krusty_benediction

After being bored of reinstalling every dependencies needed to compile the tools for crossdev under linux, I have started to write a Dockerfile which allow to create a container specialized in crossdev.
I have not still intensively used it, but as it is based on what I am doing since years, it should work.

You can find the source there: cpcsdk/docker-amstrad-crossdev · GitHub
and an example to use it there (I'll add others later if needed): docker-amstrad-crossdev/examples/experts at master ·

If you do not want to build yourself the image, you can retreive the one I have created (probably outdated now)

The following tools are installed :

# Installed tools:
## PC related :
- git
- meld

## CPC related :
- iDSK
- createSnapshot
- hideur
- libdsk
- vasm
- vlink
- exomizer
- cpctelera (need to be tested / may be incompatible with my own tool chain)


with this approach :
- you use the image to build (edit if you want) your code without polluting your computer with tons of installed softwares
- you test the result on a real computer or in an emulator launched from the host machine

ronaldo

@krusty_benediction: Nice idea :). It's curious how docker works. I didn't know it, but it looks like a bash script.

Btw, your script is installing CPCtelera 1.2.3. You may be interested in adding latest stable version 1.3. Another thing you may want to take into consideration is that CPCtelera already includes iDSK. You could use that one instead of installing it twice.


krusty_benediction

@ronaldo

thanks for the informations.

- I have update the docker to use the latest cpctelera version
- i do not know yet how to manage things for iDSK (I use cpcsdk version, and I do not know if they are synced)

I have also added wine in the list of installed softwares in order to be able to use aplib crunch library

ronaldo

@krusty_benediction, thanks to you for contributing to the community :D.

Yes, iDSK versions are synced. In fact, latest bug fix came from CPCtelera's use of iDSK as you can see in the commit list for cpcsdk. As CPCtelera relies on iDSK for creating DSKs, it will be kept up-to-date and any bug-fix or improvement will be also sent to its original source from cpcsdk :).

litwr

Quote from: Octoate on 16:50, 02 November 12
The only problem, which I have, is the emulator. Currently I am using WinApe or WinCPC with Wine, but a good CPC emulator for Linux would be great.
IMHO I find Ep128emu - CPCWiki quite a good one.  It has powerful debugger with Lua scripting and other convenient features.

Powered by SMFPacks Menu Editor Mod