Friday, May 1, 2020

CUSTCHAR.P

[Table of Contents]
CUSTCHAR.ATR Disk Image

Kyan Pascal 2.x has a few include files to help you modify the Atari ATASCII character set. Custom character sets can be used for program icons, objects, maps, animations, etc.

Simple Atari BASIC magazine type-in games such as Concentration and Gold Rush! make good use of these custom character sets.

You can use a program such as InstEdit to designed a custom character set. You can use a program such as MapMaker to use a customer character set to design a map.

ATASCII stands for ATARI Standard Code for Information Interchange, or a combination of ATARI ASCII, is the variation on the more general ASCII characters set code.

For reference, here is the standard Atari ATASCII character set:


Characters from 128 to 255 are the inverse video (blue character on white background for example) of characters 0 to 127. Some of the characters don't actually print on the screen by default, but are "control characters". For example, character 125 will clear the screen instead of displaying.

Note that the Atari's standard character set is at address 57344. Kyan Pascal only supports up to a two-byte signed integers (-32,768 to 32,767), so you will need to use a Two’s Complement conversion to reach that address:

  1. Take the number: 57344
  2. Convert the Decimal to Binary: 1110000000000000
  3. Moving from RIGHT to LEFT, flip every bit AFTER the first 1: 0010000000000000
  4. Convert the Binary to Decimal: 8192
  5. Use the negated value: -8192

What's on the disk?


The disk image includes the various Atari DOS 2.5 files, Kyan Pascal Include files, Kyan Pascal Run-time library, and ...


Source Code


PROGRAM CUSTCHAR(INPUT,OUTPUT);
TYPE
#I IOTYPES.I

VAR
   FN    : PATHSTRING;
   ADDR1 : INTEGER;
   ADDR2 : INTEGER;
   I     : INTEGER;

#I LOADCSET.I
#I ACTCSET.I

BEGIN
   (* NORMAL SET AT 57344 *)
   (* OR -8192 IN 2'S COMPLEMENT *)
   ADDR1 := -8192; (* 57344 *)

   (* RANDOM ADDRESS SPACE *)
   ADDR2 := 4000; (* CUSTOM *)

   (* DISPLAY SOME CHARACTERS *)
   WRITELN;
   FOR I := 32 TO 90 DO
      WRITE(CHR(I));
   WRITELN;
   WRITELN;

   WRITE('ENTER FILENAME: ');
   READLN(FN);
   WRITELN;

   (* LOAD FULL SET FROM FILE *)
   LOAD_CHAR_SET(FN,ADDR2);

   (* ACTIVATE CUSTOM SET *)
   ACTIVATE_CHAR_SET(ADDR2);

   READLN;

   (* ACTIVATE NORMAL SET *)
   ACTIVATE_CHAR_SET(ADDR1);

END.


Sample Run




Here are a few more screenshots:


Pascal Program Compiled 


Prompting For Character Set Filename


Custom Character Set Activated


Back To The Standard Character Set

No comments:

Post a Comment