ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
cls.c
Go to the documentation of this file.
1/*****************************************************************************
2 * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
3 *****************************************************************************
4 * Copyright 2021-2026 Marco Spedaletti (asimov@mclink.it)
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *----------------------------------------------------------------------------
18 * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
19 * (la "Licenza"); è proibito usare questo file se non in conformità alla
20 * Licenza. Una copia della Licenza è disponibile all'indirizzo:
21 *
22 * http://www.apache.org/licenses/LICENSE-2.0
23 *
24 * Se non richiesto dalla legislazione vigente o concordato per iscritto,
25 * il software distribuito nei termini della Licenza è distribuito
26 * "COSÌ COM'È", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
27 * implicite. Consultare la Licenza per il testo specifico che regola le
28 * autorizzazioni e le limitazioni previste dalla medesima.
29 ****************************************************************************/
30
31/****************************************************************************
32 * INCLUDE SECTION
33 ****************************************************************************/
34
35#include "../../ugbc.h"
36
37/****************************************************************************
38 * CODE SECTION
39 ****************************************************************************/
40
47/* <usermanual>
48@keyword CLS
49
50@english
51
52The ''CLS'' command is used to clear the screen and return the cursor to the
53upper left corner. In other words, ''CLS'' clears the screen, eliminating
54everything that was previously printed.
55
56Before printing new data to the screen, it is often useful to use ''CLS'' to
57have a clean and tidy space. In combination with other instructions,
58''CLS'' can be used to create simple animations by erasing and redrawing
59elements on the screen. It allows you to update the user interface without
60leaving traces of previous operations.
61
62The CLS command is generally very fast to execute and can also be used
63in graphics mode to clear the entire drawing area. It also has
64the ability to set a default background color, if possible. The clearing
65occurs with respect to the selected mode, so it will be a "pixel by pixel"
66clearing (if in bitmap mode) or "tile by tile" (if in tile mode). In the
67second case, the value of the ''EMPTYTILE'' variable will be used,
68possibly overridden.
69
70In the case of a graphical erasure, you can also indicate the coordinate
71from which to start erasing the screen as well as the size of the erasure
72(in terms of width and height). Particular attention must be paid to the
73fact that these metrics are relative to the limits of the underlying hardware:
74therefore, if a byte contains for example 4 pixels, the coordinates and
75dimensions will be "modulo 4".
76
77@italian
78
79Il comando ''CLS'' viene utilizzato per cancellare lo schermo e riportare
80il cursore nell'angolo in alto a sinistra. In altre parole, ''CLS'' cancella
81lo schermo, eliminando tutto ciò che era stato stampato in precedenza.
82
83Prima di stampare nuovi dati sullo schermo, è spesso utile usare ''CLS''
84per avere uno spazio pulito e ordinato. In combinazione con altre istruzioni,
85''CLS'' può essere utilizzato per creare semplici animazioni cancellando e
86ridisegnando elementi sullo schermo. Consente di aggiornare l'interfaccia
87utente senza lasciare tracce delle operazioni precedenti.
88
89Il comando CLS è generalmente molto veloce da eseguire e può essere
90utilizzato anche in modalità grafica per cancellare l'intera area di
91disegno. Ha anche la possibilità di impostare un colore di sfondo predefinito,
92se possibile. La cancellazione avviene rispetto alla modalità selezionata,
93quindi sarà una cancellazione "pixel per pixel" (se in modalità bitmap) o
94"tile per tile" (se in modalità tile). Nel secondo caso, verrà utilizzato
95il valore della variabile ''EMPTYTILE'', eventualmente sovrascritto
96
97Nel caso di una cancellazione in modalità grafica, è possibile indicare
98anche la coordinata da cui partire per cancellare lo schermo nonché la
99dimensione della cancellazione (in termini di larghezza e altezza).
100Particolare attenzione si deve porre sul fatto che tali metriche sono
101relative ai limiti dell'hardware sottostante: quindi, se un byte contiene
102ad esempio 4 pixel, le coordinate e le dimensioni saranno "modulo 4".
103
104@syntax CLS
105@syntax CLS color
106@syntax CLS x, y, w, h
107
108@example CLS
109@example CLS WHITE
110@example CLS 100, 100, 8, 8
111
112@usedInExample texts_position_01.bas
113@usedInExample texts_position_02.bas
114
115@target all
116@alias PCLS
117</usermanual> */
118
119/* <usermanual>
120@keyword PCLS
121@alias CLS
122</usermanual> */
123
124void cls( Environment * _environment, char * _paper ) {
125
126 if ( _paper ) {
127 paper( _environment, _paper );
128 }
129
130 vic2_cls( _environment );
131
132}
133
void cls(Environment *_environment, char *_paper)
Emit code for CLS.
Definition cls.c:48
void paper(Environment *_environment, char *_color)
Emit code for PAPER ... command.
Definition paper.c:47
struct _Environment Environment
Structure of compilation environment.
void vic2_cls(Environment *_environment)
Definition vic2.c:2085