38static RGBi SYSTEM_PALETTE[] = {
39 { 0x00, 0x00, 0x00, 0xff, 0,
"BLACK", 0 },
40 { 0x00, 0x00, 0xff, 0xff, 1,
"BLUE", 1 },
41 { 0x88, 0x00, 0x00, 0xff, 2,
"RED", 2 },
42 { 0xff, 0x00, 0xff, 0xff, 3,
"MAGENTA", 3 },
43 { 0x00, 0xff, 0x00, 0xff, 4,
"GREEN", 4 },
44 { 0xaa, 0xff, 0xe6, 0xff, 5,
"CYAN", 5 },
45 { 0xee, 0xee, 0x77, 0xff, 6,
"YELLOW", 6 },
46 { 0xff, 0xff, 0xff, 0xff, 7,
"WHITE", 7 }
49static RGBi * commonPalette;
52static int RowsAddress[] = {
53 16384, 16640, 16896, 17152, 17408, 17664, 17920, 18176,
54 16416, 16672, 16928, 17184, 17440, 17696, 17952, 18208,
55 16448, 16704, 16960, 17216, 17472, 17728, 17984, 18240,
56 16480, 16736, 16992, 17248, 17504, 17760, 18016, 18272,
57 16512, 16768, 17024, 17280, 17536, 17792, 18048, 18304,
58 16544, 16800, 17056, 17312, 17568, 17824, 18080, 18336,
59 16576, 16832, 17088, 17344, 17600, 17856, 18112, 18368,
60 16608, 16864, 17120, 17376, 17632, 17888, 18144, 18400,
61 18432, 18688, 18944, 19200, 19456, 19712, 19968, 20244,
62 18464, 18720, 18976, 19232, 19488, 19744, 20000, 20266,
63 18496, 18752, 19008, 19264, 19520, 19776, 20032, 20288,
64 18528, 18784, 19040, 19296, 19552, 19808, 20064, 20320,
65 18560, 18816, 19072, 19328, 19584, 19840, 20096, 20352,
66 18592, 18848, 19104, 19360, 19616, 19872, 20128, 20384,
67 18624, 18880, 19136, 19392, 19648, 19904, 20160, 20416,
68 18656, 18912, 19168, 19424, 19680, 19936, 20192, 20448,
69 20480, 20736, 20992, 21248, 21504, 21760, 22016, 22272,
70 20512, 20768, 21024, 21280, 21536, 21792, 22048, 22304,
71 20544, 20800, 21056, 21312, 21568, 21824, 22080, 22336,
72 20576, 20832, 21088, 21344, 21600, 21856, 22112, 22368,
73 20608, 20864, 21120, 21376, 21632, 21888, 22144, 22400,
74 20640, 20896, 21152, 21408, 21664, 21920, 22176, 22432,
75 20672, 20928, 21184, 21440, 21696, 21952, 22208, 22464,
76 20704, 20960, 21216, 21472, 21728, 21984, 22240, 22496
91 return 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height >> 3 ) );
99static int calculate_images_size(
Environment * _environment,
int _frames,
int _width,
int _height,
int _mode ) {
105 return 3 + ( 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height >> 3 ) ) ) * _frames;
113static int calculate_sequence_size(
Environment * _environment,
int _sequences,
int _frames,
int _width,
int _height,
int _mode ) {
119 return 3 + ( ( 3 + ( ( _width >> 3 ) * _height ) + ( ( _width >> 3 ) * ( _height >> 3 ) ) ) * _frames ) * _sequences;
137 outline1(
"LD A, $%2.2x", ( _displacement & 0xff ) );
138 outline1(
"LD IXL, $%2.2x", ( _overlap & 0xff ) );
141 deploy( vScroll,src_hw_zx_vscroll_asm );
150 deploy( vScroll, src_hw_zx_vscroll_asm );
151 deploy( textEncodedAt, src_hw_zx_text_at_asm );
156 outline1(
"LD A, (%s)", _text_size );
162 deploy( textEncodedAtTextRaw, src_hw_zx_text_at_text_raw_asm );
165 deploy( textEncodedAtText, src_hw_zx_text_at_text_asm );
189 deploy( clsBox, src_hw_zx_cls_box_asm );
207 deploy( keyboard, src_hw_zx_keyboard_asm);
218 deploy( keyboard, src_hw_zx_keyboard_asm );
248 deploy( keyboard, src_hw_zx_keyboard_asm );
249 deploy( joystick, src_hw_zx_joystick_asm );
251 outline1(
"LD A, $%2.2x", (
unsigned char)(_release&0xff) );
256 outline1(
"LD A, $%2.2x", (
unsigned char)(_port&0xff) );
271 deploy( keyboard, src_hw_zx_keyboard_asm );
272 deploy( joystick, src_hw_zx_joystick_asm );
292 deploy( keyboard, src_hw_zx_keyboard_asm );
293 deploy( joystick, src_hw_zx_joystick_asm );
311 deploy( keyboard, src_hw_zx_keyboard_asm );
312 deploy( joystick, src_hw_zx_joystick_asm );
314 outline1(
"LD A, #$%2.2x", _joystick);
328 deploy( keyboard, src_hw_zx_keyboard_asm );
341 deploy( keyboard, src_hw_zx_keyboard_asm);
352 deploy( keyboard, src_hw_zx_keyboard_asm);
365 deploy( keyboard, src_hw_zx_keyboard_asm );
384 deploy( keyboard, src_hw_zx_keyboard_asm );
395 deploy( keyboard, src_hw_zx_keyboard_asm );
401static int rgbConverterFunction(
int _red,
int _green,
int _blue ) {
405 unsigned int minDistance = 0xffffffff;
412 for (j = 0; j <
sizeof(SYSTEM_PALETTE)/
sizeof(
RGBi); ++j) {
549 zx_cls( _environment, NULL, NULL );
565 copperList = copperList->
next;
570 cpu_label( _environment,
"MUSICPLAYER" );
600 outline0(
"CALL CONSOLECALCULATE" );
614 zx_cls( _environment, NULL, NULL );
638static Variable * zx_image_converter_bitmap_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 ) {
640 (void)!_transparent_color;
642 image_converter_asserts( _environment, _width, _height, _offset_x, _offset_y, &_frame_width, &_frame_height, 8, 8 );
646 _width = ( ( ( _width - 1 ) / 8 ) - 1 ) * 8;
648 if ( _frame_width % 8 ) {
649 _frame_width = ( ( ( _frame_width - 1 ) / 8 ) - 1 ) * 8;
655 _height = ( ( ( _height - 1 ) / 8 ) - 1 ) * 8;
657 if ( _frame_height % 8 ) {
658 _frame_height = ( ( ( _frame_height - 1 ) / 8 ) - 1 ) * 8;
666 if (paletteColorCount > 16) {
672 commonPalette =
palette_match( palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) );
675 if ( _transparent_color & 0x0f0000 ) {
678 if ( _transparent_color & 0xf00000 ) {
680 paletteColorCount = 8;
699 char * buffer =
malloc ( bufferSize );
700 memset( buffer, 0, bufferSize );
703 int image_x, image_y;
714 *(buffer) = ( _frame_width & 0xff );
715 *(buffer+1) = ( _frame_width >> 8 ) & 0xff;
716 *(buffer+2) = _frame_height;
720 _source += ( ( _offset_y * _width ) + _offset_x ) * _depth;
724 char * colorBackgroundCells =
malloc( ( _frame_height >> 3 ) * ( _frame_width >> 3 ) );
726 memset( colorBackgroundCells, 0, ( _frame_height >> 3 ) * ( _frame_width >> 3 ) );
728 char * colorForegroundCells =
malloc( ( _frame_height >> 3 ) * ( _frame_width >> 3 ) );
730 memset( colorForegroundCells, 0, ( _frame_height >> 3 ) * ( _frame_width >> 3 ) );
738 if ( paletteColorCount > 2 ) {
742 for (image_y = 0; image_y < _frame_height; image_y+=8) {
744 for (image_x = 0; image_x < _frame_width; image_x+=8) {
746 memset( colorIndexCount, 0,
MAX_PALETTE *
sizeof(
int ) );
748 for(
int y = 0; y<8; ++y ) {
750 _source =
source + ( ( _offset_y * _width ) + _offset_x ) * _depth +
751 ( ( image_y * _frame_width + image_x ) * _depth ) +
752 ( ( y * _frame_width ) * _depth );
754 for(
int x = 0; x<8; ++x ) {
758 rgb.
green = *(_source + 1);
759 rgb.
blue = *(_source + 2);
761 rgb.
alpha = *(_source + 3);
765 if ( rgb.
alpha == 0 ) {
773 int minDistance = 9999;
774 for(
int index = 0; index <8; ++index ) {
778 colorIndex = SYSTEM_PALETTE[index].index;
784 ++colorIndexCount[colorIndex];
796 int colorBackgroundMax = 0;
797 int colorBackground = 0;
798 int colorForegroundMax = 0;
799 int colorForeground = 0;
801 if ( _transparent_color & 0x0f0000 ) {
802 colorBackground = ( _transparent_color & 0xff );
804 for(
int xx = 0; xx<16; ++xx ) {
805 if ( colorIndexCount[xx] > colorBackgroundMax ) {
806 colorBackground = xx;
807 colorBackgroundMax = colorIndexCount[xx];
810 colorIndexCount[colorBackground] = 0;
813 if ( _transparent_color & 0xf00000 ) {
814 colorForeground = ( _transparent_color & 0xff00 ) >> 8;
816 for(
int xx = 0; xx<16; ++xx ) {
817 if ( colorIndexCount[xx] > colorForegroundMax ) {
818 colorForeground = xx;
819 colorForegroundMax = colorIndexCount[xx];
822 if ( colorForeground == colorBackground ) {
823 colorForeground = ( colorBackground == 0 ) ? 1 : 0;
825 colorIndexCount[colorForeground] = 0;
830 *(colorForegroundCells + (image_y>>3)*(_frame_width>>3) + (image_x>>3)) = colorForeground;
831 *(colorBackgroundCells + (image_y>>3)*(_frame_width>>3) + (image_x>>3)) = colorBackground;
843 _source =
source + ( ( _offset_y * _width ) + _offset_x ) * _depth;
846 for (image_y = 0; image_y < _frame_height; ++image_y) {
848 for (image_x = 0; image_x < _frame_width; image_x+=8) {
850 for( xx = 0; xx < 8; ++xx ) {
853 rgb.
green = *(_source + 1);
854 rgb.
blue = *(_source + 2);
856 rgb.
alpha = *(_source + 3);
860 if ( rgb.
alpha == 0 ) {
868 int minDistance = 9999;
869 for(
int i=0; i<paletteColorCount; ++i ) {
873 colorIndex = commonPalette[i].index;
877 int offset = ( image_y * _frame_width>>3 ) + (image_x>>3);
878 int bitmask = 1 << ( 7 - xx );
879 int colorForeground = 0;
880 int colorBackground = 0;
882 if ( paletteColorCount > 2 ) {
884 colorForeground = *(colorForegroundCells + (image_y>>3)*(_frame_width>>3) + (image_x>>3));
885 colorBackground = *(colorBackgroundCells + (image_y>>3)*(_frame_width>>3) + (image_x>>3));
889 colorBackground = commonPalette[0].index;
890 colorForeground = commonPalette[1].index;
896 if ( colorIndex != colorBackground ) {
898 *( buffer +
offset + 3) |= bitmask;
901 *( buffer +
offset + 3) &= ~bitmask;
904 offset = ( ( image_y >> 3 ) * _frame_width>>3 ) + (image_x>>3);
907 *( buffer + 3 + ( ( _frame_width >> 3 ) * _frame_height ) +
offset ) = ( colorBackground << 3 ) | ( colorForeground );
920 _source += _depth * ( _width - _frame_width );
938Variable *
zx_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 ) {
945 return zx_image_converter_bitmap_mode_standard( _environment, _data, _width, _height, _depth, _offset_x, _offset_y, _frame_width, _frame_height, _transparent_color, _flags );
956static void zx_load_image_address_to_other_register(
Environment * _environment,
char * _register,
char * _source,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count ) {
958 outline2(
"LD %s, %s", _register, _source );
963 if ( strlen(_sequence) == 0 ) {
972 outline1(
"LD HL, OFFSETS%4.4x", _frame_size * _frame_count );
984 if ( strlen(_frame) == 0 ) {
993 outline1(
"LD HL, OFFSETS%4.4x", _frame_size );
1010 if ( strlen(_frame) == 0 ) {
1019 outline1(
"LD HL, OFFSETS%4.4x", _frame_size );
1044 if ( strlen(_sequence) == 0 ) {
1048 outline1(
"LD A, (%s)", _sequence );
1053 outline1(
"LD HL, OFFSETS%4.4x", _frame_size * _frame_count );
1065 if ( strlen(_frame) == 0 ) {
1074 outline1(
"LD HL, OFFSETS%4.4x", _frame_size );
1091 if ( strlen(_frame) == 0 ) {
1100 outline1(
"LD HL, OFFSETS%4.4x", _frame_size );
1116static void zx_load_image_address_to_register(
Environment * _environment,
char * _register,
Resource * _source,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count ) {
1118 if ( !_sequence && !_frame ) {
1134 if ( strlen(_sequence) == 0 ) {
1137 outline1(
"LD A, (%s)", _sequence );
1143 if ( strlen(_frame) == 0 ) {
1158 if ( strlen(_frame) == 0 ) {
1172 outline1(
"LD (%s), HL", _register );
1177void zx_put_image(
Environment * _environment,
Resource * _image,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
char * _flags ) {
1185 deploy( putimage, src_hw_zx_put_image_asm );
1187 if ( _frame_size ) {
1188 zx_load_image_address_to_register( _environment, NULL, _image, _sequence, _frame, _frame_size, _frame_count );
1208void zx_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 ) {
1211 deploy( blitimage, src_hw_zx_blit_image_asm );
1213 if ( _source_count > 2 ) {
1220 if ( _source_count > 0 ) {
1222 resource.
realName = strdup( _sources[0] );
1224 zx_load_image_address_to_register( _environment, NULL, &resource, _sequence, _frame, _frame_size, _frame_count );
1233 if ( _source_count > 1 ) {
1235 resource.
realName = strdup( _sources[1] );
1237 zx_load_image_address_to_register( _environment, NULL, &resource, _sequence, _frame, _frame_size, _frame_count );
1252 outline1(
"LD A, $%2.2x", (_flags & 0Xff) );
1254 outline1(
"LD A, $%2.2x", ((_flags>>8) & 0Xff) );
1275 memset( buffer, 0,
size );
1277 *(buffer) = ( _width & 0xff );
1278 *(buffer+1) = ( ( _width >> 8 ) & 0xff );
1279 *(buffer+2) = _height;
1292 int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
1293 int frameSize =
zx_image_size( _environment, _width, _height, _mode );
1302 memset( buffer, 0,
size );
1304 *(buffer) = _frames;
1305 *(buffer+1) = ( _width & 0xff );
1306 *(buffer+2) = ( _width >> 8 ) & 0xff;
1307 for(
int i=0; i<_frames; ++i ) {
1308 *(buffer+3+(i*frameSize)) = ( _width & 0xff );
1309 *(buffer+3+(i*frameSize)+1) = ( ( _width >> 8 ) & 0xff );
1310 *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
1326 int size2 = calculate_sequence_size( _environment, _sequences, _frames, _width, _height, _mode );
1327 int size = calculate_images_size( _environment, _frames, _width, _height, _mode );
1328 int frameSize =
zx_image_size( _environment, _width, _height, _mode );
1336 char * buffer =
malloc ( size2 );
1337 memset( buffer, 0, size2 );
1339 *(buffer) = _frames;
1340 *(buffer+1) = _width;
1341 *(buffer+2) = _sequences;
1342 for(
int i=0; i<(_frames*_sequences); ++i ) {
1343 *(buffer+3+(i*frameSize)) = ( _width & 0xff );
1344 *(buffer+3+(i*frameSize)+1) = ( ( _width >> 8 ) & 0xff );
1345 *(buffer+3+(i*frameSize)+2) = ( _height & 0xff );
1357void zx_get_image(
Environment * _environment,
char * _image,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
int _palette ) {
1362 deploy( getimage, src_hw_zx_get_image_asm );
1364 zx_load_image_address_to_other_register( _environment,
"HL", _image, _sequence, _frame, _frame_size, _frame_count );
1370 outline1(
"LD A, $%2.2x", _palette & 0xff );
1384 deploy( tiles, src_hw_zx_tiles_asm );
1409 deploy( tiles, src_hw_zx_tiles_asm );
1447 deploy( tiles, src_hw_zx_tiles_asm );
1475 deploy( tiles, src_hw_zx_tiles_asm );
1492 deploy( tiles, src_hw_zx_tiles_asm );
1510void zx_slice_image(
Environment * _environment,
char * _image,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
char * _destination ) {
1516 outline1(
"CALL $%4.4x", _destination );
1524 memcpy( _palette,
palette_match( _palette, paletteColorCount, SYSTEM_PALETTE,
sizeof(SYSTEM_PALETTE) /
sizeof(
RGBi) ), paletteColorCount *
sizeof(
RGBi ) );
1526 int uniquePaletteCount = 0;
1530 return uniquePaletteCount;
1537 deploy( textHScrollScreen, src_hw_zx_hscroll_screen_asm );
1538 deploy( textHScrollLine, src_hw_zx_hscroll_line_asm );
1543 outline1(
"LD A, 0x%2.2x", (
unsigned char)(_direction));
1544 outline1(
"LD IYL, 0x%2.2x", (
unsigned char)(_overlap));
1552 deploy( textHScrollScreen, src_hw_zx_hscroll_screen_asm );
1554 outline1(
"LD A, 0x%2.2x", (
unsigned char)(_direction));
1555 outline1(
"LD IYL, 0x%2.2x", (
unsigned char)(_overlap));
1562 deploy( timer, src_hw_z80_timer_asm);
1578 deploy( timer, src_hw_z80_timer_asm);
1595 deploy( timer, src_hw_z80_timer_asm);
1617 deploy( timer, src_hw_z80_timer_asm);
1639 deploy( timer, src_hw_z80_timer_asm);
1664 deploy( keyboard, src_hw_zx_keyboard_asm);
1675 deploy( vbl, src_hw_zx_vbl_asm);
1677 if ( ! _raster_line ) {
1696static unsigned int SOUND_FREQUENCIES[] = {
1697 0x6868, 0x628d, 0x5d03, 0x57bf, 0x52d7, 0x4e2b, 0x49cc, 0x45a3, 0x41b6, 0x3e06, 0x3a87, 0x373e,
1698 0x3425, 0x3134, 0x2e6f, 0x2bd3, 0x295c, 0x2708, 0x24d5, 0x22c2, 0x20cd, 0x1ef4, 0x1d36, 0x1b90,
1699 0x1a02, 0x188b, 0x1728, 0x15da, 0x149e, 0x1374, 0x125b, 0x1152, 0x1058, 0x0f6b, 0x0e9d, 0x0db8,
1700 0x0cf2, 0x0c36, 0x0b86, 0x0add, 0x0a40, 0x09ab, 0x091e, 0x089a, 0x081c, 0x07a6, 0x0736, 0x06cd,
1701 0x066a, 0x060c, 0x05b3, 0x0560, 0x0511, 0x04c6, 0x0480, 0x043d, 0x03ff, 0x03c4, 0x038c, 0x0357,
1702 0x0325, 0x02f7, 0x02ca, 0x02a0, 0x0279, 0x0254, 0x0231, 0x020f, 0x01f0, 0x01d3, 0x01b7, 0x019c,
1703 0x0183, 0x016c, 0x0156, 0x0141, 0x012d, 0x011b, 0x0109, 0x00f8, 0x00e9, 0x00da, 0x00cc, 0x00bf,
1704 0x00b2, 0x00a7, 0x009c, 0x0091, 0x0087, 0x007e, 0x0075, 0x006d, 0x0065, 0x005e, 0x0057, 0x0050,
1705 0x004a, 0x0044, 0x003e, 0x0039, 0x0034, 0x0030, 0x002b, 0x0027, 0x0023, 0x0020, 0x001c, 0x0019
1708static unsigned int SOUND_DURATIONS[] = {
1709 0x0010 / 0x20, 0x0011 / 0x20, 0x0012 / 0x20, 0x0013 / 0x20, 0x0014 / 0x20, 0x0015 / 0x20, 0x0017 / 0x20, 0x0018 / 0x20, 0x0019 / 0x20, 0x001b / 0x20, 0x001d / 0x20, 0x001e / 0x20,
1710 0x0020 / 0x20, 0x0022 / 0x20, 0x0024 / 0x20, 0x0026 / 0x20, 0x0029 / 0x20, 0x002b / 0x20, 0x002e / 0x20, 0x0031 / 0x20, 0x0033 / 0x20, 0x0037 / 0x20, 0x003a / 0x20, 0x003d / 0x20,
1711 0x0041 / 0x20, 0x0045 / 0x20, 0x0049 / 0x20, 0x004d / 0x20, 0x0052 / 0x20, 0x0057 / 0x20, 0x005c / 0x20, 0x0062 / 0x20, 0x0067 / 0x20, 0x006e / 0x20, 0x0074 / 0x20, 0x007b / 0x20,
1712 0x0082 / 0x20, 0x008a / 0x20, 0x0092 / 0x20, 0x009b / 0x20, 0x00a4 / 0x20, 0x00ae / 0x20, 0x00b9 / 0x20, 0x00c4 / 0x20, 0x00cf / 0x20, 0x00dc / 0x20, 0x00e9 / 0x20, 0x00f6 / 0x20,
1713 0x0105 / 0x20, 0x0115 / 0x20, 0x0125 / 0x20, 0x0137 / 0x20, 0x0149 / 0x20, 0x015d / 0x20, 0x0172 / 0x20, 0x0188 / 0x20, 0x019f / 0x20, 0x01b8 / 0x20, 0x01d2 / 0x20, 0x01ed / 0x20,
1714 0x020b / 0x20, 0x022a / 0x20, 0x024b / 0x20, 0x026e / 0x20, 0x0293 / 0x20, 0x02ba / 0x20, 0x02e4 / 0x20, 0x0310 / 0x20, 0x033e / 0x20, 0x0370 / 0x20, 0x03a4 / 0x20, 0x03db / 0x20,
1715 0x0417 / 0x20, 0x0455 / 0x20, 0x0497 / 0x20, 0x04dd / 0x20, 0x0527 / 0x20, 0x0575 / 0x20, 0x05c8 / 0x20, 0x0620 / 0x20, 0x067d / 0x20, 0x06e0 / 0x20, 0x0749 / 0x20, 0x07b8 / 0x20,
1716 0x082d / 0x20, 0x08a9 / 0x20, 0x092d / 0x20, 0x09b9 / 0x20, 0x0a4d / 0x20, 0x0aea / 0x20, 0x0b90 / 0x20, 0x0c40 / 0x20, 0x0cfa / 0x20, 0x0dc0 / 0x20, 0x0e91 / 0x20, 0x0f6f / 0x20,
1717 0x105a / 0x20, 0x1153 / 0x20, 0x125b / 0x20, 0x1372 / 0x20, 0x149a / 0x20, 0x15d4 / 0x20, 0x1720 / 0x20, 0x1880 / 0x20, 0x19f5 / 0x20, 0x1b80 / 0x20, 0x1d23 / 0x20, 0x1ede / 0x20
1722 deploy( audio1startup, src_hw_zx_audio1_asm );
1724 outline1(
"LD HL, $%4.4x", (
unsigned short)(_pitch&0xffff) );
1725 outline1(
"LD DE, $%4.4x", (
unsigned short)(_duration&0xffff) );
1732 zx_set_pitch( _environment, _channels, SOUND_FREQUENCIES[_note], SOUND_DURATIONS[_note] * ( _duration / 32 ) );
1738 deploy( audio1startup, src_hw_zx_audio1_asm );
1745 outline1(
"LD A, (%s)", _duration );
1758 deploy( audio1startup, src_hw_zx_audio1_asm );
1762 outline1(
"LD DE, (%s)", _duration);
void cpu_store_16bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 16 bit
void cpu_label(Environment *_environment, char *_label)
void cpu_move_16bit(Environment *_environment, char *_source, char *_destination)
CPU 6309: emit code to move 16 bit
void cpu_store_8bit(Environment *_environment, char *_destination, int _value)
CPU 6309: emit code to store 8 bit
void cpu_ctoa(Environment *_environment)
void cpu_move_8bit(Environment *_environment, char *_source, char *_destination)
CPU 6309: emit code to move 8 bit
int lastUsedSlotInCommonPalette
#define BITMAP_MODE_DEFAULT
#define BITMAP_MODE_STANDARD
void cpu_port_out(Environment *_environment, char *_port, char *_value)
Z80: emit code to send one byte throught a I/O port
Variable * variable_retrieve(Environment *_environment, char *_name)
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.
Variable * variable_import(Environment *_environment, char *_name, VariableType _type, int _size_or_value)
RGBi * palette_promote_color_as_background(int _index, RGBi *_source, int _source_size)
Promote an index color in a palette.
RGBi * malloc_palette(int _size)
Allocate a palette space.
void variable_global(Environment *_environment, char *_pattern)
Variable * variable_temporary(Environment *_environment, VariableType _type, char *_meaning)
Define a temporary variable.
int rgbi_extract_palette(Environment *_environment, unsigned char *_source, int _width, int _height, int _depth, RGBi _palette[], int _palette_size, int _sorted)
Extract the color palette from the given image.
RGBi * palette_promote_color_as_foreground(int _index, RGBi *_source, int _source_size, int _max_size)
Promote an index color in a palette.
Variable * variable_store(Environment *_environment, char *_destination, unsigned int _value)
Store a direct value to a variable.
RGBi * palette_remove_duplicates(RGBi *_source, int _source_size, int *_unique_size)
Remove duplicates from a palette.
void font_descriptors_init(Environment *_environment, int _embedded_present)
RGBi * palette_match(RGBi *_source, int _source_size, RGBi *_system, int _system_size)
Make a "palette match".
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)
void back(Environment *_environment, char *_color)
Emit ASM code to fill background color.
void cls(Environment *_environment, char *_paper)
Emit code for CLS.
#define TILEMAP_MODE_STANDARD
void console_init(Environment *_environment)
Variable * distance(Environment *_environment, char *_x1, char *_y1, char *_x2, char *_y2)
Return the distance between two (screen) positions.
struct _CopperList * next
JoystickConfig joystickConfig
RgbConverterFunction currentRgbConverterFunction
VestigialConfig vestigialConfig
unsigned char * valueBuffer
RGBi originalPalette[MAX_PALETTE]
struct _ScreenMode ScreenMode
#define CRITICAL_IMAGE_CONVERTER_TOO_COLORS(f)
struct _Resource Resource
struct _RGBi RGBi
Structure to store color components (red, green and blue).
#define MAX_TEMPORARY_STORAGE
#define adilineendbitmap()
struct _Variable Variable
Structure of a single variable.
#define outline2(s, a, b)
struct _Environment Environment
Structure of compilation environment.
#define adiline3(s, a, b, c)
#define deploy_preferred(s, e)
#define SCREEN_MODE_DEFINE(_id, _bitmap, _width, _height, _colors, _tile_width, _tile_height, _description)
#define CRITICAL_NEW_IMAGES_UNSUPPORTED_MODE(f)
#define WARNING_IMAGE_CONVERTER_UNSUPPORTED_MODE(f)
#define adilinepalette(s, c, p)
#define adilinebeginbitmap(s)
struct _CopperList CopperList
#define CRITICAL_NEW_IMAGE_UNSUPPORTED_MODE(f)
#define CRITICAL_BLIT_TOO_MUCH_SOURCES()
void zx_slice_image(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
void zx_keyshift(Environment *_environment, char *_shifts)
Variable * zx_new_images(Environment *_environment, int _frames, int _width, int _height, int _mode)
void zx_initialization(Environment *_environment)
void zx_cls(Environment *_environment, char *_pen, char *_paper)
void zx_timer_set_address(Environment *_environment, char *_timer, char *_address)
void zx_set_pitch_vars(Environment *_environment, char *_channels, char *_pitch, char *_duration)
void zx_timer_set_init(Environment *_environment, char *_timer, char *_init)
void zx_clear_key(Environment *_environment)
void zx_wait_fire_semivar(Environment *_environment, char *_port, int _release)
void zx_screen_rows(Environment *_environment, char *_rows)
void zx_joystick_semivars(Environment *_environment, char *_joystick, char *_result)
Variable * zx_new_sequence(Environment *_environment, int _sequences, int _frames, int _width, int _height, int _mode)
void zx_move_tiles(Environment *_environment, char *_tile, char *_x, char *_y)
void zx_bitmap_enable(Environment *_environment, int _width, int _height, int _colors)
int zx_screen_mode_enable(Environment *_environment, ScreenMode *_screen_mode)
void zx_asciicode(Environment *_environment, char *_result)
void zx_timer_set_status_off(Environment *_environment, char *_timer)
void zx_wait_key_or_fire(Environment *_environment, int _port, int _release)
void zx_screen_columns(Environment *_environment, char *_columns)
void zx_joystick(Environment *_environment, int _joystick, char *_result)
void zx_set_note(Environment *_environment, int _channels, int _note, int _duration)
void zx_sys_call(Environment *_environment, int _destination)
void zx_back(Environment *_environment)
void zx_put_tiles(Environment *_environment, char *_tile, char *_x, char *_y, char *_w, char *_h)
void zx_set_pitch(Environment *_environment, int _channels, int _pitch, int _duration)
void zx_scanshift(Environment *_environment, char *_shifts)
void zx_hscroll_line(Environment *_environment, int _direction, int _overlap)
void zx_set_note_vars(Environment *_environment, char *_channels, char *_note, char *_duration)
Variable * zx_new_image(Environment *_environment, int _width, int _height, int _mode)
void zx_tilemap_enable(Environment *_environment, int _width, int _height, int _colors, int _tile_width, int _tile_height)
Variable * zx_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)
void console_calculate_vars(Environment *_environment)
int zx_palette_extract(Environment *_environment, char *_data, int _width, int _height, int _depth, int _flags, RGBi *_palette)
void zx_inkey(Environment *_environment, char *_key)
void zx_use_tileset(Environment *_environment, char *_tileset)
void zx_text(Environment *_environment, char *_text, char *_text_size, int _raw)
void zx_put_key(Environment *_environment, char *_string, char *_size)
void zx_vscroll(Environment *_environment, int _displacement, int _overlap)
void zx_timer_set_status_on(Environment *_environment, char *_timer)
void zx_key_pressed(Environment *_environment, char *_scancode, char *_result)
void zx_put_tile(Environment *_environment, char *_tile, char *_x, char *_y)
void zx_finalization(Environment *_environment)
void zx_tile_at(Environment *_environment, char *_x, char *_y, char *_result)
void zx_get_image(Environment *_environment, char *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _palette)
void zx_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)
void zx_color_border(Environment *_environment, char *_color)
void zx_wait_key(Environment *_environment, int _release)
void zx_calculate_sequence_frame_offset(Environment *_environment, char *_offset, char *_sequence, char *_frame, int _frame_size, int _frame_count)
void zx_scancode(Environment *_environment, char *_result)
void zx_wait_vbl(Environment *_environment, char *_raster_line)
void zx_wait_fire(Environment *_environment, int _port, int _release)
void zx_hscroll_screen(Environment *_environment, int _direction, int _overlap)
int zx_image_size(Environment *_environment, int _width, int _height, int _mode)
Variable * zx_get_raster_line(Environment *_environment)
void zx_cls_box(Environment *_environment, char *_x1, char *_y1, char *_w, char *_h)
void zx_timer_set_counter(Environment *_environment, char *_timer, char *_counter)
void zx_put_image(Environment *_environment, Resource *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_flags)
void zx_key_state(Environment *_environment, char *_scancode, char *_result)
void zx_wait_key_or_fire_semivar(Environment *_environment, char *_port, int _release)
void zx_scroll(Environment *_environment, int _dx, int _dy)
void console_calculate(Environment *_environment)
#define PORT_COLOR_BORDER