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

Re: 65816 coprocessor options..



Supertimer <supertimer@aol.com> wrote:

> phoenyx <quazar@dcnet2000.com> wrote:
> 
> >Pim Blokland wrote:
> >
> >> Processors didn't do that in those days, not even the 8086!
> >
> >The early PC cpu's used 24 bit addressing, it was very close
> >to a bank switch method.

The 8088 and 8086 use 20-bit addressing, not 24-bit.

In addition, it was not bank switching, per se.  With bank switching, an
entire chunk of memory is replaced with a different chunk.  In some
architectures you may retain read-only or write-only access to the
switched out bank (e.g. the IIe's RDRAM and WRRAM switches, and the
language card).

The segment register mechanism used in the 8088/8086 allows a more
gradual transition, since the segment register refers to addresses which
are multiples of 16 bytes (a "paragraph").  You can have overlapping
segments, and still refer to part of memory through a different segment
register, even if you have changed your data segment.  It gives you up
to four 64K windows into a 1 MB address space, with the windows being
aligned on paragraphs.

Personally, I hate this arrangement, since it is rather clumsy to deal
with data structures larger than 64K, and you have several different far
pointer values (segment:offset) which refer to the same memory location.
Dealing with this wastes CPU time (normalising pointers, etc.).

The IIgs doesn't use bank switching either (except in cases where it
emulates the IIe).  It happens to logically organise memory into 64K
banks, and has some bank registers which allow the use of shorter and
more flexible addressing methods, but the address space is treated by
the processor as a single logical 16MB area for data operations.  Data
structures may cross bank boundaries.  (Code is stuck in a 64K bank
unless you use a long jump, call or return, but even this is not "bank
switching".)

On the other hand, a multi-bank RAM card like the RamWorks quite
definitely uses bank switching.  It replaces the entire 64K address
space (except the parts which are switched to main memory) when you
select a bank.  An application which wants to treat this as a single
logical area of memory has to be able to map between memory banks and
logical addresses.  It would be cumbersome to have a data structure
crossing a bank boundary, since the application would need to identify
exactly where the bank ends within the data structure, and do the switch
at the appropriate point.

> ? 24-bit addressing = Apple IIGS & 65C816 ?

Correct.

The 80286 also has a 24-bit address space.  It supports the 8088/8086
behaviour ("real mode") for compatibility, but adds "protected mode", in
which the segment registers now contain a "selector" instead of an
actual memory address.  The selector is a lookup into a segment table
which is usually maintained by the operating system.  Each segment has
protection settings (e.g. read-only) and a length limit (up to 64K).

The '286 is no better off than the 8088/8086 for dealing with data
structures larger than 64K.  Instead of updating your segment register,
you need to load a different selector value.

The 80386 finally made it easy to deal with large data structures.  The
address space of the processor increased to at least 32 bits (4
gigabytes), and register sizes increased accordingly.  Selectors can now
refer to a virtual 4GB address space, and with 32-bit pointers you don't
need to play with selectors all the time.

-- 
David Empson
dempson@actrix.gen.nz
Snail mail: P O Box 27-103, Wellington, New Zealand