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

Cycle times

Description - NEW All instructions will take a certain amount of CPU time to process, they are usually measured in “Cycles”, or “states”. So, you’ll want to know the speed of each instruction, with different source and destination operands. Here, I have collected and compiled together the cycle times a 68k CPU from a model 1 Mega Drive (this information was recorded from the hardware itself, not an emulator), and has been done with great care and attention. While I’m certain these cycle times are accurate, the shift based instructions (lsl, lsr, asl, asr, rol, ror, roxl and roxr) might not be accurate. The numbers you’ll see, are exactly how they came out on hardware, I couldn’t find an explanation for this, but have left it here for your viewing pleasure. Please follow this link to an index page of instruction cycle times.

Updates

2017 September 16 Once again, it’s been a while, I’ve finally removed those stupid “NEW” tags, since they’re technically not new d= This update isn’t anything to do with the tutorial site, I still haven’t touched it, and probably won’t for a long while. But what I have done, is compiled a list of cycle times for all instructions I possibly could. These were collected from hardware with the highest accuracy I could muster given the technology I have available to me. Look for “Cycle Times” just below the “Contents” menu. I’ve been getting into lofi hip hop lately, so maybe you’ll enjoy it too~ Click here for previous "older" updates

Minor Fixes Thanks To...

Tim Hansson, Stuart Patton, Mathieu Stempell, Anthony Vanover, Paul Krigovsky, Andre Tampubolon, Daniel Kang, Robert, Krzysztof Lasocki, Matt Cole, and Fran Jednobrkovic. If you find an error or mistake somewhere, be sure to email me, and I’ll fix it almost immediately.

Personal 68k Project(s)

The chaos Layer This was a platform game I was working on for the SEGA Mega Drive , unfortunately, I've gotten rather bored of programming on the Mega Drive these days, so I've taken a break from it all. I did of course, release what I had of this game so far, it's majorly incomplete, but it is what it is. You can download it here , you will need either a Mega Drive/Genesis emulator program to play this ROM, or a flash cart device and an actual Mega Drive/Genesis.

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.

A visitor counter (Because why not!).



