ugBASIC
1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
chain.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
#include "
../../libs/msc1.h
"
37
38
/****************************************************************************
39
* CODE SECTION
40
****************************************************************************/
41
42
/* <usermanual>
43
@keyword CHAIN
44
45
@english
46
47
The ''CHAIN'' command is a powerful tool used to load and execute another ugBASIC
48
program from mass storage (such as a floppy disk), terminating the current program.
49
This feature is useful on computers with limited memory, as it allows large
50
applications to be broken down into smaller, more manageable modules or programs
51
that can be "chained" together. Using ''CHAIN'' allows you to create complex
52
programs that would otherwise not fit entirely into the available RAM.
53
54
The ''CHAIN'' command syntax requires a ''filename'', which should represent the binary
55
file located on the mass storage device. It is therefore not the name of the BASIC source
56
file. When this instruction is executed, the current program is overwritten with the
57
loaded one and executed from the beginning.
58
59
Therefore, the ugBASIC program to be called with the ''CHAIN'' command must first be
60
compiled into the specified binary format. Only then should this compiled file be
61
inserted into the ''STORAGE'' definition, and the symbolic name can be used to
62
load the program.
63
64
Finally, it is important to note that the program to be loaded must also use the
65
''CHAIN'' command or, alternatively, use the ''DEFINE CHAIN'' directive at the
66
head of the program.
67
68
@italian
69
70
Il comando ''CHAIN'' è un potente strumento utilizzato per caricare ed eseguire un
71
altro programma ugBASIC dalla memoria di massa (come un disco floppy), terminando
72
l'esecuzione del programma corrente. Questa funzionalità è utile nei computer con
73
memoria limitata, in quanto consente di suddividere grandi applicazioni in moduli
74
o programmi più piccoli e gestibili, che potevano essere "incatenati" tra loro.
75
L'uso di ''CHAIN'' permette di creare programmi complessi che non avrebbero potuto
76
essere caricati interamente nella RAM disponibile.
77
78
La sintassi del comando ''CHAIN'' prevede un ''filename'', che dovrebbe rappresentare
79
il file binario che si trova sul sistema di memorizzazione di massa. Non è, quindi,
80
il nome del file BASIC. Quando questa istruzione viene eseguita, il programma
81
corrente viene sovrascritto con quello caricato, e viene eseguito dall'inizio.
82
83
Ne consegue che il programma BASIC da richiamare con il comando ''CHAIN'' va, prima
84
di tutto, compilato nel formato binario specifico. Solo in seguito tale file
85
compilato andrà inserito all'interno della definizione dello STORAGE, e il nome
86
simbolico potrà essere utilizzato per caricare il programma.
87
88
E' importante, infine, notare che il programma che andrà caricato dovrà utilizzare
89
anch'esso il comando ''CHAIN'' oppure, in alternativa, usare la direttiva
90
''DEFINE CHAIN'' in testa al programma.
91
92
@syntax CHAIN filename
93
94
@example CHAIN "t1"
95
96
@target atari
97
@target c64
98
@target c128
99
@target cpc
100
</usermanual> */
101
void
chain
(
Environment
* _environment,
char
* _filename ) {
102
103
if
( _environment->
emptyProcedure
) {
104
return
;
105
}
106
107
atari_chain
( _environment, _filename );
108
109
}
chain
void chain(Environment *_environment, char *_filename)
Definition
chain.c:101
atari_chain
void atari_chain(Environment *_environment, char *_filename)
Definition
atari.c:1255
msc1.h
_Environment::emptyProcedure
int emptyProcedure
Definition
ugbc.h:2932
ugbc.h
Environment
struct _Environment Environment
Structure of compilation environment.
Z:
ugbasic
ugbc
src
targets
atarixl
chain.c
Generated by
1.16.1