ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
next_animation.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 NEXT ANIMATION
49
50@english
51
52This command can be used to stop the execution of the central part of an animation,
53and therefore go to the possible "ease out" and execute the next animation, if present.
54
55@italian
56
57Questo comando può essere utilizzato per interrompere l'esecuzione della parte centrale
58di una animazione, e portarsi quindi nell'eventuale "ease out" nonché eseguire l'animazione
59successiva, se presente.
60
61@syntax NEXT ANIMATION prefix
62
63@example NEXT ANIMATION airplane
64
65</usermanual> */
66void next_animation( Environment * _environment, char * _prefix ) {
67
69
70 char prefixAnimation[MAX_TEMPORARY_STORAGE]; sprintf( prefixAnimation, "%sAnimation", _prefix );
71 char prefixNext[MAX_TEMPORARY_STORAGE]; sprintf( prefixNext, "%sNext", _prefix );
72
73 if ( ! variable_exists( _environment, prefixAnimation ) ) {
75 }
76
77 if ( ! variable_exists( _environment, prefixNext ) ) {
79 }
80
81 Variable * prefixAnimationVar = variable_retrieve( _environment, prefixAnimation );
82
83 if ( prefixAnimationVar->type != VT_THREAD ) {
85 }
86
87 char doneLabel[MAX_TEMPORARY_STORAGE]; sprintf( doneLabel, "%sDone", label );
88
89 Variable * prefixNextVar = variable_retrieve( _environment, prefixNext );
90
91 cpu_or_8bit_const( _environment, prefixNextVar->realName, 0x80, prefixNextVar->realName );
92
93 begin_loop( _environment, 1 );
95 variable_and_const( _environment, prefixNextVar->name, 0x02)->name, 0x02, doneLabel, 1 );
96 run_parallel( _environment );
97 end_loop( _environment, 1 );
98
99 cpu_label( _environment, doneLabel );
100
101}
102
void cpu_label(Environment *_environment, char *_label)
Definition 6309.c:356
void cpu_or_8bit_const(Environment *_environment, char *_left, int _right, char *_result)
Definition 6309.c:4306
Variable * variable_retrieve(Environment *_environment, char *_name)
int variable_exists(Environment *_environment, char *_name)
void variable_compare_and_branch_const(Environment *_environment, char *_source, int _destination, char *_name, int _positive)
Variable * variable_and_const(Environment *_environment, char *_destination, int _mask)
Calculate "and" mask for a variable and it as the result.
void begin_loop(Environment *_environment, int _do)
Emit ASM code for DO ....
Definition begin_loop.c:49
void end_loop(Environment *_environment, int _do)
Emit ASM code for ... LOOP.
Definition end_loop.c:49
void next_animation(Environment *_environment, char *_prefix)
Emit code for KILL ....
void run_parallel(Environment *_environment)
Emit code for RUN PARALLEL.
char * name
Definition ugbc.h:979
VariableType type
Definition ugbc.h:988
char * realName
Definition ugbc.h:982
#define MAX_TEMPORARY_STORAGE
Definition ugbc.h:563
struct _Variable Variable
Structure of a single variable.
#define CRITICAL_CANNOT_USE_NEXT_ANIMATION_WITHOUT_ANIMATION(n)
Definition ugbc.h:3776
struct _Environment Environment
Structure of compilation environment.
@ VT_THREAD
Definition ugbc.h:492
#define MAKE_LABEL
Definition ugbc.h:3351