Files
Work/as68hc11/code/led.asm
2024-08-07 09:12:07 -04:00

61 lines
1.8 KiB
NASM

RAM equ 0000h
THIS equ 0010h
END equ 0020h
SCSR equ 2Eh
PORTB equ 1004h ; address of PORTB register
org RAM
jmp BEGIN
BEGIN:
ldab 01h ; move 1 into register b
stab [PORTB] ; light b0
ldab 03h ; move 1 into register b
stab [PORTB] ; light b0
bsr DELAY1K
ldab 00h ; move 0 into register b
stab [PORTB] ; turn off bo
bsr DELAY1K
jmp BEGIN
; ldaa [PORTB] ; move contents of PORTB into register a
; ldab [PORTB] ;
rts
DELAY10 equ * ; 10ms delay @ 2.1 mhz
pshy ; save register y
ldy 0BB8h ; load loop counter into y register
DELAY10LOOP equ * ; loop counter sync address
dey ; decrement counter
bne DELAY10LOOP ; loop until zero in y
puly ; restore register y
rts ; return to caller
DELAY1K equ * ; 1000ms delay @ 2.1 mhz
pshy ; save register y
ldy 0Ah ; load 10d into register y
DELAY1KLP equ * ; loop counter sync address
bsr DELAY100 ; call 100 ms delay
dey ; decrement register y
bne DELAY1KLP ; continue
puly ; restore register y
rts ; return to caller
DELAY100 equ * ; 100 ms @ 2.1 mhz
pshx ; save register x
ldx 07530h ; load loop counter into register x
DELAY100LP equ * ; loop counter sync address
dex ; decrement register x
bne DELAY100LP ; continue
pulx ; restore register x
rts ; return to caller