ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
begin_storage.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 BEGIN STORAGE...END STORAGE
49
50@english
51
52The ''BEGIN STORAGE..END STORAGE'' allows to begin describing
53the content of a storage media. The syntax of this command
54allows to define up to two parameter. The first parameter,
55''name'', refers to the internal name of the storage.
56The ''filename'', optional, will define the file name
57that will contain the "image" of the storage. If omitted,
58the program filename will be used, and an additional incremented
59number will be appended, one for each storage media.
60
61Note that, for some targets, a special toolchain is needed to
62manage this keyword. In particular, for ''cpc'' target you need to
63install and use the correct version of the ''z88dk-appmake'' application.
64Starting from version 1.15.3 of ugBASIC, that is, since
65''BEGIN STORAGE'' was implemented for ''cpc'', it is necessary to use a
66patched version of the z88dk toolchain. The version that can be
67obtained from the official release is not powerful enough to include
68external files in the disk image that is created for that target.
69
70You can find out the empowered version looking for a fork of that project,
71or as a module inside ugBASIC. You should recompile it on a specific branch
72(''ugbasic'' branch, precisely). On ugBASIC website and on the UGBASIC-IDE
73there is a precompiled version from that version, that can be directly
74used.
75
76@italian
77Il comando ''BEGIN STORAGE'' consente di iniziare a descrivere
78il contenuto di un supporto di memorizzazione. La sintassi di
79questo comando consente di definire fino a due parametri. Il
80primo parametro, ''name'', si riferisce al nome interno del
81supporto di memorizzazione. Il comando ''filename'',
82facoltativo, definirà il nome del file che conterrà l'"immagine"
83del supporto di memorizzazione. Se omesso, verrà utilizzato il
84nome del file del programma e verrà aggiunto un numero
85incrementato aggiuntivo, uno per ciascun supporto di
86memorizzazione.
87
88Nota che per alcuni target è necessaria una toolchain speciale per
89gestire questa parola chiave. In particolare, per il target ''cpc'' devi
90installare e usare la versione corretta dell'applicazione ''z88dk-appmake''.
91A partire dalla versione 1.15.3 di ugBASIC, ovvero, poiché
92''BEGIN STORAGE'' è stato implementato per ''cpc'', si deve usare una
93versione patchata della toolchain z88dk. La versione che può essere
94ottenuta dalla release ufficiale non è abbastanza potente da includere
95file esterni nell'immagine disco creata per quel target.
96
97E' possibile trovare la versione migliorata cercando un fork di quel progetto,
98o come modulo all'interno di ugBASIC. Dovresti ricompilarla su un ramo specifico
99(ramo ''ugbasic'', per essere precisi). Sul sito web di ugBASIC e in UGBASIC-IDE
100c'è una versione precompilata di quella versione, che può essere
101utilizzata direttamente.
102
103@syntax BEGIN STORAGE name [AS filename] ... END STORAGE
104@syntax STORAGE name [AS filename] ... END STORAGE
105
106@example BEGIN STORAGE "dischetto"
107@example ...
108@example ENDSTORAGE
109
110@usedInExample storage_example_01.bas
111
112@alias STORAGE...END STORAGE
113
114@target atari c128 c64 c64reu coco coco3 cpc msx1 vic20
115</usermanual> */
116/* <usermanual>
117@keyword STORAGE...END STORAGE
118
119@english
120
121@italian
122
123@syntax STORAGE name [AS filename] .. END STORAGE
124@syntax STORAGE name [AS filename] .. END STORAGE
125
126@example BEGIN STORAGE "dischetto"
127@example ...
128@example ENDSTORAGE
129
130@usedInExample storage_example_01.bas
131
132@alias BEGIN STORAGE...END STORAGE
133
134@target atari
135@target c128
136@target c64
137@target c64reu
138@target coco
139@target coco3
140@target cpc
141@target msx1
142@target pc128op
143@target to8
144@target vic20
145</usermanual> */
146
147void begin_storage( Environment * _environment, char * _name, char * _file_name ) {
148
149 if ( _environment->currentStorage ) {
151 }
152
153 Storage * storage = malloc( sizeof( Storage ) );
154 memset( storage, 0, sizeof ( Storage ) );
155 storage->name = strdup( _name );
156 if ( _file_name ) {
157 storage->fileName = strdup( _file_name );
158 }
159
160 _environment->currentStorage = storage;
161
162}
void begin_storage(Environment *_environment, char *_name, char *_file_name)
Emit code for STORAGE ... ENDSTORAGE.
Storage * currentStorage
Definition ugbc.h:2531
char * fileName
Definition ugbc.h:229
char * name
Definition ugbc.h:226
void * malloc(YYSIZE_T)
struct _Environment Environment
Structure of compilation environment.
struct _Storage Storage
Structure of a single storage.
#define CRITICAL_STORAGE_NESTED_UNSUPPORTED(n)
Definition ugbc.h:3576