Learning Assembler on Amiga #2

In the previous lesson, I gave you the reasoning of why learning Amiga Assembler these days when clearly there are the far easier way to get the job done across multiple platforms and the bootstrap to setup your OS environment with the FS-UAE emulator.
In this lesson, we’re going to pick an assembler to work with. As a great community contributor, Henrik at Coppershare.org properly lists you have several options when it comes to choosing an assembler. Unless you have used something in the past that makes you feel more comfortable with shortcuts and other mechanical details, there isn’t a ton of difference from one or the other
My dilemma of which one to pick was between VASM and Asm-One.
vasm is a portable and retargetable assembler to create linkable objects in various formats or absolute code. Multiple CPU-, syntax and output-modules can be selected.
Many common directives/pseudo-opcodes are supported (depending on the syntax module) as well as CPU-specific extensions.
VASM is a pure assembler (multi-platform) with no other fanciness, such integrated editor and stuff like that. Reaktor.com has a very good article about an assembler crash course where vasm is used. Check it out. At the time when I started this new hobby of retro development, that article was too intense for what I knew at the time. I do believe that vasm would be a great choice if you plan to adopt your gonna be awesome skillset in assembler on other platforms, in the future. Say Raspberry PI.
Asm-One was built for Amiga by a German company called Rune Gram-Madsen (Also known as Promax), last time they sold it was in 1992. Its features should cover pretty much everything that an assembler newbie can wish for.

Features

  • fully integrated development package with fullscreen-editor, assembler, monitor and debugger
  • written entirely in assembly language; very light (about 90 kbytes) and fast
  • operation via keyboard or mouse
  • can create standard object modules to be linked with Blink
  • assembler provides macro capabilities, include-files, and peephole-optimizer
  • crash-recovery via level-7-interrupt
  • includes Amiga includes and offset tables
image
My choice has fallen on Asm-One. At this point, you probably guessed it. However, what you likely did not guess is that I am going to provide a one-off vasm tutorial as I believe it will help the many that run into Reaktor.com article and got slammed like I did for lack of knowledge.

Code

All source code, from now on will be placed on this GitHub repo under the folder 68K. Eh! How original of me…

Lesson

Before we go ahead and start typing our own code, let’s achieve one simple goal that can result in quite a rewarding moment if properly executed. The intent behind this exercise is to provide the help I didn’t find on Reaktor.com and to allow you to build up some brain muscles around the basics of deploying code.
Our objectives will be:
  1. Download the code for vasm
  2. Build it for your platform to generate Amiga (68K) code
  3. Download source code for an Amiga demo-intro from this great collection of demos
  4. Build that code using vasm
  5. Deploy on an Amiga (emulated or physical hardware)
  6. Open a bottle of wine and celebrate or just play Silk Worm
STEP ONE
If you don’t have the command wget installed. Via homebrew install it using 
brew install wget
then use the following to download vasm
Unzip, walk into the folder where vasm has been unpacked and build the flavor of the compiler that we need to generate Amiga assembler 68000. Which means, do the following:
tar zxvf vasm.tar.gz
cd vasm
make CPU=m68k SYNTAX=mot
Using the same exact steps, we are going to download Amiga Down Under demo, unpack it, compile it using our brand new built vasm. Like so:
wget http://cyberpingui.free.fr/dl.php?id=800 -O aduintro1.zip
unzip aduintro1.zip
cd aduintro1
../vasm/vasmm68k_mot AmiDwnUnder.s -o AmiDwnUnder.bin -Fhunkexe -nosym
Now, the file that has been generated is AmiDwnUnder.bin and in its current form and structure, it says “I am an Amiga binary”. However, since we are going to copy it over our emulated Amiga environment we set up in lesson #1, we are going to use the following command to guarantee compatibility with the Amiga filesystem.
file AmiDwnUnder.bin
If you are not sure about the UNIX command File, have a look at this guide.
image
In lesson #1 we setup our virtual folder-hard drive to AmigaHD. Copy the at .bin file in that folder. Boot your emulated Amiga.

Kick-Off

At this point you should see your Workbench, which looks like this:
image
It is possible that the folder appears to be empty and that is only because probably you haven’t set the right option in the WB menu.
image
double click on AmiDwnUnder.bin, you will be asked to confirm that you want to launch the file.
image
Hit OK and enjoy the result of your work. The demo will kick in. To exit just hit the left button of your mouse.

Conclusion

We learned how to compile and use vasm. Learned a few UNIX commands in the process and successfully deployed an intro code. Of which you have the code and if you feel adventurous you can mess, build, rinse and repeat.
See you next time.

Comments

Popular posts from this blog

Zen-inification - The art of decluttering

Postgres on Synology

Bring Boxee Box back to life