; Nip over to asm80.com
; Create a New file called PROMPROG and select the Zilog Z80 CPU.
; Copy and paste the contents of this text into the newly created file.
; Save the file.
; COMPILE the file [sic]. Really assemble the file.
; This produces a listing file and a HEX file.
; You can download the resulting HEX file and send it to your EPROM programmer.
; There is also an option to Download as a BIN file.
ORG $0000
START:
; Input from all of the I/O ports from $00 to $3F.
LD B,64 ; Number of I/O ports to input from.
LD C,0 ; Starting I/O port number.
LP1:
IN A,(C) ; Perform a port read from the I/O port in register 'C'.
INC C ; Move on to the next I/O port.
DJNZ LP1 ; Loop until all the I/O ports have been read.
; Output to all of the I/O ports from $10 to $17.
LD B,8 ; Number of I/O ports to output to.
LD C,$10 ; Starting I/O port number = display driver.
LD A,0 ; Initial value to output.
LP2:
OUT (C),A ; Perform a port write to the I/O port in register 'C'.
INC C ; Move on to the next I/O port.
INC A ; Increment the value to output to the specified I/O port.
DJNZ LP2 ; Loop until all I/O ports have been written.
JR START ; Keep repeating forever.
; The end.
END