Last active
June 30, 2018 06:44
-
-
Save kuninet/abd1fa5e61c254e468af27a83d2f5531 to your computer and use it in GitHub Desktop.
Z80 LED BLINK(8255-PPI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; PPI LED BLINK FOR Z80 ASM | |
; | |
; | |
PPI_IO EQU 000H | |
; | |
ORG 8000H | |
; | |
MAIN: | |
LD HL,M_MSGE1 | |
RST 20H | |
CALL MAIN1 | |
; | |
RST 08H ; PGM END | |
; | |
MAIN1: | |
LD HL,5 ; LOOP COUNT SET | |
LD A,080h | |
OUT (PPI_IO+3),A ; PPI INIT | |
LOOP: | |
LD A,0FEh | |
CALL OUT_PPI | |
LD A,0FDh | |
CALL OUT_PPI | |
LD A,0FBh | |
CALL OUT_PPI | |
LD A,0F7h | |
CALL OUT_PPI | |
LD A,0EFh | |
CALL OUT_PPI | |
LD A,0DFh | |
CALL OUT_PPI | |
LD A,0BFh | |
CALL OUT_PPI | |
LD A,07Fh | |
CALL OUT_PPI | |
; | |
DEC HL | |
LD A,L | |
OR H | |
JP Z,END_RTN | |
; | |
NEXT: | |
JP LOOP | |
; | |
END_RTN: | |
LD A,000h | |
CALL OUT_PPI | |
LD A,0FFh | |
CALL OUT_PPI | |
LD A,000h | |
CALL OUT_PPI | |
LD A,0FFh | |
CALL OUT_PPI | |
RET ; GOTO MAIN | |
; | |
OUT_PPI: | |
OUT (PPI_IO),A | |
CALL WAIT1 | |
RET | |
; | |
WAIT1: | |
LD DE,1000 | |
CALL WAIT | |
RET | |
; | |
WAIT: | |
CALL WAIT1MS | |
DEC DE | |
LD A,D | |
OR E | |
JR NZ,WAIT | |
RET | |
; | |
WAIT1MS: | |
LD BC,50 | |
WAIT1MSLOOP: | |
DEC BC | |
NOP ;DUMMY (clock 4) | |
NOP ;DUMMY (clock 4) | |
LD A,C | |
OR B | |
JR NZ,WAIT1MSLOOP | |
RET | |
; | |
CR EQU 0DH | |
LF EQU 0AH | |
; | |
M_MSGE1 DB "*** i8255 LED BLINK ***",CR,0 | |
; | |
END | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment