[comp.sys.mac.programmer] screen swapping

bm1q+@andrew.cmu.edu (Benjamin Jameson McCurtain) (04/08/88)

Does anyone have any pointers on how to accomplish this? I have a cruddy
book with the source for megaroids, but it provides little or no
explanation of the techniques.  Also, the addresses are absolute, and I'd
prefer vectors.  At least the address of the video screens are for
pre-mac plusses.. It says that 0xeffffe is the address of the VIA
port to change between the primary and secondary screens.  I think
I found the vector in my LSC headers, but nothing I try seems to work.
To display the front screen, it does *chsrcn |= 64, & then does &= ~64
do display the secondary screen, where chrsrcn is the address above.
Am I missing something?  Do I need to protect this memory somehow?

Also, can someone recommend a *very* cheap sound digitizer for a poor
college student?  I'd actually prefer to build one myself, I still have
my chips from my apple II days, but I'd have no idea how to interface them
to the mac..   Thanks muchly, Ben McCurtain

bm1q+@andrew.cmu.edu (Benjamin Jameson McCurtain) (04/08/88)

Hmm, I'm thoroughly confused.. I was mistaken, you can use Launch from
LSC ( I had to read an update ).  But what the heck does the filename mean?
Does that mean that every time I want to turn around a program, I need
to build an application?  Makes me wonder if using two pages is worth it.
Boy do I miss my Apple II sometimes...
If anyone has any pointers, suggestions, ideas... PLEASE PLEASE PLEASE
share them!!!

Thanks,

Ben McCurtain -- bm1q@andrew.cmu.edu

oster@dewey.soe.berkeley.edu (David Phillip Oster) (04/10/88)

don't do it. In machines that have a second video page, it resides at a
fixed offset below the primary page, which is at
screenBits.bounds.baseAddr. Note: 

1.) finding the alternate page will be different on a Mac II.
2.) not all mac IIs have video adapters that support the second screen
buffer.
3.) almost all non-mac IIs have something, an INIT, a ram cache, or
something, that is already using the alternate video pages memory.

Just allocate a simple offscreen buffer, and copybits it onto the screen.

bm1q+@andrew.cmu.edu (Benjamin Jameson McCurtain) (04/12/88)

Darnit, I forgot to mention that you need to do this before you attempt to change screens:

chscrn = (char *) 0xeffffe;

sorry
Ben

bm1q+@andrew.cmu.edu (Benjamin Jameson McCurtain) (04/14/88)

> don't do it ... mac II stuff, etc. etc. etc... use off screen buffers
> and copy it onto the screen, etc.


NO NO NO NO!!!! I could care less about Mac II's right now, all I want to
do is REALLY FAST animation of a bunch of objects and even screen scrolling!

That's all!  If I wanted to be upwardly compatible and all, I wouldn't be
writing directly to the memory!  Copybits sure is versatile, but I need
pure 68K turbocharging!!

