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.
The user manual of Cx51 describes that maximum size of reenterant stack in compact memory model is 256 Bytes. While in STARTUP.A51 sets its top to 0xFFFFh which is 64 KBytes. Can any body tell me what is the exact size of the reenterant stack in compact model
The user manual of Cx51 describes that maximum size of reenterant stack in compact memory model is 256 Bytes. While in STARTUP.A51 sets its top to 0xFFFFh which is 64 KBytes. Can any body tell me what is the exact size of the reenterant stack in compact model Well, the COMPACT reentrant stack is stored in PDATA which is accessed usingR0/R1 in the MOVX @R0 and MOVX @R1 instructions. Since R0 and R1 are 8-bit registers, one can infer that the maximum addressed space is 256 bytes. As for the top of the stack, from the STARTUP.A51 file:
; Stack Space for reentrant functions in the COMPACT model. PBPSTACK EQU 0 ; set to 1 if compact reentrant is used. PBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
PBPSTACKTOP EQU 0AAFFH+1
;------------------------------------------------------------------------------ ; ; Page Definition for Using the Compact Model with 64 KByte xdata RAM ; ; The following EQU statements define the xdata page used for pdata ; variables. The EQU PPAGE must conform with the PPAGE control used ; in the linker invocation. ; PPAGEENABLE EQU 1 ; set to 1 if pdata object are used. ; PPAGE EQU 0xAA ; define PPAGE number. ; PPAGE_SFR DATA 0A0H ; SFR that supplies uppermost address byte ; (most 8051 variants use P2 as uppermost address byte) ; ;------------------------------------------------------------------------------