Hi All, I have this following example program,Here in this code when I simulate,The stack gets initialised to 0x69.
PROG SEGMENT CODE CONST SEGMENT CODE VAR1 SEGMENT DATA BITVAR SEGMENT BIT STACK SEGMENT IDATA RSEG STACK DS 10H ; 16 Bytes Stack CSEG AT 0 USING 0 ; Register-Bank 0 ; Execution starts at address 0 on power-up. JMP START RSEG PROG ; first set Stack Pointer START: MOV SP,#STACK-1 . . .
main_prg segment code main_stack segment idata main_bit segment bit main_var segment data rseg main_stack ds 10h ;reserve 16 bytes of RAM for the stack cseg at 0 using 0 jmp start rseg main_prg start: MOV SP,#main_stack-1
It is DANGEROUS to specify the stack at an absolute address. Put ALL data storage in one segment as follows org 030h var1 ds n define var2 var1+n ... define stack varnnn+n and your stack will be 1) at the end of used (i)data and thus as large as possible. Erik PS if you do it in C that is how it happens.