Dark Castle (and beyond DC) both use screen swapping ( you can see the


effect by having the Jclock init while the screen is scrolling in the
labyrinths, it's all over the place)... Does these games work on a Mac II?

Ben -- bm1q@andrew.cmu.edu

jwhitnel@csi.UUCP (Jerry Whitnell) (04/14/88)

In article <IWMvUIy00UjIyHM08y@andrew.cmu.edu> bm1q+@andrew.cmu.edu (Benjamin Jameson McCurtain) writes:
|> don't do it ... mac II stuff, etc. etc. etc... use off screen buffers
|> and copy it onto the screen, etc.
|NO NO NO NO!!!! I could care less about Mac II's right now, all I want to
|do is REALLY FAST animation of a bunch of objects and even screen scrolling!
|
|Dark Castle (and beyond DC) both use screen swapping ( you can see the
|effect by having the Jclock init while the screen is scrolling in the
|labyrinths, it's all over the place)... Does these games work on a Mac II?

Beyond Dark Castle works on the Mac II in 2-bit mode (b&w).  Dark Castle
came out before the Mac II was known to exist and so does not work.  The
trick to supporting both seems simple enough with only a little extra
work on your part.  Detirmine whether you are running on a Plus/SE or
a II.  If on the Plus/SE, use screen swapping.  If on the II, make up
a offscreen bit-map that you draw into, then copybit the whole thing
onto the real screen.  On a II, in two-bit mode this should be fast enough.
A little more work and we II owners won't flame you when your program doesn't
work on our machines :-).
|
|Ben -- bm1q@andrew.cmu.edu


Jerry Whitnell				Been through Hell?
Communication Solutions, Inc.		What did you bring back for me?
						- A. Brilliant

jellinghaus-robert@CS.YALE.EDU (Rob Jellinghaus) (04/15/88)

In article <IWMvUIy00UjIyHM08y@andrew.cmu.edu> bm1q+@andrew.cmu.edu (Benjamin Jameson McCurtain) writes:
>> don't do it ... mac II stuff, etc. etc. etc... use off screen buffers
>> and copy it onto the screen, etc.
>
>NO NO NO NO!!!! I could care less about Mac II's right now, all I want to
>do is REALLY FAST animation of a bunch of objects and even screen scrolling!
>
>That's all!  If I wanted to be upwardly compatible and all, I wouldn't be
>writing directly to the memory!  Copybits sure is versatile, but I need
>pure 68K turbocharging!!

Waaaahh!!!  You are going to make a lot of Mac II owners kind of sad...
Yes, there are Mac II-owning game addicts in existence...

>Dark Castle (and beyond DC) both use screen swapping ( you can see the
>effect by having the Jclock init while the screen is scrolling in the
>labyrinths, it's all over the place)... Does these games work on a Mac II?

Yes, BDC DOES work on a Mac II.  Under Multifinder, yet (as long as nothing
is going on in the background, but at least it doesn't crash).  It puts up
a BIG dialog box and plays the game inside that.

So there must be ways around direct screen writes.  Now all you have to do
is call Silicon Beach and wangle their algorithms out of them :-)

>Ben -- bm1q@andrew.cmu.edu

Rob Jellinghaus                | "FISH-NET-FISH-NET-
jellinghaus@yale.edu           |  FISH-NET-FISH-NET-
ROBERTJ@{yalecs,yalevm}.BITNET |  FISH!"
!..!ihnp4!hsi!yale!jellinghaus |          -- Zippy

darin@Apple.COM (Darin Adler) (04/15/88)

In article <IWMvUIy00UjIyHM08y@andrew.cmu.edu> bm1q+@andrew.cmu.edu (Benjamin Jameson McCurtain) writes:
> Dark Castle (and beyond DC) both use screen swapping ( you can see the
> effect by having the Jclock init while the screen is scrolling in the
> labyrinths, it's all over the place)... Does these games work on a Mac II?

Yes, these games do work on the Mac II. They use screen swapping on older
machines, but when they notice that screen swapping isn't available, they
use CopyBits! Three cheers for QuickDraw!
-- 
Darin Adler, Apple Computer                          AppleLink:Adler4
UUCP: {sun,voder,nsc,mtxinu,dual}!apple!darin  CSNET: darin@Apple.com

darin@Apple.COM (Darin Adler) (04/15/88)

Whoops! Beyond Dark Castle works on a Mac II. Dark Castle doesn't.
-- 
Darin Adler, Apple Computer                          AppleLink:Adler4
UUCP: {sun,voder,nsc,mtxinu,dual}!apple!darin  CSNET: darin@Apple.com

jmunkki@santra.UUCP (Juri Munkki) (04/16/88)

Someone once wrote: (:
>> don't do it ... mac II stuff, etc. etc. etc... use off screen buffers
>> and copy it onto the screen, etc.

Right!

In article <IWMvUIy00UjIyHM08y@andrew.cmu.edu> bm1q+@andrew.cmu.edu (Benjamin Jameson McCurtain) writes:
>NO NO NO NO!!!! I could care less about Mac II's right now, all I want to
>do is REALLY FAST animation of a bunch of objects and even screen scrolling!

No, no, no... You can have both. You have to write a few lines of code twice,
but I think it's worth the trouble. Suppose that one day we'll have a really
fast graphics coprocessor on the Mac. Now suppose that because it requires
a large amount of the graphics memory bus bandwidth, the processor has an
access time of (say) 3000 ns. You shouldn't even try to do animation using
the main processor, if memory access is that slow. The coprocessor will
probably then do the copybits several times faster than you can do it with
a 680x0.

What should you do? Read on...

>Dark Castle (and beyond DC) both use screen swapping ( you can see the
>effect by having the Jclock init while the screen is scrolling in the
>labyrinths, it's all over the place)... Does these games work on a Mac II?

Dark Castle and Beyond DC are different. BDC does things almost right, while DC
doesn't work on a Mac II. If BDC detects that it is running on a Mac II,
it uses copybits. You can even turn color on and watch the screen update
a few times per minute! What BDC fails to do is give the user a choice.
A vanilla BDC does not work on an Atari (just an example, I couldn't care
less). There should be a check box in the settings dialog. The use could
always try enabling "quick and dirty graphics", if his/her machine supported
it.

If you're interested in seeing source code for both ways of animation, read
my August 1987 article in MacTutor (in J|rg's Forth Column). It has two
separate programs...a single program might have been better. The other one
works on a Mac II (I have a Mac II). The other program requires the old
double buffered Mac screen.

Juri Munkki
jmunkki@santra.hut.fi
jmunkki@fingate.bitnet