XDEF Entry XREF __SEG_END_SSTACK Variables: Section VAR_1 dc.b $EC Constants: Section DDR_S equ $24A DDR_T equ $242 PORT_T equ $240 PORT_S equ $248 Code: Section Entry: BSET DDR_S,#$FF ;set all bits of DDR_S (output) BSET DDR_T,#$00 ;clear all bits of DDR_T (input) LDAA #$00 ;all 0's (off) STAA PORT_S ;turn off all LED's LDAA VAR_1 ;read VAR_1 into acc. A ANDA #%11011111 ;clear bit 6 ORAA #%00001000 ;set bit 4 STAA VAR_1 ;store again into VAR_1 CheckOff: LDAB PORT_T ;read the DIP switches into acc. B ANDB #%00000010 ;mask all but switch bit 1 BEQ CheckOff ;check switch bit 1 in a loop (exit this loop if switch 1 is unset) CheckOn: LDAB PORT_T ;read the DIP switches into acc. B ANDB #%00000010 ;mask all but switch bit 1 BNE CheckOn ;check switch bit 1 in a loop (exit this loop if switch 1 is set) LDAB PORT_T BITB #%00000010 BVS OffLoop