| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- XDEF Entry
- XREF __SEG_END_SSTACK
- Variables: Section
- Constants: Section
- SEQUENCE_1 dc.b $81,$42,$24,$18,$24,$42,$42,$00
- SEQUENCE_2 dc.b $80,$40,$20,$10,$08,$04,$01,$01,$00
- DDR_S equ $24A
- DDR_T equ
- PORT_S equ $248
- PORT_T equ $240
- Code: Section
- Entry:
- LDAA #$FF ;load all 1’s to acc. A
- STAA DDR_S ;set all 1’s from acc. to Port S DDR (all outputs)
- LDAA #$00 ;8-bit all 0’s in acc. A
- STAA DDR_T ;set all 0’s for Port T DDR (all inputs)
- ;use register X to point to the index of SEQUENCE_1
- ;use register Y to point to the index of SEQUENCE_2
- ;use acc. A to output the LED’s at Port S
- ;use acc. B to read the DIP switch at Port T
- Loop1: ;loop for SEQUENCE_1
- LDX #SEQUENCE_1 ;load the address of the 1st seq. value to reg. X
- LDAA 1,X+ ;load the value at address X to acc. A, increment X
- STAA PORT_S ;output the value of acc. A to PORT_S
- LDAB PORT_T ;load the DIP switches to acc. B
- CMPB #$00 ;check if the DIP switches are all off
- BNE Loop2 ;branch to Loop2 if a switch is on
- CMPA #$00 ;check if we are at the end of the array
- BEQ Loop1 ;loop if we are at the last array value
- Loop2: ;loop for SEQUENCE_2
- LDY #SEQUENCE_2 ;load the address of the 2nd seq. value to reg. Y
- LDAA 1,Y+ ;load the value at address Y to acc. A
- STAA PORT_S ;output acc. A to Port S
- LDAB PORT_T ;load the DIP switches to acc. B
- CMPB #$00 ;check if the DIP switches are all off
- BEQ Loop1 ;branch to Loop1 if all switches are off
- CMPA #$00 ;check if we are at the end of the array
- BEQ Loop2 ;continue from the beginning of SEQUENCE_2
|