ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
bank_uncompress.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
48void bank_uncompress_semi_var( Environment * _environment, int _bank, int _address1, char * _address2 ) {
49
50 deploy_preferred( duff, src_hw_6809_msc1_asm );
51 deploy_preferred( msc1, src_hw_6809_msc1_asm );
52 deploy_preferred( bank, src_hw_to8_bank_asm );
53
54 int realAddress = _address1;
55
56 // outline0("; bank uncompress (1)")
57 // Variable * previous = bank_get( _environment );
58 // bank_set( _environment, _bank );
59 // int realAddress = 0xa000 + _address1;
60 // char realAddressAsString[MAX_TEMPORARY_STORAGE];
61 // sprintf(realAddressAsString, "$%4.4x", realAddress);
62 // cpu_msc1_uncompress_direct_direct( _environment, realAddressAsString, _address2 );
63 // bank_set_var( _environment, previous->name );
64 // outline0("; end bank uncompress (1)")
65
66 outline0("; bank uncompress")
67 outline1("LDB #$%2.2x", _bank );
68 outline1("LDX #$%4.4x", realAddress );
69 outline1("LDY #%s", _address2 );
70 outline0("JSR BANKUNCOMPRESS");
71 outline0("; end bank uncompress");
72
73}
74
86void bank_uncompress_vars( Environment * _environment, char * _bank, char * _address1, char * _address2 ) {
87
88 deploy_preferred( duff, src_hw_6809_msc1_asm );
89 deploy_preferred( msc1, src_hw_6809_msc1_asm );
90 deploy_preferred( bank, src_hw_to8_bank_asm );
91
92 Variable * bankAddress = bank_get_address_var( _environment, _bank );
93 Variable * address1 = variable_retrieve_or_define( _environment, _address1, VT_ADDRESS, 0 );
94 Variable * realAddress = variable_add( _environment, bankAddress->name, address1->name );
95 Variable * address2 = variable_retrieve_or_define( _environment, _address2, VT_ADDRESS, 0 );
96
97 // outline0("; bank uncompress (2)")
98 // Variable * previous = bank_get( _environment );
99 // bank_set_var( _environment, _bank );
100 // Variable * bankAddress = bank_get_address_var( _environment, _bank );
101 // Variable * address1 = variable_retrieve_or_define( _environment, _address1, VT_ADDRESS, 0 );
102 // Variable * realAddress = variable_add( _environment, bankAddress->name, address1->name );
103 // Variable * address2 = variable_retrieve_or_define( _environment, _address2, VT_ADDRESS, 0 );
104 // cpu_msc1_uncompress_indirect_indirect( _environment, realAddress->name, address2->name );
105 // bank_set_var( _environment, previous->name );
106 // outline0("; end bank uncompress (2)")
107
108 outline0("; bank uncompress")
109 outline1("LDB #$%2.2x", _bank );
110 outline1("LDX %s", realAddress->realName );
111 outline1("LDY #%s", address2->realName );
112 outline0("JSR BANKUNCOMPRESS");
113 outline0("; end bank uncompress");
114
115}
Variable * variable_add(Environment *_environment, char *_source, char *_destination)
Add two variable and return the sum of them.
Variable * variable_retrieve_or_define(Environment *_environment, char *_name, VariableType _type, int _value)
Variable * bank_get_address_var(Environment *_environment, char *_bank)
Emit ASM code for instruction = BANK ADDRESS( ).
void bank_uncompress_vars(Environment *_environment, char *_bank, char *_address1, char *_address2)
Emit ASM code for instruction BANK UNCOMPRESS ....
void bank_uncompress_semi_var(Environment *_environment, int _bank, int _address1, char *_address2)
Emit ASM code for instruction BANK UNCOMPRESS ....
char * name
Definition ugbc.h:979
char * realName
Definition ugbc.h:982
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
@ VT_ADDRESS
Definition ugbc.h:465
#define deploy_preferred(s, e)
Definition ugbc.h:4299
#define outline0(s)
Definition ugbc.h:4252
#define outline1(s, a)
Definition ugbc.h:4253