Programming Like It’s 1989: Learning Motorola 68000 Assembler

Back in my teens I used to spend a lot of time enjoying the Amiga by writing games and playing games such as Sensible World Of Soccer against my friends. Because I enjoyed those days so much I decided that making a simple football game would be a great way to relive the days of programming the Amiga. When I used to program games for the Amiga I didn’t spend much time with the low level languages such as Assembler favor something a bit more ‘simpler’ such as C, AMOS or Blitz. I look back in regret as my career path would of been so much different now. So why not give it a go now? I write this blog as I learn, relearn in the same was as I did in my early games programming days.

The Plan

Whenever I write a game a always put together a small plan which divides the workload up into simplistic steps, building on each step by adding complexity until the desire result is achieved. If you break down each part you end of with simplistic tasks to achieve like mini goals. In the GTD methodology (Get Things Done) these are often described as ‘widgets’. Our jobs is much easier if we think of each task as stamping a widget rather than thinking about building a whole game. This is especially important when programming in a new language, breaking down tasks further into simplistic parts and slowing building upon these saves us from loosing focus and getting bored.

Our plan is as described (Note, I will strike through each bullet point as it is complete and provide a link to the article):

Phase 1: Simple game flow.

The following tasks will create a simplistic simulation of the game flow from title to play screen, increasing scores and showing the winner at the end of the game. This will just basic text output to screen utilising the CLI and standard AmigaDOS libraries.

  • Simple Hello world.
  • Build a busy loop: A basic loop that will exit when the user hits escape.
  • Show a Title on the Page: The start of the game title page with two pieces of text ‘Start’ and ‘Exit’.
  • Assign key to start game.
  • Start game and clear the page.
  • Scoreboard: Add scores for either side.
  • Time keeping code and output to screen.
  • Increase score: Assign a key to increase the score of one end and on another key to increase the score of the other.
  • End half / game: When timer reaches zero.
  • Display who has won by comparing scores.

Phase 1: Retrospective

Once phase 1 has been completed I will take stock and go over what went well and what didn’t go to plan. I will identify the troubles I had and how I managed to overcome them. Through this I will formulate a plan of what I need to before and during the next phase of learning and development.

Phase 2: Basic Graphics

The next phase builds knowledge around drawing graphics to the screen via simple text, lines and circles along with some colour. It isimportant to note that there is a move from the cli to a custom screen. Being this close to the metal we will have to disable certain interrupts from the OS to stop any interferance from the system in the background.

  • Understand the process of drawing via hardware.
  • Open a custom screen for drawing.
  • Draw shape code: Be able to draw the basic shapes just as square, oval, circle and line. These will be used to convert the text buttons into actual buttons and for drawing the pitch.
  • Colour the shapes that we have drawn.
  • Create a title page with graphics but still look for the keypresses to start and end.
  • Create a scoreboard with graphics.
  • Update scoreboard when keys are pressed as per phase 1.
  • Draw the pitch: I now should be able to draw a football pitch.
  • Draw player.
  • Draw ball.

Phase 3: Basic movement

  • Move player: Detect the location of the sides of the screen and where player is.
  • Move player: Change players position left and right on screen between these positions.
  • Move player: Change players position up and down.

Phase 4: Input Control

  • Joystick: Recognise joystick and what direction it has been pushed and what buttons have been pressed.
  • Move cursor on title page to highlight an option
  • Select the option when the joystick button has been pressed.
  • Execute the same code as per the key press for the option selected.
  • Move player: Use joystick to move the player.

Phase 5: Collisions

  • Collision detection: How?
    Collision detection: Detect player collision with ball.
    Collision detection: Move ball away from player is the direction of movement.
    Dribble ball.
    Kick ball.

Phase 6: More Game Logic

  • Detect ball has crossed the horizontal bounds of the pitch.
    Detect if ball has entered the goal.
    Increase score if goal has been scored at either end.

Be the first to comment

Leave a Reply

Your email address will not be published.


*