8051-CH2 Intro Assemblys2'10
8051-CH2 Intro Assemblys2'10
Programming
8051 Assembly Language
Programming
Outlines
8051 programming model
Machine instructions
A programmer should;
Know the internal structure of the 8051
Example:
ORG (origin)
indicates the beginning of the instructions. The number
that either hex or decimal.
END
Indicates the end of assembly instructions.
EQU (equate)
used to define a constant without occupying a memory
location. It does not set aside storage for a data item
but associates a constant value with a data label so that
when the label appears in the program. Its constant
value will be substituted for the label.
Eg. COUNT EQU 25H
Define Byte (DB) and Data Types
Used to define 8-bit data and store them in
assigned memory locations. Define data can be in
decimal, binary, hex, or ASCII formats.
ORG 500H
DATA1: DB 28 ;DECIMAL (1C in Hex)
DATA2: DB 00110101B ;BINARY (35 in Hex)
DATA3: DB 39H ;HEX
ORG 510H
DATA4: DB “2591” ; ASCII NUMBERS
ORG 518H
DATA6: DB “My name is Deen” ;ASCII CHARACTERS
Address/ Opcodes Assembly language
Program Pointer
Programming is both a science
and art !!
[ Read chapter 4 from Ayala for revision on basic assembly language concepts.]
Start
Create /edit
Text editor source codes
Assemble
Assembler source codes
Logical Yes
Errors?
No
Stop
Steps to Create a Program
Assembler/Linker
Assembler
Change mnemonic code into machine code
Label can be used to represent symbolic
address/data
Directives : like pre-processing operator (#) in C
language.
Linkage Editor
Link objective code into executable file
(*.obj → *.exe)
List File For Test Program (Assembly)
Opcodes Assembly language
Address/
Program Pointer
Terima Kasih,
Ceria-ceria
Selalu
&
Jumpa
Lagiiiiii!!!