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 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 = 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) = $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 MOVE.W #$AABB, $ $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$ 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  $ MOVE.W4(A0),D0; D0  8 LEA4(A0),A1; A1  $ ORG$ ARRAYDC.W12,4, $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