ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
sg1000.h
Go to the documentation of this file.
1#ifndef __UGBC_SG1000__
2#define __UGBC_SG1000__
3
4/*****************************************************************************
5 * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
6 *****************************************************************************
7 * Copyright 2021-2026 Marco Spedaletti (asimov@mclink.it)
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *----------------------------------------------------------------------------
21 * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
22 * (la "Licenza"); è proibito usare questo file se non in conformità alla
23 * Licenza. Una copia della Licenza è disponibile all'indirizzo:
24 *
25 * http://www.apache.org/licenses/LICENSE-2.0
26 *
27 * Se non richiesto dalla legislazione vigente o concordato per iscritto,
28 * il software distribuito nei termini della Licenza è distribuito
29 * "COSì COM'è", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
30 * implicite. Consultare la Licenza per il testo specifico che regola le
31 * autorizzazioni e le limitazioni previste dalla medesima.
32 ****************************************************************************/
33
34#include "../ugbc.h"
35
36#define KEY_NONE 64
37#define KEY_0 '0'
38#define KEY_1 '1'
39#define KEY_2 '2'
40#define KEY_3 '3'
41#define KEY_4 '4'
42#define KEY_5 '5'
43#define KEY_6 '6'
44#define KEY_7 '7'
45#define KEY_8 '8'
46#define KEY_9 '9'
47#define KEY_A 'A'
48#define KEY_ASTERISK '*'
49#define KEY_AT '@'
50#define KEY_B 'B'
51#define KEY_C 'C'
52#define KEY_CLEAR 0xf9
53#define KEY_COLON ':'
54#define KEY_COMMA ','
55#define KEY_COMMODORE 0x00
56#define KEY_CONTROL 0x00
57#define KEY_CRSR_LEFT_RIGHT 0x00
58#define KEY_CRSR_UP_DOWN 0x00
59#define KEY_D 'D'
60#define KEY_DELETE 0x90
61#define KEY_E 'E'
62#define KEY_EQUAL '='
63#define KEY_F 'F'
64#define KEY_F1 0x00
65#define KEY_F2 0x00
66#define KEY_F3 0x00
67#define KEY_F4 0x00
68#define KEY_F5 0x00
69#define KEY_F6 0x00
70#define KEY_F7 0x00
71#define KEY_F8 0x00
72#define KEY_G 'G'
73#define KEY_H 'H'
74#define KEY_HOME 0x88
75#define KEY_I 'I'
76#define KEY_INSERT 0x89
77#define KEY_J 'J'
78#define KEY_K 'K'
79#define KEY_L 'L'
80#define KEY_LEFT_ARROW 0x91
81#define KEY_LEFT_SHIFT 0x81
82#define KEY_M 'M'
83#define KEY_MINUS '-'
84#define KEY_N 'N'
85#define KEY_O 'O'
86#define KEY_P 'P'
87#define KEY_PERIOD '.'
88#define KEY_PLUS '+'
89#define KEY_POUND 0x00
90#define KEY_Q 'Q'
91#define KEY_R 'R'
92#define KEY_RETURN 0x0d
93#define KEY_RIGHT_SHIFT 0x81
94#define KEY_RUNSTOP 0x86
95#define KEY_S 'S'
96#define KEY_SEMICOLON ';'
97#define KEY_SLASH '/'
98#define KEY_SPACE ' '
99#define KEY_T 'T'
100#define KEY_U 'U'
101#define KEY_UP_ARROW 0x92
102#define KEY_V 'V'
103#define KEY_W 'W'
104#define KEY_X 'X'
105#define KEY_Y 'Y'
106#define KEY_Z 'Z'
107#define KEY_BACKSLASH '\\'
108#define KEY_SQUARE_OPEN 0x00
109#define KEY_SQUARE_CLOSED 0x00
110#define KEY_SEMICOMMA ';'
111#define KEY_QUOTE '"'
112#define KEY_APIX 0x00
113#define KEY_DEAD 0x00
114#define KEY_SHIFT 0x81
115#define KEY_CTRL 0x82
116#define KEY_GRAPH 0x83
117#define KEY_CAPS 0x84
118#define KEY_CODE 0x85
119#define KEY_ESC 0x27
120#define KEY_TAB 0x09
121#define KEY_STOP 0x86
122#define KEY_BS 0x08
123#define KEY_SELECT 0x87
124#define KEY_RET 0x0d
125#define KEY_INS 0x89
126#define KEY_DEL 0x90
127#define KEY_LEFT 0x91
128#define KEY_UP 0x92
129#define KEY_DOWN 0x93
130#define KEY_RIGHT 0x94
131#define KEY_DIVISION '/'
132
133#define KEYBOARD_CONFIG_DEFAULT_SYNC 1
134
135#define INPUT_DEFAULT_SEPARATOR ','
136#define INPUT_DEFAULT_SIZE 32
137#define INPUT_DEFAULT_CURSOR 0x60
138
139#define SCREEN_CAPABILITIES ( ( 1<<TILEMAP_NATIVE ) | ( 1<<BITMAP_NATIVE ) )
140
141#define DEFAULT_PAINT_BUCKET_SIZE 128
142
143#define BANK_COUNT 0
144#define BANK_SIZE 0
145#define BANK_BASE_ADDRESS 0
146
147#define JOY_COUNT 2
148
149#define JOY_UP 0
150#define JOY_DOWN 1
151#define JOY_LEFT 2
152#define JOY_RIGHT 3
153#define JOY_FIRE 4
154#define JOY_FIRE_LEFT 4
155#define JOY_FIRE_RIGHT 5
156
157#define JOYSTICK_CONFIG_DEFAULT_SYNC 1
158
159#define MAX_AUDIO_CHANNELS 3
160
161#define DSTRING_DEFAULT_COUNT 16
162#define DSTRING_DEFAULT_SPACE 128
163
164void sg1000_inkey( Environment * _environment, char * _pressed, char * _key );
165void sg1000_wait_fire( Environment * _environment, int _port, int _release );
166void sg1000_wait_fire_semivar( Environment * _environment, char * _port, int _release );
167void sg1000_wait_key_or_fire( Environment * _environment, int _port, int _release );
168void sg1000_wait_key_or_fire_semivar( Environment * _environment, char * _port, int _release );
169void sg1000_scancode( Environment * _environment, char * _pressed, char * _scacode );
170void sg1000_key_pressed( Environment * _environment, char *_scancode, char * _result );
171void sg1000_scanshift( Environment * _environment, char * _shifts );
172void sg1000_keyshift( Environment * _environment, char * _shifts );
173void sg1000_clear_key( Environment * _environment );
174void sg1000_irq_at( Environment * _environment, char * _label );
175
176void sg1000_sys_call( Environment * _environment, int _destination );
177
178void sg1000_timer_set_status_on( Environment * _environment, char * _timer );
179void sg1000_timer_set_status_off( Environment * _environment, char * _timer );
180void sg1000_timer_set_counter( Environment * _environment, char * _timer, char * _counter );
181void sg1000_timer_set_init( Environment * _environment, char * _timer, char * _init );
182void sg1000_timer_set_address( Environment * _environment, char * _timer, char * _address );
183
184#endif