[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 65816 Memory management questions.
In article <32AB7A38.290E@execpc.com>, Hal <hal@execpc.com> writes:
>
>I'm currently working on a 65816 emulater for the IBM and have run into
>a snag. I did a 6510/6502 emulater a few years ago but the 24 bit memory
>model has left totaly confused. Could anyone help answer these folowing
>questions;
>
> 1) How can the memory be 24 bit when the PC and S registers are
only 16 bits wide. I think it has something to do with the PB register.
>
Actually, GS memory is 8 bits wide. That is, the 65C816 has an 8-bit
Data bus; but registers, such as the Accumulator, X, and Y index
registers, can be 16 bits wide (hence "...816").
The 65C816 uses a 24-bit Address bus.
> 2) The PB register switches banks but to where? How big is the
bank?
>I've seen memory maps where a bank goes from $0000-$FFFF. If that's so
>then that means when you bank in a page of ram, (1 page=1 bank=64K; the
>largest amount of data that could be "seen" with a 16 bit PC and S
>register) you loose the page that your're on, including the stack &
>program data.
>
Yes; a "bank" is 64k. The 8-bit Program Bank reg decides which 64k
bank is being addressed for code accesses-- remember, you have a 24-bit
Address bus.
Usually, a "page" is 256 bytes. The '816 lets your program use any
page in Bank 0 (00/0000 through 00/FFFF) as a Direct Page (like the 6502
"Zero Page"). Placement of the Stack is, similarly, more flexible on the
65C816.
> 3) where is the stack now? In the 6502/6510 it started at $FFFF
and the
>Interupt vectors were at $0000. How can this be in the 65816 with it
>banking memory at 64k a time.
>
The 6502 stack is, usually, at addresses $0100-01FF. ($FFFF?
Probably, you are thinking of the locations of NMI, RESET, and IRQ vectors
on a 6502.) When the 65C816 is in "emulation mode" (i.e., when it 'looks
like a 6502'), the stack is in page 1. In "native mode", a program can
have a stack in some other page in Bank 0.
You can get a 65C816 data sheet from Western Design Center. The GS
hardware reference manual includes a 65C816 data sheet reprint as does the
paperback: 65816/65802 Assembly Language Programming (from Osborne
McGraw-Hill by Michael Fischer).
Rubywand