News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Developing on a Mac

Started by shaymanjohn, 08:07, 29 March 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shaymanjohn

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.




Singaja

Imho WinAPE running through WINE is the most user friendly emulator with integrated asembler to play around.

BSC

#2
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/

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.
** My SID player/tracker AYAY Kaeppttn! on github **  Some CPC music and experiments ** Other music ** More music on scenestream (former nectarine) ** Some shaders ** Some Soundtrakker tunes ** Some tunes in Javascript

My hardware: ** Schneider CPC 464 with colour screen, 64k extension, 3" and 5,25 drives and more ** Amstrad CPC 6128 with M4 board, GreaseWeazle.

teopl

#3
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)

BSC

Haven't heard of Retro Virtual Machine before, but the list of features sounds awesome :)
** My SID player/tracker AYAY Kaeppttn! on github **  Some CPC music and experiments ** Other music ** More music on scenestream (former nectarine) ** Some shaders ** Some Soundtrakker tunes ** Some tunes in Javascript

My hardware: ** Schneider CPC 464 with colour screen, 64k extension, 3" and 5,25 drives and more ** Amstrad CPC 6128 with M4 board, GreaseWeazle.

shaymanjohn

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:

Hwikaa

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.

SkulleateR

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"


Hwikaa

#8
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.

shaymanjohn

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)


Hwikaa


Sid_

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 ^^.

ronaldo

#12
Quote from: shaymanjohn on 08:07, 29 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 :)

Powered by SMFPacks Menu Editor Mod