1
            .data
Vdata       .byte 7
Wdata       .word 10,-1
Xdata       .space      2
Ydata       .string "BA", "BY"
Zdata       .word 99h

            .sect "mysect"
Dest        .space      14

mysect is a section i have created assigned to the memory location 0x3400. I have created this space of 14 bytes inside of it. What I want to do is to move all the contents of the address labels declared above (Vdata to Zdata) to the 14 bytes space. Here is what I have tried:

            mov.b   Vdata, Dest
            mov.w   Wdata, Dest
            mov.w   Xdata, Dest
            mov.w   Ydata, Dest
            mov.w   Zdata, Dest

It only however updates the start of the memory location (0x3400).

UPDATE: I have tried other solutions but it does not work. I was wondering if someone had the code on how to perform what I need to do(move all values in the address labels to the space in mysect section).

  • 1
    You used the same store address every time, so that shouldn't be a surprise. Use Dest+1, Dest+3, etc. If MSP430 cares at all about alignment, then do mov.w for all of them without caring about whether the two bytes are from one object or not. (And if `.data` is constant, use mov-immediate instead of a memory-memory copy. Unless that's storing the addresses as immediate?) – Peter Cordes Oct 26 '17 at 12:30
  • 1
    If you read those `mov` instructions, the destination side is always `Dest`. Should sound logical, that it writes the source value every time to the same place. Also you are copying b+w+w+w+w data, which is only 9 bytes (if word is 16 bit, which I guess). The machine code and CPU doesn't see your source, so it has no idea how much data were defined after `Wdata` label, and that it should copy two words instead of one, you have to write code like that. There may be also automatic padding between V and W to make word aligned. Check probably some listing/disassembly to see how `.data` memory look – Ped7g Oct 26 '17 at 12:34
  • And indeed the `.word` directive does align data, so your `.data` segment should look after compilation as (hex bytes): `07 00 0A 00 FF FF 00 00 42 41 42 59 99 00` (14 bytes) – Ped7g Oct 26 '17 at 12:41

0 Answers0