[comp.sys.apple] Page Flipping.

PGOETZ@LOYVAX.BITNET (03/15/89)

        Blink problems depend on the animation technique you use.  If you have
large figures (for ex, the walking man in Aztec which blinks), or if your
program does a "erase all figures, then plot all figures in their new position"
(large time gap), or if for some unknown reason you use Applesoft shape tables,
you get screen blink.
        Page flipping helps, but on the ][+ it can cause the undesirable split
effect when you flip while the raster beam is in the vertical middle of your
character.  Only on the ][e (and presumable ][c, ][gs) can you do page-
flipping right, since it provides you with information on when the electron
gun is doing a vertical blank (going back to start at the top again).

Phil Goetz

paul@athertn.Atherton.COM (Paul Sander) (03/16/89)

>         Page flipping helps, but on the ][+ it can cause the undesirable split
> effect when you flip while the raster beam is in the vertical middle of your
> character.  Only on the ][e (and presumable ][c, ][gs) can you do page-
> flipping right, since it provides you with information on when the electron
> gun is doing a vertical blank (going back to start at the top again).

Just before the IIe was released, Don Lancaster published a book entitled 
"Enhancing Your Apple II" which addresses this issue.  He also gave a talk 
at the West Coast Computer Faire that year that discussed a better method.

Both methods required making reversable changes to the motherboard (the first
method, I believe, required adding only one wire).  Of course, at this late
date, I don't think anyone is worried about voiding their warrantees if they
wish to try this.
-- 
Paul Sander        (408) 734-9822       | Do YOU get nervous when a
paul@Atherton.COM                       | sys{op,adm,prg,engr} says
{decwrl,sun,hplabs!hpda}!athertn!paul   | "oops..." ?

dnelson@umbio.MIAMI.EDU (Dru Nelson) (03/17/89)

 
>        Page flipping helps, but on the ][+ it can cause the undesirable split
> effect when you flip while the raster beam is in the vertical middle of your
> character.  Only on the ][e (and presumable ][c, ][gs) can you do page-
> flipping right, since it provides you with information on when the electron
> gun is doing a vertical blank (going back to start at the top again).

There is a way to do it on all ]['s.  Bob Bishop once wrote an article
in Softalk about changing video modes during screen refresh.  He
monitored a location in I/O memory for a certain byte or sequence of
bytes.  These could also be used for page flipping timing.  The ][c
and IIgs are the only ones that give interupts (I believe).  The 
article was titled the "Hi-Lo Split" and was mainly concerned about
mixing text and hires or lo-res or any combination.  It gave an
excellent description (from a programmers point of view) of how this
information could be used and how the video operated.





-- 
Dru Nelson                    UUCP: ....!uunet!gould!umbio!dnelson
Miami, Florida                 MCI: dnelson
                          Internet: dnelson%umbio@umigw.miami.edu

PGOETZ@LOYVAX.BITNET (03/17/89)

        The method Bob Bishop published in Softalk involved finding when
the vertical blank was and then counting cycles until the next one.  Thus,
it could only be used with static images, and NOT with animation (unless
you want to time your entire program loop!)  For an example of a similar
technique, see the boot display for Nasir Gebelli's _Gorgon_.

        Bob Bishop was a truly inventive programmer:  first to use 560
horizontal resolution, first to digitize voice on the Apple, first to
publish this page-flipping method.  What happened to him?

Phil Goetz

labc-3dc@web-3b.berkeley.edu (Andy McFadden) (03/17/89)

In article <1494@umbio.MIAMI.EDU> dnelson@umbio.MIAMI.EDU (Dru Nelson) writes:
>[somebody else writes: ]
>> [...]       Only on the ][e (and presumable ][c, ][gs) can you do page-
>> flipping right, since it provides you with information on when the electron
>> gun is doing a vertical blank (going back to start at the top again).
>
>There is a way to do it on all ]['s.  Bob Bishop once wrote an article
>in Softalk about changing video modes during screen refresh.  He
>monitored a location in I/O memory for a certain byte or sequence of
>bytes.  These could also be used for page flipping timing.  The ][c

It's been a while, but I believe the general idea was to look at some of the
I/O addresses (e.g., $c050)... apparently they reflect the contents of the
screen currently being scanned.

>and IIgs are the only ones that give interupts (I believe).  The 
>article was titled the "Hi-Lo Split" and was mainly concerned about
>mixing text and hires or lo-res or any combination.  It gave an
>excellent description (from a programmers point of view) of how this
>information could be used and how the video operated.

Yes... but it can be CPU intensive, and it's hard to use.  Somebody mentioned
the article in Lancaster's "Enhancing your Apple //" about a hardware mod to
make the //+ signal VBL interrupts.  I installed that a while back (a long
while back...), and it works just fine except that it sends the logical
complement of the one on the //e.

