"If anything can go wrong, it will. If it can't, it will anyway."
You get some strange errors messages when assembling or running your program and you don't know what's wrong? Take it easy, it is quite common :->
But finding the errors in the source can be hard, VERY hard, sometimes. There are some common mistakes though if you've programmed other assembly languages before. Those include:
* You MUST put a # before an immediate value!! There are exceptions, for example LEA 10(A7),A7, but when using MOVE, CMP and other instructions it can be a fatal error. For example, MOVE.B $10,D0 means move the byte stored at address $10 to D0! This can cause protected memory error or something like that. Always check so you've not missed any pound signs!
* The first operand is the source, the second the destination! This is also a very common error in the beginning. We will not speak of what it could do, but instead of getting things from important places in the RAM (like, the interrupt vector), you store some trash there! Not good! Check all instructions with two operands! Most instructions have two operands.
* Since the upper part of the register will remain there until you move another longword to the register, it may cause big problems! For example, when getting a byte from somewhere in the memory, and then you want to multiply it, you MUST be sure that the upper part of the byte is cleared out, since you don't specify any operation size (.B, .W or .L) when multiplying. To do this, use either CLR or EXT (see 2.0 Instruction summary).
* All tables and other variables you will address with (An) must be at an even address. If you have defined it one byte before the table, it will cause the table to start at an odd address, which will probably cause in a calculator crash. To avoid this, move all such tables/arrays at the beginning of the variable section (I think, or at least it seems so, all instructions have the size 2, 4, 6...). You may also use the "even" assembly directive which aligns the table on a longword boundary.
* Learn to use the debugging tools in the EASy68K simulator. Place breakpoints in your program and Trace individual instructions as you observe the contents of the 68000 registers. Make sure you fully understand the operation of each instruction and verify it's behavior as your trace through the code.
Be aware that when programming an assembly language, most of the time (>50%) you're sitting and correcting bugs.