ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
dojo_get_message_inplace.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 extern char DATATYPE_AS_STRING[][16];
38
39 void dojo_get_message_inplace( Environment * _environment, char * _port, char * _channel, char * _variable ) {
40
42
43 Variable * port = variable_retrieve_or_define( _environment, _port, VT_BYTE, 0 );
44 Variable * channel = NULL;
45 if ( _channel ) {
46 channel = variable_retrieve_or_define( _environment, _channel, VT_BYTE, 0 );
47 }
48 Variable * result = variable_retrieve( _environment, _variable );
49 Variable * size = variable_temporary( _environment, VT_BYTE, "(size)");
50 Variable * address = variable_temporary( _environment, VT_ADDRESS, "(size)");
51 Variable * esito = variable_temporary( _environment, VT_BYTE, "(result)");
52
53 cpu_addressof_16bit( _environment, result->realName, address->realName );
54
55 if ( port->type != VT_DOJOKA ) {
57 }
58
59 dojo_begin( _environment );
60 dojo_put_requestds( _environment, DOJO_CMD_SELECT_PORT, NULL, NULL, port->realName, 4, esito->realName );
61 cpu_compare_and_branch_8bit_const( _environment, esito->realName, 0, label, 0 );
62 dojo_put_request0( _environment, DOJO_CMD_GET_MESSAGE, channel ? channel->realName : NULL, NULL, esito->realName );
63 cpu_compare_and_branch_8bit_const( _environment, esito->realName, 0, label, 0 );
64 dojo_partial( _environment );
65 dojo_get_response_size( _environment, esito->realName, size->realName );
66 dojo_get_response_payload( _environment, address->realName );
67 dojo_end( _environment );
68
69 cpu_label( _environment, label );
70
71 cpu_move_8bit( _environment, esito->realName, "DOJOERROR" );
72
73}
74
void cpu_addressof_16bit(Environment *_environment, char *_source, char *_destination)
Definition 6309.c:1485
void cpu_label(Environment *_environment, char *_label)
Definition 6309.c:356
void cpu_move_8bit(Environment *_environment, char *_source, char *_destination)
CPU 6309: emit code to move 8 bit
Definition 6309.c:743
void cpu_compare_and_branch_8bit_const(Environment *_environment, char *_source, int _destination, char *_label, int _positive)
CPU 6309: emit code to compare two 8 bit values and jump if they are equal/different
Definition 6309.c:876
Variable * variable_retrieve(Environment *_environment, char *_name)
Variable * variable_retrieve_or_define(Environment *_environment, char *_name, VariableType _type, int _value)
Variable * variable_temporary(Environment *_environment, VariableType _type, char *_meaning)
Define a temporary variable.
int size
Definition _optimizer.c:678
void dojo_put_request0(Environment *_environment, int _command, char *_param1, char *_param2, char *_result)
Definition dojo.c:63
void dojo_partial(Environment *_environment)
Definition dojo.c:103
void dojo_end(Environment *_environment)
Definition dojo.c:173
void dojo_put_requestds(Environment *_environment, int _command, char *_param1, char *_param2, char *_data, int _size, char *_result)
Definition dojo.c:93
void dojo_begin(Environment *_environment)
Definition dojo.c:53
void dojo_get_response_size(Environment *_environment, char *_status, char *_size)
Definition dojo.c:143
void dojo_get_response_payload(Environment *_environment, char *_address)
Definition dojo.c:153
void dojo_get_message_inplace(Environment *_environment, char *_port, char *_channel, char *_variable)
char * realName
Definition ugbc.h:982
struct _Variable Variable
Structure of a single variable.
#define DOJO_CMD_GET_MESSAGE
Definition ugbc.h:4736
struct _Environment Environment
Structure of compilation environment.
@ VT_DOJOKA
Definition ugbc.h:534
@ VT_BYTE
Definition ugbc.h:450
@ VT_ADDRESS
Definition ugbc.h:465
#define DOJO_PEEK_MESSAGE_DOJOKA_REQUIRED(v, t)
Definition ugbc.h:3818
#define DOJO_CMD_SELECT_PORT
Definition ugbc.h:4733
#define MAKE_LABEL
Definition ugbc.h:3351
char DATATYPE_AS_STRING[][16]