[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/vr/ - Retro Games

Search:


View post   

>> No.1683064 [View]
File: 21 KB, 637x671, addressing_table.png [View same] [iqdb] [saucenao] [google]
1683064

(part 2 of >>1682959 )

The target isn't used in all instructions (jumps and branch for example).

On pic related, you have most of the addressing modes, that means the valid combinations of sources and targets that instructions that need both can accept (all instructions don't alway accept all addressing mode, they accept some of them).
To understand the table:
$ = Hexadecimal number # = some data
x = depending on the size:
- .b = 1
- .w = 2
- .l = 4
d16 = movement coded on 16bit
d = movement coded on 8bit
X = either an A or D register, both are valid.

Something I forgot on last post:
Words and long words can only be stored on even addresses, not odd ones. Don't ask why, it's a bug of the conception.
The 68000 is a Big Endian CPU, so when the word 01011010 00100100 is stored at the Address $00 for exemple, the byte 01011010 is stored at $00, while the byte 00100100 is stored at $01. It's the other way around on intel CPUs.

Now if you want an example of 68000 assembly code, here are some:
MOVE.b #5,D1 ;place the byte 5 in data register D1
EOR.b D2,D2 ;Exclusive OR of the first byte of D2 and the first byte of D2 which result is placed in D2. Well D2 is equal to itself, so every 1 is turned in a 0.
loop: ADD.b #1,D2 ;add the byte 1 to D2
CMP.b D1,D2 ;compare the first byte of D1 to the first byte of D2
BNE loop ;If D1 and D2 are not equal (according to the SR), then branch to the line who's label is loop
RTS ;End

Well, that's all you need to know to start coding in assembly. You might as well check for the complete instruction set of the 68000, then look at some x68000-specific stuff like hardware registers and rom routines. Good luck anon.

Navigation
View posts[+24][+48][+96]