RSSAmplifier

Blog

Mark Wrobel

Mark Wrobel

markwrobel.dkRSS feed ↗42 posts

Latest posts

Line drawing 3 - Code Example

Using the Amiga blitter to do line drawing is not so easy. There are a lot of moving parts to take care of before that first line hits the screen. Part 1 of this post discussed the history of the Bresenham algorithm, and retraced the steps to make the algorithm efficient. In Part 2, we continued by taking a look at how the Amiga blitter uses Bresenham’s algorithm. In Part 3, it’s…

Line drawing 2 - Using the Blitter

The Bresenham line drawing algorithm, was usually implemented in software, but that all changed with the Amiga. The Amiga introduced line drawing in hardware, and if you stick around I’ll show you how it works. Part 1 of this post discussed the history of the Bresenham algorithm, and retraced the steps to make the algorithm efficient. In Part 2, we continue by taking a look at how the Amiga…

Amiga Machine Code Course

Here you’ll find my complete set of posts covering the Amiga Machine Code course. Some readers have mentioned that the course confuses machine code with assembly code. In a way they are absolutely right. Machine code is the binary representation the computer consumes, while assembly code is a textual representation, more suited for humans. Several books from the early days of home computing,…

Line drawing 1 - Bresenham's Algorithm

I have for a long time wanted to write something about the Amiga’s support for line drawing. It’s an area of the Amiga, that’s not so well described out there. This makes it a bit of a challenge, and I lost count on how many times I tried to poke at this stuff. So why am I doing this? Well, hardware accelerated line drawing was one of the many featues that made the Amiga a superb…

Amiga Machine Code Detour - Reverse Engineering

History has shown time and again, a demand for reverse engineering of programs. The reasons are many, some innocent and some not. Either way, it’s an interesting skill to have, that will make you a better programmer. The tools might be simple, but the knowledge needed are somewhat more demanding. By now, we know enough machine code, to take a detour into the land of reverse engineering. This…

Horizontal Sine Shifting

One of the classic demo effects, of all time, is horizontal shifting using a sine wave. This effect is easy to code on the Amiga, using Copper instructions to deliver timed updates to the custom chip registers. In the following, we are going to look at how this is done, and explain a litle bit about how the Amiga works along the way. This post is inspired by Letter XII of the Amiga Machine Code…

The Starfield Effect

In this post we are going to take a look at the starfield effect - one of the classic graphic effects of all time. If you want to learn how a starfield is programmed on the Amiga, using simple pixel drawing and double buffering and a bunch of fixed-point arithmetic - you’ve come to the right place. 😃 👍 This post was inspired by the Amiga Machine Code Course , Letter XII , and we are going…

Make Your Own Graphic Assets

The Amiga Machine Code Course, contains many examples using graphics, but we have never created our own graphics. In this post we are going to make up for it, by showing how to create custom graphics and store them in a format that works with the program examples. Let’s get to it! 🎨 This post is a continuation of Amiga Machine Code Letter VI - Blitter 3 . The Toolchain As always, I like to…

Amiga Machine Code Letter XII - Vertical Scaling Using the Copper

The Amiga demo scene produced a wide range of clever effects, written in assembly language. Enjoyed by many, and understood by few, they pushed the envelope of what was thought possible on a home computer system. Most demos were put together by several effects, and some of those have found their way into Letter XII of the Amiga Programming in Machine Code course. One such effects is called rotate…

Amiga Machine Code Letter XII - HAM

The Amiga had one of the most photorealistic image modes in the late 80’ties, which could display a massive 4096 colors at the same time - something never seen before in a home computer system. The image mode is called HAM, which is short for Hold and Modify, and if you stick with me, I will tell you what it’s about, and also demonstrate a little assembly program that enables this…

Amiga Machine Code Letter XI - Fizzle Fade

In this post we are going to look at a neat technique to do fast multiplication. The technique is described in detail in the last chapter of Letter XI , and involves doing bitshifting instead of naive multiplication. When calling 68K instructions, some instructions will take longer time to execute than others. One of the more expensive calls, is the multiplication instruction MULU . Let’s…

Amiga Machine Code Letter XI - The Printer

Back in the Amiga 500 glory days, the printer was one of those essential add-ons, that allowed you to produce something physical from your word processor or drawing program. It was still a time, where physical prints were the only universally acceptable form of non-verbal communication. In this post we are going to take a look at some assembly code, that prints a string to the printer, using the…

Amiga Machine Code Letter XI - The Mouse

In this post we will take a closer look at the Amiga mouse, and go through a little program that reads the mouse x and y counters and transform them to x and y coordinates. For those of you that have followed along, we have now reached Letter XI of the Amiga Machine Code course. As always make sure to read the letter, since I won’t go through all the details here. 😉 The Hardware The Amiga…

Amiga Machine Code Letter X - Trackdisk

Before we dive in, a little warning is in place. This is the hardest piece of machine code, that I yet had to decipher, and there is no doubt, that we are almost at the limits of readability with regards to 68K assembly. The code would have been far more readable if written in C. 😃 We need to start softly, with an explaination of the physical disk, and then continue with a brief introduction to…

Amiga Machine Code Letter X - More CLI

This is the forth part, of a multi-part series about the system libraries. We are still looking at Letter X of the Amiga Machine Code course, and as always, make sure to read the letter, since I won’t go through all the details. In this post we continue our exploration of the CLI from The previous post . We are still using the DOS library to interact with the command line interface of the…

Amiga Machine Code Letter X - CLI

This is the third part, of a multi-part series about the system libraries. The previous post was about using the DOS library to read and write files. We are still looking at Letter X of the Amiga Machine Code course, and as always, make sure to read the letter, since I won’t go through all the details. In this post, and the next one, we will take at how to use the DOS library to interact…

Amiga Machine Code Letter X - Files

This is the second part, of a multi-part series about the system libraries. The previous post was about memory allocation. We are still looking at Letter X of the Amiga Machine Code course, and as always, make sure to read the letter, since I won’t go through all the details. Reading files Reading files from an Amiga disk is pretty easy, when you use the DOS library. For the newbie…

Amiga Machine Code Letter X - Memory

The machine code course is nearing it’s end, and now it’s time to look at the libraries and operating system of the Amiga. This cathedral of software is actually rather beutiful and placed a multitasking system in the hands of the hobby user back in the late 80’ties. Multitasking, that previously belonged to the realm of expensive unix machines, was now entering the livingroom.…

Amiga Machine Code Letter IX - Interrupts

We have reached Letter IX of the Amiga Machine Code course. As always, make sure to read the letter, since I won’t go through all the details. In this post, we are going to take a closer look at interrupts. If you haven’t heard about them before, then it only shows how amazingly well abstractions work on a computer. You can spend your whole programming career in a high-level language,…

Amiga Machine Code Letter VIII - Wavetable Synthesis

We have reached Letter VIII of the Amiga Machine Code course. As always, make sure to read the letter, since I won’t go through all the details. In this post we are going to take a look at the mc0802 program. It plays a simple melody and then exits. That’s all there is to it, yet it’s kind of interesting in it’s simplicity. As mentioned in the previous post, the Amiga sound…

Amiga Machine Code Letter VIII - Audio

We have reached Letter VIII of the Amiga Machine Code course. As always, make sure to read the letter, since I won’t go through all the details. In this post, we are going to look at audio on the Amiga 500, and go through a little bit of machine code, that shows how to deliver a nice little opening and closing effect to a looped sample. The Amiga 500, delivers sound through four 8-bit mono…

Amiga Machine Code Letter VII - Colorcycling

We have reached Letter VII of the Amiga Machine Code course. As always, make sure to read the letter, since I won’t go through all the details. The theme of this post, is to use color cycling, to make the text scrolling program from the previous post , a little more interesting. The end result looks like this. The screenshot shows a lot of nice colors, where we have the scrolling text.…

Amiga Machine Code Letter VII - Blitting and Scrolling

We have reached Letter VII of the Amiga Machine Code course. It took a while getting here 😉. In this post, we are going to take another round with the blitter. This time to show how to make scrolling work! There’s a few concepts that are a bit hard to grasp, but the letter does a great job at explaining them. However, there some darker spots, so lets dive in! Descending mode Up until now,…

Amiga Machine Code Letter VI - Blitter 3

We have reached Letter VI of the Amiga Machine Code course. I will only skip through the details in this post. Make sure to read the letter, to get a grasp of things. In this post I will go through the code of the mc0602 program, that’s found on Disk 1 . I have annotated the code with a lot of comments, so that it should be possible to get a gist of things reading this post alone. To get…

Amiga Machine Code Letter VI - Blitter 2

We have reached Letter VI of the Amiga Machine Code course. I’ll skip through the details in this post. Make sure to read the letter, to get a grasp of things. In this post we will look at the code of the mc0601 program, found on Disk 1 . The program draws a blitter object that scrolls smoothly down the screen on a black background. It’s a very simple blitting, that provide some basic…

Amiga Machine Code Letter VI - Blitter

We have reached Letter VI of the Amiga Machine Code course. I will only skip through the details in this post. Make sure to read the letter, to get a grasp of things. The main theme of this letter, is moving bytes from an array of memory to another. In the Amiga this can be done with hardware support, through a technique called blitting. The word blitting is derived from the BitBLT routine for the…

Amiga Machine Code Letter V - Sprites

We have reached Letter V of the Amiga Machine Code course. The program examples are now so big, that we have to read them from the course disk Disk 1 Below is a listing of the program mc0501 that shows a sprite of a flag of Norway, that scrolls down the screen. I have annotated the program and below the listing I will dive into a couple of details. ; mc0501 move.w #$4000,$dff09a ; INTENA - clear…

Amiga Machine Code Letter V

We have reached Letter V of the Amiga Machine Code course. This letter is all about sprites and a few extra machine code instructions, and the instroduction of the stack. Let’s start with the extra machine code instructions and then look at some code. A new way to move The letter introduces a new addressing mode called address indirect with indexing and displacement . The addressing mode is…

