ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
flip_image.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
41extern char DATATYPE_AS_STRING[][16];
42
51/* <usermanual>
52@keyword FLIP IMAGE
53@target cocob
54</usermanual> */
55void flip_image_vars( Environment * _environment, char * _image, char * _frame, char * _sequence, char * _direction ) {
56
57 if ( _environment->emptyProcedure ) {
58 return;
59 }
60
61 Variable * image = variable_retrieve( _environment, _image );
62
63 if ( image->bankAssigned != -1 ) {
65 }
66
67 Resource * resource = build_resource_for_sequence( _environment, _image, _frame, _sequence );
68
69 Variable * frame = NULL;
70 if ( _frame) {
71 frame = variable_retrieve_or_define( _environment, _frame, VT_BYTE, 0 );
72 }
73 Variable * sequence = NULL;
74 if ( _sequence) {
75 sequence = variable_retrieve_or_define( _environment, _sequence, VT_BYTE, 0 );
76 }
77
78 switch( resource->type ) {
79 case VT_SEQUENCE:
80 if ( !sequence ) {
81 if ( !frame ) {
82 c6847b_flip_image( _environment, resource, "", "", image->frameSize, image->frameCount, _direction );
83 } else {
84 c6847b_flip_image( _environment, resource, "", frame->realName, image->frameSize, image->frameCount, _direction );
85 }
86 } else {
87 if ( !frame ) {
88 c6847b_flip_image( _environment, resource, "", sequence->realName, image->frameSize, image->frameCount, _direction );
89 } else {
90 c6847b_flip_image( _environment, resource, frame->realName, sequence->realName, image->frameSize, image->frameCount, _direction );
91 }
92 }
93 break;
94 case VT_IMAGES:
95 if ( !frame ) {
96 c6847b_flip_image( _environment, resource, "", NULL, image->frameSize, 0, _direction );
97 } else {
98 c6847b_flip_image( _environment, resource, frame->realName, NULL, image->frameSize, 0, _direction );
99 }
100 break;
101 case VT_IMAGE:
102 case VT_TARRAY:
103 c6847b_flip_image( _environment, resource, NULL, NULL, 0, 0, _direction );
104 break;
105 default:
107 }
108
109
110}
void c6847b_flip_image(Environment *_environment, Resource *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_direction)
Definition 6847b.c:2068
Variable * variable_retrieve(Environment *_environment, char *_name)
Variable * variable_retrieve_or_define(Environment *_environment, char *_name, VariableType _type, int _value)
Resource * build_resource_for_sequence(Environment *_environment, char *_image, char *_frame, char *_sequence)
void flip_image_vars(Environment *_environment, char *_image, char *_frame, char *_sequence, char *_direction)
Emit ASM code for FLIP IMAGE X/Y/XY/YX [image].
Definition flip_image.c:56
int emptyProcedure
Definition ugbc.h:2932
VariableType type
Definition ugbc.h:559
int bankAssigned
Definition ugbc.h:1172
VariableType type
Definition ugbc.h:988
int frameSize
Definition ugbc.h:1134
int frameCount
Definition ugbc.h:1137
char * realName
Definition ugbc.h:982
struct _Resource Resource
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
@ VT_TARRAY
Definition ugbc.h:480
@ VT_BYTE
Definition ugbc.h:450
@ VT_IMAGES
Definition ugbc.h:495
@ VT_IMAGE
Definition ugbc.h:489
@ VT_SEQUENCE
Definition ugbc.h:513
#define CRITICAL_CANNOT_FLIP_BANKED_IMAGE(v)
Definition ugbc.h:3724
#define CRITICAL_FLIP_IMAGE_UNSUPPORTED(v, t)
Definition ugbc.h:3723
char DATATYPE_AS_STRING[][16]