Assembly Language - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Assembly Language

Description:

... (.LST) Assembly Language Label, Operation, Operand, Comment Numbers, Symbols Addressing Modes Assembler Directives THRSim11 330_03 ELEC 330 Assembly Language ... – PowerPoint PPT presentation

Number of Views:147
Avg rating:3.0/5.0
Slides: 20
Provided by: Dr231553
Category:

less

Transcript and Presenter's Notes

Title: Assembly Language


1
Assembly Language
  • ELEC 330
  • Digital Systems Engineering
  • Dr. Ron Hayne

2
The Assembly Process
  • Assembly Language
  • Symbolic representation of instructions and data
  • Source module (.ASM)
  • Assembler
  • Program which translates symbols to machine code
  • Object/Load module (.S19)
  • Listing (.LST)
  • Loader
  • Utility that places machine code into target
    memory
  • Some assemblers require Linker to convert object
    module into load module

3
Source Load Modules
  • Source Module (.ASM)
  • Symbolic Instructions, Data and Addresses
  • Instruction mnemonics
  • Symbols
  • Assembler Directives
  • Control instructions for assembler program
  • Comments
  • Explanation of program
  • Load Module (.S19)
  • Binary Instructions and Data
  • Object Module
  • Load Information
  • Address information
  • Error-checking info
  • Checksum

4
Listing (.LST)
  • Source Code
  • Source Module
  • Object Code
  • Object Module
  • Symbol Table
  • User symbols
  • Numeric values of symbols
  • (Cross-references)
  • Error Messages

5
Motorola Assembly Language
  • Source Statement
  • Single line of program
  • Symbols and Numbers
  • Spaces (or tabs) delineate fields
  • Label
  • Operation
  • Operand
  • Comment
  • Line beginning with an is also a comment

6
Numbers and Symbols
  • Numbers
  • Assembler translates into 16-bit binary
  • Number Systems
  • Decimal
  • 34, -34
  • Hex
  • 12, ABCD
  • Binary
  • 1001, 01101101
  • Symbols
  • Characters used to represent addresses or data
  • Assembler translates into numbers
  • Characteristics
  • One to six alphanumeric characters
  • First character a letter
  • Cant be single letter A, B, X, or Y
  • Must be unique

7
Addressing Modes
Addressing Mode Operand Format Operand Type Example
Inherent none none INCA
Immediate operand data number LDAB 40
Extended operand address STAA LENGTH
Direct operand address SUBA COUNT
Indexed operand,X offset LDD 0,X
Relative operand address/offset BVS LOOP
8
Assembler Directives
  • ORG origin
  • RMB reserve memory bytes
  • FCB form constant bytes
  • FCC form constant characters
  • FDB form double-bytes
  • EQU equate
  • END end

9
Source Module (.ASM)
This line is a comment CONST EQU 17 Data
Section ORG 20 DATA1 FCB 10 DATA2 FDB B610 STO
RE RMB 3 VALUE FCB 20 ORG B600 PTRN FCB 0000110
0 SAVE RMB 1
10
Source Module (.ASM)
Program Section ORG E100 START LDAA VALUE DE
CA STAA SAVE LDAB 23 LDX DATA2 STAB CONST,X D
ONE BRA DONE "STOP" ORG FFFE reset
vector FDB START set to start END
11
Assembler Listing (.LST)
This line is a comment
CONST EQU 17
Data Section
ORG 20 0020 10
DATA1 FCB 10 0021 B6 10 DATA2 FDB
B610 STORE RMB 3 0026
14 VALUE FCB 20
ORG B600 B600 0C PTRN FCB
00001100 SAVE RMB 1

12
Assembler Listing (.LST)
Program Section
ORG E100 E100 96 26 START
LDAA VALUE E102 4A DECA E103
B7 B6 01 STAA SAVE E106 C6 17
LDAB 23 E108 DE 21 LDX
DATA2 E10A E7 11 STAB CONST,X
E10C 20 FE DONE BRA DONE "STOP"
ORG FFFE reset
vector FFFE E1 00 FDB START
set to start END
13
Assembler Listing (.LST)
Symbol Table CONST 0011 DATA1
0020 DATA2 0021 DONE
E10C PTRN B600 SAVE
B601 START E100 STORE
0023 VALUE 0026
14
THRSim11
  • 68HC11 Simulator
  • setup
  • setup license
  • Source Module (.ASM)
  • Assemble
  • Object/Load Module (.S19)
  • Listing (.LST)
  • Label Window (List)
  • Memory List
  • Memory Map
  • 0000-00FF RAM
  • 1000-103F I/O
  • B600-B7FF RAM
  • E000-FFFF ROM
  • Run (Step)
  • CPU Registers
  • Memory List
  • Reset

15
(No Transcript)
16
Project 1
  • THRSim11
  • Write, Assemble, Test
  • Copy-a-table Program (Figure 2-49, p.108)
  • Individual Work
  • Due Date
  • See web site

17
Bad Assembly Language
  • Bad Documentation
  • too little, too much
  • confusing comments
  • Bad Labels
  • confusing
  • meaningless
  • Bad Numbers
  • mixed bases
  • complex calculations
  • Bad Expressions
  • single/double-bytes
  • mixed constants
  • Bad Instructions
  • mixed addresses/data
  • Extraneous Statements
  • unused symbols
  • unused instructions

18
Bad Example
CONST EQU 15
ORG
32 Data Section 0020 10 MARY
FCB 10 0021 39 46 BOB FDB
ABCD/32 0023 36 ABCDEF FCB
CONSTBOB LDAA RMB 1
0025 0A A FCB A 0026 EC
TWOONES FCB 11101100 0027 96 24
START LDAA LDAA 0029 7A 00 25
DEC A 002C 97 45 STAA 45
Load the A reg 002E C6 20 LDAB
MARY 0030 D7 25 STAB
ABCDEF2 0032 DF 15 STX
CONST 0034 E7 20 STAB MARY,X
0036 20 F3 BRA START4 0038
3F SWI "Stop"
END
19
Summary
  • Assembly Process
  • Source Module (.ASM)
  • Object/Load Module (.S19)
  • Listing (.LST)
  • Assembly Language
  • Label, Operation, Operand, Comment
  • Numbers, Symbols
  • Addressing Modes
  • Assembler Directives
  • THRSim11
Write a Comment
User Comments (0)
About PowerShow.com