[net.micro.apple] Scrolling with and without interrupts

ags@pucc-i (Seaman) (06/18/84)

I have gotten some mail asking how to obtain the ROM listings I mentioned
for the //e.  I got mine from an Apple dealer.  Ask for the "Apple //e
Reference Manual."  The ROM listings come packaged with the manual.

The entry to the Pascal output routine is JPWRITE at $C357.  Most of the
work is done by PWRITE at $CA8E.  A table at $CC5F controls the processing
of control characters.  I duplicated the driver routine in my terminal
emulator and made a few patches in the control character table wherever
I wanted to handle something differently from the ROM, or add new capabilities
such as tabbing, or insert/delete line or character.

My first attempt to handle the scrolling problem was to write a transparent
subroutine (preserves registers and flags) to check for incoming characters
and place them in a buffer.  I modified the scrolling routines, the bell
routine, and a few others to call the polling routine at appropriate
intervals.  This helped, but I was still losing a character here and there.
I tried adding more calls to the polling routine, but things were beginning
to get out of hand and I was still losing characters.  I decided to simplify
and go to interrupts.

I turned my polling routine into an interrupt handler and removed all the calls
I had inserted.  In some cases I was able to remove entire subroutines and go 
back to the ROM version (the BELL routine, for example).  The result was much
cleaner code and it worked the first time.

As I mentioned previously, the //e ROM disables interrupts part of the time
during scrolling.  To be precise, interrupts are disabled whenever text page
2 (in the alternate bank, sometimes called page 1x) is swapped in.  This 
happens because text page 1 contains some memory locations which are not 
mapped to the screen and which are reserved for use by the peripheral cards 
(see chapter 6 in the Reference Manual).  Apple assumes that an interrupt 
handler might need to access some of these special locations, and that 
handlers from pre-//e days might not know about alternate banks.

My interrupt handler does not use any locations on text page 1, so I just
leave interrupts enabled while page 2 is swapped in.  
-- 

Dave Seaman			"My hovercraft is full of eels."
..!pur-ee!pucc-i:ags