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

Re: 65816 Memory management questions.



In article <32AB7A38.290E@execpc.com>, hal@execpc.com wrote:

>         1) How can the memory be 24 bit when the PC and S registers
> are only 16 bits wide.
[rest snipped]

OK, from the ground up:
* 1 page = chunk of   $100   (256) bytes
* 1 bank = chunk of $10000 (65536) bytes
* addresses with  8 bits are called direct page addresses (zero page on 6502)
  on the 65816 you can place it in the whole bank 0 thanks to the DP register.
* addresses with 16 bits are called absolute addresses
* addresses with 24 bits are called absolute long addresses, consisting of
  the 8 bit bank address and the 16 bit absolute address: $bb/aaaa

the PBR (Program Bank Register) enables you to run programs outside bank 0
(the amount of memory addressable with a 16 bit PC). It is preferable for
the program not to cross a bank boundary though due to PBR increment
peculiarities (please read details in a good 65816 text book like
'Eyes/Lichty, Programming the 65816, Brady/Prentice Hall (1986)').
To address data in the whole address space without using absolute long
addressing all the time you use the DBR (data bank register). To program
in assembler in a traditional manner with data mixed with code you must
synchronize the DBR to the PBR.
So, you see, the banks are not switched. They are always there, but the
bank registers are used that you can code away as if on a 6502 most of the
time.

>         3) where is the stack now? In the 6502/6510 it started at $FFFF and
> the Interupt vectors were at $0000.
Wrong. The stack was from $01FF to $0100 (at least on the 6502), the
interrupt vectors were at $FFFx
On the 65816 the stack can be anywhere in the bank 0 (i.e. $00/0000-00/FFFF)

>         I know there is an easy explanation for all this and I know I'm VERY
> much in error with a lot of my thinking. Could someone strighten me
> out?  
Essentially you should read a thorough 65816 textbook. I can recommend the
'Eyes/Lichty' wholeheartedly. It also deals with 6502 and 65C02. Study it
carefully, you'll need the knowledge to write a functional emulator. Good
luck!

Cheers
--Cody

_____________________________________________________________________
Urs Hochstrasser   ('Cody')    internet: hochstrasse@ubaclu.unibas.ch
Official Computer Wizard (CV) of the Botanical Institute Hebelstrasse
                  University of BASEL (Tel int. 7 23 32)
                webmaster of http://www.unibas.ch/bothebel
_____________________________________________________________________