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.
I am having some difficulty with using the Keil A51 assembler. My 8051 derivative processor has 256 bytes of internal RAM. I have my code organized with a...
BSEG AT 0 BIT1 DBIT 1 BIT2 DBIT 1 BIT3 DBIT 1 ... ... BIT8 DBIT 1
DSEG AT 021H VAR1: DS 1 VAR2: DS 1 ... ... VARn: DS 1 ; BUF1: DS 32 BUF2: DS 26 BUF4: DS 16 BUF5: DS 16 STACK: DS 16 _RAM_TOP: DS 0
MOV R0, #BUF3 MOV @R0, A
IDATA?
As Andy so succinctly put it, IDATA is the answer. As far as the linker in concerned, IDATA starts where DATA stops and (usually) the stack space goes at the end. IDATA is not restricted to the top 128 bytes; but is, potentially, the entire 256-byte indirectly addressable space.
Of course, if you have xdata then you do get 256 bytes of pdata space that is accessed just as quickly as idata. Given that idata is such a valuable resource (e.g. it is needed for stack space) I would always go for pdata in preference to idata where it is available.
I solved my problem. I guess the biggest difficulty came from trying to use the type of absolute segment declaration I was using. I went to relocatable segments as shown below and let the linker decide where to put things. Now all is better!!
BITS_SEG SEGMENT BIT DATA_SEG SEGMENT DATA BUFF_SEG SEGMENT IDATA CODE_SEG SEGMENT CODE RSEG BITS_SEG BIT1: DBIT 1 BIT2: DBIT 1 BIT3: DBIT 1 ... ... BITn: DBIT 1 ; RSEG DATA_SEG VAR1: DS 1 VAR2: DS 1 ... ... VARn: DS 1 ; RSEG BUFF_SEG BUF1: DS 32 BUF2: DS 26 BUF3: DS 16 ... ... BUFn: DS 16 STACK: DS 16