comparison exporters.pde @ 225:1c9deae71fb1

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 05 Sep 2018 20:28:23 +0300
parents 33a5c7670e66
children 2d424d096281
comparison
equal deleted inserted replaced
224:33a5c7670e66 225:1c9deae71fb1
232 } 232 }
233 head++; 233 head++;
234 } 234 }
235 } 235 }
236 else 236 else
237 if (g_machine == C64) { 237 if (g_machine == C64)
238 {
238 //0x0002->bitmap 239 //0x0002->bitmap
239 //0x1f42->colormap 240 //0x1f42->colormap
240 //0x232a=border (take the lower nybble) 241 //0x232a=border (take the lower nybble)
241 if (fdata.length < 9006) { 242 if (fdata.length < 9006)
243 {
242 return false; 244 return false;
243 } 245 }
244 if (fdata.length >= 0x232a) { 246 if (fdata.length >= 0x232a)
247 {
245 g_map[0] = byte(fdata[0x232a] & 0x0f); 248 g_map[0] = byte(fdata[0x232a] & 0x0f);
246 } 249 }
247 for (y = 0; y < 25; y++) 250 for (y = 0; y < 25; y++)
248 for (x = 0; x < 40; x++) 251 for (x = 0; x < 40; x++)
249 for (y2 = 0; y2 < 8; y2++) 252 for (y2 = 0; y2 < 8; y2++)
257 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(p2); 260 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(p2);
258 g_map[65536 + MX * MY * 8 + x + y * 40 * 8 + y2 * 40] = byte(p1); 261 g_map[65536 + MX * MY * 8 + x + y * 40 * 8 + y2 * 40] = byte(p1);
259 } 262 }
260 } 263 }
261 else 264 else
262 if (g_machine == PLUS4) { // Botticelli 265 if (g_machine == PLUS4)
266 { // Botticelli
263 //g.hires.prg = botticelli 267 //g.hires.prg = botticelli
264 //2 - luminance 40*25 268 //2 - luminance 40*25
265 //1026 - colors 40*25 269 //1026 - colors 40*25
266 //2050 - bitmappi 40*25*8 270 //2050 - bitmappi 40*25*8
267 if (fdata.length < 10050) { 271 if (fdata.length < 10050)
272 {
268 return false; 273 return false;
269 } 274 }
270 int l1, l2; 275 int l1, l2;
271 for (y = 0; y < 25; y++) 276 for (y = 0; y < 25; y++)
272 for (x = 0; x < 40; x++) 277 for (x = 0; x < 40; x++)
284 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(convertluminance(l1, p2)); 289 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(convertluminance(l1, p2));
285 g_map[65536 + MX * MY * 8 + x + y * 40 * 8 + y2 * 40] = byte(convertluminance(l2, p1)); 290 g_map[65536 + MX * MY * 8 + x + y * 40 * 8 + y2 * 40] = byte(convertluminance(l2, p1));
286 } 291 }
287 } 292 }
288 else 293 else
289 if (g_machine == PLUS4M) { // Multi Botticelli 294 if (g_machine == PLUS4M)
295 { // Multi Botticelli
290 //m.multi.prg = multi botticelli 296 //m.multi.prg = multi botticelli
291 //2- lumins 40*25 297 //2- lumins 40*25
292 //1024 - bäkki1 298 //1024 - bäkki1
293 //1025 - bäkki2 299 //1025 - bäkki2
294 //1026 - colors 40*25 300 //1026 - colors 40*25
295 //2050 - bitmap 40*25*8 301 //2050 - bitmap 40*25*8
296 if (fdata.length < 10050) { 302 if (fdata.length < 10050)
303 {
297 return false; 304 return false;
298 } 305 }
299 int l1, l2; 306 int l1, l2;
300 for (y = 0; y < 25; y++) 307 for (y = 0; y < 25; y++)
301 for (x = 0; x < 40; x++) 308 for (x = 0; x < 40; x++)
321 p1 = (int(fdata[1024]) >> 4) & 0x0f; 328 p1 = (int(fdata[1024]) >> 4) & 0x0f;
322 l1 = int(fdata[1024]) & 0x0f; 329 l1 = int(fdata[1024]) & 0x0f;
323 g_map[2] = byte(convertluminance(l1, p1)); 330 g_map[2] = byte(convertluminance(l1, p1));
324 } 331 }
325 else 332 else
326 if (g_machine == C64M) { //advanced art studio 333 if (g_machine == C64M)
334 { //advanced art studio
327 //adv. art studio (=multicolor) 10018 bytes 335 //adv. art studio (=multicolor) 10018 bytes
328 //0x0002 bitmap (40*25*8) 336 //0x0002 bitmap (40*25*8)
329 //0x1f42 colors1 (40*25) 337 //0x1f42 colors1 (40*25)
330 //0x232a border 338 //0x232a border
331 //0x232b background 339 //0x232b background
332 //0x233a colors2 (40*25) 340 //0x233a colors2 (40*25)
333 if (fdata.length < 10018) { 341 if (fdata.length < 10018)
342 {
334 return false; 343 return false;
335 } 344 }
336 for (y = 0; y < 25; y++) 345 for (y = 0; y < 25; y++)
337 for (x = 0; x < 40; x++) 346 for (x = 0; x < 40; x++)
338 for (y2 = 0; y2 < 8; y2++) 347 for (y2 = 0; y2 < 8; y2++)
351 } 360 }
352 g_map[0] = byte(fdata[0x232a] & 0x0f); //bord 361 g_map[0] = byte(fdata[0x232a] & 0x0f); //bord
353 g_map[1] = byte(fdata[0x232b] & 0x0f); //baku 362 g_map[1] = byte(fdata[0x232b] & 0x0f); //baku
354 } 363 }
355 else 364 else
356 if (g_machine == C64FLIM) { 365 if (g_machine == C64FLIM)
366 {
357 // FBI Crew FLI designer 1.x & 2.0 (unpacked) 367 // FBI Crew FLI designer 1.x & 2.0 (unpacked)
358 // { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, 0, NULL, NULL }, 368 // { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, 0, NULL, NULL },
359 // DEF_SCREEN_RAMS_8(0x0400, 0, 0x400, 0), 369 // DEF_SCREEN_RAMS_8(0x0400, 0, 0x400, 0),
360 // { DO_COPY , DS_BITMAP_RAM , 0x2400, 0, 0, 0, NULL, NULL }, 370 // { DO_COPY , DS_BITMAP_RAM , 0x2400, 0, 0, 0, NULL, NULL },
361 // { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, 371 // { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL },
362 if (fdata.length != 17409) { 372 if (fdata.length != 17409)
373 {
363 // TODO XXX: Check for load addresses 3c00 and 3ff0 374 // TODO XXX: Check for load addresses 3c00 and 3ff0
364 return false; 375 return false;
365 } 376 }
366 for (y = 0; y < 25; y++) 377 for (y = 0; y < 25; y++)
367 for (x = 0; x < 40; x++) 378 for (x = 0; x < 40; x++)
382 } 393 }
383 g_map[0] = byte(0); //bord 394 g_map[0] = byte(0); //bord
384 g_map[1] = byte(0); //baku 395 g_map[1] = byte(0); //baku
385 } 396 }
386 else 397 else
387 if (g_machine == MSX) { // sc2 398 if (g_machine == MSX)
399 { // sc2
388 // 7=bitmap 32*24*8 400 // 7=bitmap 32*24*8
389 // 7+(32*24*8)=colormap 32*24 401 // 7+(32*24*8)=colormap 32*24
390 if (fdata.length < 14343) { 402 if (fdata.length < 14343)
403 {
391 return false; 404 return false;
392 } 405 }
393 for (y = 0; y < 24; y++) 406 for (y = 0; y < 24; y++)
394 for (x = 0; x < 32; x++) 407 for (x = 0; x < 32; x++)
395 for (y2 = 0; y2 < 8; y2++) 408 for (y2 = 0; y2 < 8; y2++)
408 g_map[65536 + x + y * 32 * 8 + y2 * 32] = byte(p2); 421 g_map[65536 + x + y * 32 * 8 + y2 * 32] = byte(p2);
409 g_map[65536 + MX * MY * 8 + x + y * 32 * 8 + y2 * 32] = byte(p1); 422 g_map[65536 + MX * MY * 8 + x + y * 32 * 8 + y2 * 32] = byte(p1);
410 } 423 }
411 } 424 }
412 else 425 else
413 if (g_machine == CPC) { // a studio? 426 if (g_machine == CPC)
427 { // a studio?
414 return false; 428 return false;
415 } 429 }
416 430
417 consistency(); 431 consistency();
418 refresh(); 432 refresh();
424 boolean mpExportFormat(MPWriteCtx ctx, int subformat) 438 boolean mpExportFormat(MPWriteCtx ctx, int subformat)
425 { 439 {
426 int val1, val2, val3; 440 int val1, val2, val3;
427 int y, y2, yy, x, yp, xp, ad, valu, valu2, bri; 441 int y, y2, yy, x, yp, xp, ad, valu, valu2, bri;
428 442
429 if (g_machine == PLUS4) { // botticelli hires 443 if (g_machine == PLUS4)
444 { // botticelli hires
430 ctx.loadTemplate("g.hires.prg"); 445 ctx.loadTemplate("g.hires.prg");
431 446
432 ctx.setOffs(0x02); 447 ctx.setOffs(0x02);
433 mpExportColorData(ctx, 40, 25, 65536, 5); //lumis 448 mpExportColorData(ctx, 40, 25, 65536, 5); //lumis
434 449
437 452
438 ctx.setOffs(2050); 453 ctx.setOffs(2050);
439 mpExportBitmapData(ctx, 40, 25); 454 mpExportBitmapData(ctx, 40, 25);
440 } 455 }
441 else 456 else
442 if (g_machine == PLUS4M) { // multi botticelli multicolor 457 if (g_machine == PLUS4M)
458 { // multi botticelli multicolor
443 ctx.loadTemplate("m.multi.prg"); 459 ctx.loadTemplate("m.multi.prg");
444 460
445 val2 = getpluscolor(int(g_map[1])); 461 val2 = getpluscolor(int(g_map[1]));
446 val1 = getplusluminance(int(g_map[1])); 462 val1 = getplusluminance(int(g_map[1]));
447 val3 = val2 * 16 + val1; 463 val3 = val2 * 16 + val1;
460 476
461 ctx.setOffs(2050); 477 ctx.setOffs(2050);
462 mpExportBitmapData(ctx, 40, 25); 478 mpExportBitmapData(ctx, 40, 25);
463 } 479 }
464 else 480 else
465 if (g_machine == C64) { 481 if (g_machine == C64)
482 {
466 ctx.loadTemplate("hires.art"); 483 ctx.loadTemplate("hires.art");
467 484
468 ctx.setOffs(2); 485 ctx.setOffs(2);
469 mpExportBitmapData(ctx, 40, 25); 486 mpExportBitmapData(ctx, 40, 25);
470 487
472 mpExportColorData(ctx, 40, 25, 65536, 0); 489 mpExportColorData(ctx, 40, 25, 65536, 0);
473 490
474 ctx.writeByteAt(0x232a, g_map[0]); 491 ctx.writeByteAt(0x232a, g_map[0]);
475 } 492 }
476 else 493 else
477 if (g_machine == C64M) { 494 if (g_machine == C64M)
495 {
478 if (subformat == 0) 496 if (subformat == 0)
479 { 497 {
480 // Advanced Art Studio 498 // Advanced Art Studio
481 ctx.loadTemplate("multic.ocp"); 499 ctx.loadTemplate("multic.ocp");
482 500
508 526
509 ctx.writeByteAt(0x2712, g_map[1] & 0x0f); 527 ctx.writeByteAt(0x2712, g_map[1] & 0x0f);
510 } 528 }
511 } 529 }
512 else 530 else
513 if (g_machine == C64FLIM) { 531 if (g_machine == C64FLIM)
532 {
514 // FBI Crew FLI designer 1.x & 2.0 (unpacked) 533 // FBI Crew FLI designer 1.x & 2.0 (unpacked)
515 // { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, 0, NULL, NULL }, 534 // { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, 0, NULL, NULL },
516 // DEF_SCREEN_RAMS_8(0x0400, 0, 0x400, 0), 535 // DEF_SCREEN_RAMS_8(0x0400, 0, 0x400, 0),
517 // { DO_COPY , DS_BITMAP_RAM , 0x2400, 0, 0, 0, NULL, NULL }, 536 // { DO_COPY , DS_BITMAP_RAM , 0x2400, 0, 0, 0, NULL, NULL },
518 // { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, 537 // { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL },
529 548
530 ctx.setOffs(0x2402); 549 ctx.setOffs(0x2402);
531 mpExportBitmapData(ctx, 40, 25); 550 mpExportBitmapData(ctx, 40, 25);
532 } 551 }
533 else 552 else
534 if (g_machine == MSX) { 553 if (g_machine == MSX)
554 {
535 ctx.loadTemplate("msx-screen2.sc2"); 555 ctx.loadTemplate("msx-screen2.sc2");
536 556
537 ctx.setOffs(7); 557 ctx.setOffs(7);
538 mpExportBitmapData(ctx, 32, 24); 558 mpExportBitmapData(ctx, 32, 24);
539 559
540 ctx.setOffs(7 + (32 * 24 * 8) + 768 + 1280); 560 ctx.setOffs(7 + (32 * 24 * 8) + 768 + 1280);
541 mpExportColorData(ctx, 32, 24, 65536, 3); //there's an exception for msx-style 561 mpExportColorData(ctx, 32, 24, 65536, 3); //there's an exception for msx-style
542 } 562 }
543 else 563 else
544 if (g_machine == SPECTRUM) { 564 if (g_machine == SPECTRUM)
565 {
545 ctx.loadTemplate("zx-screen.scr"); 566 ctx.loadTemplate("zx-screen.scr");
546 567
547 ctx.setOffs(0); 568 ctx.setOffs(0);
548 for (y = 0; y < 3; y++) 569 for (y = 0; y < 3; y++)
549 for (y2 = 0; y2 < 8; y2++) 570 for (y2 = 0; y2 < 8; y2++)
596 boolean mpExportMachinePRG(MPWriteCtx ctx) 617 boolean mpExportMachinePRG(MPWriteCtx ctx)
597 { 618 {
598 // any common text headers 619 // any common text headers
599 ctx.addComment("g_machine=" + str(g_machine) + " (" + g_name + ")"); 620 ctx.addComment("g_machine=" + str(g_machine) + " (" + g_name + ")");
600 621
601 if (g_machine == C64) { //C64 HIRES 622 if (g_machine == C64)
623 { //C64 HIRES
602 ctx.loadTemplate("c64show.prg"); 624 ctx.loadTemplate("c64show.prg");
603 625
604 ctx.setOffs(0x0227); 626 ctx.setOffs(0x0227);
605 ctx.addLabel("_bitmap"); 627 ctx.addLabel("_bitmap");
606 mpExportBitmapData(ctx, 40, 25); 628 mpExportBitmapData(ctx, 40, 25);
617 //0x0227->bitmappi (40x25 x 8 bytee) 639 //0x0227->bitmappi (40x25 x 8 bytee)
618 //0x2167:borderi väri 640 //0x2167:borderi väri
619 //0x2169->värikartta (40x25 bytee, nyppelit foreg/backg) 641 //0x2169->värikartta (40x25 bytee, nyppelit foreg/backg)
620 } 642 }
621 else 643 else
622 if (g_machine == C64M) { //C64 MULTICOLOR 644 if (g_machine == C64M)
645 { //C64 MULTICOLOR
623 ctx.loadTemplate("c64mshow.prg"); 646 ctx.loadTemplate("c64mshow.prg");
624 647
625 ctx.setOffs(0x0239); 648 ctx.setOffs(0x0239);
626 ctx.addLabel("_bitmap"); 649 ctx.addLabel("_bitmap");
627 mpExportBitmapData(ctx, 40, 25); 650 mpExportBitmapData(ctx, 40, 25);
646 //0x217A:bäkkis väri 669 //0x217A:bäkkis väri
647 //0x217B->värikartta 1 (40x25 bytee, nyppelit foreg/backg ilmeisesti) 670 //0x217B->värikartta 1 (40x25 bytee, nyppelit foreg/backg ilmeisesti)
648 //0x2563->värikartta 2 (40x25 bytee, nyppeli 3-väri nepan osoitteessa $d800-) 671 //0x2563->värikartta 2 (40x25 bytee, nyppeli 3-väri nepan osoitteessa $d800-)
649 } 672 }
650 else 673 else
651 if (g_machine == PLUS4M) { //PLUS4 MULTICOLOR 674 if (g_machine == PLUS4M)
675 { //PLUS4 MULTICOLOR
652 ctx.loadTemplate("showpfourm.prg"); 676 ctx.loadTemplate("showpfourm.prg");
653 677
654 ctx.addLine(".global @@_bitmap"); 678 ctx.addLine(".global @@_bitmap");
655 ctx.addLine(".global @@_color1"); 679 ctx.addLine(".global @@_color1");
656 ctx.addLine(".global @@_color2"); 680 ctx.addLine(".global @@_color2");
698 //0x2080 background 2 722 //0x2080 background 2
699 //0x2081 colors (40 x 25) 723 //0x2081 colors (40 x 25)
700 //0x2469 luminance (40 x 25) 724 //0x2469 luminance (40 x 25)
701 } 725 }
702 else 726 else
703 if (g_machine == PLUS4) { // Plus 4 hires 727 if (g_machine == PLUS4)
728 { // Plus 4 hires
704 ctx.loadTemplate("showpfour.prg"); 729 ctx.loadTemplate("showpfour.prg");
705 730
706 ctx.addLine(".global @@_bitmap"); 731 ctx.addLine(".global @@_bitmap");
707 ctx.addLine(".global @@_color"); 732 ctx.addLine(".global @@_color");
708 ctx.addLine(".global @@_lumi"); 733 ctx.addLine(".global @@_lumi");
730 //0x2077 borderi 755 //0x2077 borderi
731 //0x2078 colors (40 x 25) 756 //0x2078 colors (40 x 25)
732 //0x2460 luminance (40 x 25) 757 //0x2460 luminance (40 x 25)
733 } 758 }
734 else 759 else
735 if (g_machine == MSX) { // MSX 760 if (g_machine == MSX)
761 { // MSX
736 ctx.loadTemplate("msxshow.com"); 762 ctx.loadTemplate("msxshow.com");
737 763
738 ctx.addLine(".globl @@_bitmap,@@_nimi2"); 764 ctx.addLine(".globl @@_bitmap,@@_nimi2");
739 ctx.addLine(".area _CODE"); 765 ctx.addLine(".area _CODE");
740 766
753 //0x00f9 bitmap (32x24 x 8 bytes) 779 //0x00f9 bitmap (32x24 x 8 bytes)
754 //0x18f9 background color 780 //0x18f9 background color
755 //0x18fa colors (32*24 bytes) 781 //0x18fa colors (32*24 bytes)
756 } 782 }
757 else 783 else
758 if (g_machine == SPECTRUM) { // ZX Spectrum 784 if (g_machine == SPECTRUM)
785 { // ZX Spectrum
759 786
760 //would need some cleaning up 787 //would need some cleaning up
761 788
762 // ctx.addLine(".area _DATA"); 789 // ctx.addLine(".area _DATA");
763 // ctx.addLine(".globl @@_taustakuva"); 790 // ctx.addLine(".globl @@_taustakuva");
826 ctx.setBPLOff(); 853 ctx.setBPLOff();
827 854
828 ctx.writeByteAt(0x1d3e, int(checksum), "_checksum"); 855 ctx.writeByteAt(0x1d3e, int(checksum), "_checksum");
829 } 856 }
830 else 857 else
831 if (g_machine == CPC) { 858 if (g_machine == CPC)
859 {
832 int val1, val2, val3, valu; 860 int val1, val2, val3, valu;
833 ctx.loadTemplate("cpc-mode0.bin"); 861 ctx.loadTemplate("cpc-mode0.bin");
834 862
835 ctx.setOffs(69); //bitmap offset 863 ctx.setOffs(69); //bitmap offset
836 ctx.addLabel("_bitmap"); 864 ctx.addLabel("_bitmap");
1013 if (param == 0 || param == 3 || param == 4 || param == 5) 1041 if (param == 0 || param == 3 || param == 4 || param == 5)
1014 xmult = width * 8; 1042 xmult = width * 8;
1015 else 1043 else
1016 xmult = width; 1044 xmult = width;
1017 1045
1018 if (g_machine == MSX) { 1046 if (g_machine == MSX)
1047 {
1019 myrpsi = 7; 1048 myrpsi = 7;
1020 } 1049 }
1021 1050
1022 for (int yc = 0; yc < height; yc++) 1051 for (int yc = 0; yc < height; yc++)
1023 { 1052 {
1106 xcolors = g_maxcolors; 1135 xcolors = g_maxcolors;
1107 vertti = 8; 1136 vertti = 8;
1108 erkki = 1; 1137 erkki = 1;
1109 limitter = 2; 1138 limitter = 2;
1110 1139
1111 if (g_britemode == 1) { 1140 if (g_britemode == 1)
1141 {
1112 xcolors = 8; 1142 xcolors = 8;
1113 } 1143 }
1114 if (g_attrimode == 0) { 1144 if (g_attrimode == 0)
1145 {
1115 vertti = 1; 1146 vertti = 1;
1116 erkki = 8; 1147 erkki = 8;
1117 } 1148 }
1118 if (g_multic == 1) 1149 if (g_multic == 1)
1119 limitter = 4; 1150 limitter = 4;