Hi all.
I've written the following programming:
Basically, it grabs each of the digits in "number", matches it with the 5-bit binary pattern in hexpat and outputs the bits to 5 LEDs. It's supposed to keep repeating until it hits the "#", which is the EOD marker. But for some reason, it grabs the first digit every time and just sits there displaying a 0 over and over again (which is represented by 00110 on the LEDs). I followed the same method used in an experiment we did in class to grab each byte out of the string, and it worked fine then, but now it doesn't. What have I done wrong?
Any help is appreciated.
I've written the following programming:
Rich (BB code):
prb equ $1004 Peripheral Port B
ddrb equ $1006 Data direction register B
org $0000
hexpat fcb %00110 Barcode pattern 0
fcb %10001 Barcode pattern 1
fcb %01001 Barcode pattern 2
fcb %11000 Barcode pattern 3
fcb %00101 Barcode pattern 4
fcb %10100 Barcode pattern 5
fcb %01100 Barcode pattern 6
fcb %00011 Barcode pattern 7
fcb %10010 Barcode pattern 8
fcb %01010 Barcode pattern 9
NUMBER fcc '7348284923920#' student number with EOD marker
EOD equ $23
org $00a0
start jsr INITIALISE Goto the INITIALISE sub-routine.
ldy #number Point index register Y to the first digit of the number.
jsr GETBYTE
HALT clra
staa prb Turn off LEDs.
jmp HALT Halt.
INITIALISE clra
ldaa $1F Store 00011111 to AccA
staa ddrb Sets pins 0-4 on Data Direction Register B to High (Output)
rts Return to main program
GETBYTE ldab 0.y Put the first digit into Acc B.
clra
staa prb
cmpb #EOD Compare with the EOD marker.
beq HALT If this is the EOD, goto HALT.
ldx #hexpat Load hexpat to Index Reg X.
abx Add the offset to index register X (add AccB to Index Reg X)
ldaa 0,x Get the barcode pattern into AccA
staa prb Output to the LEDs
iny Increment Index Register Y to point to the next digit.
bra GETBYTE Keep repeating until EOD marker is reached.
Any help is appreciated.