Download presentation
Presentation is loading. Please wait.
1
Assembly Language (continue)
6/1/2018
2
Assembly Language Format
Label Opcode Operand Comment Start : LXI SP,3FF0H ;Initialize stack pointer Delimiter Placement Colon After label Space Between an opcode and an operan Comma Between two operand Semicolon Before beginning of a comment 6/1/2018
3
Assembler Directive Assembler Example Description Directive
ORG (Origin) ORG 2000H The next block of instructions should store in memory starting at 2000H END END End of assembly EQU PORTA: EQU 80H The value of term PORTA is equal to 80H DFB (define byte) DATA: DFB 10H,30H Initializes an area byte by byte DFW (define Word) DATA: DFW 2020H Initializes an area two byte at time DFS (define Storage) DATA: DFS 10 Reserves a specified number of memory 6/1/2018
4
Flowchart : Program Assembly & Execution
Write /Edit Source Program Assemble Source File Errors? Generate Hex / List File Download Hex File into Target System & Execute Program Expected Result? Troubleshot/Debug Go Back to Edit Errors Start End Yes No Yes No 6/1/2018
5
Example (Sample Source Code)
CPU “8085.TBL” ORG 2000H NUM1: EQU 55H NUM2: EQU 78H LXI SP, 3FF0H ;Initialize Stack pointer MVI A, NUM1 ;load first number MOV B,A ;save it to B register MVI A, NUM2 ;load second number ADD B ;add register A & B STA RESULT ;store to 2050H RST 1 ORG 2050H RESULT: DFS 1 ;reserve 1 byte location in END ;memory (Note: write your source code using any text editor) 6/1/2018
6
Manual assembly *Please Refer to 8085 Assembly Code Summary
FLAGS _ INSTRUCT LOGICAL OP-CODE BYTE T-STATE S Z P CY AC MOV B,A (B)(A) LXI SP, data16 (SP) (byte 3) (SP) (byte 2) 6/1/2018
7
Manual assembly Address (Hex) Program Code Machine Code (Hex) 2000
LXI SP, 3FF0H 31 F0 3F 2003 MVI A, NUM1 3E 55 2005 MOV B,A 47 2006 MVI A, NUM2 3E 78 2008 ADD B 80 2009 STA RESULT 200C RST 1 CF 6/1/2018
8
Exercise CPU “8085.TBL” ORG 2000H PORTA: EQU 80H
LXI SP, 3FF0H ;Initialize Stack pointer XRA A LOOP: CMA OUT PORTA CALL DELAY JMP LOOP DELAY: MVI B, 255 LOOP1: DCR B JNZ LOOP1 RET END 6/1/2018
9
Manual assembly Address (Hex) Program Code Machine Code (Hex)
LXI SP, 3FF0H XRA A CMA OUT PORTA CALL DELAY JMP LOOP MVI B, 255 DCR B JNZ LOOP1 RET 6/1/2018
10
Assembler The Assembler is a program that translates source code or mnemonics into the binary code (machine code). In addition to translating mnemonics, the Assembler performs various functions, such as error checking and memory allocations. 6/1/2018
11
Source File (Example.ASM) Assembler (Translator) HEX File Listing File
(Example.HEX) Listing File (Example.LST) Assembler (Translator) Source File (Example.ASM) 6/1/2018
12
Example of Listing File
CPU "8085.TBL" ORG 2000H = NUM1: EQU 55H = NUM2: EQU 78H F03F LXI SP, 3FF0H ;Initialize Stack pointer E MVI A, NUM1 ;load first number MOV B,A ;save it to B register E MVI A, NUM2 ;load second number ADD B ;add register A & B STA RESULT ;store to 2050H 0200C CF RST 1 ORG 2050H RESULT: DFS 1 ;reserve 1 byte location in END ;memory NUM1 NUM2 RESULT 6/1/2018
13
Data Byte (Program Code)
Example of Hex File : FC :0D F03F3E55473E CFF2 : FF Byte Count Record Type Data Byte (Program Code) Checksum Address 6/1/2018
14
The number of data bytes in the record Address
Byte Count The number of data bytes in the record Address Address of the first data byte in the record. Address in End of File record is 0000 Record Type The record type for a data record is 00. The record type for an End of File record is 01 Data Byte Data byte in HEX ASCII. Two character per byte. Checksum Two’s complement byte of binary sum of preceding byte in record; Including byte count, address and data byte 6/1/2018
15
Testing & Debugging Download Hex File into Target System & Execute Program 8085 Development System is communicated with PC through serial port (RS232). 8085 Development Board PC RS232 6/1/2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.