I'm trying to write a loader for some new hardware I designed but I don't use a Z80 much and I need some help. My program doesn't work correctly, it loads every other byte. I thought I needed a delay in the dumping of the code through the serial port but that isn't it because I tried 500ms and it still skips every other byte.
I know the serial port works because I can do a simple read character, send it back out the serial port and that works without data loss. Here's my code:
LD A,03H ;RESET 6850 PORT
OUT 20 (OCTAL)
LD A,25(OCTAL) ;SET UP PORT 8,1
OUT 20
LD HL,0000H ;LOAD HL REGISTER PAIR WITH 0000 (STARTING ADDRESS)
LOOP:
IN 20 ;READ STATUS REGISTER OF 6850
RRC ;IS THERE DATA TO READ?
JNC LOOP ;LOOP IF CARRY NOT SET
IN 21 ;YES, READ DATA
LD (HL),A ;STORE DATA AT MEMORY LOCATION OF HL
INC L ;INCREASE REGISTER L
JMP LOOP ;CONTINUE THIS LOOP FOREVER UNTIL HARDWARE STOPPED
What is wrong with the code? It should continue to read data, dump it in memory, then increase the memory storage location. Thanks for any help.
Vince
I know the serial port works because I can do a simple read character, send it back out the serial port and that works without data loss. Here's my code:
LD A,03H ;RESET 6850 PORT
OUT 20 (OCTAL)
LD A,25(OCTAL) ;SET UP PORT 8,1
OUT 20
LD HL,0000H ;LOAD HL REGISTER PAIR WITH 0000 (STARTING ADDRESS)
LOOP:
IN 20 ;READ STATUS REGISTER OF 6850
RRC ;IS THERE DATA TO READ?
JNC LOOP ;LOOP IF CARRY NOT SET
IN 21 ;YES, READ DATA
LD (HL),A ;STORE DATA AT MEMORY LOCATION OF HL
INC L ;INCREASE REGISTER L
JMP LOOP ;CONTINUE THIS LOOP FOREVER UNTIL HARDWARE STOPPED
What is wrong with the code? It should continue to read data, dump it in memory, then increase the memory storage location. Thanks for any help.
Vince