Changes

Jump to: navigation, search

Programming methods used in games

1,121 bytes added, 13:51, 16 November 2012
/* Hardware Scrolling */
==== Hardware Scrolling ====
Hardware scrolling is performed by changing the CRTC registers 12 R12 and 13 (R13 to define the start address)of the screen. The display is automatically wrapped at 16K, so continuous incrementation of these values will scroll the screen and wrap around. The code must then update the display for new graphics.
The scrolling is normally in CRTC character sizes. * 1 CRTC char (horizontally is 2 bytes of RAM at a time which corresponds to 4 mode 0 pixels, 8 mode 1 pixels or 16 mode 2 pixels) in the horizontal and 1 .* The height of a CRTC char line is defined by CRTC Register 9 (scroll amount dependant on R9Max Raster), but which is normally set to 7. Resulting in 8 scan lines) verticallyscanlines per character.
Horizontal scrolling can be made smoother by using R3 (Hsync Width) , in addition to using R12 and R13 and makes the scrolling effectively half a CRTC char (therefore 2 mode 0 pixels, 4 mode 1 pixels, or 8 mode 2 pixels). (Changing between This can be done by changing the HSYNC width values between 5 and 6 for the horizontal sync causes a half CRTC char . The movement. This is an effect on of how the monitor)handles the HSYNC. This effect works well on Amstrad monitors, doesn't work on modern TFT screens and produces a black and white image on a MP-2 modulator because of the adjusted HSYNC timing.
Vertical scrolling can be made smoother by using R5 (Vertical Adjust). This effect works well on Amstrad all monitors but produces a black and white image on a MP-2 modulator because of the adjusted HSYNC timing.
Vertical scrolling can be made smoother by using R5 More recent games (Vertical Adjuste.g. Prehistorik 2, Super Cauldron) in combination with Rupture/Splitting to make perfect 1 scanline use the rupture technique when doing vertical scrollingscroll to ensure the display is a constant number of scan lines in height, and so the refresh rate is always the same.
Older games adjust R5 and don't use rupture (e.g. LED Storm, Legend of Kage), the time for a frame therefore varies by up to 7 extra scan-lines. This works means the VSYNC to the monitor also varies in position by up to 7 extra scan-lines, and thestability of the image is then dependent on all monitorshow the monitor handles the VSYNC.  If the game uses a status panel, there are 2 ways to handle this.1. Redraw the panel when the screen is scrolled to compensate for it.2. Use rupture technique, the panel is in a different part of RAM and will not be affected by the scroll.
This following is an incomplete list of games using hardware scrolling. From this list it can be seen that hardware scrolling has been used from 1984 :
2,541
edits