>Dru Nelson                    UUCP: ....!uunet!gould!umbio!dnelson

-- 
fadden@cory.berkeley.edu (Andy McFadden)
labc-3dc@widow.berkeley.edu

labc-3dc@e260-3d.berkeley.edu (Andy McFadden) (03/18/89)

In article <8903161724.aa22311@SMOKE.BRL.MIL> PGOETZ@LOYVAX.BITNET writes:
[chop, chop]
>        Bob Bishop was a truly inventive programmer:  first to use 560
>horizontal resolution, first to digitize voice on the Apple, first to
>publish this page-flipping method.  What happened to him?

Wasn't he the one who wrote AppleVision?

(you know, that Intbasic/assembly program that appeared on the original
 DOS 3.3 system master disk, with the dancing guy on the hires screen...)

A lot of the old-timers have faded away... I was kind of surprised to see
Robert Clardy still around...

>Phil Goetz

-- 
fadden@cory.berkeley.edu (Andy McFadden)
labc-3dc@widow.berkeley.edu

brianw@microsoft.UUCP (Brian Willoughby) (03/19/89)

In article <8903141654.aa28044@SMOKE.BRL.MIL>, PGOETZ@LOYVAX.BITNET writes:
>         Page flipping helps, but on the ][+ it can cause the undesirable split
> effect when you flip while the raster beam is in the vertical middle of your
> character.  Only on the ][e (and presumable ][c, ][gs) can you do page-
> flipping right, since it provides you with information on when the electron
> gun is doing a vertical blank (going back to start at the top again).
> 
> Phil Goetz

That may seem to be true from the hardware viewpoint, but if you check in the
_Enhancing Your Apple Vol. II_ (which is often on bargain shelves in
bookstores), there is a software method that will work on all Apple IIs.
Because of the way video shares memory with the 6502 by reading between each
processor access, you can look back at the video bus by reading an unused I/O
location. This software trick (used very well in the game 'Karateka') stores
id values in the unused areas of the HiRes screen. You remember the 8 byte
groups that follow the last third of the graphics scan lines? These aren't
displayed, but they are read by the video generator to guarantee RAM refresh.
By accessing an unused address from $C000-$C07F, you can actually read the byte
last fetched by the video. Then you look for the signature id bytes which
indicate that you are in verticle blanking. If you want to know this technique,
then try reading that book!

On a related note. Many netters have asked why the GS must slow down to access
the graphics memory. Some suspect that the Mega chip must run at the original
Apple's 1 MHz. Actually, the constricting factor is that the video display
fetches bytes at a rate of 1 MHz in all screen modes. To keep these same screen
modes, a GS must access video memory between these fetches. On the original II,
the RAM was actually being accessed at 2 MHz! I don't think that the GS suffers
too much from the slowdown, since every other computer on the market must slow
down to access video memory. The Amiga and original Mac only have one bank of
memory, so all accesses to this bank must be slowed to squeeze between the
video updates. The Mac SE improves this with 32 bit memory, making 3 processor
accesses per video access. The Mac II's and Mac SE/30 have multiple RAM areas
so that program memory accesses don't have to be slowed down. This is similar
to the accelerated II computers. But even the Mac II has to slow down when
accessing video memory because it is stored across thet NuBus, which isn't as
fast as direct 68000 bus memory. The Amiga can be expanded with program only
RAM off the side 68000 bus port, but few people take advantage of the higher
speed this offers. I don't even want to start on the subject of how the many
PC video boards can really slow down the clone machines' accesses to video RAM.
You have to pay a high price for the faster PC video boards. Most 20 MHz PCs
are not created equal when you compare the amount of time waiting for video
updates.

Comments welcome,

Brian Willoughby			microsoft!brianw@uunet.UU.NET
		or			uw-beaver!microsoft!brianw
		or just			microsoft!brianw

christer@zeus.cs.umu.se (Christer Ericson) (03/21/89)

In article <8903161724.aa22311@SMOKE.BRL.MIL> PGOETZ@LOYVAX.BITNET writes:
>
>        The method Bob Bishop published in Softalk involved finding when
>the vertical blank was and then counting cycles until the next one.  Thus,
>it could only be used with static images, and NOT with animation (unless
>you want to time your entire program loop!)  For an example of a similar
>technique, see the boot display for Nasir Gebelli's _Gorgon_.
>
The article named 'Hi-Lo Split', as someone already mentioned, appeared in
the August (possibly the September) '82 issue. I have it somewhere deep down
in one of the piles in the Apple bookshelf at home if someone would want a
hardcopy of the article. I'd guess it is some 6-7 pages long.

Now to the real reason to my reply. Phillie, where did you get the impression
that 'scan-line interrupts' couldn't be used together with animation. Just
take a look at the games on the 64 (sorry if I offended someone by mentioning
that particular number) - they do it all the time! Sure, the VIC chip can
automatically tell you which raster line you're at and on the Apple we have
to rely on tagging the off-screen screen-memory. But after having detected
the raster line we're interested in we have some 7200 cycles (that's PAL, NOT
NTSC, you have fewer) during which we can do anything, like animation, before
we return to the same raster line.

