Sunday, April 12, 2020

CHNGCOLR.P

[Table of Contents]
CHNGCOLR.P Disk Image

Notes


CHNGCOLR.P is from the Pointers / Using Special Memory Locations section of the Kyan Pascal 2.x User's Manual.

As written, the program runs so fast you can just about see the screen flicker. You could put in a second loop to slow it down.

I fixed a bug in the second to the last line, changing Color^:= Orig to Color^:=Orig^.

I changed the pointers from Integers pointers to Char pointers so that it would work with single byte variables rather than two byte variables.

If you want to display the value in the memory location, you can use the Ord() function, for example, Writeln(Ord(Color^)).

What's on the disk?


The disk image includes the various Atari DOS 2.5 files, Kyan Pascal Include files (none of which are used in this program), Kyan Pascal Run-time library, and ...

CHNGCOLR.P - Source code file
P.OUT - Kyan Pascal intermediate file
CHNGCOLOR - Executable file

Source Code


(* CHNGCOLR.P *)
(* Kyan Pascal 2.x / Atari 8-bit *)

Program CHNGCOLR(Input, Output);
(* Cycle through screen background colors *)

Var
   Color, Orig : ^Char;

Procedure Cycle;
Var
   Loop : Char;

Begin
   For Loop := 0 To 255 Do
      Color^ := Loop
End;

Begin
   Color := Pointer(710);
   Orig^ := Color^;
   Cycle;
   Color^ := Orig^;
End

Sample Run

Screen colors briefly flicker.

No comments:

Post a Comment