Jump to content

Category:68000 Assembly: Difference between revisions

m
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1:
{{stub}}{{language}}
{{merge language | M680x0 }}
 
{{language}}
68000 assembly is the assembly language used for the Motorola 68000, or commonly known as the 68K. It should not be confused with the 6800 (which predates it). The Motorola 68000 is a big-endian processor with full 32-bit capabilities (despite most systems that use it being considered 16-bit.) It was used in many computers such as the Amiga or the Canon Cat, as well as game consoles such as the Sega Genesis and Neo Geo.
 
 
{{merge language | M680x0 }}
==Architecture Overview==
===Big-Endian===
Line 134 ⟶ 135:
MOVE.L #0,D3 ;D3 = #$00000000</lang>
 
Loading immediate values into address registers is different. You can only move words or longer into address registers, and if you move a word, the value is sign-extended. This means that if the top nibble of the word is 8 or greater, the value gets padded to the left with Fs, and is padded with zeroes if the top nibble is 7 or less. ItIf you're adding a constant value less than 7FFF to an address, it's bestusually safe to alwaysuse movethe longsword intolength addressoperation, registers.which Thattakes wayless youbytes knowto whatencode you'rethan the long length gettingversion.
 
<lang 68000devpac>MOVEA.W #$8000,A4 ;A4 = #$FFFF8000. Remember the top byte is ignored so this is the same as #$00FF8000.
Line 183 ⟶ 184:
 
* It's best to push all registers (D0 thru D7 and A0-A6) onto the stack at the start and pop them off at the end. This is not required for the traps you call with the <code>TRAP #?</code> command, but for the others it's absolutely necessary, since you can't know in advance when they'll happen. You can leave out A7 when doing this since that's the stack pointer itself.
 
==Interrupts==
The 68000 supports 7 different interrupts, often called IRQs or Interrupt Requests. Enabling interrupts is often a twofold process: first, the interrupt source must be enabled, which is usually an implementation-defined process that involves interacting with memory-mapped ports. Second, the status register must be set accordingly to allow the interrupt to occur, which can be achieved with <code>MOVE #$2x00,SR</code> where X is the desired interrupt level. X can range from 0 to 7, and for an interrupt to occur, its interrupt level (which is determined by the hardware implementation and the placement of the desired address in the vector table) must be greater than X or it will not happen (even if the source is enabled.)
 
==Alignment==
1,489

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.