* * bled.asm ---- Example program for the Ep2711E9 Rev. C board * (c)2003, EVBplus.com * * Function: It makes PB7 blink * * * PORTB: equ $4 ; portB offset REGBASE equ $1000 stack: equ $FF * org $9000 main: ldx #$7a12 ; load reg. X with the counting value for the ; off cycle ($7A12) ldy #$f424 ; load reg. Y with the counting value on cycle * loop ldaa #$7f ; OFF LOOP: anda PORTB+REGBASE ; A (01111111) is "anded" with the pattern ; currently hold in PORTB. The result is ; put in A. In this way we affect only the ; pin 7 of PORTB. staa PORTB+REGBASE nop ; delay (nop takes 2 cycles) nop nop nop nop nop nop nop dex ; decrement reg. X (3 cycles) bne loop ; branch on not equal to Zero (3 cycles) * ldx #$7A12 ; reload the counter value to reg. X (7A12) * loop2 ldaa #$80 ; ON LOOP: oraa PORTB+REGBASE ; complement bit 7 of PORTB staa PORTB+REGBASE nop ; delay (nop takes 2 cycles) nop nop nop nop nop nop dey ; decrement reg. Y (4 cycles) bne loop2 ; branch on not equal to Z (3 cycles) * ldy #$f424 ;reload the counter value to reg. Y ($f424) * bra loop ;the loop will continue forever org $FFFE ; reset vector fdb main ; start of the program (text) end