NOTE: This program is going to be executed on an ATmega328P
.equ scrAddr = $100
.equ dstAddr = $110
.equ startAddr = $110
.equ destAddr = $120
.macro LDSW
LDS @0, @2
LDS @1, @2+1
.endmacro
;Store Word - Store Word Immediate
; Usage: STWI addr16, Rt, data16 [addr:addr+1] <- data
.macro STBI ; addr16, Rt, data8
LDI @1, @2
STS @0, @1
.endmacro
.macro STWI
STBI @0, @1, high(@2)
STBI @0+1, @1, low(@2)
.endmacro
; *******************************************************************
; data space variable section
.dseg
.org SRAM_START
srcAddress: .byte 2
numBytes: .byte 1
dstAddress: .byte 2
; *******************************************************************
; interrupt vector table
.cseg
.org 0x0000
jmp main
; *******************************************************************
;Load Word - Load Word from SRAM
; Usage: LDSW [RegH], [RegL], [Addr]
.equ numbytesConst = 5
.org INT_VECTORS_SIZE
main:
STWI srcAddr, R16, startAddr
STWI dstAddr, R16, destAddr
STS numbytesConst, R16
LDI R16, 5
LDS XH, srcAddr
LDS XL, srcAddr+1
LDS YH, dstAddr
LDS YL, dstAddr+1
LDS R5, numbytes
; main
So the objective to a program I am trying to do in assembly code is to run a program that converts hexadecimal contents of a block of RAM to an ASCII format (That part I already took care of in separate functions as I used some logical AND masking) and then store it back into RAM.
I tried running the program and it was not able to read srcAddr as a defined symbol.