Author Topic: Preferred tool chain / setup  (Read 3681 times)

0 Members and 1 Guest are viewing this topic.

Offline MartinW

  • CPC664
  • ***
  • Posts: 64
  • Country: gb
    • Guddler's Domain
  • Liked: 15
  • Likes Given: 8
Preferred tool chain / setup
« on: 15:32, 01 April 13 »
OK, so I've done a bunch of reading up lately and I'm edging toward something like SDCC / Pasmo, or something like that, but what's the generally accepted way to actually go about this? I guess I'm talking about cross development from a PC or Mac. Do people just use Notepad and the command line plus an emulator, or something else?
 
I have Windows 8 or Mac OS X 10.8.x available to me. I could go Linux but I already have 2 windows installs and an OS X install on my PC as it is so I don't really want to put a Linux partition on just for this (yes, I could do a VM but again, don't really want to).
 
I'm initially looking at running through a bunch of tutorials and just trying to learn some stuff specific to the CPC and Z80. I'm good for C and a little bit of 6502 so I think I need to start with the Z80 and CPC side first before I start worrying about wanting to write super awesome widget X. I suspect some people would disagree but I imagine as I go along I'll get an idea for something I want to do, and if the inspiration doesn't spark then it will be time to go back to fiddling with my arcade machines and flying my RC planes and heli's  :laugh:

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Preferred tool chain / setup
« Reply #1 on: 15:46, 01 April 13 »
On Windows I use Notepad++. I have pasmo and sdcc downloaded.
I use bat batch scripts to compile and build the code and run it on an emulator.

On Linux I use scite. I have pasmo and sdcc too.
I use makefiles and shell scripts.

I also have my own tools for converting graphics and manipulating files.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Preferred tool chain / setup
« Reply #2 on: 15:48, 01 April 13 »
Go with C, use one of the existing sdcc libraries to link against, or follow other examples and put your asm inline.
I'd work from the existing examples for sprites and things like that until you get familiar and want to write your own.

C is good to work with on cpc (others call me mad to use c), but you do need some good library functions which are written in asm.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline MartinW

  • CPC664
  • ***
  • Posts: 64
  • Country: gb
    • Guddler's Domain
  • Liked: 15
  • Likes Given: 8
Re: Preferred tool chain / setup
« Reply #3 on: 15:57, 01 April 13 »
Funnily enough, It was your page I was looking at yesterday which made me think that C was indeed going to be a perfectly viable option  :D
 
I would prefer to go with C as there will be less I'm having to learn then. At least until such times as I find that I'm optimizing so much that it doesn't make sense any more, but I can't see that day coming for a very long time (if ever).
 
I've used Notepad++ for ages and ages now but only ever as a simple editor (though it's certainly not simple!). Can you run the batch files directly from Notepad++ ? I had a look the other night and couldn't spot anything that suggested you could so I was thinking of giving Sublime Text a trial. It's expensive (compared to free) but I do like the look of it and the licensing would allow me to make use of it for work as well so it wouldn't be so bad.
 
I think really I just wanted to ensure I wasn't missing some other glaringly obvious option - doesn't sound like I am though.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Preferred tool chain / setup
« Reply #4 on: 16:26, 01 April 13 »
I don't know if you can run batch files from it. I use it because we use it at work and has good syntax highlighting and editing.

I normally have either a command prompt open where I then run my batch file from, or I keep an explorer window open and double click it from there.

I have used Crimson in the past, this has a project view, so making it easier for many files, and you can configure it's tools to run a batch file. So this may be easier for you.

On linux (at home), I would like to use crimson or notepad++ but there is no native version. So I use scite and run it all from the command-line.

It's what I am used to.

I am beginning to lean towards a common build method that works under linux and windows, but I haven't tried it yet.


My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline MartinW

  • CPC664
  • ***
  • Posts: 64
  • Country: gb
    • Guddler's Domain
  • Liked: 15
  • Likes Given: 8
Re: Preferred tool chain / setup
« Reply #5 on: 12:40, 04 April 13 »
Quick update - I spent the evening yesterday setting up my environment. I found in the end I was able to do everything I wanted to do with Notepad++ which is great as it doesn't involve spending any money. My other candidate was "SublimeText" which looks great but is £70.

I found in the end that there is plugin for Notepad++ (I think) called NPPExec which has it's own command console and scripting engine. This allowed me to define a script file for compiling a file by it's extension, so for an asm file it runs compile@.asm.txt, for a C file it runs  compile@.c.txt and so on. I then defined another that does the same but for "run". So I have a compile action that literally compiles the current file and a run action that also compiles the current file but then does a hex2bin, creates a DSK image and then fires up WinAPE with the auto-run feature so the code runs in the emulator. I have been able to assign these to F5 for run and F7 to compile, just like any popular IDEs.
 