With a little imagination awsome effects can be made! Virtually all cracked
programs in circulation have some sort of flashy graphical 'pirate page' and
some pirate groups have exploited the 'scan-line interrupt' feature to make
quite astonishing intros. Next time you stumble on the inevitable cracked copy
of 'Mutant Appleeaters from Space' - check the intro out, it's sometimes
better than the game itself. I don't approve of pirating software despite what
I just said above so just DON'T copy the game, ok.

You might also want to try this small routine out. This should work for an
NTSC machine giving a *vertical* split instead of the common horizontal split.
Note: I hand-coded this w/o having a 6502 assembly manual at hand so I can only
hope it is correct. No flames, please.

  0300:AD 50 C0   LDA $C050
       AD 52 C0   LDA $C052
       AD 56 C0 X:LDA $C056   4
       20 58 FF   JSR $FF58  12
       20 58 FF   JSR $FF58  12
       EA         NOP         2
       EA         NOP         2
       20 57 C0   LDA $C057   4
       20 58 FF   JSR $FF58  12
       20 58 FF   JSR $FF58  12
       EA         NOP         2
       4C 06 03   JMP X(306)  3
    -------------------------------
                             65 CYCLES

BTW, Bob Bishop also wrote a game for Datamost called Money Munchers where he
superimposed text and lores by rapidly switching between those two modes.
However the total effect were lost since it flickered too much...

>
>Phil Goetz

/Christer

Christer Ericson
Inst. for Information Processing
University of Umea
S-90187 Sweden

Internet: christer@cs.umu.se   a.k.a.  christer@[130.239.1.101]

hentosh@amethyst.bucknell.EDU (03/21/89)

I have noticed that the Double Hi-Res screen has two pages,
but I don't see a soft switch to flip between the two.
Does anyone know if Double Hi-Res page flipping is possible, and
if it is how does one go about implementing it.

                Thanks,
                        Bob

-----------------------------------------------------------------------------
 BITNET: hentosh@amethyst.bucknell.edu | Disclaimer : "I don't know why I
 ALPE  : RobertH128                    |   said that... I think it came from
                                       |   the fillings in my rear molars."
-----------------------------------------------------------------------------

