[net.micro.apple] Apple IIe and IIc raster scan synchronization.

ir332@sdcc6.ucsd.EDU (Jeff Miller) (09/25/86)

I need to synchronize a program with some fixed point in the video
display cycle (i.e. raster scan) on IIe's and IIc's.  I have done
this on II+'s by wiring a certain pin into the game port, and then
reading the status of the game port.  I would like to do the same
thing for the other II machines, but I don't know which pin it is
(or even whether there still is one that will work).  To boot, I
can barely solder, so don't refer me to some technical specs.
Anybody out there who can help for either machine?  Thanks.
-- 
        Jeff Miller                 ARPA: sdcc6!ir332@ucsd.edu
	U. C. San Diego             (I think)
	Dept Psychology, C-009
        La Jolla, CA  92093

kamath@reed.UUCP (Sean Kamath) (09/27/86)

In article <2869@sdcc6.ucsd.EDU> ir332@sdcc6.ucsd.EDU (Jeff Miller) writes:
>I need to synchronize a program with some fixed point in the video
>display cycle (i.e. raster scan) on IIe's and IIc's.  I have done
>this on II+'s by wiring a certain pin into the game port, and then
>reading the status of the game port.  I would like to do the same
>thing for the other II machines, but I don't know which pin it is
>(or even whether there still is one that will work).  To boot, I
>can barely solder, so don't refer me to some technical specs.
>Anybody out there who can help for either machine?  Thanks.
>
>        Jeff Miller

Solder my precious //e?  Never!  Well, maybe.  On the //e and //c there
is no need to solder a pin. It has already been done for you.  Read
$C019.  When it goes low (<128), it is in VBL.  For some really neat
programs that take advantage of that, look into "Enhancing Your Apple ][
Vol. 2" by Don Lancaster.

On the //c it is possible to generate interrupts when VBL ($C019) goes
low.  I KNOW this.  I THINK the same can be done on a //e with a mouse
card, but I'm not altogether sure.  If anyone is dying to know, I'll do
that before I work on my color printing routine...


________________________________________________________________________________

Sean Kamath

UUCP:            {masscomp, decvax, allegra, psu-cs, ucbcad, ucbvax,
                  purdue, hplabs, hp-pcd, sequent, uw-beaver, ihnp4,
                  cbosgd, gatech, nsc-pdc}!tektronix!reed!kamath
CSNET:           reed!kamath@Tektronix.CSNET
BITNET:          reed!kamath@Berkeley.BITNET
ARPA:            tektronix!reed!kamath@Berkeley
	         reed!kamath@hplabs
DECNET:          RHEA::DECWRL::"decvax!tektronix!reed!kamath"

US Snail:  Box 395 Reed College,
           Portland, OR  97202
           (503) 239-7458

These are not the fastest or best paths, just the easiest to use.
I hope they work. (Most notably the US Snail Service :-)

ahby@meccts.UUCP (Shane P. McCarron) (09/28/86)

In article <4160@reed.UUCP> kamath@reed.UUCP (Sean Kamath) writes:
>On the //e and //c there
>is no need to solder a pin. It has already been done for you.  Read
>$C019.  When it goes low (<128), it is in VBL.  For some really neat
>programs that take advantage of that, look into "Enhancing Your Apple ][
>Vol. 2" by Don Lancaster.
>
>On the //c it is possible to generate interrupts when VBL ($C019) goes
>low.  I KNOW this.  I THINK the same can be done on a //e with a mouse
>card, but I'm not altogether sure.  If anyone is dying to know, I'll do
>that before I work on my color printing routine...

Actually, you really can detect VBL on the //e using $C019.  And yes,
if you have a mouse card, you can cause it to generate interrupts at
each VBL.  I think you can have it generate interrupts at all sorts of
interesting events, like mouse movement, button down, button up,
etc...

However, you cannot detect VBL using $C019 on the //c or //gs.  The
only way to do it is using interrupts.  The line in the Apple //c
Technical Reference Manual reads:

	R7	$C019	RstVBL	9.1.3	See if VBlInt off(1); reset it

And the Apple //e Reference Manual reads:

	VBL	Read vertical blanking	$C019	Read, 4

This is just another example of Apple 'fixing' something so that half of 
their vendors software doesn't work.  Now when I want to detect VBL, I 
need to case for the machine I'm on; On a //e I wait for $C019 to go low.  
On a //c (//gs) I enable VBL interrupts and then loop infinitely (until 
interrupt, of course).  This works, but because of the overhead involved with
processing an interrupt, there is less time during the interval to
perform operations.  This is very annoying!
-- 
Shane P. McCarron			UUCP	ihnp4!meccts!ahby
MECC Technical Services			ATT	(612) 481-3589

"They're only monkey boys;  We can still crush them here on earth!"

dr@ski.UUCP (David Robins) (09/29/86)

In article <> ir332@sdcc6.ucsd.EDU (Jeff Miller) writes:
>I need to synchronize a program with some fixed point in the video
>display cycle (i.e. raster scan) on IIe's and IIc's.  I have done
>this on II+'s by wiring a certain pin into the game port, and then
>reading the status of the game port.  I would like to do the same
>thing for the other II machines, but I don't know which pin it is
>(or even whether there still is one that will work).  To boot, I
>can barely solder, so don't refer me to some technical specs.
>Anybody out there who can help for either machine?  Thanks.
>-- 
>        Jeff Miller                 ARPA: sdcc6!ir332@ucsd.edu
>	U. C. San Diego             (I think)
>	Dept Psychology, C-009
>        La Jolla, CA  92093

There are both hardware and software ways to do this.

They are both described in the books "Enhancing Your Apple II",
Volumes 1 and 2, by Don Lancaster (SAMS Books Publications).

The hardware solution uses the SW3 on the game port, and is described
in Volume 1, as Enhancement 4 FIELD SYNC.  The software in the same
chapter (assembly lang. routine, called from a BASIC demo program)
shows how it is used.  All soldering takes place on two IC sockets,
which are then inserted between two IC's on the board.  This is
apparently for the Apple II or II+.

The strictly software solution is in Volume 2, Enhancement 13; "THE
VAPORLOCK".  It is an ungrade of Enhancement 4., and it works on 
"the II, II+, //c, or //e". It gives you a fast and exect lock to
video timing without needing any hardware modifications.

				-Dave

-- 
====================================================================
David Robins, M.D. 
Smith-Kettlewell Eye Research Foundation
(previously known as: Smith-Kettlewell Institute of Visual Sciences)
2232 Webster St; San Francisco CA 94115
415/561-1705 (voice)
			{ihnp4,qantel,dual}!ptsfa!ski!dr

The opinions expressed herein do not reflect the opinion of the Institute!

dr@ski.UUCP (David Robins) (09/29/86)

I neglected to mention, in the article I just posted, that the FIELD
SYNC enhancement was updated in the second printing of Enhancing Your
Apple ][, Volume I.  

The one-wire addition was for the old ]['s.  In the update section, it
is pointed out that the //e has the VBL signal available at $C019.
The appropriate software corrections for the assembly program are
given.  Since $C019 is used for a different purpose on the //c, the
//e routines were not applicable.

However, since the other software solution in Vol.2  works on all
Apples, the above problems can be ignored.  The software solution
takes advantage of the Apple common data bus, reading a floating value
from the video cycle that is still present.  (The stray capacitance
holds the last value.)

				-Dave

-- 
====================================================================
David Robins, M.D. 
Smith-Kettlewell Eye Research Foundation
(previously known as: Smith-Kettlewell Institute of Visual Sciences)
2232 Webster St; San Francisco CA 94115
415/561-1705 (voice)
			{ihnp4,qantel,dual}!ptsfa!ski!dr

The opinions expressed herein do not reflect the opinion of the Institute!

ranger@ecsvax.UUCP (Rick N. Fincher) (09/30/86)

> I need to synchronize a program with some fixed point in the video
> display cycle (i.e. raster scan) on IIe's and IIc's.  I have done
> this on II+'s by wiring a certain pin into the game port, and then
> reading the status of the game port.  I would like to do the same
> thing for the other II machines, but I don't know which pin it is

The //e and //c have a soft switch that indicates vertical retrace to software.
The signal is also on the bus slots.  I don't remember which pin.  You
can look up the address of the soft switch or the bus pin in the //e reference
manual.  These signals should be          
available in the //c somewhere too, although I don't know where.  The mouse hardware built into the //c can generate an interrupt on vertical retrace,
even if you don't have a mouse connected.  So you can write an interrupt
routine to do whatever you want at that time.