File: data-indirect.S

package info (click to toggle)
kuttypy 2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,896 kB
  • sloc: python: 58,651; javascript: 14,686; xml: 5,767; ansic: 2,716; makefile: 453; asm: 254; sh: 48
file content (21 lines) | stat: -rw-r--r-- 551 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

ddrb = 0x17 
portb = 0x18

.section .data  
var1:

.section .text    ; denotes code section
.global main
main: 	
   LDI R16, 0xff   ; load r16 with 255
   OUT ddrb, R16   ; make all bits of port B as output

   LDI  R17, 0b10101010       ; set r17 to 10101010b
   STS  var1, R17             ; store it to RAM at var1
   LDI  R26, lo8(var1)        ; R26 and R27 forms X, the 16 bit address
   LDI  R27, hi8(var1)        
   LD   R16, X                ; Load R16 from location pointed to by X

   OUT portb, R16             ; display R16 contents
.end