1
0

5_1_1b.txt 993 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. XDEF Entry
  2. XREF __SEG_END_SSTACK
  3. Variables: Section
  4. VAR_1 dc.b $EC
  5. Constants: Section
  6. DDR_S equ $24A
  7. DDR_T equ $242
  8. PORT_T equ $240
  9. PORT_S equ $248
  10. Code: Section
  11. Entry:
  12. BSET DDR_S,#$FF ;set all bits of DDR_S (output)
  13. BSET DDR_T,#$00 ;clear all bits of DDR_T (input)
  14. LDAA #$00 ;all 0's (off)
  15. STAA PORT_S ;turn off all LED's
  16. LDAA VAR_1 ;read VAR_1 into acc. A
  17. ANDA #%11011111 ;clear bit 6
  18. ORAA #%00001000 ;set bit 4
  19. STAA VAR_1 ;store again into VAR_1
  20. CheckOff:
  21. LDAB PORT_T ;read the DIP switches into acc. B
  22. ANDB #%00000010 ;mask all but switch bit 1
  23. BEQ CheckOff ;check switch bit 1 in a loop (exit this loop if switch 1 is unset)
  24. CheckOn:
  25. LDAB PORT_T ;read the DIP switches into acc. B
  26. ANDB #%00000010 ;mask all but switch bit 1
  27. BNE CheckOn ;check switch bit 1 in a loop (exit this loop if switch 1 is set)
  28. LDAB PORT_T
  29. BITB #%00000010
  30. BVS OffLoop