ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
gb.c
Go to the documentation of this file.
1/*****************************************************************************
2 * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
3 *****************************************************************************
4 * Copyright 2021-2024 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 { 0xff, 0xff, 0xff, 0xff, 0, "WHITE", 0 },
40 { 0xa0, 0xa0, 0xa0, 0xff, 1, "LIGHT GRAY", 1 },
41 { 0x50, 0x50, 0x50, 0xff, 2, "DARK GRAY", 2 },
42 { 0x00, 0x00, 0x00, 0xff, 3, "BLACK", 3 }
43};
44
45/****************************************************************************
46 * CODE SECTION
47 ****************************************************************************/
48
49#ifdef __gb__
50
51void gb_joy( Environment * _environment, int _port, char * _value ) {
52
53 deploy( joystick, src_hw_gb_joystick_asm );
54
55 outline0("CALL JOYSTICKREAD0" );
56
57 outline1("LD (%s), A", _value);
58
59}
60
61void gb_joy_vars( Environment * _environment, char * _port, char * _value ) {
62
63 deploy( joystick, src_hw_gb_joystick_asm );
64
65 outline0("CALL JOYSTICKREAD0" );
66
67 outline1("LD (%s), A", _value);
68
69}
70
71void gb_inkey( Environment * _environment, char * _key ) {
72
73 outline0("LD A, 255");
74 outline1("LD (%s), A", _key);
75
76}
77
78void gb_wait_key( Environment * _environment, int _release ) {
79
80}
81
82void gb_wait_key_or_fire( Environment * _environment, int _port, int _release ) {
83
84 deploy( joystick, src_hw_gb_joystick_asm );
85
86 outline1("LD B, $%2.2x", _release );
87 outline0("CALL WAITFIRE" );
88
89}
90
91void gb_wait_key_or_fire_semivar( Environment * _environment, char * _port, int _release ) {
92
93 deploy( joystick, src_hw_gb_joystick_asm );
94
95 outline1("LD B, $%2.2x", _release );
96 outline0("CALL WAITFIRE" );
97
98}
99
100void gb_wait_fire( Environment * _environment, int _port, int _release ) {
101
102 deploy( joystick, src_hw_gb_joystick_asm );
103
104 outline1("LD B, $%2.2x", _release );
105 outline0("CALL WAITFIRE" );
106
107}
108
109void gb_wait_fire_semivar( Environment * _environment, char * _port, int _release ) {
110
111 deploy( joystick, src_hw_gb_joystick_asm );
112
113 outline1("LD B, $%2.2x", _release );
114 outline0("CALL WAITFIRE" );
115
116}
117
118void gb_key_state( Environment * _environment, char *_scancode, char * _result ) {
119
120 outline0("LD A, 0");
121 outline1("LD (%s), A", _result);
122
123}
124
125void gb_scancode( Environment * _environment, char * _result ) {
126
127 outline0("LD A, 255");
128 outline1("LD (%s), A", _result);
129
130}
131
132void gb_asciicode( Environment * _environment, char * _result ) {
133
134 outline0("LD A, 0");
135 outline1("LD (%s), A", _result);
136
137}
138
139void gb_key_pressed( Environment * _environment, char *_scancode, char * _result ) {
140
141 outline0("LD A, 255");
142 outline1("LD (%s), A", _scancode);
143 outline0("LD A, 0");
144 outline1("LD (%s), A", _result);
145
146}
147
148
149void gb_scanshift( Environment * _environment, char * _shifts ) {
150
151 outline0("LD A, 0");
152 outline1("LD (%s), A", _shifts);
153
154}
155
156void gb_keyshift( Environment * _environment, char * _shifts ) {
157
158 outline0("LD A, 0");
159 outline1("LD (%s), A", _shifts);
160
161}
162
163void gb_clear_key( Environment * _environment ) {
164
165}
166
167void gb_sys_call( Environment * _environment, int _destination ) {
168
169 outline1("CALL $%4.4x", _destination );
170
171}
172
173void gb_timer_set_status_on( Environment * _environment, char * _timer ) {
174
175 deploy( timer, src_hw_sm83_timer_asm);
176
177 if ( _timer ) {
178 outline1("LD A, (%s)", _timer );
179 outline0("LD B, A" );
180 } else {
181 outline0("LD B, 0" );
182 }
183 outline0("LD A, 1" );
184 outline0("LD C, A" );
185 outline0("CALL TIMERSETSTATUS" );
186
187}
188
189void gb_timer_set_status_off( Environment * _environment, char * _timer ) {
190
191 deploy( timer, src_hw_sm83_timer_asm);
192
193 if ( _timer ) {
194 outline1("LD A, (%s)", _timer );
195 outline0("LD B, A" );
196 } else {
197 outline0("LD B, 0" );
198 }
199 outline0("LD A, 0" );
200 outline0("LD C, A" );
201 outline0("CALL TIMERSETSTATUS" );
202
203}
204
205void gb_timer_set_counter( Environment * _environment, char * _timer, char * _counter ) {
206
207 deploy( timer, src_hw_sm83_timer_asm);
208
209 if ( _counter ) {
210 outline1("LD A, (%s)", _counter );
211 outline0("LD (IXLR), A" );
212 outline1("LD A, (%s)", address_displacement( _environment, _counter, "1" ) );
213 outline0("LD (IXHR), A" );
214 } else {
215 outline0("LD A, 0" );
216 outline0("LD (IXLR), A" );
217 outline0("LD (IXHR), A" );
218 }
219 if ( _timer ) {
220 outline1("LD A, (%s)", _timer );
221 outline0("LD B, A" );
222 } else {
223 outline0("LD B, 0" );
224 }
225 outline0("CALL TIMERSETCOUNTER" );
226
227}
228
229void gb_timer_set_init( Environment * _environment, char * _timer, char * _init ) {
230
231 deploy( timer, src_hw_sm83_timer_asm);
232
233 if ( _init ) {
234 outline1("LD A, (%s)", _init );
235 outline0("LD (IXLR), A" );
236 outline1("LD A, (%s)", address_displacement( _environment, _init, "1" ) );
237 outline0("LD (IXHR), A" );
238 } else {
239 outline0("LD A, 0" );
240 outline0("LD (IXLR), A" );
241 outline0("LD (IXHR), A" );
242 }
243 if ( _timer ) {
244 outline1("LD A, (%s)", _timer );
245 outline0("LD B, A" );
246 } else {
247 outline0("LD B, 0" );
248 }
249 outline0("CALL TIMERSETINIT" );
250
251}
252
253void gb_timer_set_address( Environment * _environment, char * _timer, char * _address ) {
254
255 deploy( timer, src_hw_sm83_timer_asm);
256
257 if ( _address ) {
258 outline1("LD HL, %s", _address );
259 outline0("LD A, L" );
260 outline0("LD (IXLR), A" );
261 outline0("LD A, H" );
262 outline0("LD (IXHR), A" );
263 } else {
264 outline0("LD A, 0" );
265 outline0("LD (IXLR), A" );
266 outline0("LD (IXHR), A" );
267 }
268 if ( _timer ) {
269 outline1("LD A, (%s)", _timer );
270 outline0("LD B, A" );
271 } else {
272 outline0("LD B, 0" );
273 }
274 outline0("CALL TIMERSETADDRESS" );
275
276}
277
278void gb_dload( Environment * _environment, char * _filename, char * _offset, char * _address, char * _size ) {
279
280}
281
282void gb_dsave( Environment * _environment, char * _filename, char * _offset, char * _address, char * _size ) {
283
284}
285
286
287void gb_put_key( Environment * _environment, char *_string, char * _size ) {
288
289}
290
291static RGBi * commonPalette;
293
294/****************************************************************************
295 * CODE SECTION
296 ****************************************************************************/
297
299
300 unsigned int minDistance = 0xffff;
301 int colorIndex = 0;
302 for (int j = 0; j < COLOR_COUNT; ++j) {
303 int distance = rgbi_distance(&SYSTEM_PALETTE[j], _color);
304 if ( _color->alpha < 255 ) {
305 if ( rgbi_equals_rgb( &SYSTEM_PALETTE[j], _color ) ) {
306 minDistance = 0;
307 distance = 0;
308 colorIndex = j;
309 }
310 } else {
311 if ( SYSTEM_PALETTE[j].alpha < 255 ) {
312 continue;
313 }
314 if (distance < minDistance) {
315 minDistance = distance;
316 colorIndex = j;
317 }
318 }
319 }
320
321 return &SYSTEM_PALETTE[colorIndex];
322
323}
324
336static void gb_image_converter_tile( Environment * _environment, char * _source, char * _dest, int _width, int _depth, int _source_width ) {
337
338 char * source = _source;
339
340 for (int y=0; y<8; ++y) {
341 for (int x=0; x<8; ++x) {
342
343 RGBi rgb;
344
345 memset( &rgb, 0, sizeof( RGBi ) );
346
347 rgb.red = *source;
348 rgb.green = *(source + 1);
349 rgb.blue = *(source + 2);
350 if ( _depth > 3 ) {
351 rgb.alpha = *(source + 3);
352 } else {
353 rgb.alpha = 255;
354 }
355 if ( rgb.alpha == 0 ) {
356 rgb.red = 0;
357 rgb.green = 0;
358 rgb.blue = 0;
359 }
360
361 RGBi *systemRgb = gb_image_nearest_system_color( &rgb );
362
363 char bitmask = 1 << ( 7 - ((x) & 0x7) );
364 int pos0 = ( y * 2 );
365 int pos1 = ( y * 2 + 1 );
366
367 if ( systemRgb->index & 0x01 ) {
368 *( _dest + pos0 ) |= bitmask;
369 } else {
370 *( _dest + pos0 ) &= ~bitmask;
371 }
372
373 if ( systemRgb->index & 0x02 ) {
374 *( _dest + pos1 ) |= bitmask;
375 } else {
376 *( _dest + pos1 ) &= ~bitmask;
377 }
378
379 adilinepixel(systemRgb->index);
380
381 source += _depth;
382
383 }
384
385 source += _depth * ( _source_width - 8 );
386
387 }
388
389}
390
402Variable * gb_collision( Environment * _environment, char * _sprite ) {
403
404 Variable * result = variable_temporary( _environment, VT_SBYTE, "(collision)" );
405
406 return result;
407
408}
409
421void gb_hit( Environment * _environment, char * _sprite_mask, char * _result ) {
422
423}
424
434void gb_border_color( Environment * _environment, char * _border_color ) {
435
436}
437
448void gb_background_color( Environment * _environment, int _index, int _background_color ) {
449
450 int colorIndex = _index & 0x03;
451 int colorValue = _background_color & 0x03;
452
453 int raw = ( colorValue ) << ( colorIndex * 2 );
454 int notRaw = ~ ( 3 << ( colorIndex * 2 ) );
455
456 outline1("LD B, $%2.2x", raw);
457 outline0("LD A, ($FF47)");
458 outline1("AND $%2.2x", notRaw);
459 outline1("OR $%2.2x", raw);
460 outline0("LD ($FF47), A");
461
462}
463
474void gb_background_color_vars( Environment * _environment, char * _index, char * _background_color ) {
475
477
478 outline0("LD A, 3");
479 outline0("PUSH AF");
480 outline1("LD A, (%s)", _index);
481 outline0("AND $03");
482 outline0("CP 0");
483 outline0("POP AF");
484 outline1("JR Z, %snorotm", label);
485 outline1("LD A, (%s)", _index);
486 outline0("AND $03");
487 outline0("LD C, A");
488 outline0("LD A, 3");
489 outhead1("%srotm:", label);
490 outline0("SLA A");
491 outline0("SLA A");
492 outline0("DEC C");
493 outline1("JR NZ, %srotm", label);
494 outhead1("%snorotm:", label);
495 outline0("XOR $FF");
496 outline0("LD B, A");
497 outline1("LD A, (%s)", _background_color);
498 outline0("AND $03");
499 outline0("LD D, A");
500 outline1("LD A, (%s)", _index);
501 outline0("CP 0");
502 outline1("JR Z, %snorot", label);
503 outline0("LD C, A");
504 outline1("LD A, (%s)", _background_color);
505 outline0("AND $03");
506 outhead1("%srot:", label);
507 outline0("SLA A");
508 outline0("SLA A");
509 outline0("DEC C");
510 outline1("JR NZ, %srot", label);
511 outline0("LD D, A");
512 outhead1("%snorot:", label);
513 outline0("LD A, ($FF47)");
514 outline0("AND B");
515 outline0("OR D");
516 outline0("LD ($FF47), A");
517
518}
519
530void gb_background_color_semivars( Environment * _environment, int _index, char * _background_color ) {
531
532 int colorIndex = _index & 0x03;
533
534 int notRaw = ~ ( 3 << ( colorIndex * 2 ) );
535
536 outline1("LD A, (%s)", _background_color);
537 outline0("AND $03");
538 for( int i=0; i<colorIndex; ++i ) {
539 outline0("SLA A");
540 }
541 outline0("LD B, A");
542 outline0("LD A, ($FF47)");
543 outline1("AND $%2.2x", notRaw);
544 outline0("OR B");
545 outline0("LD ($FF47), A");
546
547}
548
559void gb_background_color_get_vars( Environment * _environment, char * _index, char * _background_color ) {
560
562
563 outline0("LD A, 3");
564 outline0("PUSH AF");
565 outline1("LD A, (%s)", _index);
566 outline0("AND $03");
567 outline0("CP 0");
568 outline0("POP AF");
569 outline1("JR Z, %snorotm", label);
570 outline1("LD A, (%s)", _index);
571 outline0("AND $03");
572 outline0("LD C, A");
573 outline0("LD A, 3");
574 outhead1("%srotm:", label);
575 outline0("SLA A");
576 outline0("SLA A");
577 outline0("DEC C");
578 outline1("JR NZ, %srotm", label);
579 outhead1("%snorotm:", label);
580 outline0("LD B, A");
581 outline0("LD A, ($FF47)");
582 outline0("AND B");
583 outline0("LD D, A");
584 outline1("LD A, (%s)", _index);
585 outline0("CP 0");
586 outline1("JR Z, %snorot", label);
587 outline0("LD C, A");
588 outline0("LD A, D");
589 outhead1("%srot:", label);
590 outline0("SRA A");
591 outline0("SRA A");
592 outline0("DEC C");
593 outline1("JR NZ, %srot", label);
594 outline0("LD D, A");
595 outhead1("%snorot:", label);
596 outline0("LD A, D");
597 outline1("LD (%s), A", _background_color);
598
599}
600
611void gb_sprite_common_color( Environment * _environment, char * _index, char * _common_color ) {
612
613}
614
630void gb_raster_at( Environment * _environment, char * _label, char * _positionlo, char * _positionhi ) {
631
632}
633
644void gb_next_raster( Environment * _environment ) {
645
646}
647
661void gb_next_raster_at( Environment * _environment, char * _label, char * _positionlo, char * _positionhi ) {
662
663}
664
665void gb_bank_select( Environment * _environment, int _bank ) {
666
667}
668
669static int rgbConverterFunction( int _red, int _green, int _blue ) {
670
671 int colorIndex = 0;
672 unsigned int minDistance = 0xffffffff;
673 int j;
674
675 RGBi rgb;
676 rgb.red = _red;
677 rgb.green = _green;
678 rgb.blue = _blue;
679
680 for (j = 0; j < sizeof(SYSTEM_PALETTE)/sizeof(RGBi); ++j) {
681 int distance = rgbi_distance(&SYSTEM_PALETTE[j], &rgb);
682 if (distance < minDistance) {
683 minDistance = distance;
684 colorIndex = j;
685 }
686 }
687
688 return colorIndex;
689
690}
691
692int gb_screen_mode_enable( Environment * _environment, ScreenMode * _screen_mode ) {
693
694 _screen_mode->selected = 1;
695
696 cpu_store_8bit( _environment, "_PEN", _environment->defaultPenColor );
697 cpu_store_8bit( _environment, "_PAPER", _environment->defaultPaperColor );
698
699 _environment->fontWidth = 8;
700 _environment->fontHeight = 8;
701 _environment->screenTilesWidth = 20;
702 _environment->screenTilesHeight = 18;
703 _environment->screenTiles = 255;
704 _environment->screenWidth = _environment->screenTilesWidth * _environment->fontWidth;
705 _environment->screenHeight = _environment->screenTilesHeight * _environment->fontHeight;
706 _environment->screenColors = 4;
707 _environment->currentModeBW = 0;
708
709 _environment->consoleTilesWidth = _environment->screenTilesWidth;
710 _environment->consoleTilesHeight = _environment->screenTilesHeight;
711
712 cpu_store_16bit( _environment, "CLIPX1", 0 );
713 cpu_store_16bit( _environment, "CLIPX2", (_environment->screenWidth-1) );
714 cpu_store_16bit( _environment, "CLIPY1", 0 );
715 cpu_store_16bit( _environment, "CLIPY2", (_environment->screenHeight-1) );
716
717 cpu_store_16bit( _environment, "ORIGINX", 0 );
718 cpu_store_16bit( _environment, "ORIGINY", 0 );
719
720 cpu_store_16bit( _environment, "CURRENTWIDTH", _environment->screenWidth );
721 cpu_store_16bit( _environment, "CURRENTHEIGHT", _environment->screenHeight );
722 cpu_move_16bit( _environment, "CURRENTWIDTH", "RESOLUTIONX" );
723 cpu_move_16bit( _environment, "CURRENTHEIGHT", "RESOLUTIONY" );
724 cpu_store_8bit( _environment, "CURRENTTILES", _environment->screenTiles );
725 cpu_store_8bit( _environment, "CURRENTTILESWIDTH", _environment->screenTilesWidth );
726 cpu_store_8bit( _environment, "CURRENTTILESWIDTHX8", _environment->screenTilesWidth * 8 );
727 cpu_store_8bit( _environment, "CURRENTTILESHEIGHT", _environment->screenTilesHeight );
728 cpu_store_8bit( _environment, "FONTWIDTH", _environment->fontWidth );
729 cpu_store_8bit( _environment, "FONTHEIGHT", _environment->fontHeight );
730 cpu_store_8bit( _environment, "CONSOLEX1", 0 );
731 cpu_store_8bit( _environment, "CONSOLEY1", 0 );
732 cpu_store_8bit( _environment, "CONSOLEX2", _environment->consoleTilesWidth-1 );
733 cpu_store_8bit( _environment, "CONSOLEY2", _environment->consoleTilesHeight-1 );
734 cpu_store_8bit( _environment, "CONSOLEW", _environment->consoleTilesWidth );
735 cpu_store_8bit( _environment, "CONSOLEH", _environment->consoleTilesHeight );
736
737 console_calculate( _environment );
738
739 if (_environment->vestigialConfig.clsImplicit ) {
740 gb_cls( _environment );
741 }
742
743}
744
745void console_calculate( Environment * _environment ) {
746
747 int startAddress = 0x9800;
748
749 int consoleSA = startAddress + ( _environment->activeConsole.y1 * _environment->screenTilesWidth ) + _environment->activeConsole.x1;
750 int consoleWB = _environment->activeConsole.width * _environment->currentModeBW;
751 int consoleHB = _environment->activeConsole.height * 8;
752
753 cpu_store_16bit( _environment, "CONSOLESA", consoleSA );
754 cpu_store_8bit( _environment, "CONSOLEWB", consoleWB );
755 cpu_store_8bit( _environment, "CONSOLEHB", consoleHB );
756
757}
758
759void console_calculate_vars( Environment * _environment ) {
760
761 _environment->dynamicConsole = 1;
762
763 outline0( "CALL CONSOLECALCULATE" );
764
765}
766
767void gb_bitmap_enable( Environment * _environment, int _width, int _height, int _colors ) {
768
769 ScreenMode * mode = find_screen_mode_by_suggestion( _environment, 1, _width, _height, _colors, 8, 8 );
770
771 if ( mode ) {
772 gb_screen_mode_enable( _environment, mode );
773
774 cpu_store_8bit( _environment, "CURRENTMODE", mode->id );
775 cpu_store_8bit( _environment, "CURRENTTILEMODE", 0 );
776
777 _environment->currentMode = mode->id;
778 _environment->currentTileMode = 0;
779
780 if (_environment->vestigialConfig.clsImplicit ) {
781 gb_cls( _environment );
782 }
783
784 } else {
786 }
787
788}
789
790void gb_bitmap_disable( Environment * _environment ) {
791
792}
793
794void gb_tilemap_enable( Environment * _environment, int _width, int _height, int _colors, int _tile_width, int _tile_height ) {
795
796 ScreenMode * mode = find_screen_mode_by_suggestion( _environment, 0, _width, _height, _colors, _tile_width, _tile_height );
797
798 if ( mode ) {
799
800 gb_screen_mode_enable( _environment, mode );
801
802 _environment->currentMode = mode->id;
803 _environment->currentTileMode = 1;
804
805 cpu_store_8bit( _environment, "CURRENTMODE", mode->id );
806 cpu_store_8bit( _environment, "CURRENTTILEMODE", 1 );
807
808 if (_environment->vestigialConfig.clsImplicit ) {
809 gb_cls( _environment );
810 }
811
812 } else {
814 }
815
816}
817
818void gb_bitmap_at( Environment * _environment, char * _address ) {
819
820}
821
822void gb_colormap_at( Environment * _environment, char * _address ) {
823
824}
825
826void gb_textmap_at( Environment * _environment, char * _address ) {
827
828}
829
830void gb_pset_int( Environment * _environment, int _x, int _y, int *_c ) {
831
832}
833
834void gb_pset_vars( Environment * _environment, char *_x, char *_y, char *_c ) {
835
836}
837
838void gb_pget_color_vars( Environment * _environment, char *_x, char *_y, char * _result ) {
839
840}
841
842void gb_screen_on( Environment * _environment ) {
843
844 outline0("LD A, (rLCDC)");
845 outline0("OR $80");
846 outline0("LD (rLCDC), A");
847
848}
849
850void gb_screen_off( Environment * _environment ) {
851
852 outline0("LD A, (rLCDC)");
853 outline0("OR $7F");
854 outline0("LD (rLCDC), A");
855
856}
857
858void gb_screen_rows( Environment * _environment, char * _rows ) {
859
860}
861
862void gb_screen_columns( Environment * _environment, char * _columns ) {
863
864}
865
866void gb_sprite_data_set( Environment * _environment, char * _sprite, char * _address ) {
867
868 Variable * sprite = variable_retrieve_or_define( _environment, _sprite, VT_BYTE, 0 );
869 Variable * address = variable_retrieve_or_define( _environment, _address, VT_BYTE, 0 );
870
871 deploy( sprite, src_hw_gb_sprites_asm );
872
873 outline1("LD A, (%s)", sprite->realName );
874 outline0("LD B, A");
875 outline1("LD A, (%s)", address->realName );
876 outline0("CALL SPRITEDATASET");
877
878}
879
880void gb_sprite_data_from( Environment * _environment, char * _sprite, char * _image ) {
881
882 Variable * sprite = variable_retrieve_or_define( _environment, _sprite, VT_BYTE, 0 );
883 Variable * image = variable_retrieve_or_define( _environment, _image, VT_IMAGE, 0 );
884
885 deploy( sprite, src_hw_gb_sprites_asm );
886
887 char dataLabel[MAX_TEMPORARY_STORAGE]; sprintf( dataLabel, "%sdata", image->realName );
888 outline1("LD A, (%s)", sprite->realName );
889 outline0("LD B, A");
890 sprintf(dataLabel, "%sdata", image->realName);
891 outline1("LD HL, %s", dataLabel );
892 outline0("CALL SPRITEDATAFROM");
893
894}
895
896void gb_sprite_enable( Environment * _environment, char * _sprite ) {
897
898 Variable * sprite = variable_retrieve_or_define( _environment, _sprite, VT_BYTE, 0 );
899
900 deploy( sprite, src_hw_gb_sprites_asm );
901
902 outline1("LD A, (%s)", sprite->realName );
903 outline0("LD B, A");
904 outline0("CALL SPRITEENABLE");
905
906}
907
908void gb_sprite_disable( Environment * _environment, char * _sprite ) {
909
910 Variable * sprite = variable_retrieve_or_define( _environment, _sprite, VT_BYTE, 0 );
911
912 deploy( sprite, src_hw_gb_sprites_asm );
913
914 outline1("LD A, (%s)", sprite->realName );
915 outline0("LD B, A");
916 outline0("CALL SPRITEDISABLE");
917
918}
919
920void gb_sprite_at( Environment * _environment, char * _sprite, char * _x, char * _y ) {
921
922 Variable * sprite = variable_retrieve_or_define( _environment, _sprite, VT_BYTE, 0 );
923 Variable * x = variable_retrieve_or_define( _environment, _x, VT_POSITION, 0 );
924 Variable * y = variable_retrieve_or_define( _environment, _y, VT_POSITION, 0 );
925
926 deploy( sprite, src_hw_gb_sprites_asm );
927
928 outline1("LD A, (%s)", sprite->realName );
929 outline0("LD B, A");
930 outline1("LD A, (%s)", x->realName );
931 outline0("LD D, A");
932 outline1("LD A, (%s)", y->realName );
933 outline0("LD E, A");
934 outline0("CALL SPRITEAT");
935
936}
937
938void gb_sprite_expand_vertical( Environment * _environment, char * _sprite ) {
939
940}
941
942void gb_sprite_expand_horizontal( Environment * _environment, char * _sprite ) {
943
944}
945
946void gb_sprite_compress_vertical( Environment * _environment, char * _sprite ) {
947
948}
949
950void gb_sprite_compress_horizontal( Environment * _environment, char * _sprite ) {
951
952}
953
954void gb_sprite_multicolor( Environment * _environment, char * _sprite ) {
955
956}
957
958void gb_sprite_monocolor( Environment * _environment, char * _sprite ) {
959
960}
961
962void gb_sprite_color( Environment * _environment, char * _sprite, char * _color ) {
963
964}
965
966void gb_sprite_priority( Environment * _environment, char * _sprite, char * _priority ) {
967
968}
969
970void gb_tiles_at( Environment * _environment, char * _address ) {
971
972}
973
974void gb_vertical_scroll( Environment * _environment, char * _displacement ) {
975
976 outline1("LD A, (%s)", _displacement);
977 outline0("CALL WAITSTATE");
978 outline0("LD (rSCY), A");
979
980}
981
982void gb_horizontal_scroll( Environment * _environment, char * _displacement ) {
983
984 outline1("LD A, (%s)", _displacement);
985 outline0("CALL WAITSTATE");
986 outline0("LD (rSCX), A");
987
988}
989
990void gb_busy_wait( Environment * _environment, char * _timing ) {
991
993
994 outline1("LD C, (%s)", _timing);
995 outhead1("%sfirst:", label);
996 outline0("CALL WAITVBL");
997 outline0("DEC C");
998 outline1("JP NZ, %sfirst", label);
999
1000}
1001
1002void gb_get_width( Environment * _environment, char *_result ) {
1003
1004 outline0("LD HL, 160" );
1005 outline1("LD (%s), HL", _result );
1006
1007}
1008
1009void gb_tiles_get( Environment * _environment, char *_result ) {
1010
1011 outline0("LD A, 255" );
1012 outline1("LD (%s), A", _result );
1013
1014}
1015
1016void gb_get_height( Environment * _environment, char *_result ) {
1017
1018 outline0("LD HL, 144" );
1019 outline1("LD (%s), HL", _result );
1020
1021}
1022
1023void gb_cls( Environment * _environment ) {
1024
1025 deploy( clsText, src_hw_gb_cls_asm );
1026 outline0("CALL CLS");
1027
1028}
1029
1030void gb_cls_box( Environment * _environment, char * _x1, char * _y1, char * _w, char * _h ) {
1031
1032}
1033
1034void gb_scroll_text( Environment * _environment, int _direction, int _overlap ) {
1035
1036 if ( _direction > 0 ) {
1037 deploy( vScrollTextDown, src_hw_gb_vscroll_text_down_asm );
1038 outline0("CALL VSCROLLTDOWN");
1039 } else {
1040 deploy( vScrollTextUp, src_hw_gb_vscroll_text_up_asm );
1041 outline0("CALL VSCROLLTUP");
1042 }
1043
1044}
1045
1046void gb_text( Environment * _environment, char * _text, char * _text_size, int _raw ) {
1047
1048 deploy( gbvars, src_hw_gb_vars_asm );
1049
1050 deploy( vScrollTextUp, src_hw_gb_vscroll_text_up_asm );
1051
1052 outline1("LD HL, (%s)", _text);
1053 outline0("PUSH HL");
1054 outline0("POP DE");
1055 outline1("LD A, (%s)", _text_size);
1056 outline0("LD C, A");
1057
1058 if ( _raw ) {
1059
1060 // deploy( clsGraphic, src_hw_gb_cls_graphic_asm );
1061 // deploy( textEncodedAt, src_hw_gb_text_asm );
1062 // deploy( textEncodedAtGraphicRaw, src_hw_gb_text_at_raw_asm );
1063 outline0("CALL TEXTATBITMAPMODERAW");
1064
1065 } else {
1066
1067 // deploy( clsGraphic, src_hw_gb_cls_graphic_asm );
1068 // deploy( textEncodedAt, src_hw_gb_text_asm );
1069 deploy( textEncodedAtGraphic, src_hw_gb_text_at_asm );
1070 outline0("CALL TEXTATBITMAPMODE");
1071
1072 }
1073
1074}
1075
1076void gb_initialization( Environment * _environment ) {
1077
1078 _environment->bitmaskNeeded = 1;
1079
1080 // // deploy( GBvars, src_hw_gb_vars_asm );
1081 // deploy_preferred( GBstartup, src_hw_gb_startup_asm );
1082
1083 variable_import( _environment, "CURRENTWIDTH", VT_POSITION, 256 );
1084 variable_global( _environment, "CURRENTWIDTH" );
1085 variable_import( _environment, "CURRENTHEIGHT", VT_POSITION, 192 );
1086 variable_global( _environment, "CURRENTHEIGHT" );
1087 variable_import( _environment, "CURRENTTILES", VT_BYTE, 255 );
1088 variable_global( _environment, "CURRENTTILES" );
1089 variable_import( _environment, "CURRENTTILESWIDTH", VT_SBYTE, 40 );
1090 variable_global( _environment, "CURRENTTILESWIDTH" );
1091 variable_import( _environment, "CURRENTTILESWIDTHX8", VT_WORD, 320 );
1092 variable_global( _environment, "CURRENTTILESWIDTHX8" );
1093 variable_import( _environment, "CURRENTTILESHEIGHT", VT_SBYTE, 24 );
1094 variable_global( _environment, "CURRENTTILESHEIGHT" );
1095 variable_import( _environment, "FONTWIDTH", VT_BYTE, 8 );
1096 variable_global( _environment, "FONTWIDTH" );
1097 variable_import( _environment, "FONTHEIGHT", VT_BYTE, 8 );
1098 variable_global( _environment, "FONTHEIGHT" );
1099
1100 variable_import( _environment, "TILESETSLOTFIRST", VT_BYTE, 1 );
1101 variable_global( _environment, "TILESETSLOTFIRST" );
1102 variable_import( _environment, "TILESETSLOTLAST", VT_BYTE, 1 );
1103 variable_global( _environment, "TILESETSLOTLAST" );
1104
1105 variable_import( _environment, "PUTIMAGECOUNT", VT_BYTE, 0 );
1106 variable_global( _environment, "PUTIMAGECOUNT" );
1107 variable_import( _environment, "PUTIMAGEWIDTH", VT_BYTE, 0 );
1108 variable_global( _environment, "PUTIMAGEWIDTH" );
1109 variable_import( _environment, "PUTIMAGEINDEX", VT_BYTE, 0 );
1110 variable_global( _environment, "PUTIMAGEINDEX" );
1111 variable_import( _environment, "PUTIMAGETILEINDEX", VT_BYTE, 0 );
1112 variable_global( _environment, "PUTIMAGETILEINDEX" );
1113 variable_import( _environment, "PUTIMAGEX", VT_BYTE, 0 );
1114 variable_global( _environment, "PUTIMAGEX" );
1115
1116 variable_import( _environment, "IMAGEX", VT_POSITION, 0 );
1117 variable_global( _environment, "IMAGEX" );
1118 variable_import( _environment, "IMAGEY", VT_POSITION, 0 );
1119 variable_global( _environment, "IMAGEY" );
1120
1121 variable_import( _environment, "TEXTADDRESS", VT_ADDRESS, 0x9800 );
1122 variable_global( _environment, "TEXTADDRESS" );
1123
1124 SCREEN_MODE_DEFINE( TILEMAP_MODE_BGB, 0, 20, 18, 2, 8, 8, "Tilemap mode (BGB)" );
1125 SCREEN_MODE_DEFINE( TILEMAP_MODE_CGB, 0, 20, 18, 4, 8, 8, "Tilemap mode (CGB)" );
1126
1127 variable_import( _environment, "LINE", VT_WORD, 0 );
1128 variable_global( _environment, "LINE" );
1129
1130 variable_import( _environment, "XGR", VT_POSITION, 0 );
1131 variable_global( _environment, "XGR" );
1132 variable_import( _environment, "YGR", VT_POSITION, 0 );
1133 variable_global( _environment, "YGR" );
1134
1135 variable_import( _environment, "RESOLUTIONX", VT_POSITION, 0 );
1136 variable_global( _environment, "RESOLUTIONX" );
1137 variable_import( _environment, "RESOLUTIONY", VT_POSITION, 0 );
1138 variable_global( _environment, "RESOLUTIONY" );
1139
1140 variable_import( _environment, "TABCOUNT", VT_BYTE, 4 );
1141 variable_global( _environment, "TABCOUNT" );
1142
1143 variable_import( _environment, "CLINEX", VT_BYTE, 0 );
1144 variable_global( _environment, "CLINEX" );
1145
1146 variable_import( _environment, "CLINEY", VT_BYTE, 0 );
1147 variable_global( _environment, "CLINEY" );
1148
1149 variable_import( _environment, "CLIPX1", VT_POSITION, 0 );
1150 variable_global( _environment, "CLIPX1" );
1151 variable_import( _environment, "CLIPX2", VT_POSITION, 255 );
1152 variable_global( _environment, "CLIPX2" );
1153 variable_import( _environment, "CLIPY1", VT_POSITION, 0 );
1154 variable_global( _environment, "CLIPY1" );
1155 variable_import( _environment, "CLIPY2", VT_POSITION, 191 );
1156 variable_global( _environment, "CLIPY2" );
1157
1158 variable_import( _environment, "ORIGINX", VT_POSITION, 0 );
1159 variable_global( _environment, "ORIGINX" );
1160 variable_import( _environment, "ORIGINY", VT_POSITION, 0 );
1161 variable_global( _environment, "ORIGINY" );
1162
1163 variable_import( _environment, "TABSTODRAW", VT_BYTE, 0 );
1164 variable_global( _environment, "TABSTODRAW" );
1165
1166 variable_import( _environment, "CURRENTMODE", VT_BYTE, 0 );
1167 variable_global( _environment, "CURRENTMODE" );
1168 variable_import( _environment, "CURRENTTILEMODE", VT_BYTE, 1 );
1169 variable_global( _environment, "CURRENTTILEMODE" );
1170
1171 variable_import( _environment, "SPRITECOUNT", VT_SPRITE, 0 );
1172 variable_global( _environment, "SPRITECOUNT" );
1173
1174 variable_import( _environment, "GBMUSICREADY", VT_BYTE, 0 );
1175 variable_global( _environment, "GBMUSICREADY" );
1176 variable_import( _environment, "GBMUSICPAUSE", VT_BYTE, 0 );
1177 variable_global( _environment, "GBMUSICPAUSE" );
1178 variable_import( _environment, "GBMUSICLOOP", VT_BYTE, 0 );
1179 variable_global( _environment, "GBMUSICLOOP" );
1180 variable_import( _environment, "GBBLOCKS", VT_BYTE, 0 );
1181 variable_global( _environment, "GBBLOCKS" );
1182 variable_import( _environment, "GBLASTBLOCK", VT_BYTE, 0 );
1183 variable_global( _environment, "GBLASTBLOCK" );
1184 variable_import( _environment, "GBTMPPTR2", VT_ADDRESS, 0 );
1185 variable_global( _environment, "GBTMPPTR2" );
1186 variable_import( _environment, "GBTMPPTR", VT_ADDRESS, 0 );
1187 variable_global( _environment, "GBTMPPTR" );
1188 variable_import( _environment, "GBTMPOFS", VT_BYTE, 0 );
1189 variable_global( _environment, "GBTMPOFS" );
1190 variable_import( _environment, "GBTMPLEN", VT_BYTE, 0 );
1191 variable_global( _environment, "GBTMPLEN" );
1192 variable_import( _environment, "GBJIFFIES", VT_BYTE, 0 );
1193 variable_global( _environment, "GBJIFFIES" );
1194
1195 variable_import( _environment, "GBBLOCKS_BACKUP", VT_BYTE, 0 );
1196 variable_global( _environment, "GBBLOCKS_BACKUP" );
1197 variable_import( _environment, "GBLASTBLOCK_BACKUP", VT_BYTE, 0 );
1198 variable_global( _environment, "GBLASTBLOCK_BACKUP" );
1199 variable_import( _environment, "GBTMPPTR_BACKUP", VT_ADDRESS, 0 );
1200 variable_global( _environment, "GBTMPPTR_BACKUP" );
1201
1202 variable_import( _environment, "GBTIMER", VT_WORD, 0 );
1203 variable_global( _environment, "GBTIMER" );
1204 variable_import( _environment, "GBAUDIOTIMERS", VT_BUFFER, 8 );
1205 variable_global( _environment, "GBAUDIOTIMERS" );
1206
1207 // variable_import( _environment, "XSCROLLPOS", VT_BYTE, 0 );
1208 // variable_global( _environment, "XSCROLLPOS" );
1209 // variable_import( _environment, "YSCROLLPOS", VT_BYTE, 0 );
1210 // variable_global( _environment, "YSCROLLPOS" );
1211 // variable_import( _environment, "XSCROLL", VT_BYTE, 0 );
1212 // variable_global( _environment, "XSCROLL" );
1213 // variable_import( _environment, "YSCROLL", VT_BYTE, 0 );
1214 // variable_global( _environment, "YSCROLL" );
1215 // variable_import( _environment, "DIRECTION", VT_BYTE, 0 );
1216 // variable_global( _environment, "DIRECTION" );
1217
1218 // variable_import( _environment, "ONSCROLLUP", VT_BUFFER, 3 );
1219 // variable_global( _environment, "ONSCROLLUP" );
1220
1221 // variable_import( _environment, "ONSCROLLDOWN", VT_BUFFER, 3 );
1222 // variable_global( _environment, "ONSCROLLDOWN" );
1223
1224 // variable_import( _environment, "ONSCROLLLEFT", VT_BUFFER, 3 );
1225 // variable_global( _environment, "ONSCROLLLEFT" );
1226
1227 // variable_import( _environment, "ONSCROLLRIGHT", VT_BUFFER, 3 );
1228 // variable_global( _environment, "ONSCROLLRIGHT" );
1229
1230 // variable_import( _environment, "IMAGEF", VT_BYTE, 0 );
1231 // variable_global( _environment, "IMAGEF" );
1232
1233 // variable_import( _environment, "IMAGET", VT_BYTE, 0 );
1234 // variable_global( _environment, "IMAGET" );
1235
1236 // variable_import( _environment, "IMAGEY", VT_BYTE, 0 );
1237 // variable_global( _environment, "IMAGEY" );
1238
1239 // variable_import( _environment, "BLITIMAGEBLITTINGADDR", VT_ADDRESS, 0 );
1240 // variable_global( _environment, "BLITIMAGEBLITTINGADDR" );
1241 // variable_import( _environment, "BLITTMPPTR", VT_ADDRESS, 0 );
1242 // variable_global( _environment, "BLITTMPPTR" );
1243 // variable_import( _environment, "BLITTMPPTR2", VT_ADDRESS, 0 );
1244 // variable_global( _environment, "BLITTMPPTR2" );
1245
1246 // // #if __coleco__
1247 // // variable_import( _environment, "VDP_HOOK", VT_BUFFER, 10 );
1248 // // variable_global( _environment, "VDP_HOOK" );
1249 // // #endif
1250
1251 // variable_import( _environment, "VBLFLAG", VT_BYTE, 0 );
1252 // variable_global( _environment, "VBLFLAG" );
1253 // variable_import( _environment, "VDPINUSE", VT_BYTE, 0 );
1254 // variable_global( _environment, "VDPINUSE" );
1255
1256 // variable_import( _environment, "SLICEX", VT_POSITION, 0 );
1257 // variable_global( _environment, "SLICEX" );
1258 // variable_import( _environment, "SLICEY", VT_POSITION, 0 );
1259 // variable_global( _environment, "SLICEY" );
1260 // variable_import( _environment, "SLICEDTARGET", VT_POSITION, 0 );
1261 // variable_global( _environment, "SLICEDTARGET" );
1262
1263 variable_import( _environment, "CONSOLESA", VT_ADDRESS, 0x0 );
1264 variable_global( _environment, "CONSOLESA" );
1265 variable_import( _environment, "CONSOLEHB", VT_BYTE, 0x0 );
1266 variable_global( _environment, "CONSOLEHB" );
1267 variable_import( _environment, "CONSOLEWB", VT_BYTE, 0x0 );
1268 variable_global( _environment, "CONSOLEWB" );
1269
1270 gb_tilemap_enable( _environment, 40, 24, 1, 8, 8 );
1271
1272 _environment->fontConfig.schema = FONT_SCHEMA_ASCII;
1273
1274 font_descriptors_init( _environment, 0 );
1275
1276 console_calculate( _environment );
1277
1278 // _environment->currentRgbConverterFunction = rgbConverterFunction;
1279 // _environment->screenShades = 16;
1280
1281 // outline0("CALL GBAFTERINIT");
1282
1283}
1284
1285void gb_finalization( Environment * _environment ) {
1286
1287 // if ( _environment->vestigialConfig.clsImplicit ) {
1288 // // deploy( clsText, src_hw_gb_cls_text_asm );
1289 // }
1290
1291 CopperList * copperList = _environment->copperList;
1292 if ( copperList ) {
1293 while(copperList) {
1294 outhead1("COPPERACTIVATE%s:", copperList->name ? copperList->name : "" );
1295 outline0("RET");
1296 copperList = copperList->next;
1297 }
1298 }
1299
1300}
1301
1302void gb_hscroll_line( Environment * _environment, int _direction, int _overlap ) {
1303
1304 // // deploy( textHScroll, src_hw_gb_hscroll_text_asm );
1305
1306 // Variable * y = variable_retrieve( _environment, "YCURSYS" );
1307 // outline1("LD A, $%2.2x", ( _direction & 0xff ) );
1308 // outline1("LD B, (%s)", y->realName );
1309 // if ( ! _environment->hasGameLoop ) {
1310 // outline0("CALL HSCROLLLT");
1311 // } else {
1312 // outline0("CALL HSCROLLLTNMI2");
1313 // }
1314
1315}
1316
1317void gb_hscroll_screen( Environment * _environment, int _direction, int _overlap ) {
1318
1319 // // deploy( textHScroll, src_hw_gb_hscroll_text_asm );
1320
1321 // outline1("LD A, $%2.2x", ( _direction & 0xff ) );
1322 // if ( ! _environment->hasGameLoop ) {
1323 // outline0("CALL HSCROLLST");
1324 // } else {
1325 // outline0("CALL HSCROLLSTNMI2");
1326 // }
1327
1328}
1329
1330void gb_back( Environment * _environment ) {
1331
1332 // // deploy( back, src_hw_gb_back_asm );
1333
1334 // if ( ! _environment->hasGameLoop ) {
1335 // outline0("CALL BACK");
1336 // } else {
1337 // outline0("CALL BACKNMI2");
1338 // }
1339
1340}
1341
1342void gb_cline( Environment * _environment, char * _characters ) {
1343
1344 // // deploy( GBvars, src_hw_gb_vars_asm);
1345
1346 // Variable * x = variable_retrieve( _environment, "XCURSYS" );
1347 // Variable * y = variable_retrieve( _environment, "YCURSYS" );
1348
1349 // outline1("LD A, (%s)", x->realName );
1350 // outline0("LD (CLINEX), A" );
1351 // outline1("LD A, (%s)", y->realName );
1352 // outline0("LD (CLINEY), A");
1353
1354 // if ( _characters ) {
1355 // outline1("LD A, (%s)", _characters);
1356 // outline0("LD C, A");
1357 // } else {
1358 // outline0("LD A, 0");
1359 // outline0("LD C, A");
1360 // }
1361
1362 // if ( ( _environment->currentMode == 2 || _environment->currentMode == 3 ) && !_environment->currentTileMode ) {
1363 // // deploy( textClineGraphic, src_hw_gb_cline_graphic_asm );
1364 // if ( ! _environment->hasGameLoop ) {
1365 // outline0("CALL CLINEG");
1366 // } else {
1367 // outline0("CALL CLINEGGMI2");
1368 // }
1369 // } else {
1370 // // deploy( textCline, src_hw_gb_cline_text_asm );
1371 // if ( ! _environment->hasGameLoop ) {
1372 // outline0("CALL CLINE");
1373 // } else {
1374 // outline0("CALL CLINENMI2");
1375 // }
1376 // }
1377
1378}
1379
1380int gb_image_size( Environment * _environment, int _width, int _height, int _mode ) {
1381
1382 switch( _mode ) {
1383
1384 case TILEMAP_MODE_BGB:
1385 case TILEMAP_MODE_CGB: {
1386
1387 int size = ( ( _width >> 3 ) * ( _height >> 3 ) );
1388
1389 return 3 + size + size * 16;
1390
1391 break;
1392 }
1393 }
1394
1395 return 0;
1396
1397}
1398
1399static int calculate_images_size( Environment * _environment, int _frames, int _width, int _height, int _mode ) {
1400
1401 switch( _mode ) {
1402
1403 case TILEMAP_MODE_BGB:
1404 case TILEMAP_MODE_CGB: {
1405
1406 int size = ( ( _width >> 3 ) * ( _height >> 3 ) );
1407
1408 return 3 + ( 3 + size + size * 16 ) * _frames;
1409
1410 break;
1411 }
1412 }
1413
1414 return 0;
1415
1416}
1417
1418static int calculate_sequence_size( Environment * _environment, int _sequences, int _frames, int _width, int _height, int _mode ) {
1419
1420 switch( _mode ) {
1421
1422 case TILEMAP_MODE_BGB:
1423 case TILEMAP_MODE_CGB: {
1424
1425 int size = ( ( _width >> 3 ) * ( _height >> 3 ) );
1426
1427 return 3 + ( ( 3 + size + size * 16 ) * _frames ) * _sequences;
1428
1429 break;
1430 }
1431 }
1432
1433 return 0;
1434
1435}
1436
1437static Variable * gb_image_converter_tilemap_mode_standard( Environment * _environment, char * _source, int _width, int _height, int _depth, int _offset_x, int _offset_y, int _frame_width, int _frame_height, int _transparent_color, int _flags ) {
1438
1439 image_converter_asserts( _environment, _width, _height, _offset_x, _offset_y, &_frame_width, &_frame_height, 8, 8 );
1440
1441 if ( _environment->freeImageWidth ) {
1442 if ( _width % 8 ) {
1443 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
1444 }
1445 if ( _frame_width % 8 ) {
1446 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
1447 }
1448 }
1449
1450 if ( _environment->freeImageHeight ) {
1451 if ( _height % 8 ) {
1452 _height = ( ( ( _height - 1 ) / 8 ) - 1 ) * 8;
1453 }
1454 if ( _frame_height % 8 ) {
1455 _frame_height = ( ( ( _frame_height - 1 ) / 8 ) - 1 ) * 8;
1456 }
1457 }
1458
1459 Variable * result = variable_temporary( _environment, VT_IMAGE, "(image)");
1460
1461 result->locked = 1;
1462
1463 // timeslot: 1 byte
1464 // width: 1 byte
1465 // size: 1 byte
1466 // (indexes): size bytes
1467 // tiles' data
1468
1469 int size = ( ( _frame_width >> 3 ) * ( _frame_height >> 3 ) );
1470
1471 int bufferSize = 3 + size + size * 16;
1472
1473 char * buffer = malloc ( bufferSize );
1474
1475 memset( buffer, 0, bufferSize );
1476
1477 buffer[0] = 0xff; // force update at first PUT IMAGE
1478 buffer[1] = ( _frame_width >> 3 );
1479 buffer[2] = size;
1480
1481 int cx, cy;
1482
1483 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
1484
1485 for( cy=0; cy<(_frame_height >> 3);++cy) {
1486 for( cx=0; cx<(_frame_width >> 3);++cx) {
1487
1488 int tileDataOffset = 3 + size + ( (cy * ( _frame_width >> 3 ) ) + cx ) * ( 16 );
1489
1490 char * source = _source + ( ( cy * 8 * _width ) + cx * 8 ) * _depth;
1491
1492 char convertedTile[16];
1493
1494 gb_image_converter_tile( _environment, source, convertedTile, _width, _depth, _width );
1495
1496 memcpy( &buffer[tileDataOffset], convertedTile, 16 );
1497
1498 }
1499
1500 }
1501
1502 variable_store_buffer( _environment, result->name, buffer, bufferSize, 0 );
1503
1504 return result;
1505
1506}
1507
1508Variable * gb_sprite_converter( Environment * _environment, char * _source, int _width, int _height, int _depth, RGBi * _color, int _slot_x, int _slot_y ) {
1509
1510 if ( _width != 8 ) {
1512 }
1513
1514 if ( _height != 8 ) {
1516 }
1517
1518 Variable * result = variable_temporary( _environment, VT_IMAGE, "(image)");
1519
1520 result->locked = 1;
1521
1522 int size = 1;
1523
1524 int bufferSize = 3 + size + size * 16;
1525
1526 char * buffer = malloc ( bufferSize );
1527
1528 memset( buffer, 0, bufferSize );
1529
1530 buffer[0] = 0xff;
1531 buffer[1] = 1;
1532 buffer[2] = size;
1533
1534 int cx, cy;
1535
1536 int tileDataOffset = 3 + size;
1537
1538 char * source = _source;
1539
1540 char convertedTile[16];
1541
1542 gb_image_converter_tile( _environment, source, convertedTile, _width, _depth, _width );
1543
1544 memcpy( &buffer[tileDataOffset], convertedTile, 16 );
1545
1546 variable_store_buffer( _environment, result->name, buffer, bufferSize, 0 );
1547
1548 result->readonly = 1;
1549
1550 return result;
1551
1552}
1553
1554Variable * gb_image_converter( Environment * _environment, char * _data, int _width, int _height, int _depth, int _offset_x, int _offset_y, int _frame_width, int _frame_height, int _mode, int _transparent_color, int _flags ) {
1555
1556 switch( _mode ) {
1557
1558 case TILEMAP_MODE_BGB:
1559 case TILEMAP_MODE_CGB:
1560
1561 return gb_image_converter_tilemap_mode_standard( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
1562
1563 break;
1564 }
1565
1567
1568 return gb_new_image( _environment, 8, 8, TILEMAP_MODE_STANDARD );
1569
1570}
1571
1572static void gb_load_image_address_to_other_register( Environment * _environment, char * _register, char * _source, char * _sequence, char * _frame, int _frame_size, int _frame_count ) {
1573
1574 // outline1("LD HL, %s", _source );
1575 // if ( _sequence ) {
1576
1577 // outline0("LD DE, $0003" );
1578 // outline0("ADD HL, DE" );
1579 // if ( strlen(_sequence) == 0 ) {
1580
1581 // } else {
1582 // outline0("PUSH HL" );
1583 // outline1("LD A, (%s)", _sequence );
1584 // outline0("LD L, A" );
1585 // outline0("LD H, 0" );
1586 // outline0("ADD HL, HL" );
1587 // outline0("LD DE, HL" );
1588 // outline1("LD HL, OFFSETS%4.4x", _frame_size * _frame_count );
1589 // outline0("ADD HL, DE" );
1590 // outline0("LD A, (HL)" );
1591 // outline0("LD E, A" );
1592 // outline0("INC HL" );
1593 // outline0("LD A, (HL)" );
1594 // outline0("LD D, A" );
1595 // outline0("POP HL" );
1596 // outline0("ADD HL, DE" );
1597 // }
1598
1599 // if ( _frame ) {
1600 // if ( strlen(_frame) == 0 ) {
1601
1602 // } else {
1603 // outline0("PUSH HL" );
1604 // outline1("LD A, (%s)", _frame );
1605 // outline0("LD L, A" );
1606 // outline0("LD H, 0" );
1607 // outline0("ADD HL, HL" );
1608 // outline0("LD DE, HL" );
1609 // outline1("LD HL, OFFSETS%4.4x", _frame_size * _frame_count );
1610 // outline0("ADD HL, DE" );
1611 // outline0("LD A, (HL)" );
1612 // outline0("LD E, A" );
1613 // outline0("INC HL" );
1614 // outline0("LD A, (HL)" );
1615 // outline0("LD D, A" );
1616 // outline0("POP HL" );
1617 // outline0("ADD HL, DE" );
1618 // }
1619 // }
1620
1621 // } else {
1622
1623 // if ( _frame ) {
1624 // outline0("LD DE, $0003" );
1625 // outline0("ADD HL, DE" );
1626 // if ( strlen(_frame) == 0 ) {
1627
1628 // } else {
1629 // outline0("PUSH HL" );
1630 // outline1("LD A, (%s)", _frame );
1631 // outline0("LD L, A" );
1632 // outline0("LD H, 0" );
1633 // outline0("ADD HL, HL" );
1634 // outline0("LD DE, HL" );
1635 // outline1("LD HL, OFFSETS%4.4x", _frame_size );
1636 // outline0("ADD HL, DE" );
1637 // outline0("LD A, (HL)" );
1638 // outline0("LD E, A" );
1639 // outline0("INC HL" );
1640 // outline0("LD A, (HL)" );
1641 // outline0("LD D, A" );
1642 // outline0("POP HL" );
1643 // outline0("ADD HL, DE" );
1644 // }
1645 // }
1646
1647 // }
1648
1649 // if ( _register ) {
1650 // outline1("LD (%s), HL", _register );
1651 // }
1652
1653}
1654
1655static void gb_load_image_address_to_register( Environment * _environment, char * _register, Resource * _source, char * _sequence, char * _frame, int _frame_size, int _frame_count ) {
1656
1657 if ( _source->isAddress ) {
1658 outline1("LD HL, (%s)", _source->realName );
1659 } else {
1660 outline1("LD HL, %s", _source->realName );
1661 char dataLabel[MAX_TEMPORARY_STORAGE];
1662 sprintf(dataLabel, "%sdata", _source->realName);
1663 outline1("LD DE, %s", dataLabel );
1664 }
1665
1666 if ( _frame_size ) {
1667
1668 if ( !_sequence && !_frame ) {
1669 } else {
1670 if ( _sequence ) {
1671 outline0("LD DE, $0003" );
1672 outline0("ADD HL, DE" );
1673 if ( strlen(_sequence) == 0 ) {
1674
1675 } else {
1676 outline1("LD A, (%s)", _sequence );
1677 outline0("LD (IXR), HL" );
1678 outline1("CALL %soffsetsequence", _source->realName );
1679 }
1680 if ( _frame ) {
1681 if ( strlen(_frame) == 0 ) {
1682
1683 } else {
1684 outline1("LD A, (%s)", _frame );
1685 outline0("LD (IXR), HL" );
1686 outline1("CALL %soffsetframe", _source->realName );
1687 }
1688 }
1689
1690 } else {
1691
1692 if ( _frame ) {
1693 outline0("LD DE, $0003" );
1694 outline0("ADD HL, DE" );
1695 if ( strlen(_frame) == 0 ) {
1696
1697 } else {
1698 outline0("LD (IXR), HL" );
1699 outline1("LD A, (%s)", _frame );
1700 outline1("CALL %soffsetframe", _source->realName );
1701 }
1702 }
1703
1704 }
1705
1706 }
1707
1708 }
1709
1710 if ( _register ) {
1711 outline1("LD (%s), HL", _register );
1712 }
1713
1714}
1715
1716
1717void gb_blit_image( Environment * _environment, char * _sources[], int _source_count, char * _blit, char * _x, char * _y, char * _frame, char * _sequence, int _frame_size, int _frame_count, int _flags ) {
1718
1719 // // deploy( GBvars, src_hw_gb_vars_asm);
1720 // // deploy( GBvarsGraphic, src_hw_gb_vars_graphic_asm );
1721 // // deploy( blitimage, src_hw_gb_blit_image_asm );
1722
1723 // if ( _source_count > 2 ) {
1724 // CRITICAL_BLIT_TOO_MUCH_SOURCES( );
1725 // }
1726
1727 // MAKE_LABEL
1728
1729 // outline1("LD HL, %s", _blit );
1730 // outline0("LD (BLITIMAGEBLITTINGADDR), HL");
1731
1732 // outhead1("blitimage%s:", label);
1733 // if ( _source_count > 0 ) {
1734 // Resource resource;
1735 // resource.realName = strdup( _sources[0] );
1736 // resource.type = VT_IMAGE;
1737 // resource.isAddress = 0;
1738 // gb_load_image_address_to_register( _environment, "BLITTMPPTR", &resource, _sequence, _frame, _frame_size, _frame_count );
1739 // } else {
1740 // outline0( "LD HL, 0" );
1741 // outline0( "LD (BLITTMPPTR), HL" );
1742 // }
1743
1744 // if ( _source_count > 1 ) {
1745 // Resource resource;
1746 // resource.realName = strdup( _sources[0] );
1747 // resource.type = VT_IMAGE;
1748 // resource.isAddress = 0;
1749 // gb_load_image_address_to_register( _environment, "BLITTMPPTR2", &resource, _sequence, _frame, _frame_size, _frame_count );
1750 // } else {
1751 // outline0( "LD HL, 0" );
1752 // outline0( "LD (BLITTMPPTR2), HL" );
1753 // }
1754
1755 // outline1("LD A, (%s)", _x );
1756 // outline0("LD E, A" );
1757 // outline1("LD A, (%s)", _y );
1758 // outline0("LD D, A" );
1759
1760 // outline0("PUSH HL" );
1761 // outline1("LD HL, %4.4x", _flags );
1762 // outline0("LD A, L" );
1763 // outline0("LD (IMAGEF), A" );
1764 // outline0("LD A, H" );
1765 // outline0("LD (IMAGET), A" );
1766 // outline0("POP HL" );
1767
1768 // if ( ! _environment->hasGameLoop ) {
1769 // outline0("CALL BLITIMAGE");
1770 // } else {
1771 // outline0("CALL BLITIMAGENMI2");
1772 // }
1773
1774}
1775
1776void gb_put_image( Environment * _environment, Resource * _image, char * _x, char * _y, char * _frame, char * _sequence, int _frame_size, int _frame_count, char * _flags ) {
1777
1778 deploy( gbvars, src_hw_gb_vars_asm);
1779 deploy( putimage, src_hw_gb_put_image_asm );
1780
1781 // MAKE_LABEL
1782
1783 // outhead1("putimage%s:", label);
1784
1785 outline1("LD HL, (%s)", _x );
1786 outline0("LD (IMAGEX), HL" );
1787 outline1("LD HL, (%s)", _y );
1788 outline0("LD (IMAGEY), HL" );
1789
1790 gb_load_image_address_to_register( _environment, NULL, _image, _sequence, _frame, _frame_size, _frame_count );
1791
1792 // outline1("LD A, (%s)", _flags );
1793 // outline0("LD (IMAGEF), A" );
1794 // outline1("LD A, (%s)", address_displacement(_environment, _flags, "1") );
1795 // outline0("LD (IMAGET), A" );
1796
1797 outline0("CALL PUTIMAGE");
1798
1799}
1800
1801void gb_wait_vbl( Environment * _environment, char * _raster_line ) {
1802
1803 outline0("CALL WAITVBL");
1804
1805}
1806
1807void gb_screen_on_off( Environment * _environment, int _on_off ) {
1808
1809 outline1("LD A, $%2.2x", _on_off );
1810 outline0("CALL SCREENONOFF");
1811
1812}
1813
1814Variable * gb_new_image( Environment * _environment, int _width, int _height, int _mode ) {
1815
1816 int size = gb_image_size( _environment, _width, _height, _mode );
1817
1818 if ( ! size ) {
1820 }
1821
1822 Variable * result = variable_temporary( _environment, VT_IMAGE, "(image)" );
1823
1824 char * buffer = malloc ( size );
1825 memset( buffer, 0, size );
1826
1827 buffer[0] = 0xff; // force update at first PUT IMAGE
1828 buffer[1] = ( _width >> 3 );
1829 buffer[2] = size;
1830
1831 result->valueBuffer = buffer;
1832 result->size = size;
1833
1834 return result;
1835
1836}
1837
1838Variable * gb_new_images( Environment * _environment, int _frames, int _width, int _height, int _mode ) {
1839
1840 // // deploy( GBvarsGraphic, src_hw_gb_vars_graphic_asm );
1841
1842 // int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
1843 // int frameSize = gb_image_size( _environment, _width, _height, _mode );
1844
1845 // if ( ! size ) {
1846 // CRITICAL_NEW_IMAGES_UNSUPPORTED_MODE( _mode );
1847 // }
1848
1849 // Variable * result = variable_temporary( _environment, VT_IMAGES, "(new images)" );
1850
1851 // char * buffer = malloc ( size );
1852 // memset( buffer, 0, size );
1853
1854 // *(buffer) = _frames;
1855 // *(buffer+1) = ( _width & 0xff );
1856 // *(buffer+2) = ( _width >> 8 ) & 0xff;
1857 // for( int i=0; i<_frames; ++i ) {
1858 // *(buffer+3+(i*frameSize)) = ( _width & 0xff );
1859 // *(buffer+3+(i*frameSize)+1) = ( ( _width >> 8 ) & 0xff );
1860 // *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
1861 // }
1862
1863 // result->valueBuffer = buffer;
1864 // result->frameSize = frameSize;
1865 // result->size = size;
1866 // result->frameCount = _frames;
1867
1868 // return result;
1869
1870}
1871
1872Variable * gb_new_sequence( Environment * _environment, int _sequences, int _frames, int _width, int _height, int _mode ) {
1873
1874 // // deploy( GBvarsGraphic, src_hw_gb_vars_graphic_asm );
1875
1876 // int size2 = calculate_sequence_size( _environment, _sequences, _frames, _width, _height, _mode );
1877 // int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
1878 // int frameSize = gb_image_size( _environment, _width, _height, _mode );
1879
1880 // if ( ! size ) {
1881 // CRITICAL_NEW_IMAGES_UNSUPPORTED_MODE( _mode );
1882 // }
1883
1884 // Variable * result = variable_temporary( _environment, VT_SEQUENCE, "(new sequence)" );
1885
1886 // char * buffer = malloc ( size2 );
1887 // memset( buffer, 0, size2 );
1888
1889 // *(buffer) = _frames;
1890 // *(buffer+1) = _width;
1891 // *(buffer+2) = _sequences;
1892 // for( int i=0; i<(_frames*_sequences); ++i ) {
1893 // *(buffer+3+(i*frameSize)) = ( _width & 0xff );
1894 // *(buffer+3+(i*frameSize)+1) = ( ( _width >> 8 ) & 0xff );
1895 // *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
1896 // }
1897
1898 // result->valueBuffer = buffer;
1899 // result->frameSize = frameSize;
1900 // result->size = size2;
1901 // result->frameCount = _frames;
1902
1903 // return result;
1904
1905}
1906
1907void gb_get_image( Environment * _environment, char * _image, char * _x, char * _y, char * _frame, char * _sequence, int _frame_size, int _frame_count, int _palette ) {
1908
1909 // // deploy( GBvars, src_hw_gb_vars_asm);
1910 // // deploy( GBvarsGraphic, src_hw_gb_vars_graphic_asm );
1911 // // deploy( getimage, src_hw_gb_get_image_asm );
1912
1913 // MAKE_LABEL
1914
1915 // gb_load_image_address_to_other_register( _environment, NULL, _image, _sequence, _frame, _frame_size, _frame_count );
1916
1917 // outline1("LD A, (%s)", _x );
1918 // outline0("LD E, A" );
1919 // outline1("LD A, (%s)", _y );
1920 // outline0("LD D, A" );
1921 // outline1("LD A, $%2.2x", _palette );
1922 // outline0("LD IXH, A" );
1923
1924 // if ( ! _environment->hasGameLoop ) {
1925 // outline0("CALL GETIMAGE");
1926 // } else {
1927 // outline0("CALL GETIMAGENMI2");
1928 // }
1929
1930}
1931
1932
1933void gb_scroll( Environment * _environment, int _dx, int _dy ) {
1934
1935 // // deploy( vic2vars, src_hw_gb_vars_asm);
1936 // // deploy( scroll, src_hw_gb_scroll_asm);
1937 // // deploy( textHScroll, src_hw_gb_hscroll_text_asm );
1938 // // deploy( vScrollTextDown, src_hw_gb_vscroll_text_down_asm );
1939 // // deploy( vScrollTextUp, src_hw_gb_vscroll_text_up_asm );
1940
1941 // outline1("LD A, $%2.2x", (unsigned char)(_dx&0xff) );
1942 // outline0("LD B, A" );
1943 // outline1("LD A, $%2.2x", (unsigned char)(_dy&0xff) );
1944 // outline0("LD C, A" );
1945 // outline0("CALL SCROLL");
1946
1947}
1948
1949void gb_put_tile( Environment * _environment, char * _tile, char * _x, char * _y ) {
1950
1951 // // deploy( GBvars, src_hw_gb_vars_asm);
1952 // // deploy( tiles, src_hw_gb_tiles_asm );
1953
1954 // outline1("LD A, (%s)", _tile );
1955 // outline0("LD (TILET), A" );
1956 // outline1("LD A, (%s)", _x );
1957 // outline0("LD (TILEX), A" );
1958 // outline1("LD A, (%s)", _y );
1959 // outline0("LD (TILEY), A" );
1960 // outline0("LD A, 1" );
1961 // outline0("LD (TILEW), A" );
1962 // outline0("LD (TILEH), A" );
1963 // outline0("LD (TILEW2), A" );
1964 // outline0("LD (TILEH2), A" );
1965
1966 // if ( ! _environment->hasGameLoop ) {
1967 // outline0("CALL PUTTILE");
1968 // } else {
1969 // outline0("CALL PUTTILENMI2");
1970 // }
1971
1972}
1973
1974void gb_move_tiles( Environment * _environment, char * _tile, char * _x, char * _y ) {
1975
1976 // Variable * tile = variable_retrieve( _environment, _tile );
1977 // Variable * x = variable_retrieve( _environment, _x );
1978 // Variable * y = variable_retrieve( _environment, _y );
1979
1980 // // deploy( GBvars, src_hw_gb_vars_asm);
1981 // // deploy( tiles, src_hw_gb_tiles_asm );
1982
1983 // int size = ( tile->originalWidth >> 3 ) * ( tile->originalHeight >> 3 );
1984
1985 // if ( size ) {
1986 // outline1("LD HL, OFFSETS%4.4x", size );
1987 // outline0("LD A, L" );
1988 // outline0("LD (TILEO), A" );
1989 // outline0("LD A, H" );
1990 // outline0("LD (TILEO+1), A" );
1991 // } else {
1992 // outline0("LD A, 0" );
1993 // outline0("LD (TILEO), A" );
1994 // outline0("LD (TILEO+1), A" );
1995 // }
1996
1997 // outline1("LD A, (%s)", tile->realName );
1998 // outline0("LD (TILET), A" );
1999 // outline1("LD A, (%s)", x->realName );
2000 // outline0("LD (TILEX), A" );
2001 // outline1("LD A, (%s)", y->realName );
2002 // outline0("LD (TILEY), A" );
2003 // outline1("LD A, (%s)", address_displacement(_environment, tile->realName, "1") );
2004 // outline0("LD (TILEW), A" );
2005 // outline0("LD (TILEW2), A" );
2006 // outline1("LD A, (%s)", address_displacement(_environment, tile->realName, "2") );
2007 // outline0("LD (TILEH), A" );
2008 // outline0("LD (TILEH2), A" );
2009 // outline1("LD A, (%s)", address_displacement(_environment, tile->realName, "3") );
2010 // outline0("LD (TILEA), A" );
2011
2012 // if ( ! _environment->hasGameLoop ) {
2013 // outline0("CALL MOVETILE");
2014 // } else {
2015 // outline0("CALL MOVETILENMI2");
2016 // }
2017
2018}
2019
2020void gb_put_tiles( Environment * _environment, char * _tile, char * _x, char * _y, char *_w, char *_h ) {
2021
2022 // // deploy( GBvars, src_hw_gb_vars_asm);
2023 // // deploy( tiles, src_hw_gb_tiles_asm );
2024
2025 // outline1("LD A, (%s)", _tile );
2026 // outline0("LD (TILET), A" );
2027 // outline1("LD A, (%s)", _x );
2028 // outline0("LD (TILEX), A" );
2029 // outline1("LD A, (%s)", _y );
2030 // outline0("LD (TILEY), A" );
2031 // outline1("LD A, (%s)", address_displacement(_environment, _tile, "1") );
2032 // outline0("LD (TILEW), A" );
2033 // if ( _w ) {
2034 // outline1("LD A, (%s)", _w );
2035 // }
2036 // outline0("LD (TILEW2), A" );
2037 // outline1("LD A, (%s)", address_displacement(_environment, _tile, "2") );
2038 // outline0("LD (TILEH), A" );
2039 // if ( _h ) {
2040 // outline1("LD A, (%s)", _h );
2041 // }
2042 // outline0("LD (TILEH2), A" );
2043
2044 // if ( ! _environment->hasGameLoop ) {
2045 // outline0("CALL PUTTILE");
2046 // } else {
2047 // outline0("CALL PUTTILENMI2");
2048 // }
2049
2050}
2051
2052void gb_tile_at( Environment * _environment, char * _x, char * _y, char *_result ) {
2053
2054 // // deploy( GBvars, src_hw_gb_vars_asm);
2055 // // deploy( tiles, src_hw_gb_tiles_asm );
2056
2057 // outline1("LD A, (%s)", _x );
2058 // outline0("LD (TILEX), A" );
2059 // outline1("LD A, (%s)", _y );
2060 // outline0("LD (TILEY), A" );
2061
2062 // if ( ! _environment->hasGameLoop ) {
2063 // outline0("CALL TILEAT");
2064 // } else {
2065 // outline0("CALL TILEATNMI2");
2066 // }
2067
2068 // outline0("LD A, (TILET)" );
2069 // outline1("LD (%s), A", _result );
2070
2071}
2072
2073void gb_use_tileset( Environment * _environment, char * _tileset ) {
2074
2075 // // deploy( GBvars, src_hw_gb_vars_asm);
2076 // // deploy( tiles, src_hw_gb_tiles_asm );
2077
2078 // outline1("LD A, (%s)", _tileset );
2079
2080 // if ( ! _environment->hasGameLoop ) {
2081 // outline0("CALL USETILESET");
2082 // } else {
2083 // outline0("CALL USETILESETNMI2");
2084 // }
2085
2086}
2087
2089
2090 // Variable * result = variable_temporary( _environment, VT_WORD, "(raster line)" );
2091
2092 // variable_store( _environment, result->name, 0 );
2093
2094 // return result;
2095
2096}
2097
2098void gb_move_memory_video( Environment * _environment, char * _from, char * _to, char * _size ) {
2099
2100 // outline1("LD HL, (%s)", _from );
2101 // outline1("LD DE, (%s)", _to );
2102 // outline1("LD BC, (%s)", _size );
2103 // outline0("CALL VDPWRITE" );
2104
2105}
2106
2107void gb_move_video_memory( Environment * _environment, char * _from, char * _to, char * _size ) {
2108
2109 // outline1("LD HL, (%s)", _to );
2110 // outline1("LD DE, (%s)", _from );
2111 // outline1("LD BC, (%s)", _size );
2112 // outline0("CALL VDPREAD" );
2113
2114}
2115
2116void gb_colors_vars( Environment * _environment, char * _foreground_color, char * _background_color ) {
2117
2118// #ifdef __coleco__
2119// MAKE_LABEL
2120// if ( ! _environment->hasGameLoop ) {
2121// outline1("JP %sskip", label );
2122// outhead1("%s:", label );
2123// }
2124// #endif
2125 // outline1("LD E, %2.2x", VDP_RCOLOR );
2126 // outline0("CALL VDPREGIN" );
2127 // outline1("LD A, (%s)", _foreground_color );
2128 // outline0("SLA A" );
2129 // outline0("SLA A" );
2130 // outline0("SLA A" );
2131 // outline0("SLA A" );
2132 // outline0("LD B, A" );
2133 // outline1("LD A, (%s)", _background_color );
2134 // outline0("OR B" );
2135 // outline0("CALL VDPSETREG" );
2136// #ifdef __coleco__
2137// if ( ! _environment->hasGameLoop ) {
2138// outline0("RET" );
2139// outhead1("%sskip:", label );
2140// outline0("CALL WAIT_VDP_HOOK" );
2141// outline1("LD HL, %s", label );
2142// outline0("CALL SET_VDP_HOOK0" );
2143// outline0("CALL WAIT_VDP_HOOK" );
2144// }
2145// #endif
2146
2147}
2148
2149void gb_slice_image( Environment * _environment, char * _image, char * _frame, char * _sequence, int _frame_size, int _frame_count, char * _destination ) {
2150
2151}
2152
2153void gb_slice_image_copy( Environment * _environment, char * _image, char * _frame, char * _sequence, int _frame_size, int _frame_count, char * _destination ) {
2154
2155 // // deploy( GBvars, src_hw_gb_vars_asm);
2156 // // deploy( GBvarsGraphic, src_hw_gb_vars_graphic_asm);
2157 // // deploy( duff, src_hw_sm83_duff_asm );
2158 // // deploy( sliceimagecopy, src_hw_gb_slice_image_copy_asm );
2159
2160 // MAKE_LABEL
2161
2162 // Resource resource;
2163 // resource.realName = strdup( _image );
2164 // resource.type = VT_IMAGE;
2165 // gb_load_image_address_to_register( _environment, NULL, &resource, _sequence, _frame, _frame_size, _frame_count );
2166
2167 // outline1( "LD DE, %s", _destination );
2168
2169 // outline0("CALL SLICEIMAGECOPY");
2170
2171}
2172
2173void gb_slice_image_extract( Environment * _environment, char * _image, char * _frame, char * _sequence, int _frame_size, int _frame_count, char * _destination ) {
2174
2175 // // deploy( GBvars, src_hw_gb_vars_asm);
2176 // // deploy( GBvarsGraphic, src_hw_gb_vars_graphic_asm);
2177 // // deploy( duff, src_hw_sm83_duff_asm );
2178 // // deploy( sliceimageextract, src_hw_gb_slice_image_extract_asm );
2179
2180 // MAKE_LABEL
2181
2182 // Resource resource;
2183 // resource.realName = strdup( _image );
2184 // resource.type = VT_IMAGE;
2185 // gb_load_image_address_to_register( _environment, NULL, &resource, _sequence, _frame, _frame_size, _frame_count );
2186
2187 // Variable * sliceImageX = variable_retrieve( _environment, _environment->sliceImageX );
2188 // Variable * sliceImageY = variable_retrieve( _environment, _environment->sliceImageY );
2189 // outline1( "LD DE, (%s)", sliceImageX->realName );
2190 // outline0( "LD (SLICEX), DE" );
2191 // outline1( "LD DE, (%s)", sliceImageY->realName );
2192 // outline0( "LD (SLICEY), DE" );
2193 // outline1( "LD DE, %s", _destination );
2194
2195 // outline0("CALL SLICEIMAGEEXT");
2196
2197}
2198
2199int gb_palette_extract( Environment * _environment, char * _data, int _width, int _height, int _depth, int _flags, RGBi * _palette ) {
2200
2201 // int paletteColorCount = rgbi_extract_palette(_environment, _data, _width, _height, _depth, _palette, MAX_PALETTE, ( ( _flags & FLAG_EXACT ) ? 0 : 1 ) /* sorted */);
2202
2203 // memcpy( _palette, palette_match( _palette, paletteColorCount, SYSTEM_PALETTE, sizeof(SYSTEM_PALETTE) / sizeof(RGBi) ), paletteColorCount * sizeof( RGBi ) );
2204
2205 // int uniquePaletteCount = 0;
2206
2207 // memcpy( _palette, palette_remove_duplicates( _palette, paletteColorCount, &uniquePaletteCount ), paletteColorCount * sizeof( RGBi ) );
2208
2209 // return uniquePaletteCount;
2210
2211}
2212
2213void gb_calculate_sequence_frame_offset( Environment * _environment, char * _offset, char * _sequence, char * _frame, int _frame_size, int _frame_count ) {
2214
2215 // if ( !_sequence && !_frame ) {
2216 // outline0("LD HL, 0" );
2217 // } else {
2218 // outline0("LD HL, 0" );
2219
2220 // if ( _sequence ) {
2221 // outline0("LD DE, $0003" );
2222 // outline0("ADD HL, DE" );
2223 // if ( strlen(_sequence) == 0 ) {
2224
2225 // } else {
2226 // outline1("LD A, (%s)", _sequence );
2227 // outline0("PUSH HL" );
2228 // outline0("POP IX" );
2229 // outline1("CALL OFFSETS%4.4X", _frame_count * _frame_size );
2230 // }
2231 // if ( _frame ) {
2232 // if ( strlen(_frame) == 0 ) {
2233
2234 // } else {
2235 // outline1("LD A, (%s)", _frame );
2236 // outline0("PUSH HL" );
2237 // outline0("POP IX" );
2238 // outline1("CALL OFFSETS%4.4X", _frame_size );
2239 // }
2240 // }
2241
2242 // } else {
2243
2244 // if ( _frame ) {
2245 // outline0("LD DE, $0003" );
2246 // outline0("ADD HL, DE" );
2247 // if ( strlen(_frame) == 0 ) {
2248
2249 // } else {
2250 // outline0("PUSH HL" );
2251 // outline0("POP IX" );
2252 // outline1("LD A, (%s)", _frame );
2253 // outline1("CALL OFFSETS%4.4X", _frame_size );
2254 // }
2255 // }
2256
2257 // }
2258
2259 // }
2260 // outline1("LD (%s), HL", _offset );
2261
2262}
2263
2264void gb_flip_image( Environment * _environment, Resource * _image, char * _frame, char * _sequence, int _frame_size, int _frame_count, char * _direction ) {
2265
2266 // // deploy( GBvars, src_hw_gb_vars_asm);
2267 // // deploy( GBvarsGraphic, src_hw_gb_vars_graphic_asm );
2268
2269 // MAKE_LABEL
2270
2271 // if ( _direction & FLAG_FLIP_X ) {
2272 // gb_load_image_address_to_register( _environment, NULL, _image, _sequence, _frame, _frame_size, _frame_count );
2273 // // deploy( flipimagex, src_hw_gb_flip_image_x_asm );
2274 // outline0("CALL FLIPIMAGEX");
2275 // }
2276
2277 // if ( _direction & FLAG_FLIP_Y ) {
2278 // ef936x_load_image_address_to_register( _environment, NULL, _image, _sequence, _frame, _frame_size, _frame_count );
2279 // // deploy( flipimagey, src_hw_gb_flip_image_y_asm );
2280 // outline0("CALL FLIPIMAGEY");
2281 // }
2282
2283}
2284
2285static unsigned int SOUND_FREQUENCIES[] = {
2286 -5969, -5518, -5094, -4693, -4315, -3958, -3621, -3303,
2287 -3002, -2719, -2451, -2199, -1960, -1735, -1523, -1323,
2288 -1134, -955, -787, -627, -477, -336, -202, -76,
2289 44, 156, 262, 362, 457, 546, 630, 710,
2290 785, 856, 923, 986, 1046, 1102, 1155, 1205,
2291 1252, 1297, 1339, 1379, 1416, 1452, 1485, 1517,
2292 1547, 1575, 1601, 1626, 1650, 1672, 1693, 1713,
2293 1732, 1750, 1766, 1782, 1797, 1811, 1824, 1837,
2294 1849, 1860, 1870, 1880, 1890, 1899, 1907, 1915,
2295 1922, 1929, 1936, 1942, 1948, 1954, 1959, 1964,
2296 1969, 1973, 1977, 1981, 1985, 1988, 1992, 1995,
2297 1998, 2001, 2003, 2006, 2008, 2010, 2012, 2014,
2298 2016, 2018, 2020, 2021, 2023, 2024, 2026, 2027,
2299 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2034,
2300 2035, 2036, 2036, 2037, 2038, 2038, 2039, 2039
2301};
2302
2303void gb_start( Environment * _environment, int _channels ) {
2304
2305 if ( _channels & 0x01 ) {
2306 outline0("CALL GBSTART0");
2307 }
2308 if ( _channels & 0x02 ) {
2309 outline0("CALL GBSTART1");
2310 }
2311 if ( _channels & 0x04 ) {
2312 outline0("CALL GBSTART2");
2313 }
2314 if ( _channels & 0x08 ) {
2315 outline0("CALL GBSTART3");
2316 }
2317
2318}
2319
2320void gb_set_volume( Environment * _environment, int _channels, int _volume ) {
2321
2322 outline1("LD A, $%2.2x", ( _volume & 0x0f ) );
2323 outline0("LD E, A" );
2324 outline1("LD A, $%2.2x", ( _channels & 0x07 ) );
2325 outline0("CALL GBSTARTVOL");
2326
2327}
2328
2329#define PROGRAM_FREQUENCY( c, f ) \
2330 outline1("LD A, $%2.2x", ( f & 0xff ) ); \
2331 outline0("LD E, A" ); \
2332 outline1("LD A, $%2.2x", ( ( f >> 8 ) & 0xff ) ); \
2333 outline0("LD D, A" ); \
2334 if ( ( c & 0x01 ) ) \
2335 outline0("CALL GBPROGFREQ0" ); \
2336 if ( ( c & 0x02 ) ) \
2337 outline0("CALL GBPROGFREQ1" ); \
2338 if ( ( c & 0x04 ) ) \
2339 outline0("CALL GBPROGFREQ2" ); \
2340 if ( ( c & 0x08 ) ) \
2341 outline0("CALL GBPROGFREQ3" );
2342
2343#define PROGRAM_FREQUENCY_V( c, f ) \
2344 outline1("LD A, (%s)", f ); \
2345 outline0("LD E, A" ); \
2346 outline1("LD A, (%s)", address_displacement(_environment, f, "1") ); \
2347 outline0("LD D, A" ); \
2348 if ( c == NULL ) { \
2349 outline0("LD A, $3"); \
2350 } else { \
2351 outline1("LD A, (%s)", c ); \
2352 } \
2353 outline0("CALL GBFREQ" );
2354
2355#define PROGRAM_FREQUENCY_SV( c, f ) \
2356 outline1("LD A, $%2.2x", ( f & 0xff ) ); \
2357 outline0("LD E, A" ); \
2358 outline1("LD A, $%2.2x", ( ( f >> 8 ) & 0xff ) ); \
2359 outline0("LD D, A" ); \
2360 if ( c == NULL ) { \
2361 outline0("LD A, $3"); \
2362 } else { \
2363 outline1("LD A, (%s)", c ); \
2364 } \
2365 outline0("CALL GBFREQ2" );
2366
2367#define PROGRAM_DURATION( c, d ) \
2368 outline1("LD A, $%2.2x", ( d & 0xff ) ); \
2369 outline0("LD E, A" ); \
2370 outline1("LD A, $%2.2x", ( ( d >> 8 ) & 0xff ) ); \
2371 outline0("LD D, A" ); \
2372 if ( ( c & 0x01 ) ) \
2373 outline0("CALL GBPROGDUR0" ); \
2374 if ( ( c & 0x02 ) ) \
2375 outline0("CALL GBPROGDUR1" ); \
2376 if ( ( c & 0x04 ) ) \
2377 outline0("CALL GBPROGDUR2" ); \
2378 if ( ( c & 0x08 ) ) \
2379 outline0("CALL GBPROGDUR3" );
2380
2381#define WAIT_DURATION( c ) \
2382 if ( ( c & 0x01 ) ) \
2383 outline0("CALL GBWAITDUR0" ); \
2384 if ( ( c & 0x02 ) ) \
2385 outline0("CALL GBWAITDUR1" ); \
2386 if ( ( c & 0x04 ) ) \
2387 outline0("CALL GBWAITDUR2" ); \
2388 if ( ( c & 0x08 ) ) \
2389 outline0("CALL GBWAITDUR3" );
2390
2391#define PROGRAM_PITCH( c, f ) \
2392 outline1("LD A, $%2.2x", ( f & 0xff ) ); \
2393 outline0("LD E, A" ); \
2394 outline1("LD A, $%2.2x", ( ( f >> 8 ) & 0xff ) ); \
2395 outline0("LD D, A" ); \
2396 if ( ( c & 0x01 ) ) \
2397 outline0("CALL GBPROGFREQ0" ); \
2398 if ( ( c & 0x02 ) ) \
2399 outline0("CALL GBPROGFREQ1" ); \
2400 if ( ( c & 0x04 ) ) \
2401 outline0("CALL GBPROGFREQ2" ); \
2402 if ( ( c & 0x08 ) ) \
2403 outline0("CALL GBPROGFREQ3" );
2404
2405#define PROGRAM_PITCH_V( c, f ) \
2406 outline1("LD A, (%s)", f ); \
2407 outline0("LD E, A" ); \
2408 outline1("LD A, (%s)", address_displacement(_environment, f, "1") ); \
2409 outline0("LD D, A" ); \
2410 if ( c == NULL ) { \
2411 outline0("LD A, $3"); \
2412 } else { \
2413 outline1("LD A, (%s)", c ); \
2414 } \
2415 outline0("CALL GBPROGFREQ" );
2416
2417#define PROGRAM_PITCH_SV( c, f ) \
2418 outline1("LD A, $%2.2x", ( f & 0xff ) ); \
2419 outline0("LD E, A" ); \
2420 outline1("LD A, $%2.2x", ( ( f >> 8 ) & 0xff ) ); \
2421 outline0("LD D, A" ); \
2422 if ( c == NULL ) { \
2423 outline0("LD A, $3"); \
2424 } else { \
2425 outline1("LD A, (%s)", c ); \
2426 } \
2427 outline0("CALL GBPROGFREQ" );
2428
2429#define PROGRAM_PULSE( c, p ) \
2430 outline1("LD A, $%2.2x", ( p & 0xff ) ); \
2431 outline0("LD E, A" ); \
2432 outline1("LD A, $%2.2x", ( ( p >> 8 ) & 0xff ) ); \
2433 outline0("LD D, A" ); \
2434 if ( ( c & 0x01 ) ) \
2435 outline0("CALL GBPROGPULSE0" ); \
2436 if ( ( c & 0x02 ) ) \
2437 outline0("CALL GBPROGPULSE1" ); \
2438 if ( ( c & 0x04 ) ) \
2439 outline0("CALL GBPROGPULSE2" ); \
2440 if ( ( c & 0x08 ) ) \
2441 outline0("CALL GBPROGPULSE3" );
2442
2443#define PROGRAM_PULSE_V( c, p ) \
2444 outline1("LD A, (%s)", p ); \
2445 outline0("LD E, A" ); \
2446 outline1("LD A, (%s)", address_displacement(_environment, p, "1") ); \
2447 outline0("LD D, A" ); \
2448 if ( c == NULL ) { \
2449 outline0("LD A, $3"); \
2450 } else { \
2451 outline1("LD A, (%s)", c ); \
2452 } \
2453 outline0("CALL GBPROGPULSE" );
2454
2455#define PROGRAM_PULSE_SV( c, p ) \
2456 outline1("LD A, $%2.2x", ( p & 0xff ) ); \
2457 outline0("LD E, A" ); \
2458 outline1("LD A, $%2.2x", ( ( p >> 8 ) & 0xff ) ); \
2459 outline0("LD D, A" ); \
2460 if ( c == NULL ) { \
2461 outline0("LD A, $3"); \
2462 } else { \
2463 outline1("LD A, (%s)", c ); \
2464 } \
2465 outline0("CALL GBPROGPULSE" );
2466
2467#define STOP_FREQUENCY( c ) \
2468 if ( ( c & 0x01 ) ) \
2469 outline0("CALL GBSTOP0" ); \
2470 if ( ( c & 0x02 ) ) \
2471 outline0("CALL GBSTOP1" ); \
2472 if ( ( c & 0x04 ) ) \
2473 outline0("CALL GBSTOP2" ); \
2474 if ( ( c & 0x08 ) ) \
2475 outline0("CALL GBSTOP3" );
2476
2477#define STOP_FREQUENCY_V( c ) \
2478 if ( c == NULL ) { \
2479 outline0("LD A, $3"); \
2480 } else { \
2481 outline1("LD A, (%s)", c ); \
2482 } \
2483 outline0("CALL GBSTOP" );
2484
2485#define STOP_FREQUENCY_SV( c ) \
2486 if ( c == NULL ) { \
2487 outline0("LD A, $3"); \
2488 } else { \
2489 outline1("LD A, (%s)", c ); \
2490 } \
2491 outline0("CALL GBSTOP" );
2492
2493void gb_set_program( Environment * _environment, int _channels, int _program ) {
2494
2495 switch (_program) {
2497 break;
2499 break;
2510 break;
2511
2515 break;
2516
2525 break;
2526
2527 default:
2537 break;
2538
2546 break;
2547
2549 break;
2550
2560 break;
2561
2574 break;
2575
2595 break;
2596
2624 break;
2625
2648 break;
2649 }
2650
2651}
2652
2653void gb_set_parameter( Environment * _environment, int _channels, int _parameter, int _value ) {
2654
2655}
2656
2657void gb_set_frequency( Environment * _environment, int _channels, int _frequency ) {
2658
2659 PROGRAM_FREQUENCY( _channels, _frequency );
2660
2661}
2662
2663void gb_set_pitch( Environment * _environment, int _channels, int _pitch ) {
2664
2665 PROGRAM_PITCH( _channels, _pitch );
2666
2667}
2668
2669void gb_set_note( Environment * _environment, int _channels, int _note ) {
2670
2671 gb_set_pitch( _environment, _channels, SOUND_FREQUENCIES[_note] );
2672
2673}
2674
2675void gb_stop( Environment * _environment, int _channels ) {
2676
2677 STOP_FREQUENCY( _channels );
2678
2679}
2680
2681void gb_start_var( Environment * _environment, char * _channels ) {
2682
2683 if ( _channels ) {
2684 outline1("LD A, (%s)", _channels );
2685 } else {
2686 outline0("LD A, $3" );
2687 }
2688 outline0("CALL GBSTART");
2689
2690}
2691
2692void gb_set_volume_vars( Environment * _environment, char * _channels, char * _volume ) {
2693
2694 outline1("LD A, (%s)", _volume );
2695 outline0("SRL A" );
2696 outline0("SRL A" );
2697 outline0("SRL A" );
2698 outline0("SRL A" );
2699 outline0("LD E, A" );
2700 if ( _channels ) {
2701 outline1("LD A, (%s)", _channels );
2702 } else {
2703 outline0("LD A, $3" );
2704 }
2705 outline0("CALL GBSTARTVOL");
2706
2707}
2708
2709void gb_set_volume_semi_var( Environment * _environment, char * _channel, int _volume ) {
2710
2711 outline1("LD A, $%2.2x", _volume );
2712 outline0("SRL A" );
2713 outline0("SRL A" );
2714 outline0("SRL A" );
2715 outline0("SRL A" );
2716 outline0("LD E, A" );
2717 outline1("LD A, (%s)", _channel );
2718 outline0("CALL GBSTARTVOL");
2719
2720}
2721
2722void gb_set_program_semi_var( Environment * _environment, char * _channels, int _program ) {
2723
2724 switch (_program) {
2726 break;
2728 break;
2739 break;
2740
2744 break;
2745
2754 break;
2755
2756 default:
2766 break;
2767
2775 break;
2776
2778 break;
2779
2789 break;
2790
2803 break;
2804
2824 break;
2825
2853 break;
2854
2877 break;
2878 }
2879
2880}
2881
2882void gb_set_frequency_vars( Environment * _environment, char * _channels, char * _frequency ) {
2883
2884 outline1("LD A, (%s)", _frequency );
2885 outline0("LD E, A" );
2886 outline1("LD A, (%s)", address_displacement(_environment, _frequency, "1") );
2887 outline0("LD D, A" );
2888 if ( _channels ) {
2889 outline1("LD A, (%s)", _channels );
2890 } else {
2891 outline0("LD A, $3" );
2892 }
2893
2894 outline0("CALL GBFREQ");
2895
2896}
2897
2898void gb_set_pitch_vars( Environment * _environment, char * _channels, char * _pitch ) {
2899
2900 outline1("LD A, (%s)", _pitch );
2901 outline0("LD E, A" );
2902 outline1("LD A, (%s)", address_displacement(_environment, _pitch, "1") );
2903 outline0("LD D, A" );
2904 if ( _channels ) {
2905 outline1("LD A, (%s)", _channels );
2906 } else {
2907 outline0("LD A, $3" );
2908 }
2909
2910 outline0("CALL GBPROGFREQ");
2911
2912}
2913
2914void gb_set_note_vars( Environment * _environment, char * _channels, char * _note ) {
2915
2916 outline0("LD HL, GBFREQTABLE");
2917 outline1("LD A, (%s)", _note);
2918 outline0("LD E, A");
2919 outline0("LD A, 0");
2920 outline0("LD D, A");
2921 outline0("SLA E");
2922 outline0("RL D");
2923 outline0("ADD HL, DE");
2924 outline0("LD A, (HL)");
2925 outline0("LD E, A");
2926 outline0("INC HL");
2927 outline0("LD A, (HL)");
2928 outline0("LD D, A");
2929
2930 if ( _channels ) {
2931 outline1("LD A, (%s)", _channels );
2932 } else {
2933 outline0("LD A, $3" );
2934 }
2935
2936 outline0("CALL GBPROGFREQ");
2937
2938}
2939
2940void gb_stop_vars( Environment * _environment, char * _channels ) {
2941
2942 outline1("LD A, (%s)", _channels );
2943 outline0("CALL GBSTOP");
2944
2945}
2946
2947void gb_music( Environment * _environment, char * _music, int _size, int _loop ) {
2948
2949 deploy( music, src_hw_gb_music_asm );
2950
2951 // HL: music address, B: blocks, C: last block
2952 outline0("DI");
2953 outline1("LD HL, %s", _music);
2954 outline1("LD A, $%2.2x", ( _size>>8 ) & 0xff);
2955 outline0("LD B, A");
2956 outline1("LD A, $%2.2x", _size & 0xff );
2957 outline0("LD C, A");
2958 outline1("LD A, $%2.2x", _loop );
2959 outline0("LD (GBMUSICLOOP), A");
2960 outline0("CALL MUSICPLAYERRESET");
2961 outline0("EI");
2962
2963}
2964
2965void gb_set_duration( Environment * _environment, int _channel, int _duration ) {
2966
2967 PROGRAM_DURATION( _channel, _duration );
2968
2969}
2970
2971void gb_wait_duration( Environment * _environment, int _channel ) {
2972
2973 WAIT_DURATION( _channel );
2974
2975}
2976
2977void gb_set_duration_vars( Environment * _environment, char * _channel, char * _duration ) {
2978
2979 if ( _duration ) {
2980 outline1("LD HL, (%s)", _duration );
2981 outline0("LD DE, HL" );
2982 } else {
2983 outline0("LD DE, 50" );
2984 }
2985 if ( _channel ) {
2986 outline1("LD A, (%s)", _channel );
2987 } else {
2988 outline0("LD A, $3" );
2989 }
2990
2991 outline0("CALL GBPROGDUR" );
2992
2993}
2994
2995void gb_wait_duration_vars( Environment * _environment, char * _channel ) {
2996
2997 if ( _channel ) {
2998 outline1("LD A, (%s)", _channel );
2999 } else {
3000 outline0("LD A, $3" );
3001 }
3002
3003 outline0("CALL GBWAITDUR" );
3004
3005}
3006
3007void gb_screen( Environment * _environment, char * _x, char * _y, char * _c ) {
3008
3009 deploy( screen, src_hw_gb_screen_asm);
3010
3011 outline1("LD A, (%s)", _x );
3012 outline0("LD C, A" );
3013 outline1("LD A, (%s)", _y );
3014 outline0("LD B, A" );
3015 outline0("CALL SCREEN" );
3016 outline1("LD (%s), A", _c );
3017
3018}
3019
3020#endif
void cpu_store_16bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 16 bit
Definition 6309.c:1503
void cpu_move_16bit(Environment *_environment, char *_source, char *_destination)
CPU 6309: emit code to move 16 bit
Definition 6309.c:1474
void cpu_store_8bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 8 bit
Definition 6309.c:761
int lastUsedSlotInCommonPalette
Definition 6847.c:100
#define COLOR_COUNT
Definition 6847.h:72
Variable * variable_retrieve_or_define(Environment *_environment, char *_name, VariableType _type, int _value)
int rgbi_distance(RGBi *_e1, RGBi *_e2)
Calculate the distance between two colors.
int rgbi_equals_rgb(RGBi *_first, RGBi *_second)
Variable * variable_import(Environment *_environment, char *_name, VariableType _type, int _size_or_value)
void variable_global(Environment *_environment, char *_pattern)
ScreenMode * find_screen_mode_by_suggestion(Environment *_environment, int _bitmap, int _width, int _height, int _colors, int _tile_width, int _tile_height)
Variable * variable_temporary(Environment *_environment, VariableType _type, char *_meaning)
Define a temporary variable.
void font_descriptors_init(Environment *_environment, int _embedded_present)
void image_converter_asserts(Environment *_environment, int _width, int _height, int _offset_x, int _offset_y, int *_frame_width, int *_frame_height, int _modulo_x, int _modulo_y)
char * address_displacement(Environment *_environment, char *_address, char *_displacement)
Variable * variable_store_buffer(Environment *_environment, char *_destination, unsigned char *_buffer, int _size, int _at)
int size
Definition _optimizer.c:678
#define TILEMAP_MODE_STANDARD
Definition cga.h:80
Variable * distance(Environment *_environment, char *_x1, char *_y1, char *_x2, char *_y2)
Return the distance between two (screen) positions.
Definition distance.c:76
void gb_sprite_at(Environment *_environment, char *_sprite, char *_x, char *_y)
Definition gb.c:920
void gb_scanshift(Environment *_environment, char *_shifts)
Definition gb.c:149
void gb_start_var(Environment *_environment, char *_channels)
Definition gb.c:2681
void gb_set_duration(Environment *_environment, int _channel, int _duration)
Definition gb.c:2965
void gb_background_color_get_vars(Environment *_environment, char *_index, char *_background_color)
GB: emit code to retrieve background color
Definition gb.c:559
void gb_sprite_monocolor(Environment *_environment, char *_sprite)
Definition gb.c:958
int gb_screen_mode_enable(Environment *_environment, ScreenMode *_screen_mode)
Definition gb.c:692
void gb_finalization(Environment *_environment)
Definition gb.c:1285
void gb_get_height(Environment *_environment, char *_result)
Definition gb.c:1016
#define PROGRAM_DURATION(c, d)
Definition gb.c:2367
void gb_joy(Environment *_environment, int _port, char *_value)
Definition gb.c:51
void gb_text(Environment *_environment, char *_text, char *_text_size, int _raw)
Definition gb.c:1046
void gb_use_tileset(Environment *_environment, char *_tileset)
Definition gb.c:2073
void gb_sprite_compress_vertical(Environment *_environment, char *_sprite)
Definition gb.c:946
void gb_clear_key(Environment *_environment)
Definition gb.c:163
void gb_wait_duration(Environment *_environment, int _channel)
Definition gb.c:2971
void gb_background_color_vars(Environment *_environment, char *_index, char *_background_color)
GB: emit code to change background color
Definition gb.c:474
void gb_keyshift(Environment *_environment, char *_shifts)
Definition gb.c:156
void gb_timer_set_status_off(Environment *_environment, char *_timer)
Definition gb.c:189
void gb_slice_image_copy(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
Definition gb.c:2153
void gb_timer_set_status_on(Environment *_environment, char *_timer)
Definition gb.c:173
Variable * gb_image_converter(Environment *_environment, char *_data, int _width, int _height, int _depth, int _offset_x, int _offset_y, int _frame_width, int _frame_height, int _mode, int _transparent_color, int _flags)
Definition gb.c:1554
void gb_cls_box(Environment *_environment, char *_x1, char *_y1, char *_w, char *_h)
Definition gb.c:1030
void gb_timer_set_counter(Environment *_environment, char *_timer, char *_counter)
Definition gb.c:205
void gb_hscroll_line(Environment *_environment, int _direction, int _overlap)
Definition gb.c:1302
void gb_cls(Environment *_environment)
Definition gb.c:1023
#define PROGRAM_FREQUENCY(c, f)
Definition gb.c:2329
void gb_sprite_multicolor(Environment *_environment, char *_sprite)
Definition gb.c:954
void gb_set_volume(Environment *_environment, int _channels, int _volume)
Definition gb.c:2320
RGBi * gb_image_nearest_system_color(RGBi *_color)
Definition gb.c:298
void gb_slice_image(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
Definition gb.c:2149
void gb_horizontal_scroll(Environment *_environment, char *_displacement)
Definition gb.c:982
void gb_pset_int(Environment *_environment, int _x, int _y, int *_c)
Definition gb.c:830
void gb_put_key(Environment *_environment, char *_string, char *_size)
Definition gb.c:287
void gb_sprite_data_set(Environment *_environment, char *_sprite, char *_address)
Definition gb.c:866
void gb_set_program_semi_var(Environment *_environment, char *_channels, int _program)
Definition gb.c:2722
void gb_put_image(Environment *_environment, Resource *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_flags)
Definition gb.c:1776
void gb_set_pitch_vars(Environment *_environment, char *_channels, char *_pitch)
Definition gb.c:2898
void gb_screen_columns(Environment *_environment, char *_columns)
Definition gb.c:862
Variable * gb_new_sequence(Environment *_environment, int _sequences, int _frames, int _width, int _height, int _mode)
Definition gb.c:1872
void gb_tiles_get(Environment *_environment, char *_result)
Definition gb.c:1009
#define WAIT_DURATION(c)
Definition gb.c:2381
void gb_sprite_data_from(Environment *_environment, char *_sprite, char *_image)
Definition gb.c:880
void gb_blit_image(Environment *_environment, char *_sources[], int _source_count, char *_blit, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _flags)
Definition gb.c:1717
void gb_screen_on_off(Environment *_environment, int _on_off)
Definition gb.c:1807
void gb_wait_duration_vars(Environment *_environment, char *_channel)
Definition gb.c:2995
void gb_set_volume_vars(Environment *_environment, char *_channels, char *_volume)
Definition gb.c:2692
void gb_initialization(Environment *_environment)
Definition gb.c:1076
void gb_background_color_semivars(Environment *_environment, int _index, char *_background_color)
GB: emit code to change background color
Definition gb.c:530
void gb_bank_select(Environment *_environment, int _bank)
Definition gb.c:665
void gb_background_color(Environment *_environment, int _index, int _background_color)
GB: emit code to change background color
Definition gb.c:448
void gb_key_pressed(Environment *_environment, char *_scancode, char *_result)
Definition gb.c:139
void gb_calculate_sequence_frame_offset(Environment *_environment, char *_offset, char *_sequence, char *_frame, int _frame_size, int _frame_count)
Definition gb.c:2213
void gb_put_tile(Environment *_environment, char *_tile, char *_x, char *_y)
Definition gb.c:1949
void gb_wait_fire_semivar(Environment *_environment, char *_port, int _release)
Definition gb.c:109
void gb_move_memory_video(Environment *_environment, char *_from, char *_to, char *_size)
Definition gb.c:2098
void gb_start(Environment *_environment, int _channels)
Definition gb.c:2303
Variable * gb_new_images(Environment *_environment, int _frames, int _width, int _height, int _mode)
Definition gb.c:1838
void gb_sprite_priority(Environment *_environment, char *_sprite, char *_priority)
Definition gb.c:966
void gb_tile_at(Environment *_environment, char *_x, char *_y, char *_result)
Definition gb.c:2052
int gb_image_size(Environment *_environment, int _width, int _height, int _mode)
Definition gb.c:1380
#define STOP_FREQUENCY(c)
Definition gb.c:2467
void gb_colors_vars(Environment *_environment, char *_foreground_color, char *_background_color)
Definition gb.c:2116
void gb_vertical_scroll(Environment *_environment, char *_displacement)
Definition gb.c:974
void gb_busy_wait(Environment *_environment, char *_timing)
Definition gb.c:990
void gb_cline(Environment *_environment, char *_characters)
Definition gb.c:1342
void gb_move_tiles(Environment *_environment, char *_tile, char *_x, char *_y)
Definition gb.c:1974
void gb_screen_on(Environment *_environment)
Definition gb.c:842
void gb_get_width(Environment *_environment, char *_result)
Definition gb.c:1002
void gb_next_raster(Environment *_environment)
GB: emit code to wait for next raster irq
Definition gb.c:644
void gb_slice_image_extract(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
Definition gb.c:2173
void gb_dload(Environment *_environment, char *_filename, char *_offset, char *_address, char *_size)
Definition gb.c:278
void gb_set_pitch(Environment *_environment, int _channels, int _pitch)
Definition gb.c:2663
void gb_tiles_at(Environment *_environment, char *_address)
Definition gb.c:970
void gb_set_frequency_vars(Environment *_environment, char *_channels, char *_frequency)
Definition gb.c:2882
void gb_sprite_color(Environment *_environment, char *_sprite, char *_color)
Definition gb.c:962
void gb_colormap_at(Environment *_environment, char *_address)
Definition gb.c:822
void gb_bitmap_disable(Environment *_environment)
Definition gb.c:790
void gb_sprite_expand_vertical(Environment *_environment, char *_sprite)
Definition gb.c:938
void gb_scancode(Environment *_environment, char *_result)
Definition gb.c:125
void gb_textmap_at(Environment *_environment, char *_address)
Definition gb.c:826
void gb_screen(Environment *_environment, char *_x, char *_y, char *_c)
Definition gb.c:3007
void gb_wait_fire(Environment *_environment, int _port, int _release)
Definition gb.c:100
void gb_get_image(Environment *_environment, char *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _palette)
Definition gb.c:1907
void gb_dsave(Environment *_environment, char *_filename, char *_offset, char *_address, char *_size)
Definition gb.c:282
void gb_sprite_expand_horizontal(Environment *_environment, char *_sprite)
Definition gb.c:942
int gb_palette_extract(Environment *_environment, char *_data, int _width, int _height, int _depth, int _flags, RGBi *_palette)
Definition gb.c:2199
void gb_joy_vars(Environment *_environment, char *_port, char *_value)
Definition gb.c:61
void gb_inkey(Environment *_environment, char *_key)
Definition gb.c:71
void gb_put_tiles(Environment *_environment, char *_tile, char *_x, char *_y, char *_w, char *_h)
Definition gb.c:2020
void console_calculate_vars(Environment *_environment)
Definition gb.c:759
void gb_sprite_compress_horizontal(Environment *_environment, char *_sprite)
Definition gb.c:950
void gb_flip_image(Environment *_environment, Resource *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_direction)
Definition gb.c:2264
void gb_screen_off(Environment *_environment)
Definition gb.c:850
Variable * gb_collision(Environment *_environment, char *_sprite)
GB: emit code to check for collision
Definition gb.c:402
void gb_set_frequency(Environment *_environment, int _channels, int _frequency)
Definition gb.c:2657
void gb_asciicode(Environment *_environment, char *_result)
Definition gb.c:132
void gb_timer_set_init(Environment *_environment, char *_timer, char *_init)
Definition gb.c:229
void gb_scroll_text(Environment *_environment, int _direction, int _overlap)
Definition gb.c:1034
void gb_stop(Environment *_environment, int _channels)
Definition gb.c:2675
void gb_set_program(Environment *_environment, int _channels, int _program)
Definition gb.c:2493
void gb_bitmap_at(Environment *_environment, char *_address)
Definition gb.c:818
void gb_scroll(Environment *_environment, int _dx, int _dy)
Definition gb.c:1933
void gb_set_duration_vars(Environment *_environment, char *_channel, char *_duration)
Definition gb.c:2977
void gb_key_state(Environment *_environment, char *_scancode, char *_result)
Definition gb.c:118
#define PROGRAM_PITCH(c, f)
Definition gb.c:2391
void gb_pset_vars(Environment *_environment, char *_x, char *_y, char *_c)
Definition gb.c:834
void gb_move_video_memory(Environment *_environment, char *_from, char *_to, char *_size)
Definition gb.c:2107
void gb_back(Environment *_environment)
Definition gb.c:1330
void gb_sprite_common_color(Environment *_environment, char *_index, char *_common_color)
GB: emit code to change common sprite's color
Definition gb.c:611
void gb_raster_at(Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
GB: emit code to set raster irq
Definition gb.c:630
void gb_wait_key(Environment *_environment, int _release)
Definition gb.c:78
void gb_sprite_disable(Environment *_environment, char *_sprite)
Definition gb.c:908
void gb_set_note(Environment *_environment, int _channels, int _note)
Definition gb.c:2669
void gb_sys_call(Environment *_environment, int _destination)
Definition gb.c:167
void gb_music(Environment *_environment, char *_music, int _size, int _loop)
Definition gb.c:2947
void gb_sprite_enable(Environment *_environment, char *_sprite)
Definition gb.c:896
Variable * gb_get_raster_line(Environment *_environment)
Definition gb.c:2088
void gb_screen_rows(Environment *_environment, char *_rows)
Definition gb.c:858
void gb_pget_color_vars(Environment *_environment, char *_x, char *_y, char *_result)
Definition gb.c:838
void gb_stop_vars(Environment *_environment, char *_channels)
Definition gb.c:2940
void gb_set_note_vars(Environment *_environment, char *_channels, char *_note)
Definition gb.c:2914
Variable * gb_sprite_converter(Environment *_environment, char *_source, int _width, int _height, int _depth, RGBi *_color, int _slot_x, int _slot_y)
Definition gb.c:1508
void gb_set_volume_semi_var(Environment *_environment, char *_channel, int _volume)
Definition gb.c:2709
void gb_tilemap_enable(Environment *_environment, int _width, int _height, int _colors, int _tile_width, int _tile_height)
Definition gb.c:794
void gb_wait_key_or_fire(Environment *_environment, int _port, int _release)
Definition gb.c:82
void gb_bitmap_enable(Environment *_environment, int _width, int _height, int _colors)
Definition gb.c:767
void gb_border_color(Environment *_environment, char *_border_color)
GB: emit code to change border color
Definition gb.c:434
void gb_wait_vbl(Environment *_environment, char *_raster_line)
Definition gb.c:1801
void console_calculate(Environment *_environment)
Definition gb.c:745
void gb_hscroll_screen(Environment *_environment, int _direction, int _overlap)
Definition gb.c:1317
void gb_hit(Environment *_environment, char *_sprite_mask, char *_result)
GB: emit code to check for collision
Definition gb.c:421
Variable * gb_new_image(Environment *_environment, int _width, int _height, int _mode)
Definition gb.c:1814
void gb_next_raster_at(Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
GB: emit code to wait for next raster irq at different position
Definition gb.c:661
void gb_set_parameter(Environment *_environment, int _channels, int _parameter, int _value)
Definition gb.c:2653
void gb_timer_set_address(Environment *_environment, char *_timer, char *_address)
Definition gb.c:253
void gb_wait_key_or_fire_semivar(Environment *_environment, char *_port, int _release)
Definition gb.c:91
#define TILEMAP_MODE_CGB
Definition gb.h:231
#define TILEMAP_MODE_BGB
Definition gb.h:230
int width
Definition ugbc.h:2209
int y1
Definition ugbc.h:2206
int x1
Definition ugbc.h:2205
int height
Definition ugbc.h:2210
char * name
Definition ugbc.h:2252
struct _CopperList * next
Definition ugbc.h:2255
int screenTilesWidth
Definition ugbc.h:2880
int fontHeight
Definition ugbc.h:2905
Console activeConsole
Definition ugbc.h:2910
int freeImageWidth
Definition ugbc.h:3088
int currentMode
Definition ugbc.h:2696
int screenTilesHeight
Definition ugbc.h:2885
int consoleTilesHeight
Definition ugbc.h:2895
int fontWidth
Definition ugbc.h:2900
int bitmaskNeeded
Definition ugbc.h:2659
CopperList * copperList
Definition ugbc.h:3282
int screenColors
Definition ugbc.h:2870
int dynamicConsole
Definition ugbc.h:3298
FontConfig fontConfig
Definition ugbc.h:2415
int currentModeBW
Definition ugbc.h:2701
int screenHeight
Definition ugbc.h:2860
int consoleTilesWidth
Definition ugbc.h:2890
int currentTileMode
Definition ugbc.h:2706
int screenTiles
Definition ugbc.h:2875
int freeImageHeight
Definition ugbc.h:3086
int screenWidth
Definition ugbc.h:2855
int defaultPaperColor
Definition ugbc.h:3226
int defaultPenColor
Definition ugbc.h:3225
VestigialConfig vestigialConfig
Definition ugbc.h:2442
int schema
Definition ugbc.h:2063
unsigned char red
Definition ugbc.h:433
unsigned char green
Definition ugbc.h:434
unsigned char blue
Definition ugbc.h:435
unsigned char alpha
Definition ugbc.h:436
unsigned char index
Definition ugbc.h:437
int isAddress
Definition ugbc.h:557
char * realName
Definition ugbc.h:555
int selected
Definition ugbc.h:1510
unsigned char * valueBuffer
Definition ugbc.h:1061
int locked
Definition ugbc.h:1009
int size
Definition ugbc.h:1077
char * name
Definition ugbc.h:979
int readonly
Definition ugbc.h:1195
char * realName
Definition ugbc.h:982
char clsImplicit
Definition ugbc.h:2008
void * malloc(YYSIZE_T)
struct _ScreenMode ScreenMode
#define IMF_INSTRUMENT_LEAD_8_BASS_LEAD
Definition ugbc.h:4661
#define IMF_INSTRUMENT_MARIMBA
Definition ugbc.h:4586
struct _Resource Resource
#define IMF_INSTRUMENT_LEAD_6_VOICE
Definition ugbc.h:4659
#define IMF_INSTRUMENT_DRAWBAR_ORGAN
Definition ugbc.h:4590
#define IMF_INSTRUMENT_FRETLESS_BASS
Definition ugbc.h:4609
#define IMF_INSTRUMENT_PAD_1_NEW_AGE
Definition ugbc.h:4662
#define IMF_INSTRUMENT_VIOLIN
Definition ugbc.h:4614
#define IMF_INSTRUMENT_SYNTH_BASS_1
Definition ugbc.h:4612
#define IMF_INSTRUMENT_MELODIC_TOM
Definition ugbc.h:4691
#define IMF_INSTRUMENT_REVERSE_CYMBAL
Definition ugbc.h:4693
#define IMF_INSTRUMENT_ELECTRIC_BASS_FINGER
Definition ugbc.h:4607
#define IMF_INSTRUMENT_HARMONICA
Definition ugbc.h:4596
struct _RGBi RGBi
Structure to store color components (red, green and blue).
#define IMF_INSTRUMENT_BLOWN_BOTTLE
Definition ugbc.h:4650
#define IMF_INSTRUMENT_PAD_3_POLYSYNTH
Definition ugbc.h:4664
#define IMF_INSTRUMENT_FX_8_SCI_FI
Definition ugbc.h:4677
#define IMF_INSTRUMENT_RECORDER
Definition ugbc.h:4648
#define MAX_TEMPORARY_STORAGE
Definition ugbc.h:563
#define IMF_INSTRUMENT_FX_6_GOBLINS
Definition ugbc.h:4675
#define IMF_INSTRUMENT_FX_1_RAIN
Definition ugbc.h:4670
#define IMF_INSTRUMENT_SYNTH_VOICE
Definition ugbc.h:4628
#define IMF_INSTRUMENT_TENOR_SAX
Definition ugbc.h:4640
#define IMF_INSTRUMENT_PICCOLO
Definition ugbc.h:4646
#define IMF_INSTRUMENT_LEAD_7_FIFTHS
Definition ugbc.h:4660
#define IMF_INSTRUMENT_SLAP_BASS_1
Definition ugbc.h:4610
#define IMF_INSTRUMENT_MUSIC_BOX
Definition ugbc.h:4584
#define IMF_INSTRUMENT_SOPRANO_SAX
Definition ugbc.h:4638
#define IMF_INSTRUMENT_TRUMPET
Definition ugbc.h:4630
#define IMF_INSTRUMENT_BIRD_TWEET
Definition ugbc.h:4697
#define WARNING_SCREEN_MODE(v1)
Definition ugbc.h:3878
#define IMF_INSTRUMENT_PAD_8_SWEEP
Definition ugbc.h:4669
#define IMF_INSTRUMENT_CHURCH_ORGAN
Definition ugbc.h:4593
#define IMF_INSTRUMENT_HELICOPTER
Definition ugbc.h:4699
#define IMF_INSTRUMENT_BRIGHT_ACOUSTIC_PIANO
Definition ugbc.h:4575
#define IMF_INSTRUMENT_CELESTA
Definition ugbc.h:4582
#define IMF_INSTRUMENT_ACOUSTIC_GUITAR_NYLON
Definition ugbc.h:4598
#define IMF_INSTRUMENT_GLOCKENSPIEL
Definition ugbc.h:4583
#define IMF_INSTRUMENT_ORCHESTRAL_HARP
Definition ugbc.h:4620
#define IMF_INSTRUMENT_BREATH_NOISE
Definition ugbc.h:4695
#define IMF_INSTRUMENT_BAG_PIPE
Definition ugbc.h:4683
#define IMF_INSTRUMENT_ELECTRIC_GUITAR_JAZZ
Definition ugbc.h:4600
#define IMF_INSTRUMENT_ELECTRIC_GRAND_PIANO
Definition ugbc.h:4576
#define IMF_INSTRUMENT_SITAR
Definition ugbc.h:4678
#define IMF_INSTRUMENT_APPLAUSE
Definition ugbc.h:4700
struct _Variable Variable
Structure of a single variable.
#define IMF_INSTRUMENT_WHISTLE
Definition ugbc.h:4652
#define IMF_INSTRUMENT_PERCUSSIVE_ORGAN
Definition ugbc.h:4591
#define IMF_INSTRUMENT_HONKY_TONK_PIANO
Definition ugbc.h:4577
#define IMF_INSTRUMENT_CHOIR_AAHS
Definition ugbc.h:4626
#define IMF_INSTRUMENT_SHANAI
Definition ugbc.h:4685
#define IMF_INSTRUMENT_CELLO
Definition ugbc.h:4616
#define IMF_INSTRUMENT_FX_3_CRYSTAL
Definition ugbc.h:4672
#define IMF_INSTRUMENT_ELECTRIC_GUITAR_MUTED
Definition ugbc.h:4602
#define IMF_INSTRUMENT_HARPSICHORD
Definition ugbc.h:4580
#define IMF_INSTRUMENT_BRASS_SECTION
Definition ugbc.h:4635
#define IMF_INSTRUMENT_ELECTRIC_BASS_PICK
Definition ugbc.h:4608
#define IMF_INSTRUMENT_FX_5_BRIGHTNESS
Definition ugbc.h:4674
#define IMF_INSTRUMENT_FLUTE
Definition ugbc.h:4647
struct _Environment Environment
Structure of compilation environment.
@ VT_WORD
Definition ugbc.h:455
@ VT_POSITION
Definition ugbc.h:468
@ VT_BYTE
Definition ugbc.h:450
@ VT_BUFFER
Definition ugbc.h:477
@ VT_SPRITE
Definition ugbc.h:501
@ VT_SBYTE
Definition ugbc.h:452
@ VT_ADDRESS
Definition ugbc.h:465
@ VT_IMAGE
Definition ugbc.h:489
#define IMF_INSTRUMENT_ELECTRIC_GUITAR_CLEAN
Definition ugbc.h:4601
#define IMF_INSTRUMENT_ACOUSTIC_BASS
Definition ugbc.h:4606
#define IMF_INSTRUMENT_GUITAR_FRET_NOISE
Definition ugbc.h:4694
#define IMF_INSTRUMENT_SYNTHSTRINGS_2
Definition ugbc.h:4625
#define IMF_INSTRUMENT_PAD_4_CHOIR
Definition ugbc.h:4665
#define IMF_INSTRUMENT_LEAD_2_SAWTOOTH
Definition ugbc.h:4655
#define IMF_INSTRUMENT_DULCIMER
Definition ugbc.h:4589
#define IMF_INSTRUMENT_KOTO
Definition ugbc.h:4681
#define IMF_INSTRUMENT_TUBA
Definition ugbc.h:4632
#define IMF_INSTRUMENT_GUITAR_HARMONICS
Definition ugbc.h:4605
#define IMF_INSTRUMENT_CLAVI
Definition ugbc.h:4581
#define IMF_INSTRUMENT_BANJO
Definition ugbc.h:4679
#define IMF_INSTRUMENT_SYNTHBRASS_2
Definition ugbc.h:4637
#define IMF_INSTRUMENT_LEAD_4_CHIFF
Definition ugbc.h:4657
#define IMF_INSTRUMENT_VOICE_OOHS
Definition ugbc.h:4627
#define IMF_INSTRUMENT_TANGO_ACCORDION
Definition ugbc.h:4597
#define SCREEN_MODE_DEFINE(_id, _bitmap, _width, _height, _colors, _tile_width, _tile_height, _description)
Definition ugbc.h:1516
#define IMF_INSTRUMENT_FX_7_ECHOES
Definition ugbc.h:4676
#define IMF_INSTRUMENT_PAD_6_METALLIC
Definition ugbc.h:4667
#define IMF_INSTRUMENT_PAD_5_BOWED
Definition ugbc.h:4666
#define IMF_INSTRUMENT_GUNSHOT
Definition ugbc.h:4701
#define IMF_INSTRUMENT_REED_ORGAN
Definition ugbc.h:4594
#define IMF_INSTRUMENT_ORCHESTRA_HIT
Definition ugbc.h:4629
#define IMF_INSTRUMENT_SYNTH_DRUM
Definition ugbc.h:4692
#define IMF_INSTRUMENT_SEASHORE
Definition ugbc.h:4696
#define IMF_INSTRUMENT_OCARINA
Definition ugbc.h:4653
#define IMF_INSTRUMENT_TELEPHONE_RING
Definition ugbc.h:4698
#define IMF_INSTRUMENT_FX_2_SOUNDTRACK
Definition ugbc.h:4671
#define IMF_INSTRUMENT_ACOUSTIC_GUITAR_STEEL
Definition ugbc.h:4599
#define IMF_INSTRUMENT_SYNTHSTRINGS_1
Definition ugbc.h:4624
#define IMF_INSTRUMENT_MUTED_TRUMPET
Definition ugbc.h:4633
#define IMF_INSTRUMENT_PAN_FLUTE
Definition ugbc.h:4649
#define IMF_INSTRUMENT_TINKLE_BELL
Definition ugbc.h:4686
#define IMF_INSTRUMENT_VIBRAPHONE
Definition ugbc.h:4585
#define IMF_INSTRUMENT_KALIMBA
Definition ugbc.h:4682
#define IMF_INSTRUMENT_FIDDLE
Definition ugbc.h:4684
#define IMF_INSTRUMENT_PAD_7_HALO
Definition ugbc.h:4668
#define IMF_INSTRUMENT_TUBULAR_BELLS
Definition ugbc.h:4588
#define IMF_INSTRUMENT_LEAD_1_SQUARE
Definition ugbc.h:4654
#define IMF_INSTRUMENT_STRING_ENSEMBLE_1
Definition ugbc.h:4622
#define outline0(s)
Definition ugbc.h:4252
#define IMF_INSTRUMENT_DISTORTION_GUITAR
Definition ugbc.h:4604
#define IMF_INSTRUMENT_PAD_2_WARM
Definition ugbc.h:4663
#define IMF_INSTRUMENT_ACCORDION
Definition ugbc.h:4595
#define IMF_INSTRUMENT_SLAP_BASS_2
Definition ugbc.h:4611
#define IMF_INSTRUMENT_LEAD_5_CHARANG
Definition ugbc.h:4658
#define IMF_INSTRUMENT_OBOE
Definition ugbc.h:4642
#define IMF_INSTRUMENT_STEEL_DRUMS
Definition ugbc.h:4688
#define IMF_INSTRUMENT_BASSOON
Definition ugbc.h:4644
#define IMF_INSTRUMENT_TIMPANI
Definition ugbc.h:4621
#define IMF_INSTRUMENT_ROCK_ORGAN
Definition ugbc.h:4592
#define IMF_INSTRUMENT_SHAMISEN
Definition ugbc.h:4680
#define IMF_INSTRUMENT_CLARINET
Definition ugbc.h:4645
#define IMF_INSTRUMENT_ACOUSTIC_GRAND_PIANO
Definition ugbc.h:4574
#define IMF_INSTRUMENT_ALTO_SAX
Definition ugbc.h:4639
#define IMF_INSTRUMENT_EXPLOSION
Definition ugbc.h:4573
#define IMF_INSTRUMENT_PIZZICATO_STRINGS
Definition ugbc.h:4619
#define IMF_INSTRUMENT_WOODBLOCK
Definition ugbc.h:4689
#define IMF_INSTRUMENT_XYLOPHONE
Definition ugbc.h:4587
#define IMF_INSTRUMENT_AGOGO
Definition ugbc.h:4687
#define IMF_INSTRUMENT_SYNTHBRASS_1
Definition ugbc.h:4636
#define outline1(s, a)
Definition ugbc.h:4253
#define IMF_INSTRUMENT_LEAD_3_CALLIOPE
Definition ugbc.h:4656
#define WARNING_IMAGE_CONVERTER_UNSUPPORTED_MODE(f)
Definition ugbc.h:3880
#define FONT_SCHEMA_ASCII
Definition ugbc.h:582
#define IMF_INSTRUMENT_STRING_ENSEMBLE_2
Definition ugbc.h:4623
#define IMF_INSTRUMENT_SYNTH_BASS_2
Definition ugbc.h:4613
#define IMF_INSTRUMENT_ELECTRIC_PIANO2
Definition ugbc.h:4579
struct _CopperList CopperList
#define IMF_INSTRUMENT_FRENCH_HORN
Definition ugbc.h:4634
#define IMF_INSTRUMENT_TREMOLO_STRINGS
Definition ugbc.h:4618
#define IMF_INSTRUMENT_FX_4_ATMOSPHERE
Definition ugbc.h:4673
#define IMF_INSTRUMENT_ENGLISH_HORN
Definition ugbc.h:4643
#define IMF_INSTRUMENT_BARITONE_SAX
Definition ugbc.h:4641
#define IMF_INSTRUMENT_SHAKUHACHI
Definition ugbc.h:4651
#define IMF_INSTRUMENT_CONTRABASS
Definition ugbc.h:4617
#define adilinepixel(p)
Definition ugbc.h:4236
#define CRITICAL_NEW_IMAGE_UNSUPPORTED_MODE(f)
Definition ugbc.h:3540
#define IMF_INSTRUMENT_VIOLA
Definition ugbc.h:4615
#define deploy(s, e)
Definition ugbc.h:4288
#define MAKE_LABEL
Definition ugbc.h:3351
#define IMF_INSTRUMENT_TROMBONE
Definition ugbc.h:4631
#define IMF_INSTRUMENT_OVERDRIVEN_GUITAR
Definition ugbc.h:4603
#define IMF_INSTRUMENT_ELECTRIC_PIANO1
Definition ugbc.h:4578
#define IMF_INSTRUMENT_TAIKO_DRUM
Definition ugbc.h:4690
#define CRITICAL_IMAGE_CONVERTER_INVALID_WIDTH_EXACT(w)
Definition ugbc.h:3808
#define outhead1(s, a)
Definition ugbc.h:4247