CODINGLISTINGS ★ On-screen effects on the CPC464 ★

Graphic - Crtc - On - Screen Effects On the CPC464 (Popular Computing Weekly)Coding Listings
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Go for your guns

Create some great on-screen effects on the CPC464 with these programs by Brian Cadge

The Amstrad's video display is produced by two pieces of hardware, the Video Gate Array and the CRT controller. The VGA controls the screen mode (resolution), and handles the loading of colours into palette memory. It is also used by the AmstTad to control the bank switching of ROMs.

The second part of the video hardwre is the CRT (Cathode Ray Tube) Controller chip. The Amstrad uses the 6845 CRTC chip to control the positioning and size of the display on the monitor. Although the firmware uses some features of the 6845 hardware, principally for hardware scrolling the screen, there are many other useful features of this chip which the firmware does not support.

The 6845 has a total of 16 internal registers, most of which are Write-Only, that is to say we can output values to them, but we cannot read the current values from them. Two Z80 I/O port addresses are used to control the 6845, these are BCX2"and BDXX. The former is the address port and the latter the data port.

Values are sent to a peripheral chip, such as the 6845, using the Out command in Basic. To send a value to one of the 6845 registers we first of all send out the registers number to the adress port BCXX to tell the chip which register we want to change. The actual data value to be put in the particular 6845 register is then output to the data port. So to send the value 40 to register one in the 6845 we would use the following Basic commands: Out &BC00,1: Out &BD00,40.

Although the address port will keep the value one, it is always advisable to output the register number immediately before the data just in case the firmware has since updated the address port.

So just what are the 6845 registers used for? The table below lists the more useful ones. Those missing are either not implemented by the Amstrad hardware, or are only partly implemented.

It is generally not a good idea to alter any register involved with Sync functions, as this can lead to the loss of picture and you will have to reset the computer. The useful registers have the following functions: Register 0 controls the overall 'height' of the physical monitor screen. Program Four uses this feature to give a 'neon lights'effect that can be very useful for title displays, etc. An interesting feature of changing this register is that it controls when the frame flyback pulse occurs. Making the screen longer (as Program Four does) means it takes longer for the CRT to scan one 'screen' and so the interrupt occurs less frequently.

Register One controls the number of columns displayed on the screen. The Amstrad sets this to 40 (note this value applies to all modes), but this can be changed to display more or less of the border. Similarly, Register Six controls how many text lines are displayed, ini- tially 25. Register Two controls how far left the display starts and Register Seven controls how far down the display starts. Program One uses these positioning registers to allow you to move the text screen around on the monitor using the cursor keys.

Program Two uses the positioning registers and the size registers to repostion the screen in the top left hand corner of the monitor and then expand it to 24 columns by 34 lines in Mode 0. The border is completely concealed as the text screen now covers the whole of the monitor screen. In practice, if you change the size of the screen it will be necessary to check that the new display uses no more than 16K of memory or else wrap-round will occur. The firmware graphics and text routines will not operate as normal on different sizes of screen.

The position of text screen can be moved in all four directions in steps of one Mode 1 character. Register Five allows fine adjustment of the vertical position; this has many uses. For example, hardware smooth scrolling of graphics and text could be implemented. Program Three uses this register to give an 'earthquake' effect that can be used in games. The screen appears to 'shake' as in an earthquake. Try adding a Call &BD19 in Lines 75 and 105 to see an example of smooth scrolling. This firmware routine waits for the current screen scan to complete before returning and can be used to tidy up screen updating.

The four programs presented with this article only show a few of the effects possible by direct manipulation of the CRTC chip. Although some of the effects
may look strange, you cannot damage your monitor or computer by changing the register contents - if you lose the display just turn the computer on and off. You'll probably find lots more uses for the 6843 by experimenting with the registers yourself. But a word of warning, restrict all addresses m the Out command to BC00 and BD00 unless you know what you're doing or you might just lose the program in memory.


Register Function

  • 0 Horizontal Total
  • 1 Horizontal Displayed
  • 2 Horizontal Sync Position
  • 3 Sync Widths
  • 4 Vertical Total
  • 5 Vertical Total Adjust Vertical Displayed
  • 7 Vertical Sync Position
  • 8 Interlace and Skew
  • 9 Maximum Raster Address
  • 12 Start Address (high)
  • 13 Start Address (low)

PopularComputingWeekly850926

★ PUBLISHER: POPULAR COMPUTING WEEKLY
★ YEAR: 1984
★ LANGUAGE:
★ LiCENCE: LISTING
★ AUTHOR: Brian Cadge

 

★ AMSTRAD CPC ★ DOWNLOAD ★

Aucun fichier de disponible:
» Vous avez des fichiers que nous ne possédons pas concernent cette page ?
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding Src's » Sierpinski-Dreiecke (CPC Amstrad International)
» Coding Src's » Sound - Bruit Vagues - Mouette (CPC Revue)
» Coding Src's » Liss Test
» Coding Src's » 3D Colour Animation (Your Computer)
» Coding Src's » Windows (Hans-Werner Fromme/CPC Amstrad International)
» Coding Src's » Graphic - Christmas Card (Popular Computing Weekly)
Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce programme ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 316 millisecondes et consultée 5090 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.