CPCWiki forum

General Category => Programming => Topic started by: shaymanjohn on 08:07, 29 March 20

Title: Developing on a Mac
Post by: shaymanjohn on 08:07, 29 March 20
Is there a guide anywhere for developing for the Amstrad on a Mac?


I know there are Z80 assemblers for Mac, but I'm struggling to work out how I can actually run any little bits of code I create in an emulator.
In Retro Virtual Machine 2 (which is excellent!) there's a debugger, which mentions a load command (load binary files in memory), but struggling to get that to work.


Any advice appreciated.



Title: Re: Developing on a Mac
Post by: Singaja on 15:16, 29 March 20
Imho WinAPE running through WINE is the most user friendly emulator with integrated asembler to play around.
Title: Re: Developing on a Mac
Post by: BSC on 15:50, 29 March 20
Quote from: shaymanjohn on 08:07, 29 March 20
Is there a guide anywhere for developing for the Amstrad on a Mac?

I know there are Z80 assemblers for Mac, but I'm struggling to work out how I can actually run any little bits of code I create in an emulator.
In Retro Virtual Machine 2 (which is excellent!) there's a debugger, which mentions a load command (load binary files in memory), but struggling to get that to work.

Any advice appreciated.

I am developing on the Mac. I use MacCPC emulator to run the code, it's ok as far as I can see. I have to look up which assembler I am using
(writing from my Linux machine atm), but my tool-chain is basically hand-made and consists of Vim, a Makefile, that assembler and MacCPC.
For testing on a real CPC I have recently started using the m4 - it's a great add-on, go check it out if you don't have it yet:

http://www.spinpoint.org/2016/05/06/m4-board-retrofun-8-bit-amstrad-cpc-wifi/ (http://www.spinpoint.org/2016/05/06/m4-board-retrofun-8-bit-amstrad-cpc-wifi/)

As for running the code, my Makefile actually injects the object code that the assembler spits out into a snapshot file which
I then load into the emulator. Works fine for me. You can have those files if that helps you getting started.
Title: Re: Developing on a Mac
Post by: teopl on 15:52, 29 March 20
If you want to develop in C or asm, you can use cpctelera - it should also work with MacOS.

Personally, I have all 3 systems (linux, macos and windows) but I like to develop on windows using wincpctelera and visual studio because debugging is so much easier.

MacOS has some differences like bash and a lot of tools are outdated like 10 or more years (there is a new zsh but not 100% the same).

So, my suggestion is: virtual machine (on macos I use parallels) + windows + cygwin + cpctelera + wincpctelera + visual studio + winape (retrovm is great but I just didn't use it for debugging)

When I really need to debug on emulator, I use this function to do it on winape:

// put error code in HL and make breakpoint for winape
void winape_breakpoint(u16 error_code) __z88dk_callee __naked {

    // get params from stack
    __asm__("pop iy");  // ret address first because __z88dk_callee convention
    __asm__("pop hl");
    __asm__("push iy"); // ret address last  because __z88dk_callee convention
    __asm__(".db 0xed, 0xff");

    __asm__("ret");
}


EDIT: and regarding asm (and winape) this is great tutorial (although I watched only few videos they are really great and shows you some programming directly in emulator https://www.youtube.com/watch?v=QQ-CL_7pTjY&list=PLp_QNRIYljFp4RpVvsRWPGBV2CRJH2oyf)
Title: Re: Developing on a Mac
Post by: BSC on 15:57, 29 March 20
Haven't heard of Retro Virtual Machine before, but the list of features sounds awesome :)
Title: Re: Developing on a Mac
Post by: shaymanjohn on 21:36, 29 March 20
Thanks for the replies everyone.


Wine doesn't support latest Mac OS, and neither does MacCPC emulator, which is a shame.


Made some progress with Retro Virtual Machine 2 today though - got code building with the built-in assember in there.


Stupidly happy that this works:



org #4000
  ld hl, &c000
  ld a, 1
  ld b, 80
loop:
  ld (hl), a
  inc hl
  inc a
  djnz loop
  ret


Giving this in the emulator:
Title: Re: Developing on a Mac
Post by: Hwikaa on 09:26, 30 March 20
Being in the same situation right now (I used to use WinApe with Wine but, yeah, it's not working anymore), my current solution is to use Orgams in RVM; that being said, I'd love to know how to access RVM's built-in assembler.
Title: Re: Developing on a Mac
Post by: SkulleateR on 09:52, 30 March 20
Quote from: Hwikaa on 09:26, 30 March 20
that being said, I'd love to know how to access RVM's built-in assembler.
Just open the menu in main emulator window and activate "Developer Mode"

Title: Re: Developing on a Mac
Post by: Hwikaa on 10:05, 30 March 20
Nice! Thanks, @SkulleateR (https://www.cpcwiki.eu/forum/index.php?action=profile;u=3124) !


EDIT: OK, it took me quite some time, but I eventually figured it out. For those who - just like me - didn't know it: once the developer mode activated, click the blue hammer and you'll have access to the DISassembler window (Dis view). From there, you can click on the right part and type in your code.
Title: Re: Developing on a Mac
Post by: shaymanjohn on 11:59, 30 March 20
You can also assemble files that on your local file system.
In the developer mode view, click the terminal button - brings up a RVM console. You can then cd to wherever your source files are, then assemble using:
a filename.asm


If you get the success message, swap back to the main emulator window and then
call 4000 (or whatever start address you've specified in your code)

Title: Re: Developing on a Mac
Post by: Hwikaa on 13:40, 30 March 20
Awwwwwwwesome.  :D
Title: Re: Developing on a Mac
Post by: Sid_ on 15:15, 30 March 20
I also develop on a Mac (or a linux ^^).
My daily tools :
- assembler : rasm http://www.cpcwiki.eu/forum/programming/rasm-z80-assembler-in-beta/
- dsk / sna manager : my own tools  https://github.com/jeromelesaux/dsk
- images converter : my own tool https://github.com/jeromelesaux/martine
- M4 client : https://github.com/jeromelesaux/m4client
- debugger : javacpc https://sourceforge.net/projects/javacpc/


I still look for a good CPC Plus emulator with a good debugger ^^.
Title: Re: Developing on a Mac
Post by: ronaldo on 10:47, 31 March 20
Quote from: shaymanjohn on 08:07, 29 March 20
Is there a guide anywhere for developing for the Amstrad on a Mac?
CPCtelera (https://github.com/lronaldo/cpctelera) works on Mac. Please, remember that CPCtelera (https://github.com/lronaldo/cpctelera) is not a maker, but a framework of integrated tools for Amstrad CPC development. Current 1.5 version includes:
That's the main set of tools that CPCtelera (https://github.com/lronaldo/cpctelera) includes, but there are many others also included. If you wanted to install it of a modern Mac OS like Mojave, it is easy:
And then you have all tools installed, configured, sources included and ready to do whatever you wanted with them.


Hope that helps :)
Powered by SMFPacks Menu Editor Mod