We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
In start.a51, there is defined a idata segment ?STACK.
?STACK SEGMENT IDATA
Now, in my asm file, I want to use the ?STACK to reset the SP,when using it directly as follows,
mov SP, #STACK-1
but there is an error: "error A45: UNDEFINED SYMBOL"
How can I do it, thanks.
How could you make "Stack" public/extern, pls tell it in detail
In the module that has the stack segment just include the line:
Public Stack
And in the module that needs to reference the stack segment do (as you have correctly done):
Extrn Idata (Stack)
Also, I notice your code snippet of:
mov R0, #Stack;
If you want to initialise the stack to the base of the block, you would normally use:
mov R0, #Stack-1
Because the stack pointer (on the 8051) increments before storing the data byte; sometimes referred to as a pre-increment style stack.