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)

NEW!

Part 05

The JSR and RTS Instructions

NEW!

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.

 

 

 

NEW!

Part 01

The CCR (Conditional Code Register)

NEW!

Part 02

The CMP, TST & BTST Instructions

NEW!

Part 03

The BEQ & BNE Instructions

NEW!

Part 04

The BPL & BMI Instructions

NEW!

Part 05

The BVC & BVS Instructions

NEW!

Part 06

Signed Branches (BGE, BGT, BLE, BLT)

NEW!

Part 07

Unsigned Branches (BCC, BHI, BLS, BCS)

 

 

 

Updates

 

2014 March 22

 

 

Section 06 is now coming to an end.Now featuring a multitude of conditional branches.

 

If anyone notices any mistakes, be sure to give me an email.I wrote a lot of stuff today in such a short period of time, itís easy to make the slightest mistake.

 

2014 March 18

 

 

Well hot damn!!Itís been a long while, hasnít it?I think I owe you guys an explanation...

 

Iíve been extremely busy with a lot of things, namely an art editor that looks like Windows XP paint, but for Mega Drive VDP graphics:

 

http://mrjester.hapisan.com/03_Private/ZoomA.PNG

http://mrjester.hapisan.com/03_Private/ZoomB.PNG

 

Additionally, Iíve been doing various things to my game, hereís a little insight for you, featuring a new idle animation:

 

 

Pretty sweet huh?

 

Iím gonna be working on rewriting Section 05 of the tutorial and then adding some things onto it.From now on, youíll find a ďnewĒ tag at the beginning of ones that have been changed or updated, so you know which ones to read again if thereís been a mistake or whatever.

 

 

 

In the mean time, have some Kylie Minogue!Also, a special thanks to:

 

Tomislav, Ardeshir, and Tim.

 

For pointing out various mistakes in previous pages d=

 

2013 October 31

 

 

Happy Halloween!!

 

And with that, we have a Section 05!!

 

Also, have another music video, something a little more modern, recommended to me by my favourite aussie, Flygon:

 

 

 

If these YouTube video embeds are causing you too much loading time, just give me a bell via my email, and Iíll revert the older embeds to links.

 

2013 October 20

 

 

So Iíve taken the time to clean up Section 04, the parts have been shuffled around slightly.

 

If youíve read through Section 04, so far and donít wish to re-read what youíve already read.Then simply take a look at part 01, part 04 and then continue from part 08 onwards.The other parts in this section are pretty much the same, just cleaned up a little (spellings, grammar, etc).

 

Sorry for the inconvenience.

 

2013 October 18

 

 

Sorry for the lack of parts this past week.

 

I work in a deli factory you see, and the people who have been put in charge of the factory make a lot of stupid mistakes.This costs the main company money, and results in the lack of equipment and staff.We operatives go through hell most days, its bad enough having to wake up at 4-5am.

 

Iím not here to complain about that though.

 

My main point is, I lack the time and energy to do multiple projects at once during the week, and so, I have to do a bit of juggling between the projects.

 

Hereís what Iíve been up to recently:

 

http://www.youtube.com/watch?v=6P76b9Wgocs

 

Pretty cool huh?

 

Iíll be getting back to more instructions soon.

 

2013 October 13

 

 

Bit shifting and rotation have been put up to the site now, they may need a little cleaning up, so Iíll have to go over them later on at some point (you know, check for spelling errors, mistakes in the rules, etc).

 

In the mean time, have some 90ís Italo House music:

 

 

 

2013 October 08

 

 

The binary section is now complete, and Iím looking into signed and unsigned, and instructions that deal with positive and negative.Might be able to get up to (and pass) the divs/divu instruction (thatís where the previous version of the tutorial stopped).

 

2013 October 04

 

 

Some minor clean up, and a few things added here and there, and some mistakes have been rectified (a special thanks to FraGag for reporting them).

 

On subject, I was thinking of creating a FAQ or Q&A page, but of course, Iíd need some questions first...†† Any questions?I donít claim to know everything, but Iíd be happy to try and answer what I can.

 

2013 September 30

 

 

The instruction ďaddiĒ for immediate values has been explained and added to the ďaddĒ instruction page.The ďsubĒ instruction page is now available too.

 

I shall press on with the simpler instructions like ďswapĒ, ďexgĒ and ďclrĒ, so expect them to pop up sometime during the evening.

 

In the mean time, have some 80ís music:

 

 

 

2013 September 25

 

 

And weíre back ladies and gentlemen.

 

I had an attack of consciousness about a week ago.A few programming experienced individuals said that the tutorial wasnít worth doing at this much of a basic level, and that stuff such as binary/hex and basic stuff like that should be left out.

 

I originally agreed with them as they did make a few points.But given that I received a good load of emails reporting the tutorial gone when I took it down last week, itís clear to me that they appear to be wrong about the tutorial.I mean given the tutorial to receive positive feedback from people who the tutorial is actually designed for...

 

Why are experts generally uptight and negative in their area of expertise towards newcomers?

 

Maybe they have a too higher standard, who knows...Either way, I donít think Iíll sink to that level.

 

OH!!By the way!!

 

Scroll down for a little insight into what Iíve been using 68k for ;)

 

2013 September 17

 

 

Wow, what a great holiday...Itís great to be back though!

 

I did however, hit a little snag with hotmail, it seems it was trying to be ďcleverĒ.When I signed in online abroad, it locked me out requesting a phone number, thinking it was protecting me.

 

Iíve gotta tell ya folks, technology is becoming tedious these days, so much protection even I canít access my account.

 

SO!New email address, this time with Gmail, Iíve not been much of a fan of Google, but everyone Iíve asked have said that itís one of the few decent e-mail services out there.

 

Regarding the tutorial, itís still going!Got a results part for that homework in, finally.Sorry about that folks (should have done it before I went on holiday).

 

2013 September 07

 

 

An update on registers and the basic set out of an instruction, this time a little more info on address registers.

 

Additionally, Iíll be on holiday for the entire week, so I wonít be contributing any further until I get back.

 

In the mean time, have some music:

 

 

 

2013 September 05

 

 

Tutorial rewrite begins!  I have here a section where youíll be kept up to date with the progress, at least now youíll know how long ago the last update was =P

 

 

 

 

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!).