5_1_1a.txt 828 B

1234567891011121314151617181920212223242526272829303132
  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. CheckDIP:
  21. LDAB PORT_T ;read the DIP switches into acc. B
  22. ANDB #%00000001 ;mask all but switch bit 0
  23. BEQ CheckDIP ;check switches in a loop (exit loop if switch bit 0 is set)
  24. LDAA VAR_1 ;read VAR_1 back into acc. A
  25. STAA PORT_S ;write acc. A (set to VAR_1) to LED's