lea    (MarkeyJester’s).l,a0

        lea    (Motorola).l,a1

        move.l #$00068000,d0

        add.l  #Beginner’s,d0

        move.l #Tutorial,d1

        move.l d0,(a0)+

        move.l d1,(a1)+

 

(MarkeyJester’s Motorola 68000 Beginner’s Tutorial)

 

Introduction

 

Hello.  I’m MarkeyJester, and for several years, I have been programming in 68k assembly.  I have made quite a few Sonic The Hedgehog ROM modifications (a.k.a. hacks), have made a few proto games, and I’m currently in the process of programming a full game from ground up, for the SEGA Mega Drive system.

 

I had trouble learning the language to begin with, and found that a lot of 68k assembly tutorials didn’t really help.  In fact, hardly any of them explained it from a beginner’s point of view, and were extremely vague.  There was only one tutorial I found that really pointed me in the right direction, and it was a guide by SonicRetro member redhotsonic, though his tutorial has a few holes in places which makes it sort of impractical.

 

So, this tutorial here is an attempt at teaching 68k assembly at an extreme beginner’s level, to help steer away from all of those vague guides out there.  If you have any questions to ask, or any advice or feedback to share, then feel free to contact me by email at markeyjester “at” gmail “dot” com.

 

Please note, I have been getting a lot of emails regarding the simulator BSVC, and a lot of the questions related to problems with using macros correctly.  I’m afraid I don’t work with BSVC or EASy68k, and these questions are very hardware specific and actually have nothing to do with 68k itself.  So chances are, I cannot help you in that regard.  So please keep that in mind, and maybe check out manuals/documents that may have came with the hardware/simulator.

 

Good luck.

 

 

 

Contents

 

Section 01 – Getting Started

 

 

 

 

This section shows the basics of 68k assembly programming.

 

 

 

 

Part 01

Computer Memory

 

Part 02

Memory Storage

 

Part 03

Instruction Set Out

 

Part 04

Registers

 

Part 05

The MOVE Instruction

 

Part 06

Addressing & Program Flow

 

Part 07

Homework Results 01

 

 

 

Section 02 – Basic Instructions

 

 

 

 

In this section, we look at some basic instructions that are relatively simple to use.

 

 

 

 

Part 01

The ADD Instruction

 

Part 02

The SUB Instruction

 

Part 03

The SWAP Instruction

 

Part 04

The EXG Instruction

 

Part 05

The CLR Instruction

 

Part 06

Homework Results 02

 

 

 

Section 03 – Binary Instructions

 

 

 

 

This section deals with binary manipulation (bit specific instructions).

 

 

 

 

Part 01

The NOT Instruction

 

Part 02

The AND Instruction

 

Part 03

The OR Instruction

 

Part 04

The EOR Instruction (XOR)

 

Part 05

The BSET, BCLR and BCHG Instructions

 

Part 06

Homework Results 03

 

 

 

Section 04 – Positive and Negative Instructions

 

 

 

 

This section looks at instructions that work with positive and negative.  We also look at other similar instructions too.

 

 

 

 

Part 01

Bit significance

 

Part 02

Signed and Unsigned

 

Part 03

The NEG Instruction

 

Part 04

The EXT Instruction

 

Part 05

Bit shifting

 

Part 06

The LSL, LSR, ASL & ASR Instructions

 

Part 07

The ROL & ROR Instructions

 

Part 08

The MULU & MULS Instructions

 

Part 09

The DIVU & DIVS Instructions

 

Part 10

Homework Results 04

 

 

 

Section 05 – Program Flow Change

 

 

 

 

Here, we take a look at instructions that cause the 68k to jump to different locations to read different instructions.

 

 

 

 

Part 01

The PC (Program Counter)

 

Part 02

The JMP Instruction

 

Part 03

The BRA Instruction

 

Part 04

The SP (Stack Pointer)

 

Part 05

The JSR and RTS Instructions

 

Part 06

The BSR Instruction

 

 

 

Section 06 – Conditional Branches

 

 

 

 

In this section, we look at instructions that change the PC of the 68k, but this time, based on certain conditions.

 

 

 

 

Part 01

The CCR (Conditional Code Register)

 

Part 02

The CMP, TST & BTST Instructions

 

Part 03

The BEQ & BNE Instructions

 

Part 04

The BPL & BMI Instructions

 

Part 05

The BVC & BVS Instructions

 

Part 06

Signed Branches (BGE, BGT, BLE, BLT)

 

Part 07

Unsigned Branches (BCC, BHI, BLS, BCS)

 

 

 

Updates

 

2014 October 04

 

 

A little clean up here and there, nothing major.  I wanted to seperate the older updates into their own page, as the YouTube embeds were slowing the page loading down.

 

Click here for previous "older" updates

 

 

 

Personal 68k Project(s)

 

The chaos Layer

 

A platform game for the SEGA Mega Drive I’ve been working on.  Over a year has gone by and I’ve got quite far in terms of functionality, there’s even Mega CD support hidden away!  But of course, there’s still a lot to go.  What’s important now is game-play, enemies, gimmicks and some levels to design.  We’ll see how it goes...

 

 

 

 

Special thanks to http://www.quotegarden.com/ and http://www.brainyquote.com/ for the quotes used in this tutorial, to redhotsonic for inspiration and ideas drawn from his guide, and to Jorge, andlabs and FraGag, for their help, opinions, overviews and corrections.

 

The HTML Counter

 

A visitor counter (Because why not!).