I'm having some serial issues, and I'm not quite sure where to go with it.
I've attached two pictures -- one expected output, and one actual output. I've tried changing baud rates and from a WDC 65c51 to a Rockwell 65C51, and both exhibit the same behavior. I don't have another MAX233 to try, but one is on order.
What is really strange is that after the initial patterns, I can type and hold down keys on the keyboard and I get no errors whatsoever. Its almost like it needs a few seconds to get ready...
Pressing the reset button produces the same output. If there were serial errors, I would have expected different output each time.
Has anyone seen something like this before?
EDIT: Forgot to add my code:
Code:
;;
;; Read input from the keyboard, and echo to console.
;;
.PC02
iobase = $C000
iostatus = iobase + 1
iocmd = iobase + 2
ioctrl = iobase + 3
.segment "CODE"
.org $E000
start: sei ; no interrupts
lda #$00
sta iostatus
lda #$0b
sta iocmd ; Set command status
lda #$1e
sta ioctrl ; 9600,8,N,1
;; print ascii codes
test:
ldx #$05
loop: lda #$20
l1: jsr write
clc
adc #1
bpl l1
lda #$0d
jsr write
dex
bne loop
;; Load a character from the keyboard and store it into
;; the accumulator
getkey: lda iostatus ; Read the ACIA status
and #$08 ; Is the rx register empty?
beq getkey ; Yes, wait for it to fill
lda iobase ; Otherwise, read into accumulator
jsr write
jmp getkey
;; Write the current char in the accumulator to the console
write:
;sta iobase ; write to output.
;jsr delay_6551
pha
write1: lda iostatus
and #$10
beq write1
pla
sta iobase
;cmp #$0d
;bne done
;lda #$0a
;sta iobase
;jsr delay_6551
;done:
rts
delay_6551: pha
txa
pha
tya
pha
ldy #2 ; Clock speed in MHz
minidly: ldx #61 ; lessened from 68 for 1.8MHz
delay_1: dex
bne delay_1
dey
bne minidly
pla
tay
pla
tax
pla
rts
; system vectors
.segment "VECTORS"
.org $FFFA
.word start ; NMI vector
.word start ; RESET vector
.word start ; IRQ vector