[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Direct Page and Stack Pointer Question



    65816 microprocessor allows to relocate Direct Page and Stack Pointer to 
any 64K in bank zero.  The problem is that instructions have only two bytes 
to use Direct Page.
    For example, Direct Page is at $2000.  You use LDA $00 to LDA $FF that 
it can only read data from $2000 to $20FF.  How can you overcome the 256 
bytes limit?  There is no instruction to use LDA $100 or higher.  The only 
way is to use LDX $100 and then LDA $00,X before it can access $2100 or 
higher.  Remember -- it is always native mode.
    It is not safe to keep code segment to $2000.  It should be moved to any 
absolute address like $4000.  It may cause to change JMP instruction and 
ohter instructions because they do not have offset unlike Direct Page and 
Stack Pointer which they have offsets.
    Try to think that LDA $2000 is always located at absolute address: 
$2000.  If code segment is at $1000 that it may be moved to $2000.  LDA 
$2000 can be still pointed to absolute address: $3000 with the code segment 
offset so LDA $2000 is not necessary to be modified into LDA $3000.
    It is sad that 65xx processors do not have code segment offset.  Please 
suggest what you think.  If you consider to develop 32 Bits on 65xx 
processors, it would be nice for Direct Page and Stack Pointer to use 32 
Bits so they do not have to stay on bank zero anymore.  They can be 
relocated outside of 64K in bank zero.

Bryan Parkoff