ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
pccga.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 <math.h>
37
38static RGBi SYSTEM_PALETTE[] = {
39 { 0x00, 0x00, 0x00, 0xff, 0, "BLACK" },
40 { 0x00, 0x00, 0xff, 0xff, 1, "BLUE" },
41 { 0x88, 0x00, 0x00, 0xff, 2, "RED" },
42 { 0xff, 0x00, 0xff, 0xff, 3, "MAGENTA" },
43 { 0x00, 0xcc, 0x00, 0xff, 4, "GREEN" },
44 { 0xaa, 0xff, 0xe6, 0xff, 5, "CYAN" },
45 { 0xee, 0xee, 0x77, 0xff, 6, "YELLOW" },
46 { 0xff, 0xff, 0xff, 0xff, 7, "WHITE" }
47};
48
49/****************************************************************************
50 * CODE SECTION
51 ****************************************************************************/
52
53#ifdef __pccga__
54
55void pccga_inkey( Environment * _environment, char * _pressed, char * _key ) {
56
57 _environment->bitmaskNeeded = 1;
58
59 deploy( keyboard, src_hw_pccga_keyboard_asm);
60
61 outline0("CALL INKEY");
62 outline1("MOV [%s], AL", _key);
63 outline1("MOV [%s], BL", _pressed);
64
65}
66
67void pccga_wait_key( Environment * _environment, int _release ) {
68
69 _environment->bitmaskNeeded = 1;
70
71 deploy_deferred( keyboard, src_hw_pccga_keyboard_asm );
72
73 if ( _release ) {
74 outline0("CALL WAITKEYRELEASE");
75 } else {
76 outline0("CALL WAITKEY");
77 }
78
79}
80
81
82void pccga_wait_key_or_fire( Environment * _environment, int _port, int _release ) {
83
84}
85
86void pccga_wait_key_or_fire_semivar( Environment * _environment, char * _port, int _release ) {
87
88}
89
90void pccga_wait_fire( Environment * _environment, int _port, int _release ) {
91
92}
93
94void pccga_wait_fire_semivar( Environment * _environment, char * _port, int _release ) {
95
96}
97
98void pccga_scancode( Environment * _environment, char * _scancode ) {
99
100 _environment->bitmaskNeeded = 1;
101
102 deploy( keyboard, src_hw_pccga_keyboard_asm);
103
104 outline0("CALL SCANCODE");
105 outline1("MOV [%s], AL", _scancode);
106
107}
108
109void pccga_asciicode( Environment * _environment, char * _result ) {
110
111 deploy( keyboard, src_hw_pccga_keyboard_asm);
112
113 outline0("CALL ASCIICODE");
114 outline1("MOV [%s], AL", _result);
115
116}
117
118void pccga_key_pressed( Environment * _environment, char *_scancode, char * _result ) {
119
120 _environment->bitmaskNeeded = 1;
121
123
124 deploy( keyboard, src_hw_pccga_keyboard_asm );
125
126 outline1("MOV AL, [%s]", _scancode);
127 outline0("CALL KEYPRESSED");
128 cpu_ctoa( _environment );
129 outline1("MOV [%s], AL", _result);
130
131}
132
133void pccga_key_state( Environment * _environment, char *_scancode, char * _result ) {
134
135 _environment->bitmaskNeeded = 1;
136
138
139 deploy( keyboard, src_hw_pccga_keyboard_asm );
140
141 outline1("MOV AL, [%s]", _scancode);
142 outline0("CALL KEYSTATE");
143 cpu_ctoa( _environment );
144 outline1("MOV [%s], AL", _result);
145
146}
147
148void pccga_scanshift( Environment * _environment, char * _shifts ) {
149
150}
151
152void pccga_keyshift( Environment * _environment, char * _shifts ) {
153
154}
155
156void pccga_clear_key( Environment * _environment ) {
157
158}
159
160void pccga_joy_vars( Environment * _environment, char * _port, char * _value ) {
161
162}
163
164void pccga_joy( Environment * _environment, int _port, char * _value ) {
165
166}
167
168void pccga_sys_call( Environment * _environment, int _destination ) {
169
170}
171
172void pccga_timer_set_status_on( Environment * _environment, char * _timer ) {
173
174 deploy( timer, src_hw_8086_timer_asm);
175
176 if ( _timer ) {
177 outline1("MOV BL, [%s]", _timer );
178 } else {
179 outline0("MOV BL, 0" );
180 }
181 outline0("MOV CL, 1" );
182 outline0("CALL TIMERSETSTATUS" );
183
184}
185
186void pccga_timer_set_status_off( Environment * _environment, char * _timer ) {
187
188 deploy( timer, src_hw_8086_timer_asm);
189
190 if ( _timer ) {
191 outline1("MOV BL, [%s]", _timer );
192 } else {
193 outline0("MOV BL, 0" );
194 }
195 outline0("LD CL, 0" );
196 outline0("CALL TIMERSETSTATUS" );
197
198}
199
200void pccga_timer_set_counter( Environment * _environment, char * _timer, char * _counter ) {
201
202 deploy( timer, src_hw_8086_timer_asm);
203
204 if ( _counter ) {
205 outline1("MOV DX, [%s]", _counter );
206 } else {
207 outline0("MOV DX, 0" );
208 }
209 if ( _timer ) {
210 outline1("MOV BL, [%s]", _timer );
211 } else {
212 outline0("MOV BL, 0" );
213 }
214 outline0("CALL TIMERSETCOUNTER" );
215
216}
217
218void pccga_timer_set_init( Environment * _environment, char * _timer, char * _init ) {
219
220 deploy( timer, src_hw_8086_timer_asm);
221
222 if ( _init ) {
223 outline1("MOV AX, [%s]", _init );
224 } else {
225 outline0("MOV AX, 0" );
226 }
227 if ( _timer ) {
228 outline1("MOV BL, [%s]", _timer );
229 } else {
230 outline0("MOV BL, 0" );
231 }
232 outline0("CALL TIMERSETINIT" );
233
234}
235
236void pccga_timer_set_address( Environment * _environment, char * _timer, char * _address ) {
237
238 deploy( timer, src_hw_8086_timer_asm);
239
240 if ( _address ) {
241 outline1("MOV DX, %s", _address );
242 } else {
243 outline0("MOV DX, 0" );
244 }
245 if ( _timer ) {
246 outline1("MOV BL, [%s]", _timer );
247 } else {
248 outline0("MOV BL, 0" );
249 }
250 outline0("CALL TIMERSETADDRESS" );
251
252}
253
254#endif
void cpu_ctoa(Environment *_environment)
Definition 6309.c:279
void pccga_wait_fire_semivar(Environment *_environment, char *_port, int _release)
Definition pccga.c:94
void pccga_wait_fire(Environment *_environment, int _port, int _release)
Definition pccga.c:90
void pccga_joy_vars(Environment *_environment, char *_port, char *_value)
Definition pccga.c:160
void pccga_wait_key_or_fire(Environment *_environment, int _port, int _release)
Definition pccga.c:82
void pccga_wait_key(Environment *_environment, int _release)
Definition pccga.c:67
void pccga_scancode(Environment *_environment, char *_scancode)
Definition pccga.c:98
void pccga_keyshift(Environment *_environment, char *_shifts)
Definition pccga.c:152
void pccga_key_pressed(Environment *_environment, char *_scancode, char *_result)
Definition pccga.c:118
void pccga_joy(Environment *_environment, int _port, char *_value)
Definition pccga.c:164
void pccga_timer_set_address(Environment *_environment, char *_timer, char *_address)
Definition pccga.c:236
void pccga_wait_key_or_fire_semivar(Environment *_environment, char *_port, int _release)
Definition pccga.c:86
void pccga_asciicode(Environment *_environment, char *_result)
Definition pccga.c:109
void pccga_key_state(Environment *_environment, char *_scancode, char *_result)
Definition pccga.c:133
void pccga_inkey(Environment *_environment, char *_pressed, char *_key)
Definition pccga.c:55
void pccga_timer_set_init(Environment *_environment, char *_timer, char *_init)
Definition pccga.c:218
void pccga_scanshift(Environment *_environment, char *_shifts)
Definition pccga.c:148
void pccga_timer_set_status_on(Environment *_environment, char *_timer)
Definition pccga.c:172
void pccga_timer_set_status_off(Environment *_environment, char *_timer)
Definition pccga.c:186
void pccga_sys_call(Environment *_environment, int _destination)
Definition pccga.c:168
void pccga_clear_key(Environment *_environment)
Definition pccga.c:156
void pccga_timer_set_counter(Environment *_environment, char *_timer, char *_counter)
Definition pccga.c:200
int bitmaskNeeded
Definition ugbc.h:2659
struct _RGBi RGBi
Structure to store color components (red, green and blue).
#define deploy_deferred(s, e)
Definition ugbc.h:4302
struct _Environment Environment
Structure of compilation environment.
#define outline0(s)
Definition ugbc.h:4252
#define outline1(s, a)
Definition ugbc.h:4253
#define deploy(s, e)
Definition ugbc.h:4288
#define MAKE_LABEL
Definition ugbc.h:3351