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

Re: IIgs...long delay and monitor glitches



Labelas Enoreth <labelas@hotmail.com> wrote:

> In article <1dlncjf.p0912tvhko97N@dempson.actrix.gen.nz>,
> dempson@actrix.gen.nz (David Empson) wrote:
> 
> > Labelas Enoreth <labelas@hotmail.com> wrote:
> > 
> > > Someone wrote: (Was it Supertimer?)
> > > > In general, the ROM 3 is the better unit.  It has more standard
> > > > motherboard memory (1MB), saves a slot when doing AppleTalk,
> > > > has built in "Easy Access" tools so that you can run the computer
> > > > without a mouse for example, has less noisy sound output, and
> > > > a couple of other things I can't recall right now.  The quickdraw
> > > > on the ROM 3 is supposed to be a bit faster.
> > 
> ...
> > - Hardware shadowing for text page 2, so "Alternate Display Mode"
> > doesn't slow the computer down.
> This is something I've been wondering, what exactly does Alt Display mode do?
> I've been leaving it off...

If you haven't noticed any problems, then you don't need to use it.

Alternate Display Mode is required if you use any software that displays
anything on text page 2 (or low resolution graphics page 2).  This is
extremely rare.  I used it in one of my programs for a help screen, and
I've seen it in a couple of games.

The full explanation is a little complicated, but here goes:

For each of the video display modes of the 8-bit Apple II (text, lo-res,
hi-res) and the "double" versions (IIe and later), there are two display
pages.  99.9% of software that displays text uses text page 1, since
there was never any support for page 2 provided in the system firmware,
or in BASIC.  Hi-res graphics tends to use page 1 or both pages (e.g.
for page flipping animation).

The IIgs adds its own Super hi-res graphics mode, which only has one
display page, but this is incidental.

In the IIgs, all of the video displays come from the "slow" area of
memory, which is banks $E0 and $E1.  These banks are called "slow"
because the CPU is forced to run at 1.023 MHz while performing any read
or write operation in these banks.  This is due to the synchronization
requriements of the video display hardware, which interleave memory
accesses with the CPU in these banks.

The rest of the RAM (starting at bank $00 and potentially going up to
bank $7F) is called "fast" RAM, because the CPU is able to run in fast
mode (about 2.8 MHz) while accessing these areas, except during a memory
refresh cycle.  (This slows down the "fast" execution speed to about 2.6
MHz on average.)

8-bit software on the IIgs runs in banks 0 and 1, which correspond to
the main and auxiliary banks in the IIe and IIc.  Bank 0 in particular
is very important on the IIgs, because it is the only bank in which the
stack and direct page areas can be located, which are heavily used.  For
this reason it is essential that these banks are able to operate in
"fast" mode.

The problem is that the video buffers are in banks $E0 and $E1, and
8-bit software is expecting to find them in banks $00 and $01.  To get
around this problem, the IIgs implements a "shadowing" mechanism, in
which writes to video buffers in banks $00 and $01 are performed
simultaneously in banks $E0 and $E1.  This is handled in hardware, so
the software doesn't need to do anything special, and 8-bit software is
none the wiser.

When the shadowed write operation is taking place, the CPU must slow
down to 1 MHz, since the write to bank $E0 or $E1 has to be in slow
mode.

Reads to the shadowed areas in banks $00 and $01 can run at "fast"
speeds, so the software can run somewhat faster than it might on a IIe
or IIc.

This shadowing feature can be enabled independently for several video
buffers.  When running native software, the text and super hi-res
screens are normally shadowed, but the standard hi-res screen is not.
This allows the memory area normally used for standard hi-res to be used
for stack and direct page space without a speed penalty.

When running 8-bit software, shadowing is normally enabled for the text,
standard hi-res and double hi-res screens.