Amiga Machine Code Letter IV - More Code

We have reached Letter IV of the Amiga Machine Code course. This post is about the code examples found in Letter IV. I won’t go into details, as you can look them up in the letter. We start with program example 0402, which sets up a program using one bitplane and also allocates space for it. ; Letter IV mc0402 start: move.w #$01a0,$dff096 ; DMACON disable bitplane, copper, sprite move.w…

Amiga Machine Code Letter IV - DMA Revisited

We have reached Letter IV of the Amiga Machine Code course. The CPU of the Amiga was the Motorola 68K . It’s speed grade at the factory was 8 MHz, yet when used in the Amiga, it was clocked to the odd 7.09379 MHz when outputting PAL video. Why was that? Video signals for television in Europe are different from North America. Europe, and many other countries, uses the PAL system, while North…

Amiga Machine Code Letter IV

We have reached Letter IV of the Amiga Machine Code course. This letter was the toughest yet, and I think that it’s due to my obsession with details. The authors writes repeatedly that we have to gloss over the details, as an explaination will be given in later letters. Btw. these scribblings are my own notes, so don’t expect that I will explain what’s already explained in the…

Amiga Machine Code Letter III - Branching

In this post we are going to look at branching as it is explained in Letter III . At it’s most basic level, branching is a conditional jump statement. The Amiga hardware offers opcodes for several conditional jumps. But first we will have to take a look at the 68K status register . Letter III mentions that we are not going to read the status register directly. Rather, it’s used…

Amiga Machine Code Letter III - Copper Revisited

Writting the Letter II posts, left me with a feeling that many details had been left unanswered. So it was with mixed feelings that I started reading Letter III . The letter turned out to be a good read, answering many of the questions I had from the previous letter. Mind you, that Letter III is a long one, that covers a lot of ground. So we better get started 😉. Boolean arithmatic and truth…

Amiga Machine Code Letter II - Part 2

We continue where we left of in the previous post . Letter II can be found here . DMA channels DMA stands for Direct Memory Access and the channels allows the Paula, Agnus, and Denise coprocessors to communicate with memory, without involving the CPU. This hardware design is a key feature of the Amiga, which made it the multimedia machine of the late eighties and early ninetees. An important…

Amiga Machine Code Letter II - Part 1

We have reached letter II of the Amiga machine code course. This letter introduces some basic but very important stuff - the DMA channels and the copper. I will go thrugh this letter a little bit out of order. For me, it’s more logical to start with the introduction to the assembler instructions move , add , sub and lea . In the deep dive of letter I , we saw how the opcode for move looked…

Amiga Machine Code Letter I - Hint

Here’s an important hint to get the correct emulated Amiga graphic. While watching ScoopexUs Youtube channel about Amiga programming, I saw this very interesting text in the video discription: NOTE the Get Started with WinUAE link in the WinUAE box! Use the default Quickstart Config and check Chipset - Cycle-Exact to make the emulator behave like a real Amiga. What is cycle-exact? Well, it…

Amiga Machine Code Letter I - Debugger

Before we continue to letter 2 of the Amiga machine code course, I want to show the debugger in WinUAE. It’s a real gem and it makes your life as a programmer a whole lot easier. Back in the day, I had an Action Replay card, which could do much of the same stuff as the WinUAE debugger. I used the Action Replay to parse endless lines of hex dumps, so that I could add lifes or power boosters…

Amiga Machine Code Letter I - Deep Dive

Letter 1 does not explain the program in much detail. It’s just meant as a small test to see if you can get the code up and running and also explain what an assembler does. Let’s take a closer look at the program. Btw. many details in the following, will be revealed in the other Amiga machine code letters, so it’s a bit early to go down this path. The Seka can show the program…

Amiga Machine Code Letter I

In this post we will take a look at the first letter of the Amiga machine code course. The letter is freely available here: http://palbo.dk/dataskolen/maskinsprog/ The letter starts with an introduction of the binary and hex number systems. We are told that it’s very important to learn these number systems and that they will be of great use later. I was a bit lazy as a kid (who…

Amiga Machine Code Setup

In this post I will shortly describe the development environment I will use on the journey through the Amiga Machine Code course. It’s been years since I last used my Amiga 500 and all the bits and pieces are now stored away in boxes. Without the hardware and disks, it seemed like a virtually impossible quest to learn Amiga machine code. However, it turns out that there are many Amiga…

Amiga Machine Code

Back in the early ninties, my mom had the great foresight to buy me an Amiga 500 and a course in Amiga machine code. That was way before Marc Andressens famous essay Why Software Is Eating the World , made it obvious that software is in fact eating the world. My mom was hoping that I might use the Amiga for programming and really tried to get me motivated. She even learnt the binary number system…

Mandibular Metamorphosis

While I was a student at DTU I participated in the 4M project with a project about mandibular metamorphosis. It was meant to be a preparation for my master thesis. I learned a ton about programming and image analysis. However my interests soon drifted towards optimization and numerical analysis, so nothing came of the master thesis, but I did contribute to a couple of articles and made a poster…