Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; uppgift2.asm
- ;
- ; Created: 2020-02-27 09:39:01
- ; Author : eko15lj1
- ;
- #define STACK_H 0x3E
- #define STACK_L 0x3D
- #define N_ALLOC 5
- #define DDRA 0x01
- #define PINA 0x00
- ; Replace with your application code
- start:
- call stackRoutine
- rjmp start
- stackRoutine:
- ;start of prologue
- push r28
- push r29
- in r28, STACK_L
- in r29, STACK_H
- sbiw Y, N_ALLOC
- out STACK_L, r28
- out STACK_H, r29
- ;end of prologue
- ;start subroutine body
- ldi r24, N_ALLOC
- ldi r25, 252
- loophej:
- in r22, PINA
- and r22, r25
- std Y + 1, r22
- adiw Y, 1
- dec r24
- brne loophej
- ;end subroutine body
- ;star epilog
- in r28, STACK_L
- in r29, STACK_H
- adiw Y, N_ALLOC
- out STACK_L, r28
- out STACK_H, r29
- pop r29
- pop r28
- ;end epilog
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement