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.
Jon, I tried that example you gave me, and it didn't seem to work. I think there may be problems with the development kit. David
Try 0x0000 to 0xFFFD. The compiler needs a null pointer and a one beyond pointer.
There are 4 memory spaces: Phyical Size Logical Physical Internal RAM: RAM data/idata space = 1024 Bytes 00:FF 0_00:3_FF External ROM: PROGRAM code/xdata(ROM) space = 64/128 kBytes 0000:FFFF 00_0000:1_FFFF External RAM: RAM xdata(RAM) space = 32/128 kBytes 4000:FFFF 00_0000:1_FFFF CGROM xdata(RAM) space = 256 kBytes 4000:FFFF 20_0000:23_FFFF External IO: I/O xdata(I/O) space = 32/128 kBytes 4000:FFFF 00_0000:3F_FFFF //************* //************* //Lets keep thing simple, the only RAM we'll swap are the buffers. //Given: // 128k code, 128k ram, 0 IO, 20k buffers required, memory for the program will fit into data/idata space. //************* //data/idata mapping: // just use 1 bank, program is complicated enough. //************* xdata mapping: 0000:3FFF => Program, 128k = 16 banks of 8k 4000:FFFF => Buffer, 128k = 5 banks of 24k, 1 bank of 8k PAGETYP = 0x15; //Pages A-C are ram //BufId = 0 to 5 #define SETBUFFER(BufId) ( PAGEA = (BufId)*3, PAGEB = (BufId)*3+1, PAGEC = (BufId)*3+21 ) #define BUFFERSIZE = 0xC000; BYTE xdata pBuffer = 0x4000; // No other xdata variables can be used // If you need other xdata variables, you will need to break up the 20k buffers into 16k or 8k chunks.
Hi Jon, Also under the target section i cannot set xdata from 4000-FFFF it complains about it being out of bounds. If i use the BL51 tab i can but there are no options for code banking etc. I don't quite understand what you were trying to do with SETBUFFER in the example. Here is some info on how the creators of the device tend to use it. David ------------------------------------ You would need to set the paging registers manually. Basically, each of the 3 16K segments of the logical address (from 0x4000 to 0xFFFF) can be used to access a corresponding 16K segment of a 128K RAM chip or a 128K ROM chip via the paging method. In most typical applications, what we would suggest is to allocate a fixed section (say page 0) for global variables and the rest to be accessible by paging methods. You would then set one 16K segment, (in our case, we have used C000 to FFFF (Page C)) for xdata and set it to point to page 0 of the RAM chip. Then you might use another 16K segment (say segment B) to access the rest of the RAM chip, using Page 1 to Page 7, since Page 0 is already dedicated to global variables. The last section, segment A can then be used for code banking within the 128K range of the ROM chip. In this case, you would then restrict code banking to the range 0x4000 to 0x7FFF, and tell your compiler to switch banks using this range. In this way, the PAGE_TYPE SFR would be set to: segment C B A 00 01 01 00. where segment C and B is Ram and segment A is Rom. PageC register would be permanently set to 0 for the lowest 16K segment of the RAM chip. PageB would be set in your program to switch between banks 1 to 7. You probably need a memory manager routine to handle this. PageA would be set by your compiler to handle code banking.
Also under the target section i cannot set xdata from 4000-FFFF it complains about it being out of bounds. If i use the BL51 tab i can but there are no options for code banking etc. Note that the second parameter is SIZE and not ENDING address. The size of the XDATA range (from 4000-FFFF) would be 0xC000. Jon