mattd@Apple.COM (Matt Deatherage) (03/21/89)

In article <8903210050.AA00983@amethyst> hentosh@amethyst.bucknell.EDU writes:
>
>I have noticed that the Double Hi-Res screen has two pages,
>but I don't see a soft switch to flip between the two.
>Does anyone know if Double Hi-Res page flipping is possible, and
>if it is how does one go about implementing it.
>
Peter Baum (the man who discovered Double Hi-Res in the first place, and
in the second) told me once that you can access DHGR page two, but you have
to be sure the 80-column FIRMWARE is off.

Unfortunately, that's all I remember, and I haven't had time to go mucking
about with it lately.  But it's a start.

>                Thanks,
>                        Bob
==============================================================================
Matt Deatherage, Apple Computer, Inc. | "The opinions expressed in this tome
Send PERSONAL mail ONLY (please) to:  | should not be construed to imply that
AppleLink PE: Matt DTS  GEnie: AIIDTS | Apple Computer, Inc., or any of its
CompuServe: 76703,3030                | subsidiaries, in whole or in part,
Usenet:  mattd@apple.com              | have any opinion on any subject."
UUCP:  (other stuff)!ames!apple!mattd | "So there."
=============================================================================

dseah@wpi.wpi.edu (David I Seah) (03/22/89)

In article <21799@agate.BERKELEY.EDU> labc-3dc@e260-3d.berkeley.edu (Andy McFadden) writes:
>>        Bob Bishop was a truly inventive programmer:  first to use 560
>>horizontal resolution, first to digitize voice on the Apple, first to
>>publish this page-flipping method.  What happened to him?

PGOETZ writes:
>
>Wasn't he the one who wrote AppleVision?
>
>A lot of the old-timers have faded away... I was kind of surprised to see
>Robert Clardy still around...

Yep, Bop Bishop wrote Applevision!  I wonder if I still have that around
somewhere...

Didn't Robert Clardy write, uh, Apventure to Atlantis: The Compleat Adventure?
Neat game.  What else did he do, and what is he up to nowadays?

| <<<<<(((((( DAVE SEAH ))))))>>>>> |	Internet:  dseah@wpi.wpi.edu
| Worcester  Polytechnic  Institute |	Bitnet:	   dseah@wpi.bitnet
| Computer Engineering Class of '90 |	ALink PE:  Omnitreant

Phil_Bowers.henr801E@XEROX.COM (03/23/89)

Return-Path: <info-apple-request@smoke.brl.mil>
Redistributed: XeroxInfo-Apple^.x
Received: from SMOKE.BRL.MIL ([192.5.23.3]) by Xerox.COM ; 20 MAR 89
22:00:35 PST
Received: by SMOKE.BRL.MIL id ab13400; 20 Mar 89 21:02 EST
Received: from SMOKE.BRL.MIL by SMOKE.BRL.MIL id aa12827; 20 Mar 89 19:59
EST
Received: from cunyvm.cuny.edu by SMOKE.BRL.MIL id aa12604; 20 Mar 89 19:49
EST
Received: from BKNLVMS.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with
BSMTP id 7574; Mon, 20 Mar 89 19:50:45 EST
Return-path: hentosh%amethyst.bucknell.edu@CUNYVM.CUNY.EDU
Received: from amethyst by BKNLVMS.BITNET; Mon, 20 Mar 89 19:50 EST
Received: by amethyst (5.57/Ultrix2.0-B) id AA00983; Mon, 20 Mar 89
19:50:16 EST
Original-Date: Mon, 20 Mar 89 19:50:16 EST
Message-Id: <8903210050.AA00983@amethyst>


I have noticed that the Double Hi-Res screen has two pages,
but I don't see a soft switch to flip between the two.
Does anyone know if Double Hi-Res page flipping is possible, and
if it is how does one go about implementing it.

                Thanks,
                        Bob


-----------------------------------------------------------------------------
 BITNET: hentosh@amethyst.bucknell.edu | Disclaimer : "I don't know why I
 ALPE  : RobertH128                    |   said that... I think it came
