Download presentation
Presentation is loading. Please wait.
Published byLauren Morgan Modified over 8 years ago
1
ASSEMBLY CODE EEE 365 [FALL 2014] LECTURE 24 ATANU K SAHA BRAC UNIVERSITY
2
EEE 365 : MICROPROCESSOR ATANU K SAHA 2 ASSEMBLY CODE BRAC UNIVERSITY DATA SEGMENT ; data variables are initialized here DATA ENDS EXTRA SEGMENT ; EXTRA ENDS STACK SEGMENT ; stack contents are initialized here STACK ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA, ES:EXTRA, SS:STACK START: ; codes are written here CODE ENDS ENDSTART BASIC CODE FLOW Within the code we have to initialize the followings 1.Data Segment 2.Stack Segment 3.Extra Segment 4.Stack Pointer 5.8255 PPI 6.8259 PIC 7.8254 timer 8.8251 Serial interface 9.Initialize Data variables 10.Set Interrupt enable flag
3
EEE 365 : MICROPROCESSOR ATANU K SAHA 3 ASSEMBLY CODE BRAC UNIVERSITY DATA SEGMENT PPDW0220H QQDW 0015H RRDW2 DUP(0) DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA, ES:EXTRA, SS:STACK START: MOVAX, DATA MOVDS,AX MOVAX, PP MULQQ MOV RRAX MOV RR+2,DX INT 3 CODE ENDS ENDSTART Example:1 SIMPLE MULTIPLICATION RR = PP X QQ
4
EEE 365 : MICROPROCESSOR ATANU K SAHA 4 ASSEMBLY CODE BRAC UNIVERSITY IVTSEGMENT TYPE_64DW2 DUP(0) TYPE_65DW2 DUP(0) IVTENDS DATA SEGMENT FINALCDW0000 H DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:IVT START:MOVAX, IVT MOVDS,AX MOVTYPE_64+2,SEG UPC MOVTYPE_64,OFFSET UPC MOVTYPE_65+2,SEG DWC MOVTYPE_65,OFFSET DWC ASSUME DS:DATA MOVAX, DATA MOVDS,AX MOVAL,00010011B MOVDX,FF00H OUTDX,AL;ICW1 MOVAL,01000000B MOVDX,FF02H OUTDX,AL;ICW2 Example2: Suppose the INTR pin of an 8086 microprocessor is connected with an 8259 PIC’s INT pin. The 8259 can take Type-64 and Type-65 interrupt in its IR0 and IR1 pin respectively which are positive edge sensitive. The 8086 up count a value in its memory location if Type-64 interrupt occurs and down count if Type-65 occurs. The 8259 PIC is connected at FF00 H as a port device. MOVAL,00000001B OUTDX,AL;ICW4 MOVAL,11111100B OUTDX,AL ;OCW1 HERE:JMPHERE UPC PROC INCFINALC MOVAL,00100000B MOVDX,FF00H OUTDX,AL;OCW2 IRET UPCENDP DWC PROC DECFINALC MOVAL,00100000B MOVDX,FF00H OUTDX,AL;OCW2 IRET DWCENDP CODE ENDS END START Assembly code
5
EEE 365 : MICROPROCESSOR ATANU K SAHA 5 ASSEMBLY CODE BRAC UNIVERSITY Example2: (Continue…) Suppose the INTR pin of an 8086 microprocessor is connected with an 8259 PIC’s INT pin. The 8059 can take Type-64 and Type-65 interrupt in its IR0 and IR1 pin respectively which are positive edge sensitive. The 8086 up count a value in its memory location if Type-64 interrupt occurs and down count if Type-65 occurs. The 8259 PIC is connected at FF00 H as a port device. Circuit connection
6
EEE 365 : MICROPROCESSOR ATANU K SAHA 6 ASSEMBLY CODE0 BRAC UNIVERSITY Example3: Suppose an 8086 is connected with a 8255A PPI. Port A is connected with four 7-segment display’s common anode pin. Port C is connected with the input of a 74LS47 binary to 7-seg decoder. The output of the decoder is connected with the input of the 7-segment displays. Now write an assembly code which display 1, 2, 3, 4 in the 7-segment displays. The 8255 PPI is connected at FF00 H as a port device. Circuit connection
7
EEE 365 : MICROPROCESSOR ATANU K SAHA 7 ASSEMBLY CODE BRAC UNIVERSITY Example3: (Continue…) Suppose an 8086 is connected with a 8255A PPI. Port A is connected with four 7-segment display’s common anode pin. Port C is connected with the input of a 74LS47 binary to 7-seg decoder. The output of the decoder is connected with the input of the 7-segment displays. Now write an assembly code which display 0, 1, 2, 3 in the 7-segment displays. The 8255 PPI is connected at FF00 H as a port device. Turn off all SSD Send data for Digit 1 Turn on SSD1 Wait for some time Turn off all SSD Send data for Digit 2 Turn on SSD2 Wait for some time Turn off all SSD Send data for Digit 3 Turn on SSD3 Wait for some time Turn off all SSD Send data for Digit 4 Turn on SSD4 Wait for some time Algorithm
8
EEE 365 : MICROPROCESSOR ATANU K SAHA 8 ASSEMBLY CODE BRAC UNIVERSITY Example3: (Continue…) Suppose an 8086 is connected with a 8255A PPI. Port A is connected with four 7-segment display’s common anode pin. Port C is connected with the input of a 74LS47 binary to 7-seg decoder. The output of the decoder is connected with the input of the 7-segment displays. Now write an assembly code which display 0, 1, 2, 3 in the 7-segment displays. The 8255 PPI is connected at FF00 H as a port device. PORTAEQUFF00H PORTBEQUFF02H PORTCEQUFF04H PORTCWEQUFF06H DATA SEGMENT DEC0DB00H DEC1DB01H DEC2DB02H DEC3DB03H DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA MOVAX,DATA MOVDS,AX MOVAL, 1000000B OUTPORTCW,AL L1:OUTPORTB, DEC0 OUTPORTA,00000001B CALLDELAY OUTPORTA,00000000B OUTPORTB, DEC1 OUTPORTA,00000010B CALLDELAY OUTPORTA,00000000B OUTPORTB, DEC2 OUTPORTA,00000100B CALL DELAY OUTPORTA,00000000B OUTPORTB, DEC3 OUTPORTA,00001000B CALLDELAY OUTPORTA,00000000B JMP L1 DELAY:MOVCX,FFFFH; AGAIN:NOP NOP LOOPAGAIN RET CODE ENDS END Assembly code
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.