Friday, 9 October 2015

ASM development on Amiga - part 1: the basics

Why??


I used to program on the Amiga through the use of Blitz Basic 2. A great language which took away a lot of the initial headaches of Amiga development: knowing the chip-sets, the libraries, and it also saved you from having to buy all those expensive books on Amiga hardware.

I want to learn and code assembler on the Amiga computer. Why? Because it is fun!  What will I code? I am not sure yet. When I've achieved the basics (getting images on screen, creating some sound and then some interaction) who knows what might be fun to do after that.

This will be an experiment and it will probably take a lot of time, so don't expect the new "WdW Mega Artshow Demo" within the next few months!  But the Amiga hardware is fascinating and I want to explore and get to know this classic machine... if only for the hell of it.

I will write down a lot on the basics of Amiga ASM development in these series. That's because I like to share but also because it is all new to me as well and having a log of the things you discover and create will be great to have... if only for myself.

How?


First question to answer: will I develop through the use of an emulator, or will I sit behind my Amiga and work from there? For now I have decided to go with an emulator first and maybe, once I have the kinks worked out, move to developing on the actual hardware itself.

Second question to answer: which hardware will we hit? There have been a few iterations of the Amiga hardware platform and while the later custom chips have more features, I don't think we need them at the moment as we will be trying basic stuff in the beginning anyway. Still, I already own a real A1200 and that means I can later on try the code on real hardware.

Third question to answer: will I code IN the emulated machine, or use a more modern editor and then send the code to the emulated machine to compile? Or cross-compile on the PC and THEN send it to the Amiga to run? For now, I will use Sublime Text to edit the code because it is the editor I like the best at the moment. I love my fancy colours and easy block and bulk editing.  Compiling and running in the emulated machine will allow me to have access to debug tools in the Amiga itself. I am not so sure what a good cross-compiler is to use on Windows. It may be handy to build on the PC because it might be possible to make some fancy build systems and automate things from there. If you have an idea, please yell in the comments.

The workflow will be as follows:

  1. Write code in Sublime Text on the PC
  2. Save this in a folder that is added to the emulated machine as a hard disk
  3. Compile and run in the emulator.
  4. Reset the emulated Amiga from the inevitable lock-up and repeat from step 1.

We will see how this method will work out and we'll adjust when needed.

Setting up the emulator


First thing to do is to set up the emulated machine. I am using WinUAE. Downloading and installing it is easy. Also, using an emulator will initially make it easier to get the files and tools I need in place.
I installed Workbench 3.1 from the floppy disks and that was it. I'll probably need more libraries and things like that, but I don't want to install all kinds of library packs now while not knowing what I need.

Installing tools in the emulated machine


Which tools will I need? For now, the assembler will suffice. I added an extra HD to the emulated machine, and pointed it to a folder on my PC hard drive. I called it Data_PC. This way it's easy to add files to the system. Also, no need to prep and format the device.  I created a dev folder in this location, and a sources sub-folder in that.

The Coppershade website has all kinds of handy tools, and I downloaded ASM-One from there. If it's good enough for these scene legends, then we will be just fine with it as well. I copied the executable file to the dev sub-folder.

ASM-One needs the req.library which can be downloaded from Aminet. Put req.library in the system:libs folder.

I added some entries to a new User-Startup file in S: to make life a bit easier:

path data_pc:dev ADD
assign src: data_pc:dev/sources

This will make starting ASM-One a bit easier and the sources will be easier to find as well.

IDE aka Editor


Sublime Text has a Package Manager, and it told me that there is a package for 68K development. Thanks Internet!!  Installing this is done in a few secs and then it's time to enter some code.

We need to save the code in the sources sub-folder so it can be loaded into the assembler and compiled.

Test


Let's create a simple bit of code (even for me at this stage!) , compile and run it.  Testing the mouse button is always a nice simple example:


Here you can see Sublime Text and ASM-One side by side and using the same source file. Stuff compiles on the Amiga and I can run it!  I don't even have to move the file, I can work on it from the PC, and then re-load it into the assembler.

When the file is edited in ASM-One then Sublime Text reloads the file automatically... This does not happen the other way around. I think I can live with this :)

Resources


Now, I need time to read and research as well. Here are some of the great sites I've found that talk about 68000 ASM:
I also borrowed a great book to get me up to speed on the 68000 chip layout and instruction set:


That's all for now... Till next time!

1541 Ultimate II Guide 6 : D71 and D81 images

When you want to use your 1571 or 1581 drive with your C64 or C128 it's nice to be able to use the hardware to the fullest. That means ...