SHARE
TWEET

Untitled

a guest Feb 27th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; uppgift2.asm
  3. ;
  4. ; Created: 2020-02-27 09:39:01
  5. ; Author : eko15lj1
  6. ;
  7.  
  8. #define STACK_H 0x3E
  9. #define STACK_L 0x3D
  10. #define N_ALLOC 5
  11. #define DDRA 0x01
  12. #define PINA 0x00
  13.  
  14. ; Replace with your application code
  15. start:
  16.     call stackRoutine
  17.     rjmp start
  18.  
  19. stackRoutine:
  20.     ;start of prologue
  21.     push r28
  22.     push r29
  23.     in r28, STACK_L
  24.     in r29, STACK_H
  25.     sbiw Y, N_ALLOC
  26.     out STACK_L, r28
  27.     out STACK_H, r29
  28.     ;end of prologue
  29.  
  30.     ;start subroutine body
  31.     ldi r24, N_ALLOC
  32.     ldi r25, 252
  33.     loophej:
  34.         in r22, PINA
  35.         and r22, r25
  36.         std Y + 1, r22
  37.         adiw Y, 1
  38.         dec r24
  39.     brne loophej
  40.     ;end subroutine body
  41.  
  42.     ;star epilog
  43.     in r28, STACK_L
  44.     in r29, STACK_H
  45.     adiw Y, N_ALLOC
  46.     out STACK_L, r28
  47.     out STACK_H, r29
  48.     pop r29
  49.     pop r28
  50.     ;end epilog
  51.  
  52.     ret
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top