News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Ynot.zer0

Programming in C on the CPC

Started by Ynot.zer0, 18:20, 06 February 12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cpcitor

It could be useful to discuss if the kind of tricks explained on can apply to the CPC, with z88dk, sdcc, gcc, whatever.

Also, (follow link to pdf presentation).

Can you believe those 4k and 13k prods ? Ok the CPC could not do much in reasonable time, but the more complete knowledge we have now may allow some clever guys to do interesting stuff in small size (like a procedural title screen).
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.


MartinW

Is anyone following these? I can't get the very first step where all you do is write the block to the screen and measure the FPS without moving it to work. None of my ASM routines such as the setmode etc. do anything and each time the FPS is printed the screen is moved down a line.

I can create a video tomorrow if I can work out how.

It may not be anything to worry about but I would prefer to understand why the first part isn't working for me before I move onto the second step. I've not tried it on a real machine yet, only an emulator (WinAPE).

Martin.

Mochilote

Quote from: MartinW on 01:27, 10 April 13
Is anyone following these? I can't get the very first step where all you do is write the block to the screen and measure the FPS without moving it to work. None of my ASM routines such as the setmode etc. do anything and each time the FPS is printed the screen is moved down a line.


Make sure you are using the official version of sdcc 3.2.0 and compiling these as it comes in bat files. For the first example would be:

sdcc -mz80 --oldralloc --code-loc 0x6038 --data-loc 0 --no-std-crt0 crt0_cpc.rel putchar.rel PongC01.c


Is important to use "- oldralloc" in version 3.2.0 since it introduced a bug that just makes the assembly code in line fails (Small Device C Compiler suite / Bugs / #2064 Accesing parameters through IX)

regards.



MartinW

Hmm, I'm not exactly doing it as per the example! I'm making things harder for myself but there is method to my madness :)

I have the PutPixelMode2 method in a separate file that I compile first and then link in when 'main.c' is compiled (ok, file names are different too but that doesn't matter). I'm doing that simply as I wanted to explore how that would work with SDCC and also if I just copy and paste from examples then I learn nothing. I have to experiment!. I don't think that's my issue though as I have also tried it exactly as typed. I'm guessing it's the lack of the --oldralloc that is doing it. I'll give it another go at lunchtime and see what happens.

Oh, I'm also locating the program at 0x100 as per the first tutorial but again, I'm guessing as long as my headers and code match up and it actually runs that is also fine?

MartinW

OK - just to confirm, it was the lack of "--oldralloc". When I added that it solved my problem.

I may post up my Notepad++ compile script if it's of any interest to anyone but I should probably do it in a different thread.


Powered by SMFPacks Menu Editor Mod