Zero page allocation
The zero page is a stategic location for 6502 assembly code programers, because it's faster to access (one byte adress are enough to acess the first 256 bytes of memory), and also because some adressing modes are only available in zero page variant.
In order to avoid conflicts between your code, the code generated by the C compiler, and the code into the libraries, you have to be aware of the allocated resources.
The following adresses are used by the C compiler and library, and thus can be overwritten at any times. These declaration are made in the HEADER.S file in the OSDK\LIB folder.
*= $50 ap .dsb 2 fp .dsb 2 sp .dsb 2 tmp0 .dsb 2 tmp1 .dsb 2 tmp2 .dsb 2 tmp3 .dsb 2 tmp4 .dsb 2 tmp5 .dsb 2 tmp6 .dsb 2 tmp7 .dsb 2 op1 .dsb 2 op2 .dsb 2 tmp .dsb 2 reg0 .dsb 2 reg1 .dsb 2 reg2 .dsb 2 reg3 .dsb 2 reg4 .dsb 2 reg5 .dsb 2 reg6 .dsb 2 reg7 .dsb 2
You can use these symbols in your code, but you have to be sure that no library function (or C function) is called between the moment you write a value, and when you use it, because it would have most certainly be overwritten.
No known problem - please signal any issue on the Cross development tools forum.
comments powered by Disqus