ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
copper_color_background.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
46
47 /* <usermanual>
48@keyword COPPER COLOR BACKGROUND
49
50@english
51
52The ''COPPER COLOR BACKGROUND'' command is a fundamental instruction used
53in copper lists to dynamically change the color of the screen background,
54where present. The copper list is a sequence of instructions executed
55synchronized with the raster stream (the monitor's horizontal scanning
56of the screen line).
57
58When a ''COPPER COLOR BACKGROUND'' instruction is encountered in the copper
59list, the processor directly writes the color value to the hardware
60background color register of the target graphics chip (which will vary
61depending on the target computer). This color change occurs
62instantaneously and with pixel-level precision, based on the position
63of the raster beam on the screen at the time the instruction is
64executed.
65
66@italian
67
68Il comando ''COPPER COLOR BACKGROUND'' è un'istruzione fondamentale
69utilizzata nelle copper list per modificare dinamicamente il colore
70del sfondo dello schermo, laddove sia presente. La copper list è una
71sequenza di istruzioni eseguite in modo sincronizzato con il flusso del
72raster (la scansione orizzontale della linea dello schermo da parte
73del monitor).
74
75Quando un'istruzione ''COPPER COLOR BACKGROUND'' viene incontrata nella
76copper list, il processore scrive direttamente il valore del colore
77nel registro hardware del colore del sfondo del chip grafico di
78riferimento (che sarà diverso a seconda del computer target). Questo
79cambiamento di colore avviene istantaneamente e con una precisione al
80singolo pixel, in base alla posizione del raster beam sullo schermo nel
81momento in cui l'istruzione viene eseguita.
82
83@syntax BEGIN COPPER
84@syntax COPPER WAIT LINE 10
85@syntax COPPER COLOR BACKGROUND RED
86@syntax COPPER WAIT LINE 30
87@syntax COPPER COLOR BACKGROUND BLUE
88@syntax END COPPER
89
90@seeAlso BEGIN COPPER...END COPPER
91
92</usermanual> */
93
94void copper_color_background( Environment * _environment, int _color ) {
95
96 if ( !_environment->insideCopperList ) {
98 }
99
101 memset( color, 0, sizeof( CopperInstruction ) );
102
103 color->operation = COP_COLOR_BACKGROUND;
104 color->param1 = _color;
105
106 if ( _environment->copperList->first ) {
107 CopperInstruction * actual = _environment->copperList->first;
108 while( actual->next ) {
109 actual = actual->next;
110 }
111 actual->next = color;
112 } else {
113 _environment->copperList->first = color;
114 }
115
116}
void color(Environment *_environment, int _index, int _shade)
Emit ASM code for instruction COLOR [int], [int].
Definition color.c:59
void copper_color_background(Environment *_environment, int _color)
Emit code for BEGIN COPPER.
struct _CopperInstruction * next
Definition ugbc.h:2246
struct _CopperInstruction * first
Definition ugbc.h:2254
CopperList * copperList
Definition ugbc.h:3282
int insideCopperList
Definition ugbc.h:3280
void * malloc(YYSIZE_T)
@ COP_COLOR_BACKGROUND
Definition ugbc.h:2236
struct _Environment Environment
Structure of compilation environment.
#define CRITICAL_COPPER_LIST_NOT_OPENED()
Definition ugbc.h:3841
struct _CopperInstruction CopperInstruction