Defining variables
MikeS
Posts: 131
I am working my way through Exploring the SX Microcontroller with Assembly and BASIC Programming manual. In Unit 4:Variables and Math (pg45) there is a section on defining variables by reserving space for·them using the ds directive.
············ org······· 8
Myvar···· ds·········1
The text reads:
"The confusing part about this is that the org directive can refer to the data space or the program space, depending on the contnet of the context. In this case, the 8 refers to data memory"
My question is this. Is the 8 a memory location (address #8) in data memory? Is there anything special about the number 8? I see alot of examples· in the manual with org 8.
thanks,
Mike S
············ org······· 8
Myvar···· ds·········1
The text reads:
"The confusing part about this is that the org directive can refer to the data space or the program space, depending on the contnet of the context. In this case, the 8 refers to data memory"
My question is this. Is the 8 a memory location (address #8) in data memory? Is there anything special about the number 8? I see alot of examples· in the manual with org 8.
thanks,
Mike S
Comments
To keep myself straight when writing code I'll write "org $08" for data, and "org $008" for program origin. The result is the same, but if makes it easier for you to see 2 digits = data, 3 digits = program. I picked this up from Gunther's book and it serves as a handy mental notation.
Post Edited (Paul Baker) : 4/1/2005 9:10:30 PM GMT
I appreciate the reply and the link. It answered other questions that I had.
Haven't programmed with assembly since 1985 with the Moto 6800, but its slowly comming back.
Thanks
Mike S.