SHARE
TWEET

Untitled

a guest Jun 19th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; thats how i understood the instructions
  2. ; after reading a few short avr tutorials
  3. ; hope it helps
  4.  
  5. .include "m64def.inc"
  6.     jmp RESET
  7.  
  8. .dseg
  9. var1: .BYTE 3 ; high byte of the word
  10. var2: .BYTE 2 ; low byte  of the word - i hope thats correct
  11.  
  12.  
  13. .cseg
  14. const: .DB 0xAA, 0xCC, 0xDD
  15.  
  16. reset:
  17.     ldi ZL, low(var1)
  18.     ldi ZH, high(var1)     ; load high byte of address in Z pointer: Z = &var1
  19.     ldi r17, 0xBB          ; r17 = 0xBB
  20.     st Z, r17              ; *Z = 0xBB: var1 = 0xBB
  21.     ldi ZL, low(const<<1)
  22.     ldi ZH, high(const<<1) ; load low byte of address in Z pointer: Z = (&const) + 1: points on 0xCC
  23.     lpm                    ; load r0 = *Z: r0 = 0xCC
  24.     jmp mainloop
  25. .dseg
  26. var3: .BYTE 4
  27. .cseg
  28. .org 0x20
  29. mainloop:
  30.     ldi r20, 0xF0         ; r20 = 0xF0
  31.     ...
  32.  
  33. Symbol    Segment   Value
  34. var1      dseg            ?
  35. var3      dseg            ?
  36. reset     cseg            ?
  37. const     cseg            ?
  38. mainloop  cseg            ?
RAW Paste Data
Top