Author Topic: Developing on a Mac  (Read 441 times)

0 Members and 1 Guest are viewing this topic.

Offline shaymanjohn

  • CPC464
  • **
  • Posts: 14
  • Country: gb
  • Liked: 24
  • Likes Given: 12
Developing on a Mac
« on: 10: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.




Offline Singaja

  • CPC6128
  • ****
  • Posts: 169
  • Country: pl
  • Liked: 113
  • Likes Given: 535
Re: Developing on a Mac
« Reply #1 on: 17:16, 29 March 20 »
Imho WinAPE running through WINE is the most user friendly emulator with integrated asembler to play around.

Offline BSC

  • CPC6128
  • ****
  • Posts: 229
  • Country: de
  • CPC 464 aspirant
    • my (Android) mobile game
  • Liked: 289
  • Likes Given: 253
Re: Developing on a Mac
« Reply #2 on: 17:50, 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/

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.

Offline teopl

  • CPC664
  • ***
  • Posts: 103
  • Country: cs
  • Liked: 41
  • Likes Given: 84
Re: Developing on a Mac
« Reply #3 on: 17: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:

Code: [Select]
// 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)
« Last Edit: 17:59, 29 March 20 by teopl »

Offline BSC

  • CPC6128
  • ****
  • Posts: 229
  • Country: de
  • CPC 464 aspirant
    • my (Android) mobile game
  • Liked: 289
  • Likes Given: 253
Re: Developing on a Mac
« Reply #4 on: 17:57, 29 March 20 »
Haven't heard of Retro Virtual Machine before, but the list of features sounds awesome :)

Offline shaymanjohn

  • CPC464
  • **
  • Posts: 14
  • Country: gb
  • Liked: 24
  • Likes Given: 12
Re: Developing on a Mac
« Reply #5 on: 23: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:

Offline Hwikaa

  • Supporter
  • CPC464
  • *
  • Posts: 36
  • Country: es
  • Liked: 29
  • Likes Given: 131
Re: Developing on a Mac
« Reply #6 on: 11: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.

Offline SkulleateR

  • CPC6128
  • ****
  • Posts: 184
  • Country: de
  • Liked: 102
  • Likes Given: 61
Re: Developing on a Mac
« Reply #7 on: 11:52, 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"


Offline Hwikaa

  • Supporter
  • CPC464
  • *
  • Posts: 36
  • Country: es
  • Liked: 29
  • Likes Given: 131
Re: Developing on a Mac
« Reply #8 on: 12:05, 30 March 20 »
Nice! Thanks, @SkulleateR !


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.
« Last Edit: 13:52, 30 March 20 by Hwikaa »

Offline shaymanjohn

  • CPC464
  • **
  • Posts: 14
  • Country: gb
  • Liked: 24
  • Likes Given: 12
Re: Developing on a Mac
« Reply #9 on: 13: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)


Offline Hwikaa

  • Supporter
  • CPC464
  • *
  • Posts: 36
  • Country: es
  • Liked: 29
  • Likes Given: 131
Re: Developing on a Mac
« Reply #10 on: 15:40, 30 March 20 »
Awwwwwwwesome.  :D

Offline Sid_

  • CPC664
  • ***
  • Posts: 51
  • Country: fr
  • Liked: 53
  • Likes Given: 73
Re: Developing on a Mac
« Reply #11 on: 17: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 ^^.

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 616
  • Country: es
    • Fremos Blog
  • Liked: 866
  • Likes Given: 801
Re: Developing on a Mac
« Reply #12 on: 12:47, 31 March 20 »
Is there a guide anywhere for developing for the Amstrad on a Mac?
CPCtelera works on Mac. Please, remember that CPCtelera is not a maker, but a framework of integrated tools for Amstrad CPC development. Current 1.5 version includes:
  • SDCC compiler, to be able to program in C
  • ASZ80 assembler, integrated within SDCC, to be able to develop in ASM
  • Custom project management system, that lets you create projects with a single command, and then you can compile all your files just by typing in 'make'.
  • Automatic generation of DSK, CDT and SNA from your source files
  • You can seamlessly develop in C and ASM at the same time (with C and ASM files together in your own project)
  • Automatic image conversion system with Img2CPC
  • Automatic Arkos music conversion system
  • Automatic Tiled tilemaps conversion system
  • Automatic installing and console management of RetroVirtualMachine: lets you launch your CDT, DSK and SNA directly into RVM2 easily from the console. This way you can compile and test all your project instantly with a single command
  • Automatic CDT and DSK management system
  • Low level library with many optimized functions (you may not use it if you prefer to program your own, but you have it if you like)
  • All source code included, from all tools. You may customize everything to your needs.
  • Source code is heavily commented.
  • And, though in Spanish, you have tens of videos on programming games in C and ASM with CPCtelera in my youtube channel.
That's the main set of tools that 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:
  • Install homebrew.
  • Ensure that XCode command line tools are installed with this command: 'xcode-select --install'
  • Install required packages: 'brew install boost freeimage mono wget'
  • Clone CPCtelera repository wherever you want it to be installed: 'git clone https://github.com/lronaldo/cpctelera'
  • Enter cpctelera folder and change to development branch: 'cd cpctelera && git checkout development'
  • Launch setup.sh: './setup.sh -dme'  (-dme is just for disabling machine echo)
  • Close your terminal and reopen it to have PATH variable changed.
And then you have all tools installed, configured, sources included and ready to do whatever you wanted with them.


Hope that helps :)
« Last Edit: 12:49, 31 March 20 by ronaldo »