OSDN Git Service

c634443576cb6ca00319733e761a2c55e548399f
[proj16/16.git] / 16 / PCGPE10 / TUT10.TXT
1                    ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸\r
2                    ³         W E L C O M E         ³\r
3                    ³  To the VGA Trainer Program   ³ ³\r
4                    ³              By               ³ ³\r
5                    ³      DENTHOR of ASPHYXIA      ³ ³ ³\r
6                    ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; ³ ³\r
7                      ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³\r
8                        ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
9 \r
10                            --==[ PART 10 ]==--\r
11 \r
12 \r
13 \r
14 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
15 þ Introduction\r
16 \r
17 Wow! The trainer has finally reached part 10! This will also be the\r
18 first part introduced simultaneously to local BBS's and the INTERNET at\r
19 the same time! Yes folks, I put up a copy of previous tutorials onto\r
20 various ftp sites, and awaited the flames saying that the net.gurus\r
21 already knew this stuff, and why was I wasting disk space! The flames\r
22 did not appear (well, except for one), and I got some messages saying\r
23 keep it up, so from now on I will upload all future trainers to ftp\r
24 sites too (wasp.eng.ufl.edu , cs.uwp.edu etc.). I will also leave a\r
25 notice in the USENET groups comp.lang.pascal and comp.sys.ibm.pc.demos\r
26 when a new part is finished (Until enough people say stop ;-))\r
27 \r
28 I can also be reached at my new E-Mail address,\r
29                  smith9@batis.bis.und.ac.za\r
30 \r
31 Well, this tutorial is on Chain-4. When asked to do a trainer on\r
32 Chain-4, I felt that I would be walking on much travelled ground (I have\r
33 seen numerous trainers on the subject), but the people who asked me said\r
34 that they hadn't seen any, so could I do one anyway? Who am I to say no?\r
35 \r
36 The sample program attached isn't that great, but I am sure that all you\r
37 people out there can immediately see the potential that Chain-4 holds.\r
38 \r
39 \r
40 If you would like to contact me, or the team, there are many ways you\r
41 can do it : 1) Write a message to Grant Smith/Denthor/Asphyxia in private mail\r
42                   on the ASPHYXIA BBS.\r
43             2) Write to Denthor, EzE or Goth on Connectix.\r
44             3) Write to :  Grant Smith\r
45                            P.O.Box 270 Kloof\r
46                            3640\r
47                            Natal\r
48                            South Africa\r
49             4) Call me (Grant Smith) at (031) 73 2129 (leave a message if you\r
50                   call during varsity). Call +27-31-73-2129 if you call\r
51                   from outside South Africa. (It's YOUR phone bill ;-))\r
52             5) Write to smith9@batis.bis.und.ac.za in E-Mail.\r
53 \r
54 NB : If you are a representative of a company or BBS, and want ASPHYXIA\r
55        to do you a demo, leave mail to me; we can discuss it.\r
56 NNB : If you have done/attempted a demo, SEND IT TO ME! We are feeling\r
57         quite lonely and want to meet/help out/exchange code with other demo\r
58         groups. What do you have to lose? Leave a message here and we can work\r
59         out how to transfer it. We really want to hear from you!\r
60 \r
61 \r
62 \r
63 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
64 þ What is Chain-4?\r
65 \r
66 You people out there all have at least 256k vga cards. Most of you have\r
67 512k vga cards, and some have 1MB vga cards. But what you see on your\r
68 screen, as discussed in previous trainers, is 64k of data! What happened\r
69 to the other 192k??? Chain-4 is a method of using all 256k at one time.\r
70 \r
71 The way this is done is simple. 1 screen = 64k. 64k * 4 = 256k.\r
72 Therefore, chain-4 allows you to write to four screens, while displaying\r
73 one of them. You can then move around these four screens to see the data\r
74 on them. Think of the Chain-4 screen as a big canvas. The viewport,\r
75 the bit you see out of, is a smaller rectangle which can be anywhere\r
76 over the bigger canvas.\r
77 \r
78      +----------------------------+ Chain-4 screen\r
79      |          +--+              |\r
80      |          |  | <- Viewport  |\r
81      |          +--+              |\r
82      |                            |\r
83      +----------------------------+\r
84 \r
85 \r
86 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
87 þ The size of the chain-4 screen\r
88 \r
89 The Chain-4 screen, can be any size that adds up to 4 screens.\r
90 \r
91 For example, it can be 4 screens across and one screen down, or one\r
92 screen across and 4 screens down, or two screens across and two screens\r
93 down, and any size in between.\r
94 \r
95 In the sample program, the size is a constant. The size * 8 is how many\r
96 pixels across there are on the chain-4 screen, ie\r
97    Size = 40   = 320 pixels across = 1 screen across, 4 screens down\r
98    Size = 80   = 640 pixels across = 2 screens across, 2 screens down\r
99 etc.\r
100 \r
101 We need to know the size of the screen for almost all dealings with the\r
102 Chain-4 screen, for obvious reasons.\r
103 \r
104 \r
105 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
106 þ Layout of the chain-4 screen, and accessing it\r
107 \r
108 If you will remember all the way back to Part 1 of this series, I\r
109 explained that the memory layout of the MCGA screen is linear. Ie, the\r
110 top left hand pixel was pixel zero, the one to the right of it was\r
111 number one, the next one was number two etc. With Chain-4, things are\r
112 very different.\r
113 \r
114 Chain-4 gets the 4 screens and chains them together (hence the name :)).\r
115 Each screen has a different plane value, and must be accessed\r
116 differently. The reason for this is that a segment of memory is only 64k\r
117 big, so that we could not fit the entire Chain-4 screen into one\r
118 segment.\r
119 \r
120 All Chain-4 screens are accessed from $a000, just like in MCGA mode.\r
121 What we do is, before we write to the screen, find out what plane we are\r
122 writing to, set that plane, then plot the pixel. Here is how we find out\r
123 how far in to plot the pixel and what plane it is on :\r
124 \r
125  Instead of the linear model of MCGA mode, ie :\r
126         ÚÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄ¿\r
127         ³00³01³02³03³04³05³06³07³08³09³10³11³ ...\r
128 \r
129  Each plane of the Chain-4 screen accesses the memory in this way :\r
130 \r
131        Plane 0 :\r
132         ÚÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄ¿\r
133         ³00³  ³  ³  ³01³  ³  ³  ³02³  ³  ³  ³ ...\r
134 \r
135        Plane 1 :\r
136         ÚÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄ¿\r
137         ³  ³00³  ³  ³  ³01³  ³  ³  ³02³  ³  ³ ...\r
138 \r
139        Plane 2 :\r
140         ÚÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄ¿\r
141         ³  ³  ³00³  ³  ³  ³01³  ³  ³  ³02³  ³ ...\r
142 \r
143        Plane 3 :\r
144         ÚÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄÂÄÄ¿\r
145         ³  ³  ³  ³00³  ³  ³  ³01³  ³  ³  ³02³ ...\r
146 \r
147 In this way, by choosing the right plane to write to, we can access all\r
148 of the 256k of memory available to us. The plane that we write to can\r
149 easily be found by the simple calculation of  x mod 4, and the x\r
150 coordinate is also found by  x div 4. We work out our y by multiplying\r
151 it by the size of our chain-4 screen.\r
152 \r
153 NOTE : It is possible to write to all four planes at once by setting the\r
154        correct port values.\r
155 \r
156 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
157 þ Uses of Chain-4\r
158 \r
159 The uses of Chain-4 are many. One could write data to one screen, then\r
160 flip to it (the move_to command is almost instantaneous). This means\r
161 that 64k of memory does not need to be set aside for a virtual screen,\r
162 you are using the vga cards memory instead!\r
163 \r
164 Scrolling is much easier to code for in Chain-4 mode.\r
165 \r
166 It is possible to "tweak" the mode into other resolutions. In our demo,\r
167 our vectors were in 320x240 mode, and our dot vectors were in 320x400\r
168 mode.\r
169 \r
170 The main disadvantage of chain-4 as I see it is the plane swapping,\r
171 which can be slow. With a bit of clever coding however, these can be\r
172 kept down to a minimum.\r
173 \r
174 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
175 þ The sample programs\r
176 \r
177 The first sample program is GFX.PAS. This is a until in which I have\r
178 placed most of our routines from previous tuts. All the procedures and\r
179 variables you can see under the INTERFACE section can be used in any\r
180 program with GFX in the USES clause. In other words, I could do this :\r
181 \r
182 USES GFX,crt;\r
183 \r
184 BEGIN\r
185   Setupvirtual;\r
186   cls (vaddr,0);\r
187   Shutdown;\r
188 END.\r
189 \r
190 This program would compile perfectly. What I suggest you do is this :\r
191 Rename the file to a name that suites you (eg your group name), change\r
192 the first line of the unit to that name, then add all useful procedures\r
193 etc. to the unit. Make it grow :-).\r
194 \r
195 The second file is the sample program (note the USES GFX,crt; up near\r
196 the top!). The program is easy to understand and is documented. The bit\r
197 that I want to draw your attention to is the constant, BIT. Because I\r
198 am distributing this file to many places in text form, not binary form,\r
199 I could not just add a .CEL file with the program. So what I did was\r
200 write some text in one color then saved it as a .CEL . I then wrote a\r
201 ten line program that did the following : Moving from left to right, it\r
202 counted how many pixels were of color zero, then saved the byte value to\r
203 an array. When it came across color one, is counted for how long that\r
204 went on then saved the byte value and saved it to an array and so on.\r
205 When it was finished, I converted the array into a text file in the\r
206 CONST format. Not too cunning, but I thought I had better explain it ;-)\r
207 \r
208 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
209 þ In closing\r
210 \r
211 There are other documents and sample programs available on Chain-4 and\r
212 it's like : Try XLIB for one...\r
213 \r
214 Finally! Some BBS's have joined my BBS list! (Okay, only two new ones,\r
215 but it's a start ;-)) All you international BBS's! If you will regularly\r
216 download the tuts from an FTP site, give me your names!\r
217 \r
218 I own a car. The car's name is Bob. A few days ago, Bob was in an\r
219 accident, and now has major damage to his front. Knowing insurance, I\r
220 probably won't get much, probably nothing (the other guy wasn't insured,\r
221 and I am only 18 :( ). I will probably have to find work in order to pay\r
222 for my repairs. The point to this meandering is this : I am upset, so if\r
223 you think you are getting a quote, you can just forget it.\r
224 \r
225 Oh, well. Life goes on!\r
226 \r
227 See you next time,\r
228   - Denthor\r
229 \r
230 These fine BBS's carry the ASPHYXIA DEMO TRAINER SERIES : (alphabetical)\r
231 \r
232 ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍËÍÍÍËÍÍÍÍËÍÍÍÍ»\r
233 ºBBS Name                  ºTelephone No.   ºOpen ºMsgºFileºPastº\r
234 ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÎÍÍÍÎÍÍÍÍÎÍÍÍ͹\r
235 ºASPHYXIA BBS #1           º(031) 765-5312  ºALL  º * º *  º *  º\r
236 ºASPHYXIA BBS #2           º(031) 765-6293  ºALL  º * º *  º *  º\r
237 ºConnectix BBS             º(031) 266-9992  ºALL  º   º *  º *  º\r
238 ºPOP!                      º(012) 661-1257  ºALL  º   º *  º *  º\r
239 ºPure Surf BBS             º(031) 561-5943  ºA/H  º   º *  º *  º\r
240 ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÊÍÍÍÊÍÍÍÍÊÍÍÍͼ\r
241 \r
242 For international users : If you live outside the Republic of South\r
243 Africa, do the following : Dial +27, dont dial the first 0, but dial\r
244 the rest of the number. Eg, for the ASPHYXIA BBS : +27-31-765-5312\r
245 \r
246 Open = Open at all times or only A/H\r
247 Msg  = Available in message base\r
248 File = Available in file base\r
249 Past = Previous Parts available\r
250 \r
251 \r
252 ÚÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\r
253 ³ C4TUT.PAS ³\r
254 ÀÄÄÄÄÄÄÄÄÄÄÄÙ\r
255 \r
256 (*\r
257 Well folks, here it is - the long awaited for Chain-4 trainer. The\r
258 routines are commented so I'm not going to say too much more here,\r
259 except a few things.\r
260 \r
261 1: If ya don't understand this (not suprising its bloody cryptic!)\r
262    then if ur serious go out and buy - Programming the EGA & VGA Cards\r
263    I don't know who the book is by, so don't ask. Perhaps you know Greg?\r
264 \r
265 2: The code is unoptimised. I wrote it specifically for this conf. and\r
266    I'm buggered if I'm gonna give out my wholely (sp? ahh stuff it :-))\r
267    optimised code. If you want it faster, OPTIMISE IT!!\r
268    HINT: Its faster to load ax, with a low byte/high byte combination\r
269          and out a word instead of a byte at a time. If u don't know\r
270          what I'm talking about, too bad :-)\r
271 \r
272 3: If you use/like/whatever this code, please give Asphyxia a mention.\r
273    It wos bloody hard work figuring out how all this cr*p works, we\r
274    couldn't have done it with out a little guidence (thanx Gregie Poo).\r
275 \r
276 4: LiveWire got interested in the whole tut/trainer idea and MAY be\r
277    putting together a doc on how the whole thing works, including\r
278    Pel-Panning which I haven't included here.\r
279 \r
280 \r
281 5: Good luck with the code, and if you write anything with it, I'd\r
282    appreciate having a look at it :-). Feel free to direct any comments\r
283    about the code to me in this conf. Or at one of the contact addresses\r
284    given in the code.\r
285 \r
286 \r
287 l8rs\r
288 EzE / Asphyxia\r
289 \r
290 \r
291 \r
292 --------------------------------=[ Cut Here ]=-------------------------\r
293 *)\r
294 {$X+,G+}\r
295 Program Chain4_Tut;\r
296 Uses\r
297    Crt;\r
298 \r
299 \r
300 Const\r
301    Size : Byte = 80;\r
302 \r
303 \r
304 Var Loop : Integer;\r
305 \r
306 \r
307 \r
308 Procedure Init_C4; Assembler;\r
309 Asm\r
310    mov   ax, 0013h\r
311    int   10h               { set up bios initially for 13h            }\r
312 \r
313    mov   dx, 03c4h         { Sequencer Address Register               }\r
314    mov   al, 4             { Index 4 - Memory mode                    }\r
315    out   dx, al            { select it.                               }\r
316    inc   dx                { 03c5h - here we set the mem mode.        }\r
317    in    al, dx            { get whats already inside the reg         }\r
318    and   al, 11110111b     { un-set 4th bit - chain4                  }\r
319    out   dx, al\r
320 \r
321    mov   dx, 3d4h\r
322    mov   al, 13h           { Offset Register - allocates amt. mem for }\r
323    out   dx, al            { 1 displayable line as - length div 8, so }\r
324    inc   dx                { we use 80 (80*8) = 640 = 2 pages across  }\r
325    mov   al, [Size]        { and cause of chain-4 i.e. 256k display   }\r
326    out   dx, al            { mem, 2 pages down for four pages         }\r
327 \r
328                            { NOTE: setting AL above to 40 selects 1   }\r
329                            { page across and four down (nice for      }\r
330                            { 1942 type scrolling games) and setting   }\r
331                            { AL to 160 selects 4 pages across and 1   }\r
332                            { down, nice for horizontal scrolling      }\r
333 \r
334 End;\r
335 \r
336 \r
337 \r
338 Procedure Cls_C4; Assembler;\r
339 Asm\r
340    mov   dx, 03c4h         { 03c4h                                    }\r
341    mov   al, 2             { Map Mask Register                        }\r
342    out   dx, al\r
343    inc   dx\r
344    mov   al, 00001111b     { Select all planes to write to            }\r
345    out   dx, al            { Doing this to clear all planes at once   }\r
346 \r
347    mov   ax, 0a000h\r
348    mov   es, ax\r
349    xor   di, di            { set es:di = Screen Mem                   }\r
350    mov   ax, 0000h         { colour to put = black                    }\r
351    mov   cx, 32768         { 32768 (words) *2 = 65536 bytes - vga mem }\r
352    cld\r
353    rep   stosw             { clear it                                 }\r
354 End;\r
355 \r
356 \r
357 \r
358 Procedure PutPixel_C4(X, Y : Integer; Col : Byte); Assembler;\r
359 Asm\r
360    mov   ax, [Y]           { Y val multiplied by...                   }\r
361    xor   bx, bx\r
362    mov   bl, [Size]        { Size....                                 }\r
363    shl   bx, 1             { *2 - just 'cause! (I can't remember why!)}\r
364    mul   bx\r
365    mov   bx, ax\r
366 \r
367    mov   ax, [X]\r
368    mov   cx, ax\r
369    shr   ax, 2\r
370    add   bx, ax            { add X val div 4 (four planes)            }\r
371 \r
372    and   cx, 00000011b     { clever way of finding x mod 4, i.e.      }\r
373    mov   dx, 03c4h         { which plane we're in.                    }\r
374    mov   al, 2             { then use 03c4h index 2 - write plane sel.}\r
375    out   dx, al            { to set plane to write to.                }\r
376    mov   al, 1             { plane to write to = 1 shl (X mod 4)      }\r
377    shl   al, cl\r
378    inc   dx\r
379    out   dx, al\r
380 \r
381    mov   ax, 0a000h\r
382    mov   es, ax\r
383    mov   al, [Col]\r
384    mov   es: [bx], al      { then write pixel.                        }\r
385 End;\r
386 \r
387 \r
388 Function GetPixel_C4(X, Y : Integer): Byte; Assembler;\r
389 Asm\r
390    mov   ax, [Y]           { Y val multiplied by...                   }\r
391    xor   bx, bx\r
392    mov   bl, [Size]        { Size....                                 }\r
393    shl   bx, 1             { *2 - just 'cause! (I can't remember why!)}\r
394    mul   bx\r
395    mov   bx, ax\r
396 \r
397    mov   ax, [X]\r
398    mov   cx, ax\r
399    shr   ax, 2\r
400    add   bx, ax            { add X val div 4 (four planes)            }\r
401 \r
402    and   cx, 00000011b     { clever way of finding x mod 4, i.e.      }\r
403    mov   dx, 03c4h         { which plane we're in.                    }\r
404    mov   al, 4h            { then use 03c4h index 4 - read plane sel. }\r
405    out   dx, al            { to set plane to read from.               }\r
406    mov   al, cl            { Plane to read from = X mod 4             }\r
407    inc   dx\r
408    out   dx, al\r
409 \r
410    mov   ax, 0a000h\r
411    mov   es, ax\r
412    mov   al, es: [bx]      { then return pixel read                   }\r
413 End;\r
414 \r
415 \r
416 \r
417 Procedure MoveScr_C4(X,Y : Integer); Assembler;\r
418 Asm\r
419    mov   ax, [Y]           { Y val multiplied by...                   }\r
420    xor   bx, bx\r
421    mov   bl, [Size]        { Size....                                 }\r
422    shl   bx, 1             { *2 - just 'cause! (I can't remember why!)}\r
423    mul   bx\r
424    mov   bx, ax\r
425 \r
426    add   bx, [X]           { Add X val                                }\r
427 \r
428    mov   dx, 03d4h\r
429    mov   al, 0ch           { CRTC address reg.                        }\r
430    out   dx, al            { Start Address High Reg.                  }\r
431    inc   dx\r
432    mov   al, bh            { send high byte of start address.         }\r
433    out   dx, al\r
434 \r
435    dec   dx\r
436    mov   al, 0dh           { Start Address Low Reg.                   }\r
437    out   dx, al\r
438    inc   dx\r
439    mov   al, bl            { send low byte of start address.          }\r
440    out   dx, al\r
441 \r
442 End;\r
443 \r
444 \r
445 Procedure SetText; Assembler;\r
446 Asm\r
447    mov   ax, 0003h\r
448    int   10h\r
449 End;\r
450 \r
451 Procedure Creds;\r
452 Begin\r
453    SetText;\r
454    While KeyPressed do ReadKey;\r
455 \r
456    Asm\r
457       mov   ah, 1\r
458       mov   ch, 1\r
459       mov   cl, 0\r
460       int   10h\r
461    End;\r
462 \r
463    WriteLn('Chain-4 Trainer...');\r
464    WriteLn('By EzE of Asphyxia.');\r
465    WriteLn;\r
466    WriteLn('Contact Us on ...');\r
467    WriteLn;\r
468    WriteLn;\r
469    WriteLn('the Asphyxia BBS (031) - 7655312');\r
470    WriteLn;\r
471    WriteLn('Email :       eze@');\r
472    WriteLn('         asphyxia@');\r
473    WriteLn('          edwards@');\r
474    WriteLn('           bailey@');\r
475    WriteLn('          mcphail@');\r
476    WriteLn('                  beastie.cs.und.ac.za');\r
477    WriteLn;\r
478    WriteLn('or  peter.edwards@datavert.co.za');\r
479    WriteLn;\r
480    WriteLn('Write me snail-mail at...');\r
481    WriteLn('P.O. Box 2313');\r
482    WriteLn('Hillcrest');\r
483    WriteLn('Natal');\r
484    WriteLn('3650');\r
485    Asm\r
486       mov   ah, 1\r
487       mov   ch, 1\r
488       mov   cl, 0\r
489       int   10h\r
490    End;\r
491 \r
492 End;\r
493 \r
494 \r
495 \r
496 \r
497 Begin\r
498    Init_C4;\r
499    Cls_C4;\r
500    Repeat\r
501       Putpixel_C4(Random(320),Random(200),Random(256)+1);\r
502    Until KeyPressed;\r
503    For Loop := 0 to 80 do\r
504    begin\r
505       MoveScr_C4(0,Loop);\r
506       Delay(10);\r
507    End;\r
508    ReadKey;\r
509    Loop := GetPixel_C4(100,100);\r
510    Creds;\r
511    WriteLn('Colour at location X:100, Y:100 was: ',Loop);\r
512 End.\r
513 \r
514 --------------------------------=[ Cut Here ]=-------------------------\r