Authors
Publication
Pub Details
Date
Pages
BASIC Terms
First the Colors
I modified Paul Banisik’s “Second display file initialization routine” from the April RAMTOP (1985), and incorporated it into a BASIC program that would poke attribute values into the second display file.
To access this display mode, type “OUT 255,2”.
In this mode, the computer looks at the first display file (D_File_1) for character bytes, which means that all you have to do to print a character on the screen is use a simple “PRINT” statement just as if you were in a regular display mode.
But the computer looks at the second display file (D_FILE_2) for the attributes, which enables you to have 8 colors in one character (don’t forget that display file 2 is set up just like the first display file, 8 bytes per character, or in this case 8 colors per character). Also, don’t forget that all of the attributes have to be POKEd and that the characters can either be printed or POKEd.
Notes: Do not start poking into the second display file until it is CLEARed using Paul’s initialize routine or the system may crash.
When you first enter this display mode and the second display file has been cleared, you will see nothing on the screen because the display, or in this case the attribute file, contains zeros (black ink on black paper).
10 CLEAR 55999: INPUT "Screen color ";s: IF s<0 OR s>255 OR s<>INTO s THEN GO TO 10
20 GO SUB 200: POKE 23624,s: RANDOMIZE USR 56000
30 DIM b(8): FOR a=1 TO 8
40 INPUT "Attribute byte#";(a);" ";b(a): IF b(a)<0 OR b(a)>255 OR b(a)<>INT b(a) THEN GO TO 40
50 NEXT a
60 INPUT "Row ";r: IF r<0 OR r>21 or r<>INT r THEN GO TO 60
70 INPUT "Column ";c: IF c<0 OR c>31 OR c<>INT c THEN GO TO 70
80 INPUT "1character,2bytes to character";ch: IF ch<>1 AND ch<>2 THEN GO TO 80
90 IF ch=1 THEN INPUT "Character ";a$: IF LEN a$<1 THEN GO TO 90
100 IF ch=2 THEN GO SUB 170
110 LET g=INT (r/8): LET rc=(2048*g+((r-(g*))*32))+c
120 OUT 255,2: LET i=1: FOR f=rc+24576 TO rc+24576+1792 STEP 256: POKE f,b(i): LET i=i+1: NEXT f
130 IF ch=1 THEN PRINT AT r,c;a$: GO TO 150
140 LET i=1: FOR f=rc+16384 TO rc+16384+1792 SETP 256: POKE f,h(i): LET i=i+1: NEXT f
150 GO TO 30
170 DIM h(8): FOR a=1 TO 8
180 INPUT "Character bytes#";(a);" ";h(a): IF h(a)<0 OR h(a)>255 OR h(a)<>INT h(a) THEN GO TO 180
190 NEXT a: RETURN
200 RESTORE: FOR a=56000 TO 56034: READ b: POKE a,b: NEXT a: RETURN
210 DATA 62,198,211,255,62,3,211,244,62, 6,205,142,14,62,2,211,255,62,0,211,244: REM Paul's CLEAR second display file routine
220 DATA 33,0,96,54,s,229,209,19,1,255, 23,237,176,201: REM Routine to POKE total second display file with number specified
Now for VAL$
This is really nothing but a string ($) version of VAL. Try this demo program.
10 LET a$="SCREEN$ (0,0)": REM The "SCREEN$" must be the FUNCTION and NOT spelled out
20 PRINT AT 0,0; "A"
30 PRINT a$
40 PRINT VAL$ a$
50 PRINT VAL$ "SCREEN$ (0,0)"
60 PRINT VAL as
The results should be:
A
SCREEN$ (0,0)
A
A
With error code C.
The first “A” is from the first PRINT statement. The “SCREEN$ (0,0) ” is what you get from PRINting the contents of a$.
The next “A” comes from printing the VALS of af or executing a$.
The third “A” comes from executing the literal “SCREENS$ (0,0)” which is equal to the variable a$.
The error code comes from PRINTing the VALue of a$ which doesn’t really have a value in our case but can be only printed or executed.
So if the command has a “$” at the end, you use: VAL$.
If the command does not have the “$”, use VAL.
NOTE: With VAL, you may use any number, a number producing command (within quotes), or a variable. Whereas with the VAL$ function, you may use a plain string variable (within quotes) or a command that does NOT produce a number (within quotes).
Products
Media
Image Gallery
Source Code
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.