Would the functions be considered CODE space whereas the others are DATA space since they are either declared before hand or set equal to some value initially?
Yes, but it is a good idea to always declare the variables in the DATA space but you have to initialize or assign values to DATA variables in your code. It is possible for some PICs (but not the PIC10 series) to have variables initialized with the assembler
idata directive when code is assembled and downloaded but this requires an initialization block of code be downloaded with your program and executed each time the PIC is reset. Don't try to go there with your PIC10(L)F320 because data variable initialization is not supported. I would also avoid the linker for this and other small PICs and assemble absolute rather than relocatable code.
Here is a useful factoid: everything the assembler produces will be downloaded to memory locations in CODE space, and the values stored at those locations are NOT subject to change by PIC instructions. I think some of the later PICs DO allow the program to write to CODE space, but don't go there. Self-modifying code is scary and that's why you have a DATA space to store variables in.
Looks like you may have it. The code you just cited works because
dc2 and
dc1 are DATA variables accessible in RAM, anywhere from address 0x00 to 0x7f. But realize that addresses in the range of 0x00 to 0x3f are used by the Special Function Registers so they are not really available for variables. You can access the locations from 0x00 to 0x3f just like any other location in the RAM address range, but some of the bits are read-only, or are always read with a constant value (either 0 or 1) even if you try to write to them, all depending on the Special Function Register involved. So you store your variables in RAM starting at 0x40 and extending to 0x7f inclusive. If required, use program code to initialize variables. There is a snippet of code in the datasheet that shows how to zero-out a range of DATA memory if that is your desire. This advice is of course specific to this particular model PIC10(L)F320. Other PICs may have more RAM available.
When you create symbols in the CODE space and give them names, they will either be DATA symbols or CODE symbols. For example, you could define
TEN equ .10 and then use
TEN to represent the literal value decimal 10, or 0x0a, for use in an instruction with an literal immediate operand like
movlw TEN. However, if you want to move a variable into the accumulator, you must declare it as a variable,
NUMBER for example, whose symbol is an address in the DATA space. Then use
movf NUMBER, 0.
I find this pair of mnemonics confusing because both instructions can result in data being moved into the accumulator, replacing whatever was already there, but movlw TEN explicitly names a literal (constant) value to move into W while movf NUMBER, d allows you to move either the contents at the location NUMBER in DATA space to the accumulator (W) if d=0, or to the register NUMBER itself if d=1, the latter for the purpose of setting or clearing the zero bit in the STATUS word for subsequent testing without affecting the contents of the accumulator or the variable addressed at NUMBER. I guess that can be handy if you are using a variable as a counter and want to see if it overflowed to zero after it was incremented, or if it was decremented to zero.
I know this is a might bit confusing, but that's what happens when you only have 256 words of program memory to work with. Gotta make every bit count.