2

I am working on STM8S microcontroller, and I need to reserve absolute data locations for my variables via using assembly.

So, I try to "LD" instructions but I couldn't.

In PIC assembly I have a part of code like this:

       ORG  0X40    ; origin set
cnt         RES  1  ; 1 byte reserve at 0x040 address
cnt1        RES  1  ; 1 byte reserve at 0x041 address 
test        RES  2  ; 2 byte reserve at 0x042 address
test1       RES  1  ; 1 byte reserve at 0x044 address

This is what I need and I want to do it in STM8S Assembly literally.

mryldz
  • 95
  • 2
  • 9
  • What do you mean "I couldn't" with `LD` instructions? Isn't that a load? – Peter Cordes Oct 11 '17 at 07:47
  • I mean I try related instruction sets like `"LD A,#$55","LD A,$50" ` etc. where "stm8s programming manual". – mryldz Oct 11 '17 at 08:07
  • Loading from an absolute address (or loading a pointer to that absolute address) doesn't imply anything about reserving space at that address. You can do one without the other. – Peter Cordes Oct 11 '17 at 08:18

1 Answers1

0

You can use ds.b or ds.w followed by number of bytes/words to reserve. Example: My_Bytes ds.b 100 This will reserve 100 bytes, and you can access same using the label "My_Bytes".

Dapu
  • 195
  • 1
  • 3
  • 13