Presentation is loading. Please wait.

Presentation is loading. Please wait.

2/22/20161 Assembly Language (continue). 2/22/20162 Assembly Language Format LabelOpcodeOperandComment Start:LXISP,3FF0H;Initialize stack pointer DelimiterPlacement.

Similar presentations


Presentation on theme: "2/22/20161 Assembly Language (continue). 2/22/20162 Assembly Language Format LabelOpcodeOperandComment Start:LXISP,3FF0H;Initialize stack pointer DelimiterPlacement."— Presentation transcript:

1 2/22/20161 Assembly Language (continue)

2 2/22/20162 Assembly Language Format LabelOpcodeOperandComment Start:LXISP,3FF0H;Initialize stack pointer DelimiterPlacement ColonAfter label SpaceBetween an opcode and an operan CommaBetween two operand SemicolonBefore beginning of a comment

3 2/22/20163 Assembler Directive Assembler ExampleDescription Directive ORG (Origin)ORG 2000HThe next block of instructions should store in memory starting at 2000H ENDENDEnd of assembly EQUPORTA: EQU 80HThe value of term PORTA is equal to 80H DFB (define byte)DATA: DFB 10H,30HInitializes an area byte by byte DFW (define Word)DATA: DFW 2020HInitializes an area two byte at time DFS (define Storage)DATA: DFS 10Reserves a specified number of memory

4 2/22/20164 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

5 2/22/20165 Example (Sample Source Code) CPU “8085.TBL” ORG 2000H NUM1:EQU55H NUM2:EQU78H 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:DFS1;reserve 1 byte location in END;memory (Note: write your source code using any text editor)

6 2/22/20166 Manual assembly *Please Refer to 8085 Assembly Code Summary 8085 Assembly Codes FLAGS _ INSTRUCT LOGICAL OP-CODE BYTE T-STATE S Z P CY AC MOV B,A (B)  (A) 47 1 4 LXI SP, data16 (SP)  (byte 3) 31 3 10 (SP)  (byte 2)

7 2/22/20167 Manual assembly Address (Hex)Program CodeMachine Code (Hex) 2000LXI SP, 3FF0H31 F0 3F 2003MVI A, NUM13E 55 2005MOV B,A47 2006MVI A, NUM23E 78 2008ADD B80 2009STA RESULT32 50 20 200CRST 1CF

8 2/22/20168 Exercise CPU “8085.TBL” ORG 2000H PORTA:EQU80H 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

9 2/22/20169 Manual assembly Address (Hex)Program CodeMachine Code (Hex) LXI SP, 3FF0H XRA A CMA OUT PORTA CALL DELAY JMP LOOP MVI B, 255 DCR B JNZ LOOP1 RET

10 2/22/201610 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.

11 2/22/201611 HEX File (Example.HEX) Listing File (Example.LST) Assembler (Translator) Source File (Example.ASM)

12 2/22/201612 Example of Listing File 00000 CPU "8085.TBL" 02000 ORG 2000H 00000055 = NUM1:EQU55H 00000078 = NUM2:EQU78H 02000 31F03F LXI SP, 3FF0H;Initialize Stack pointer 02003 3E55 MVI A, NUM1;load first number 02005 47 MOV B,A;save it to B register 02006 3E78 MVI A, NUM2;load second number 02008 80 ADD B;add register A & B 02009 325020 STA RESULT;store to 2050H 0200C CF RST 1 02050 ORG 2050H 02050 RESULT:DFS1;reserve 1 byte location in 00000 END;memory 00000055 NUM1 00000078 NUM2 00002050 RESULT

13 2/22/201613 Example of Hex File :020000020000FC :0D20000031F03F3E55473E7880325020CFF2 :00000001FF :0D20000031F03F3E55473E7880325020CFF2 Byte Count Checksum Data Byte (Program Code) Record Type Address

14 2/22/201614 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

15 2/22/201615 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


Download ppt "2/22/20161 Assembly Language (continue). 2/22/20162 Assembly Language Format LabelOpcodeOperandComment Start:LXISP,3FF0H;Initialize stack pointer DelimiterPlacement."

Similar presentations


Ads by Google