Presentation is loading. Please wait.

Presentation is loading. Please wait.

CEG 320/520: Computer Organization and Assembly Language Programming1 Assembly Language Programming Machine Code Hand Assembly.

Similar presentations


Presentation on theme: "CEG 320/520: Computer Organization and Assembly Language Programming1 Assembly Language Programming Machine Code Hand Assembly."— Presentation transcript:

1 CEG 320/520: Computer Organization and Assembly Language Programming1 Assembly Language Programming Machine Code Hand Assembly

2 CEG 320/520: Computer Organization and Assembly Language Programming2 Machine Code: Introduction Machine instructions in the 68000 can be as small as one word long, and as long as five words long. Instructions always begin at a word address. The first word of an instruction is called the op- code word. –Operation + Effective Address Fields

3 CEG 320/520: Computer Organization and Assembly Language Programming3 Machine Code: Table C.4 Mnemonic: ADD Legal operand sizes (B, W, L) Addressing modes –Source or dest must be a data register for add

4 CEG 320/520: Computer Organization and Assembly Language Programming4 Machine Code: The ADD instruction Two forms: src is Dn or dest is Dn –Add D0, D1 could use either form DDD = src/dest register number SS = size EEEEEE/eeeeee = address field All CCR bits are set ADD.W D0, D1 = 1101 0001 01 000 001 ADD Src = D0 Size = W Dn direct Dst = D1

5 CEG 320/520: Computer Organization and Assembly Language Programming5 Machine Code: Address field 6 bits Denoted EEEEEE (dest) or eeeeee (source) in table C.4

6 CEG 320/520: Computer Organization and Assembly Language Programming6 Machine Code: Another ADD ADD.L $0012A0, D3 (Form 2, dst = Dn) 1101 0110 10 111 001 = $D6B9 We are only considering absolute long addressing, so the source address, $0012A0 is a long word. The instruction takes three memory words: $D6B9 $0000 $12A0

7 CEG 320/520: Computer Organization and Assembly Language Programming7 Machine Code: MOVE Example MOVE.B (A3)+,D5 00SS RRR MMM eeeeee 0001 101 000 011011 MOVE.W #$AABB, $002000 0011 001 111 111100 $1A1B $33FC $AABB $0000 $2000 What would the extension words look like for MOVE.B? What would the extension words look like for MOVE.B?

8 CEG 320/520: Computer Organization and Assembly Language Programming8 Assembly: LEA LEA – Load Effective Address –Loads the address of the operand, instead of the value. MOVE.WARRAY,A0 LEAARRAY,A0 ORG$002000 ARRAYDC.W12,15,30,5 END A0  12 A0  $2000

9 CEG 320/520: Computer Organization and Assembly Language Programming9 Assembly: LEA example LEAARRAY,A0; A0  $002000 MOVE.W4(A0),D0; D0  8 LEA4(A0),A1; A1  $002004 ORG$002000 ARRAYDC.W12,4,8 12 4 8 $2000 $2002 $2004


Download ppt "CEG 320/520: Computer Organization and Assembly Language Programming1 Assembly Language Programming Machine Code Hand Assembly."

Similar presentations


Ads by Google