1

I have started to convert legacy pic assembly code to C. I learn the instruction set of PIC in my case PIC18F2585 but encouter the code phase which make variable definition:

             MAINVAR  UDATA
             Sample1       res  .1      
             Sample2       res  .1      
             SampleCntr    res  .1  

There are two directive: first, UDATA declares the begining of the uninitialized data and second res which reserve memory for a variable, for example sample res 64 allocate 64 byte memory for the sample variable.

The point that i dont understand is: they use the '.' sign in front of the number and there is no any definition for '.1' in the source code file.

At that point my question: Is there any special meaning of the statement Sample1 res .1.

Nazim
  • 406
  • 1
  • 6
  • 20
  • 2
    Are you sure you have the dot in there? Which assembler are you using? If you don't have documentation, can you assemble it and look at a map file, the symbol table or disassembly to see what is output? If all else fails, I'd assume it's just 1 byte allocation. – Jester Mar 11 '20 at 10:39
  • Yes i am sure ı guessed it was a variable so i search it but there is no variable like '.1'. The assembler is mpasm v.5.86, There is not any documentation about them. – Nazim Mar 11 '20 at 10:43
  • 1
    It can't really be a variable because `res` only takes a size to reserve and that is a compile time constant. – Jester Mar 11 '20 at 10:44
  • That sounds logical, i am going to check that – Nazim Mar 11 '20 at 10:47
  • 1
    The [mpasm manual](http://ww1.microchip.com/downloads/en/devicedoc/33014g.pdf) I googled makes no mention of anything with a leading dot. – Jester Mar 11 '20 at 10:47
  • 1
    I'd go with Jester and say it's a 1byte reserve. Try to find the usage in the code, perhaps that helps a bit more – Tommylee2k Mar 11 '20 at 10:59
  • 1
    @Jester There is a link [link](https://books.google.com.tr/books?id=G5jGKbsCNYcC&pg=PA260&lpg=PA260&dq=decimal+statement+in+pic+assembly&source=bl&ots=b6xnaJeOo5&sig=ACfU3U1H9W-aKeLELPWWK-LfW9cLcPGk8g&hl=tr&sa=X&ved=2ahUKEwj3vpvZoZLoAhUQAhAIHYkAA1QQ6AEwAXoECAkQAQ#v=onepage&q=decimal%20statement%20in%20pic%20assembly&f=false. In that situation it is used to state a decimal number. Is it valid for res directive – Nazim Mar 11 '20 at 11:02

1 Answers1

3

The dot means it's a decimal number.

.10  : decimal 10
0x10 : hexadezimal 10 , decimal 16
Mike
  • 4,041
  • 6
  • 20
  • 37