EE 308
Homework #4
Due Feb. 7, 1996
d_10ms: pshx
ldx #(20000/6) ;1 us = 2 cycles => 10 ms = 20,000 cycles
;loop takes 6 cycles, so run loop 20000/6 times
d_10ms_1: dex
bne d_10ms_1
pulx
rts
Write a subroutine called "delay" which will call this routine a number of times equal to what's in the A accumulator. For example, to create a 1 second delay, do the following:
ldaa #100
jsr delay

| PC 7 | PC 5 | Port B Function |
|---|---|---|
| 0 | 0 | Up Counter |
| 0 | 1 | Down Counter |
| 1 | 0 | Flasher |
| 1 | 1 | Turn Signal |