GRAPHIC

From C64-Wiki
Jump to navigationJump to search
Stub This article is very short and not very detailed. Please help to improve it.
BASIC keyword
Keyword: GRAPHIC
Abbreviation: gR or gR cL
Type: Command
Token code: $de (222)
Handling routine
in BASIC ROM:
List of all BASIC keywords


Remark: This article describes the BASIC command GRAPHIC in Commodore BASIC V3.5.

Type: Command
General Programming-Syntax: GRAPHIC <mode>[,<clear>[,<text>]] or GRAPHIC CLR

The command GRAPHIC the corresponding graphics or text mode is set. In the case of a graphics mode a part of the free BASIC RAM is reserved for graphics use. This is about 10 KByte. With the C128 and Plus/4 here the BASIC program beginning is shifted upward, while with the C16/116 it is shortened because of the small working memory.

For the parameter Mode the following values are allowed:

  • 0 : Text mode with 40 characters per line.
  • 1 : high resolution graphics (320×200 pixels)
  • 2 : high resolution graphic mixed with text (split screen).
  • 3 : multicolor graphic (160×200 pixels)
  • 4 : Multicolor graphic mixed with text (split screen).
  • 5 : Text mode with 80 characters per line (not for C16/C116 and Plus/4, but only for C128!).

The parameter Clear (0 or 1) specifies whether the graphic modes 1 to 4 are cleared when called with the value 1. With the mixed modes 2 and 4 also the text area is deleted.

Only BASIC 7.0: The text line parameter (0 to 25) determines, for mixed graphics modes 2 and 4, how many screen lines are devoted to the graphic relative to the text mode.

The default is 20 screen lines, which is invariant for the C16/116 and Plus/4. With 0 the screen has no graphics, with 25 no text lines.

In contrast to switching to text mode with GRAPHIC 0, only a GRAPHIC CLR achieves that additionally also the reserved graphics area is cleared and reallocated to the free BASIC RAM.
BASIC 3.5 bug: GRAPHIC CLR forgets to copy the BASIC memory back down at 32 KByte. However, the next GRAPHIC 1 puts it back on top, which eventually causes an overflow into the TED registers and the Zeropage.

Values other than those specified for Mode and Delete, or for values for Textline outside the allowed range, will cause an error message to be displayed ?ILLEGAL QUANTITY ERROR.

The current graphics mode can be determined from a program using the RGR function. However, if you are in 80-character mode by default, you will sometimes get an ?legal quality error.

Attention by using VERIFY or DVERIFY: On those computers, where the BASIC program is moved with active graphics, the program, which is identical in itself, can nevertheless differ from the one in memory, depending on whether it was saved with or without activated graphics (since in the BASIC code the line link addresses are contained as absolute memory addresses and differ depending on the position of the program). So one must take care to save and compare the program with identical graphics constellation.

Examples

GRAPHIC 1

The hires graphic mode is activated.

GRAPHIC 2, 1

The mixed text mode (with 5 coloumns) and hires graphic mode is activated and the screen is deleting.


BASIC V3.5 Commands

ABS | ASC | ATN | AUTO | BACKUP | BOX | CHAR | CHR$ | CIRCLE | CLOSE | CLR | CMD | COLLECT | COLOR | CONT | COPY | COS | DATA | DEC | DEF | DELETE | DIM | DIRECTORY | DLOAD | DO | DRAW | DS | DS$ | DSAVE | END | EL | ELSE | ER | ERR$ | EXIT | EXP | FN | FOR | FRE | GET | GET# | GETKEY | GOSUB | GOTO | GRAPHIC | GSHAPE | HEADER | HELP | HEX$ | IF | INPUT | INPUT# | INSTR | INT | JOY | KEY | LEFT$ | LEN | LET | LIST | LOAD | LOCATE | LOG | LOOP | MID$ | MONITOR | NEW | NEXT | ON | OPEN | PAINT | PEEK | POKE | POS | PRINT | PRINT USING | PRINT# | PUDEF | RCLR | RDOT | READ | REM | RENAME | RENUMBER | RESTORE | RESUME | RETURN | RGR | RIGHT$ | RLUM | RND | RUN | SAVE | SCALE | SCNCLR | SCRATCH | SGN | SIN | SOUND | SPC | SQR | SSHAPE | STOP | STR$ | SYS | TAB | TAN | TRAP | TROFF | TRON | UNTIL | USR | VAL | VERIFY | VOL | WHILE | WAIT