Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; AssemblerApplication1.asm
- ;
- ; Created: 29/03/2017 7:03:02 PM
- ; Author : Comp2121
- ;
- .include "m2560def.inc"
- start:
- .dseg
- array: .byte 4
- .cseg
- string: .db "comp 24121.",0
- ; Assign the parts of the string to the correct data memory locations
- ldi ZL, low(string<<1)
- ldi ZH, high(string<<1)
- ldi YL, low(array)
- ldi YH, high(array)
- ldi r18, 20 ;Settign the Max String size to 20
- loop1: ;Loading the string into program memory
- lpm r16, Z+
- ST Y+, r16
- dec r18
- brne loop1
- ldi YL, low(array) ;Reinitialising the values in the Y Register
- ldi YH, high(array)
- loop2: ;Taking stuff out of program memory and storing it into the stack.
- ld r16, Y ;Load r16 with the first value of the string from PM
- push r16 ;Push the value at r16 into the stack
- ST Y+, r16 ;Interates to the next value at Y
- brne loop2
- .def a = r17
- ldi a ,1 ; Initialize a
- loop3: ;This loop will pop the vlaue into data memory.
- pop a
- inc a ; Increment a
- brne loop3
- end:
- halt:
- rjmp halt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement