<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sat, 09 Sep 2000 11:27:47 -0700 (PDT)
From   : Thomas Harte <t.harte@...>
Subject: Re: FRAK!

I already replied to the orginal poster, but made the mistake of replying
straight to his address only, but to find explain how the CRTC really works
with respect to its internal counters and under what conditions it reads
from the registers, I quote relevant parts of :

http://andercheran.aiind.upv.es/~amstrad/CPC_Guide/Hardware_Programming/Chips/explaining_the_crtc.html

[Begin quote]

How the image is constructed
In the following algorithms the following terms are used: 

Horizontal Character Count 

This starts at 0 and is incremented for each character fetched. It is reset
to zero when it's value is greater or equal to Horizontal Total
(CRTC_register_0). 

Vertical Character Count 

This starts at 0 and is incremented for each new character line. It is reset
to zero when it's value is greater or equal to Vertical Total
(CRTC_register_4). 

Vertical Line Count 

This starts at 0 and is incremented for each new line of a character. It is
reset to zero when it's value is greater or equal to Max Raster Address
(CRTC_register_9). 

Explaining Vertical Rupture/Splitting
Rupture/Splitting is the name given to a demo technique which allows the
CRTC to change the screen address for each line. Normally this is not
possible. It allows the demo coder to have a static image at the top of the
screen with a scrolling message underneath or similar things. 

As the CRTC draws lines of characters it increments the Vertical Character
Count. When this value is greater or equal to Vertical Sync Position, the
CRTC will make VSYNC high (it stays high for the number of characters
specified in Horizontal and Vertical Sync Widths). 

The vertical Sync position has been set to occur before the character count
reaches the vertical total. 

When the vertical character count is greater or equal to vertical total, the
CRTC will reload the screen address pointers from it's internal registers,
zeroise vertical character count and start a new frame. 

Normally the re-load would happen during the VSYNC, and we have our standard
display. 

Splitting works by setting vertical Sync position to any value greater than
the vertical total. 

So in reality, as the vertical count is incremented, it will never reach the
vertical sync position, and never generate a VSYNC. Since it's value will be
reset as soon as the character count exceeds Vertical total and the count
will never match the value in vertical sync position. 

The CRTC will start to display some more graphics, in a different place if
the start address registers have been changed. 

BUT! The screen display does not look correct. 

The trick is to program Vertical Sync Position to be greater than Vertical
Total at the start of the Monitor frame. In the splitshell example this
value is 255. A value which could never be reached. 

Then when the Monitor frame is about to finish (when the beam has reached
the bottom of the monitor display area), we set vertical sync position to a
value less than vertical total. And this will generate a VSYNC. In the
splitshell the value is 0 and will generate a VSYNC as soon as the current
frame has been finished. 

The only problem is that the screen display might not be steady. To make it
steady we must make sure the VSYNC occurs in the same place as it would
normally. When vertical sync position is 0, this means that the size of all
blocks added together must come to 39 characters (if register_9 has not been
changed). If you have changed register_9 then the vertical total MUST be
changed. 

On the ASIC, the CRTC is built into the hardware. This is necessary because
it would be impossible for the CRTC to force a screen address change
externally. The CRTC has been modified, so that using the CRTC you can set a
split line where the screen address will be changed, and the address of the
new screen. 

So Vertical Sync Postion>Vertical Total starts the split, and then setting
Vertical Sync Position to 0 will cause the VSYNC to be caused as soon as the
last block is drawn. 

A VSYNC IS GENERATED WHEN VERTICAL CHARACTER COUNT>=VERTICAL SYNC POSITION.

[End quote]

There is a lot more in the document, but it talks only in terms of the
mashed memory lines of the Amstrad CPC, so several statements (e.g. The CRTC
holds a raster count which is the line counter for the current character.
This value starts at 0 and is incremented for each line fetched. The address
of the character line is calculated by adding &0800 to the previous
character line. ) just aren't true on a BBC.

-Thomas





_______________________________________________________
Say Bye to Slow Internet!
http://www.home.com/xinbox/signup.html


<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>