News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_kilon

Developing for both CPC 6128 and Amiga 500

Started by kilon, 19:25, 05 December 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kilon

Is it possible to develop for both CPC 6128 and Amiga 500 at the same time ? I dont mind using a couple of different libraries in each platform as long as 60-70% of the code remains the same and I would prefer for it to be in C.

I want to make a diary application and it would be nice if I could run it on both CPC6128 and Amiga 500 without too much effort.

EgoTrip

You could use the same C code for both platforms, just replacing the machine specific code. It won't be all as simple as having one code that runs on both machines. For the CPC the screen addressing on the X axis works in 4 pixels per byte for mode 1, (2 for mode 0, 8 for mode 2) for example, so you will need additional code to deal with that. But you should be able to meet your goal of 60-70% of shared code.

I converted C code from a DS game I made over to CPC and it worked really well.

kilon

Nice then I will start with CPC version and worry about Amiga 500 later on

Which C compiler you advise using for CPC coding ?

AMSDOS

Quote from: kilon on 01:16, 06 December 16
Which C compiler you advise using for CPC coding ?


Hisoft-C if your coding on a 6128 or SDCC if using a cross compiler, the later will probably give you a good opportunity for porting your code to an Amiga.
* 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

arnoldemu

Quote from: kilon on 19:25, 05 December 16
Is it possible to develop for both CPC 6128 and Amiga 500 at the same time ? I dont mind using a couple of different libraries in each platform as long as 60-70% of the code remains the same and I would prefer for it to be in C.

I want to make a diary application and it would be nice if I could run it on both CPC6128 and Amiga 500 without too much effort.
Use SDCC on CPC, it's closer to ANSI C. I expect most C compilers on Amiga will be ANSI C. (I used one back in 1997 and I think that was Ansi C).

Also, put common code (AI) in it's own c file and keep cpc and amiga specific files separate.

To keep it compatible with CPC, try and use the smaller data types (byte, word etc). Addresses keep as (char * or void *) the compiler will use 16-bit for CPC and 32-bit for Amiga (probably).

I don't know about structure packing on CPC or Amiga compiler, so organise your data well to avoid it. On CPC you will be memory and CPU bound.

You don't say if you will be developing on Amiga and keeping all code there?

If on PC/Mac/Linux, then I suggest you use cpctelera. You could make Amiga versions of the cpctelera library if you want. Using CPCTelera will save you time because you will not need to write many library functions.

EDIT: On Amiga will you be making it OS compatible (i.e. using the OS libaries to configure your window and screen that you can draw to?). I think I still have some example code somewhere to do this - it worked on A1200 back in 1997.


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

ervin

#5
cpctelera is a *great* choice for the cpc side of this project, but at the moment I believe it lacks one important facility that you'll need for a diary application: file operations.

I don't know if file ops (reading/writing) are on the near horizon for cpctelera, but I guess you can use the firmware file functions, as long as you don't disable the firmware (several of cpctelera's game-related functions require the firmware to be disabled).

Having said that, I *think* the firmware can be disabled/enabled as required in cpctelera, so it may not be too much of a problem.
There may well be sdcc code floating around somewhere that uses the cpc firmware for file operations.

In any case, there are probably working examples (on the cpcwiki forum) of file ops written in z80 asm.

arnoldemu

I have submitted a read function for inclusion in cpctelera. I have a save function that needs a little bit of work before submitting.

If anyone wants them. send me a PM and I'll e-mail them to you.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

kilon

Sorry for the late reply I am in London for a two days YouTube seminar on YouTube campus and it has been quite hectic.


So thank for the info.


No I won't be developing on Amiga , code will be written and compiled on my late 2013 27'' iMac with Sierra.


So it seems sdcc is the way to go. Will give it a try and see how it goes from there.

Powered by SMFPacks Menu Editor Mod