ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
flash.c
Go to the documentation of this file.
1/*****************************************************************************
2 * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
3 *****************************************************************************
4 * Copyright 2021-2024 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
25 * Se non richiesto dalla legislazione vigente o concordato per iscritto,
26 * il software distribuito nei termini della Licenza è distribuito
27 * "COSÌ COM'È", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
28 * implicite. Consultare la Licenza per il testo specifico che regola le
29 * autorizzazioni e le limitazioni previste dalla medesima.
30 ****************************************************************************/
31
32/****************************************************************************
33 * INCLUDE SECTION
34 ****************************************************************************/
35
36#include "../../../ugbc.h"
37
38/****************************************************************************
39 * CODE SECTION
40 ****************************************************************************/
41
42#if defined(__atari__) || defined(__atarixl__)
43
44void flash( Environment * _environment, char * _index, char * _register ) {
45
46 Variable * idx = variable_retrieve_or_define( _environment, _index, VT_BYTE, 0 );
47 Variable * reg = NULL;
48 if ( _register ) {
49 reg = variable_retrieve_or_define( _environment, _register, VT_ADDRESS, 0xd021 );
50 }
51
52 gtia_flash_begin( _environment, idx->realName, reg!=NULL?reg->realName:NULL );
53
54 int i = 0;
55
56 while( i < _environment->flashVarsIndex ) {
57 Variable * timer = variable_retrieve_or_define( _environment, _environment->flashVars[i], VT_BYTE, 0 );
58 ++i;
59 if ( !timer ) {
60 break;
61 }
62 Variable * color = variable_retrieve_or_define( _environment, _environment->flashVars[i], VT_COLOR, COLOR_BLACK );
63 if ( !color ) {
64 break;
65 }
66 ++i;
67 gtia_flash_register( _environment, idx->realName, timer->realName, color->realName );
68 }
69
70 gtia_flash_end( _environment );
71
72}
73
74void flash_off( Environment * _environment, char * _index ) {
75
76 Variable * idx = variable_retrieve_or_define( _environment, _index, VT_BYTE, 0 );
77
78 gtia_flash_off( _environment, idx->realName );
79
80}
81
82#endif
#define COLOR_BLACK
Definition 6847.h:36
Variable * variable_retrieve_or_define(Environment *_environment, char *_name, VariableType _type, int _value)
void color(Environment *_environment, int _index, int _shade)
Emit ASM code for instruction COLOR [int], [int].
Definition color.c:59
void flash(Environment *_environment, char *_index, char *_register)
Definition flash.c:44
void flash_off(Environment *_environment, char *_index)
Definition flash.c:48
void gtia_flash_begin(Environment *_environment, char *_index, char *_register)
Definition gtia.c:3917
void gtia_flash_end(Environment *_environment)
Definition gtia.c:3952
void gtia_flash_register(Environment *_environment, char *_index, char *_timer, char *_color)
Definition gtia.c:3941
void gtia_flash_off(Environment *_environment, char *_index)
Definition gtia.c:3960
char * flashVars[128]
Definition ugbc.h:3284
char * realName
Definition ugbc.h:982
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
@ VT_BYTE
Definition ugbc.h:450
@ VT_ADDRESS
Definition ugbc.h:465
@ VT_COLOR
Definition ugbc.h:471