from
                                       |   the fillings in my rear molars."

-----------------------------------------------------------------------------

  I have just come onto the mailing service and I and not sure what type
Apple (breed, whatever) you have. I have an Apple II+. There are two Hi-Res
screen buffers; one from $2000 to $3FFF (page 1)and the second from $4000
to $5FFF(page 2). 
   I have some code in both BASIC and Assembler that allows you to write to
one page while looking at the other, and then flip to the one just written
(via a peek, or an Assembler load instruction). To set up  variuos sreen
combinations, all graphics or graphics/text, only four soft switches  are
used, and only one is needed to READ from in order to flip the screens but
I do not know them off-hand) If this would be of help, let know and I will
figure how to get the info to you with the least fat-finger errors. sent
your mail note to:      
                       Phil Bowers:henr801e:xerox

Phil_Bowers.henr801E@XEROX.COM (03/23/89)

Return-Path: <info-apple-request@smoke.brl.mil>
Redistributed: XeroxInfo-Apple^.x
Received: from SMOKE.BRL.MIL ([192.5.23.3]) by Xerox.COM ; 20 MAR 89
22:00:35 PST
Received: by SMOKE.BRL.MIL id ab13400; 20 Mar 89 21:02 EST
Received: from SMOKE.BRL.MIL by SMOKE.BRL.MIL id aa12827; 20 Mar 89 19:59
EST
Received: from cunyvm.cuny.edu by SMOKE.BRL.MIL id aa12604; 20 Mar 89 19:49
EST
Received: from BKNLVMS.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with
BSMTP id 7574; Mon, 20 Mar 89 19:50:45 EST
Return-path: hentosh%amethyst.bucknell.edu@CUNYVM.CUNY.EDU
Received: from amethyst by BKNLVMS.BITNET; Mon, 20 Mar 89 19:50 EST
Received: by amethyst (5.57/Ultrix2.0-B) id AA00983; Mon, 20 Mar 89
19:50:16 EST
Original-Date: Mon, 20 Mar 89 19:50:16 EST
Message-Id: <8903210050.AA00983@amethyst>


I have noticed that the Double Hi-Res screen has two pages,
but I don't see a soft switch to flip between the two.
Does anyone know if Double Hi-Res page flipping is possible, and
if it is how does one go about implementing it.

                Thanks,
                        Bob


-----------------------------------------------------------------------------
 BITNET: hentosh@amethyst.bucknell.edu | Disclaimer : "I don't know why I
 ALPE  : RobertH128                    |   said that... I think it came
from
                                       |   the fillings in my rear molars."

-----------------------------------------------------------------------------

  I have just come onto the mailing service and I and not sure what type
Apple (breed, whatever) you have. I have an Apple II+. There are two Hi-Res
screen buffers; one from $2000 to $3FFF (page 1)and the second from $4000
to $5FFF(page 2). 
   I have some code in both BASIC and Assembler that allows you to write to
one page while looking at the other, and then flip to the one just written
(via a peek, or an Assembler load instruction). To set up  variuos sreen
combinations, all graphics or graphics/text, only four soft switches  are
used, and only one is needed to READ from in order to flip the screens but
I do not know them off-hand) If this would be of help, let know and I will
figure how to get the info to you with the least fat-finger errors. sent
your mail note to:      
                       Phil Bowers:henr801e:xerox
LATER;
I found this info in my desk. The addresses  of the soft-switches come in
pairs;
 set 1     $C050 graphics ,                    or $C051 text
 set 2     $C052 all text or graphic ,  or $C053 mix text and  graphics
 set 3    $C056 lo-res graphic  ,        or $C057 hi-res
 set 4     $C054 page 1 ,                     or $C057 page 2
this is also in table #5 of one of your manuals.(after the Assembler
instrucrtion code section) you have to reference each of these addresses
the first time to set the proper screen. Once this is done, you can flip
between page 1 and 2 by  referering (by a READ type statement) to one of
the last two addresses.  These  should be used in this order even though
the manual shows them in a different order.

          phil