Wednesday, February 20, 2008
programming tat crack my head
ORG $0100
PORTB: EQU $1004
PORTC: EQU $1003
DDRC: EQU $1007
******************************************
ldaa #$EB
staa DDRC
readSW: ldaa PORTC
start1: ldaa PORTC ;load from portc
anda #$14 ;mask the switch
cmpa #$10 ;check switch 1
bne start2 ;not activated
starta ldx #digitsa ;activated load the data
loop1 ldaa $00,x
beq start1
staa PORTB ;o/p tp portb
ldy #$FFFF ;delay
delay1 dey
bne delay1 ;delay
inx
bra loop1 ;else countinue
start2: ldaa PORTC ;load from portc
anda #$14 ;mask the switch
cmpa #$04 ;check switch 2
bne start3 ;not activated
startb ldx #digitsb ;activated load the data
loop2 ldaa $00,x
beq start1
staa PORTB ;o/p tp portb
ldy #$FFFF ;delay
delay2 dey
bne delay2 ;delay
inx
bra loop2 ;else countinue
start3: ldaa PORTC ;load from portc
anda #$14 ;mask the switch
cmpa #$14 ;check switch 3
bne checkAgain ;not activated
startc ldx #digitsc ;activated load the data
loop3 ldaa $00,x
beq start1
staa PORTB ;o/p tp portb
ldy #$FFFF ;delay
delay3 dey
bne delay3 ;delay
inx
bra loop3 ;else countinue
checkAgain:
jmp readSW ;repeat
end
digitsa
fcb $40
fcb $42
fcb $44
fcb $46
fcb $48
fcb $00
digitsb
fcb $B1
fcb $B3
fcb $B5
fcb $B7
fcb $B9
fcb $00
digitsc
fcb $40
fcb $B1
fcb $41
fcb $B0
fcb $00
END
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment