1 / 9

Assembly Language Programming

Assembly Language Programming. Machine Code Hand Assembly. 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.

Olivia
Télécharger la présentation

Assembly Language Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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 CEG 320/520: Computer Organization and Assembly Language Programming

  3. 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 CEG 320/520: Computer Organization and Assembly Language Programming

  4. 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 Dst = D1 Size = W Dn direct CEG 320/520: Computer Organization and Assembly Language Programming

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

  6. 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 takesthree memory words: $D6B9 $0000 $12A0 CEG 320/520: Computer Organization and Assembly Language Programming

  7. 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? CEG 320/520: Computer Organization and Assembly Language Programming

  8. Assembly: LEA • LEA – Load Effective Address • Loads the address of the operand, instead of the value. MOVE.W ARRAY,A0 LEA ARRAY,A0 ORG $002000 ARRAY DC.W 12,15,30,5 END A0  12 A0  $2000 CEG 320/520: Computer Organization and Assembly Language Programming

  9. 12 4 8 $2000 $2002 $2004 Assembly: LEA example LEA ARRAY,A0 ; A0  $002000 MOVE.W 4(A0),D0 ; D0  8 LEA 4(A0),A1 ; A1  $002004 ORG $002000 ARRAY DC.W 12,4,8 CEG 320/520: Computer Organization and Assembly Language Programming

More Related