An added bonus is that I can have filtering and highlighting in my console output window so errors appear in red, warnings in blue and so on. Click on an error and it will take you to the line in the file. So far I can see only one downside. The output from the compile isn't kept in strict order. STDOUT comes first, then STDERR. I haven't found any way round this yet. For the simple hello world example I was testing against last night that didn't seem too much of an issue but i'll have to see how we go in the real world.

SO, now all I've got to do is DO something. I'm starting to get some ideas pinging about in my head :)
 
Oh, finally, it also looks like Notepad++ now has a limited concept of workspaces and projects already built in so it's looking better and better. I didn't get to explore that too much though as it was 2am by then.

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Preferred tool chain / setup
« Reply #6 on: 23:11, 04 April 13 »
Nice to hear Notepad++ is so popular as it's what I use too.

I'd like to build some of my own tools in Linux for CPC development, but I find that would take me away from the Z80 as I'd spend all day writing PC tools instead.  So Windows and WinApe it still is.

Wasn't there a collection of CPC Linux tools somewhere on the web?  Remember seeing it, but can't find it now...

Offline MartinW

  • CPC664
  • ***
  • Posts: 64
  • Country: gb
    • Guddler's Domain
  • Liked: 15
  • Likes Given: 8
Re: Preferred tool chain / setup
« Reply #7 on: 23:20, 04 April 13 »
Just going through some tutorials on norecess.net - any idea where I can get the latest version of sdcc2pasmo? Google seems to suggest the latest version (last version?) was / is v1.7 but all links seem to point back to the "productions" page on norecess.net, and for the life of me I can't see it there so it looks like it's gone.

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.851
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4287
  • Likes Given: 451
Re: Preferred tool chain / setup
« Reply #8 on: 23:25, 04 April 13 »
Send Arnaud an e-mail. I'm sure he'll point you to the latest version.

Bryce.

Offline ralferoo

  • Supporter
  • 6128 Plus
  • *
  • Posts: 970
  • Country: gb
  • Liked: 583
  • Likes Given: 222
Re: Preferred tool chain / setup
« Reply #9 on: 23:34, 04 April 13 »
Wasn't there a collection of CPC Linux tools somewhere on the web?  Remember seeing it, but can't find it now...
I use WinCPC, pasmo and a couple of slightly modified tools: ralferoo/cpctools · GitHub

The following in a Makefile will convert from WinCPC syntax to pasmo (might be missing a few cases):
Code: [Select]
build/%.bin: build/%.compat build/.dummy
        pasmo $< build/$*.bin build/$*.sym

build/%.compat: test/%.asm
        @echo Making $@

%.compat: %.asm
        @echo Making $@
        @perl -pe '{s/readbin\s\"([^"]*)\"/incbin "$$1"/;s/read\s\"([^"]*)\.asm\"/include "$$1.compat"/;s/([xy][lh])/i$$1/g;s/(add\s+)(i)?([xy][lh])/$$1a,i$$3/g;s/(ex\s+)hl\s*,\s*de/$$1de,hl/g;s/ld\s+pc,(i[xy])/jp ($$1)/;s/rst\s+5/rst #28/g;s/;DATE;/incbin "date.bin"/;s/(add\s+)(\(i[xy])/$$1a,$$2/;}' <$< >$@

I also find the following very helpful if I'm using included source:
Code: [Select]
ASMS = $(wildcard *.asm)
COMPATS = $(patsubst %.asm,%.d,$(ASMS))
-include $(COMPATS)

%.d: %.asm
        @echo Making $@
        @(perl -ne '{if (/read\s"([^"]*)\.asm\"/) {print "$*.bin: $$1.compat\n";}}' <$< | uniq ; echo $*.d: $*.asm ) >$@

Offline MartinW

  • CPC664
  • ***
  • Posts: 64
  • Country: gb
    • Guddler's Domain
  • Liked: 15
  • Likes Given: 8
Re: Preferred tool chain / setup
« Reply #10 on: 01:47, 05 April 13 »
Send Arnaud an e-mail. I'm sure he'll point you to the latest version.

Bryce.

Assuming Arnaud is the owner of norecess.net then I'll ping him a mail - on further inspection though there is a comment at the bottom of the last news item where he says all the demo stuff has been moved to scene.org and sdcc2pasmo is no longer available so I guess I can only really expect to be ignored!
 
In the meantime I've found v1.5 which would appear to be compatible with sdcc v3.0.0 so I've downgraded sdcc accordingly. It's not ideal but let's face it, until I'm WAY further down the line it will be fine for now. It's a bit of a shame that the wayback machine is incomplete as the v1.5 download when it was there also had the source. all the sdcc downloads on the archive are gone now though.
 
I'm not even sure at the moment if it's something I even need or want!

Online Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 16.105
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3501
  • Likes Given: 6316
Re: Preferred tool chain / setup
« Reply #11 on: 20:34, 06 April 13 »
Arnaud is a great guy really, just taking a break from the scene (hopefully). never hurts to try.