kirill_76rus

lab_1_32_with_comments

Apr 17th, 2022
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. .include "m64def.inc"
  2.  
  3. jmp init ;jmp to init procedure
  4. loop: ;chack btn state
  5. sbis pind, 6 ; if btn isn't pressed, then skip next cmd
  6. rcall inc_cnt
  7. jmp loop;
  8.  
  9. init:
  10. ldi r16, low(ramend)
  11. ldi r17, high(ramend)
  12. out spl, r16
  13. out sph, r17
  14. ldi r16, 0x0F
  15. out ddrc, r16
  16. jmp loop
  17.  
  18. inc_cnt:
  19. ldi r20, 0x01 ; load 0x01 for increment value into r31 (used as counter for output)
  20. add r31, r20 ;add ones value with our counter value into r31
  21. andi r31, 0x0F ;get bitmsk for counter
  22. out portc, r31 ;get out value into portc
  23. loop_1: ;check btn for unpressed state
  24. sbic pind, 6;check btn for unpressed stated
  25. ret ;if btn is unpressed, make jmp to the rcall part of code (pc+1)
  26. jmp loop_1 ;if btn is pressed, polling state again
Advertisement
Add Comment
Please, Sign In to add comment