Now, as for alternate display mode (and you thought I'd forgotten!):
since text page 2 is used so rarely, the original IIgs motherboard did
not provide hardware shadowing for text page 2.

For the odd occasions when you run a program which needs this area,
turning on Alternate Display Mode causes the system to start up a timer
interrupt which frequently copies the contents of memory locations
$0800-$0BFF in bank $00 to the corresponding locations in bank $E0.
This is the memory area for text page 2.

This simulates hardware shadowing, but has significant performance
overhead - the extra interrupts and the amount of work being done inside
them cause the computer to slow down on average.

In addition, this mechanism doesn't always work - some programs which
use text page 2 might disable interrupts permanently, preventing
Alternate Display Mode from doing its job (but eliminating the
slowdown).

For the 1MB (ROM 3) motherboard, Apple added hardware shadowing support
for text page 2.  The Alternate Display Mode option now simply toggles
the soft-switch which enables text page 2 shadowing.  The performance
overhead is significantly reduced, and there is no compatibility problem
with programs that disable interrupts.  The only performance issue is
that writes to memory locations $0800-$0BFF in bank $00 cause the
computer to slow down to 1 MHz during the write.  For this reason you
shouldn't leave A.D.M. enabled unless you need to use it for a
particular program.

Incidentally: after powering on or rebooting and prior to the first time
Alternate Display Mode is enabled, the IIgs fills the real text page 2
buffer (in bank $E0) with "2" digits.  If you ever see a text screen
full of "2"s, you are probably seeing text page 2, and the program you
are running probably needs Alternate Display Mode turned on to work.

> > - Some cards work in more slots, e.g. the Video Overlay Card and Second
> > Sight only work in slot 3 on a ROM 1, unless you make a minor
> > modification to the motherboard, but work in slots 1-6 in a ROM 3.
> Do you know offhand which cards exhibit this behavior?

As I said - the Video Overlay Card and Second Sight.  I'm not aware of
any other cards that use the signal in question (M2B0 - used to
distinguish between accesses to banks $E0 and $E1).

> > - RAM disk can be resized much more easily, and works considerably
> > faster (System 6.0.1 brings the ROM 1 up to speed but doesn't help with
> > resizing).
> Really? It had been fast enough for me under 5-something, and it seemed to
> resize fine (resize it and reboot, right?)

You probably won't notice the speed difference on an accelerated IIgs,
but the way the memory gets allocated and the firmware implementation in
ROM 1 result in slower overall access.  This is most noticeable for
large RAM disks and files located near the end of the disk.  (The driver
has to follow a linked list to locate the memory corresponding to the
appropriate block, so the higher the block number, the more links it has
to follow.)  For ROM 3, the RAM disk is allocated as one big chunk and
better algorithms are used, resulting in faster accesses.

As for resizing: after you have created the RAM disk on a ROM 1, the
only way to resize it is to power off, or to force a "frigid" reboot,
e.g. by starting the self-test, then rebooting almost immediately with
Ctrl-Apple-Reset.  For the ROM 3, there is an option in the Control
Panel to let you resize on the next reset without having to go through
the self-test.

Another related point: the ROM 3 removes the option of setting different
minimum and maximum sizes for the RAM disk.  You only get one setting.
This is almost always a good thing, because it turned out that setting
the minimum and maximum sizes differently was frequently causing
problems, especially if the system memory got full and there wasn't much
data on the RAM disk yet.

> > Some memory expansion cards have problems.  Any card that sticks to the
> > standard (one, two or four logical rows of memory, either 256KB or 1MB
> > per row, all rows the same size) will work in either machine.  If the
> > card supports more than 4MB it may have problems, depending on how it
> > decodes the address.
> Hmmmm. I think this is a card with 3<?> rows of chips...an AE card, I
> think...the computer has about 1.5mb total, so it's...1mb?

The AE cards that support 1.5MB (GS Ram) and 6MB (GS Ram Plus) are prime
examples of ones which _might_ have problems in a ROM 3.  I don't know
for certain.  These cards actually implement six "rows" of RAM (256KB
per row for the GS Ram, 1MB per row for the GS Ram Plus).

> Is this one I can upgrade?

If the card is not compatible with the ROM 3 motherboard, then the only
solution is to change to another card.

> or...are maybe some of the chips bad?

No.  It is a design flaw.  You would have to modify the address decoding
logic on the card to get it to work.

The problem is that the IIgs only provides two row select signals to the
card, which can be decoded to select between four different rows.  This
allows a maximum of 4MB of RAM (or 1MB if the card uses 256KB rows).

If the card wants to provide more RAM than this, it has to do so by
looking at the bank address (sent by the CPU on the data bus during the
first half of the cycle), and possibly combine this with the row select
signals.  This can allow up to 8MB of RAM to be addressed.

There are two problems with this technique:

1. A DMA cycle (direct memory access; to or from a card in a standard
slot) does not provide the bank address on the data bus.  This means
that the RAM card will read either random data or the last bank address
that the CPU accessed, and may end up doing DMA into the wrong bank.
This can affect the Apple High-Speed SCSI card and some other cards that
use DMA, but the RamFast uses some special tricks to get around this
problem with _most_ RAM cards (I think there might be some RAM cards
that don't even work with a RamFast).

2. The ROM 1 and ROM 3 motherboards have different numbers of banks of
"fast" memory: 2 banks for the ROM 1, 16 for the ROM 3.  If the memory
expansion card is decoding the bank address, it must take this into
account.

For example, a card designed for the original IIgs motherboard might
look specifically for bank numbers starting at 2.  This would prevent 14
banks (896KB) on the card from being accessed at all, and may result in
a "hole" in the system memory, depending on how the card decodes the
address.  This usually results in a very repeatable crash.  At best, the
card would have less memory available than it is supposed to.

Some cards use one of the higher order bank address pins to distinguish
between CPU accesses in banks $00-$3F from accesses in banks $40-$7F,
and then use the row select signals to determine which group of 16 banks
is being accessed.  This technique is compatible with both the original
and 1MB motherboards, and in some cases allows one row (1MB) to be left
off the card when it is used in a ROM 3 IIgs.

> It looks like row 1 and rows 2-3 are different chips, perhaps someone
> tried to upgrade it with imporoper chips...

Not very likely.  They might just be a different brand, hence have a
somewhat different part number.  Different types of RAM chips used on
IIgs memory cards are nearly always different sizes, so it is difficult
to mix them.  The only exception that occurs to me are 256Kx4 and 1Mx4
chips, which are both 20 pins.

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