Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20562

BASCOM-AVR : Help : REPLY

$
0
0
Hi Mustafa, first of all: Try pushing the "F1" Button inside Bascom! Search for "HW STACK"... out of the Help: HW Stack The Hardware stack is room space in SRAM that is needed by your program. Each time you call a SUB or FUNCTION, or use GOSUB, the processor need to know at which address to return after returning from the call. Also for RETURN Address after Interrupt this is needed by the program. For this purpose, the processor saves this address on the hardware stack. When you use GOSUB label, the microprocessor pushes the return address on the hardware stack and will use 2 Bytes for that. When you use RETURN, the Hardware stack is popped back and the program can continue at the proper address. When you nest GOSUB, CALL or functions, you will use more stack space. Most statements use HW stack because a machine language routine is called. The Hardware Stack is growing top down. The Hardware Stack start at the highest available SRAM Address and therefore is located before Software Stack and/or Frame. SW Stack Software Stack stores the parameter addresses passed to a subroutine and LOCAL variable addresses. So the Software stack stores the addresses of variables where each passed variable and local variable use 2 bytes per respective addresses. When using SUB or FUNCTION there are 3 ways for parameters: · Using BYREF pass a variable by reference with its ADDRESS (so it is pointing to an existing variable which is already in SRAM) · Using BYVAL the value is stored in FRAME (during the SUB is processed) so it is pointing to the address in FRAME. · Using BYLABEL pass the address of a label When nothing is specified the parameter will be passed BYREF. Best regards, Michael

Viewing all articles
Browse latest Browse all 20562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>