Download presentation
Presentation is loading. Please wait.
Published byElizabeth Daniels Modified over 9 years ago
1
Assembly Language ELEC 330 Digital Systems Engineering Dr. Ron Hayne
2
330_032 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
330_033 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
330_034 Listing (.LST) Source Code Source Module Object Code Object Module Symbol Table User symbols Numeric values of symbols (Cross-references) Error Messages
5
330_035 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
330_036 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 Can’t be single letter A, B, X, or Y Must be unique
7
330_037 Addressing Modes Addressing Mode Operand Format Operand Type Example Inherentnone INCA Immediate#operanddata numberLDAB #40 ExtendedoperandaddressSTAA LENGTH DirectoperandaddressSUBA COUNT Indexedoperand,XoffsetLDD 0,X Relativeoperandaddress/offsetBVS LOOP
8
330_038 Assembler Directives ORGorigin RMBreserve memory bytes FCBform constant bytes FCCform constant characters FDBform double-bytes EQUequate ENDend
9
330_039 Source Module (.ASM) * This line is a comment * CONSTEQU17 * ** Data Section ORG$20 DATA1FCB$10 DATA2FDB$B610 STORERMB3 VALUEFCB20 ORG$B600 PTRNFCB%00001100 SAVERMB1 *
10
330_0310 Source Module (.ASM) ** Program Section ORG$E100 STARTLDAAVALUE DECA STAASAVE LDAB#23 LDXDATA2 STABCONST,X DONEBRADONE "STOP" * ORG$FFFEreset vector FDBSTARTset to start END
11
330_0311 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
330_0312 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
330_0313 Assembler Listing (.LST) Symbol Table CONST 0011 DATA1 0020 DATA2 0021 DONE E10C PTRN B600 SAVE B601 START E100 STORE 0023 VALUE 0026
14
330_0314 THRSim11 68HC11 Simulator setup setup license Source Module (.ASM) Assemble Object/Load Module (.S19) Listing (.LST) Label Window (List) Memory List Memory Map $0000-$00FFRAM $1000-$103FI/O $B600-$B7FFRAM $E000-$FFFFROM Run (Step) CPU Registers Memory List Reset
16
330_0316 Project 1 THRSim11 Write, Assemble, Test Copy-a-table Program (Figure 2-49, p.108) Individual Work Due Date See web site
17
330_0317 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
330_0318 * Bad Example * CONST EQU $15 * ORG 32 Data Section 0020 10 MARY FCB $10 0021 39 46 BOB FDB $ABCD/3+2 0023 36 ABCDEF FCB CONST+BOB 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 ABCDEF+2 0032 DF 15 STX CONST 0034 E7 20 STAB MARY,X 0036 20 F3 BRA START+4 0038 3F SWI "Stop" END
19
330_0319 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.