TERNARO.R 22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
//  ternaro.com client-side script
//
//  Copyright (C) 2018, Alexander Shabarshin <me@shaos.net>
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.

robot "ternaro.com"
Alexander Shabarshin's avatar
Alexander Shabarshin committed
19

20
author "Alexander Shabarshin"
Alexander Shabarshin's avatar
Alexander Shabarshin committed
21

22
+INC/ROBBY
Alexander Shabarshin's avatar
Alexander Shabarshin committed
23

24 25 26 27 28
main()
{
 def tmp[17] = "START"
 def inp[9]
 def xyz[3]
29 30 31 32 33 34 35 36
 simp1 = 0
 simp2 = 0
 simp3 = 0
 indep1 = 0
 indep3 = 0
 indep = 0
 aux = 0
 mem = 0
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
 xx = 0
 yy = 0
 sendp tmp[0] @filesystem
 while(TRUE)
 {
   code = 0
   recv code
   if(N==0) continue
   if(N==@mouse)
   {
      A = X*100+Y

      if(A==2206 || A==2306)
      {
        next_val(inp[0])
        inp[0] = A
        print_bit(22,6,inp[0]>>1)
        print_bit(23,6,inp[0]&1)
        print_bit(20,43,inp[0]>>1)
        print_bit(21,43,inp[0]&1)
        draw_triad(1)
        continue
      }
      if(A==2208 || A==2308)
      {
        next_val(inp[1])
        inp[1] = A
        print_bit(22,8,inp[1]>>1)
        print_bit(23,8,inp[1]&1)
        print_bit(18,43,inp[1]>>1)
        print_bit(19,43,inp[1]&1)
        draw_triad(1)
        continue
      }
      if(A==2210 || A==2310)
      {
        next_val(inp[2])
        inp[2] = A
        print_bit(22,10,inp[2]>>1)
        print_bit(23,10,inp[2]&1)
        print_bit(16,43,inp[2]>>1)
        print_bit(17,43,inp[2]&1)
        draw_triad(1)
        continue
      }

      if(A==2216 || A==2316)
      {
        next_val(inp[3])
        inp[3] = A
        print_bit(22,16,inp[3]>>1)
        print_bit(23,16,inp[3]&1)
        print_bit(29,43,inp[3]>>1)
        print_bit(30,43,inp[3]&1)
        draw_triad(2)
        continue
      }
      if(A==2218 || A==2318)
      {
        next_val(inp[4])
        inp[4] = A
        print_bit(22,18,inp[4]>>1)
        print_bit(23,18,inp[4]&1)
        print_bit(27,43,inp[4]>>1)
        print_bit(28,43,inp[4]&1)
        draw_triad(2)
        continue
      }
      if(A==2220 || A==2320)
      {
        next_val(inp[5])
        inp[5] = A
        print_bit(22,20,inp[5]>>1)
        print_bit(23,20,inp[5]&1)
        print_bit(25,43,inp[5]>>1)
        print_bit(26,43,inp[5]&1)
        draw_triad(2)
        continue
      }

      if(A==2226 || A==2326)
      {
        next_val(inp[6])
        inp[6] = A
        print_bit(22,26,inp[6]>>1)
        print_bit(23,26,inp[6]&1)
        print_bit(38,43,inp[6]>>1)
        print_bit(39,43,inp[6]&1)
        draw_triad(3)
        continue
      }
      if(A==2228 || A==2328)
      {
        next_val(inp[7])
        inp[7] = A
        print_bit(22,28,inp[7]>>1)
        print_bit(23,28,inp[7]&1)
        print_bit(36,43,inp[7]>>1)
        print_bit(37,43,inp[7]&1)
        draw_triad(3)
        continue
      }
      if(A==2230 || A==2330)
      {
        next_val(inp[8])
        inp[8] = A
        print_bit(22,30,inp[8]>>1)
        print_bit(23,30,inp[8]&1)
        print_bit(34,43,inp[8]>>1)
        print_bit(35,43,inp[8]&1)
        draw_triad(3)
        continue
      }

      if(A==1706 || A==1806)
      {
        if(xyz[0]!=1)
        {
           xyz[0] = 1
           select 17 6; set #FE
           select 18 6; set #C5
           select 17 7; set #20
           select 18 7; set #B3
           select 17 9; set #20
           select 18 9; set #B3
           select 17 10; set #20
           select 18 10; set #B3
           print_bit(14,43,0)
           print_bit(15,43,1)
           draw_triad(1)
        }
        continue
      }
      if(X>=17 && X<=18 && Y>=7 && Y<=9)
      {
        if(xyz[0]!=0)
        {
           xyz[0] = 0
           select 17 6; set #20
           select 18 6; set #B3
           select 17 7; set #FE
           select 18 7; set #C5
           select 17 9; set #FE
           select 18 9; set #C5
           select 17 10; set #20
           select 18 10; set #B3
           print_bit(14,43,0)
           print_bit(15,43,0)
           draw_triad(1)
        }
        continue
      }
      if(A==1710 || A==1810)
      {
        if(xyz[0]!=2)
        {
           xyz[0] = 2
           select 17 6; set #20
           select 18 6; set #B3
           select 17 7; set #20
           select 18 7; set #B3
           select 17 9; set #20
           select 18 9; set #B3
           select 17 10; set #FE
           select 18 10; set #C5
           print_bit(14,43,1)
           print_bit(15,43,0)
           draw_triad(1)
        }
        continue
      }

      if(A==1716 || A==1816)
      {
        if(xyz[1]!=1)
        {
           xyz[1] = 1
           select 17 16; set #FE
           select 18 16; set #C5
           select 17 17; set #20
           select 18 17; set #B3
           select 17 19; set #20
           select 18 19; set #B3
           select 17 20; set #20
           select 18 20; set #B3
           print_bit(23,43,0)
           print_bit(24,43,1)
           draw_triad(2)
        }
        continue
      }
      if(X>=17 && X<=18 && Y>=17 && Y<=19)
      {
        if(xyz[1]!=0)
        {
           xyz[1] = 0
           select 17 16; set #20
           select 18 16; set #B3
           select 17 17; set #FE
           select 18 17; set #C5
           select 17 19; set #FE
           select 18 19; set #C5
           select 17 20; set #20
           select 18 20; set #B3
           print_bit(23,43,0)
           print_bit(24,43,0)
           draw_triad(2)
        }
        continue
      }
      if(A==1720 || A==1820)
      {
        if(xyz[1]!=2)
        {
           xyz[1] = 2
           select 17 16; set #20
           select 18 16; set #B3
           select 17 17; set #20
           select 18 17; set #B3
           select 17 19; set #20
           select 18 19; set #B3
           select 17 20; set #FE
           select 18 20; set #C5
           print_bit(23,43,1)
           print_bit(24,43,0)
           draw_triad(2)
        }
        continue
      }

      if(A==1726 || A==1826)
      {
        if(xyz[2]!=1)
        {
           xyz[2] = 1
           select 17 26; set #FE
           select 18 26; set #C5
           select 17 27; set #20
           select 18 27; set #B3
           select 17 29; set #20
           select 18 29; set #B3
           select 17 30; set #20
           select 18 30; set #B3
           print_bit(32,43,0)
           print_bit(33,43,1)
           draw_triad(3)
        }
        continue
      }
      if(X>=17 && X<=18 && Y>=27 && Y<=29)
      {
        if(xyz[2]!=0)
        {
           xyz[2] = 0
           select 17 26; set #20
           select 18 26; set #B3
           select 17 27; set #FE
           select 18 27; set #C5
           select 17 29; set #FE
           select 18 29; set #C5
           select 17 30; set #20
           select 18 30; set #B3
           print_bit(32,43,0)
           print_bit(33,43,0)
           draw_triad(3)
        }
        continue
      }
      if(A==1730 || A==1830)
      {
        if(xyz[2]!=2)
        {
           xyz[2] = 2
           select 17 26; set #20
           select 18 26; set #B3
           select 17 27; set #20
           select 18 27; set #B3
           select 17 29; set #20
           select 18 29; set #B3
           select 17 30; set #FE
           select 18 30; set #C5
           print_bit(32,43,1)
           print_bit(33,43,0)
           draw_triad(3)
        }
        continue
      }

325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
      if(A==3012 || A==3013)
      {
        if(mem)
        {
          mem = 0
          select 30 12; set #20
          select 31 12; set #B3
          select 30 13; set #FE
          select 31 13; set #C5
          print_bit(48,43,0)
        }
        else
        {
          mem = 1
          select 30 12; set #FE
          select 31 12; set #C5
          select 30 13; set #20
          select 31 13; set #B3
          print_bit(48,43,1)
        }
        draw_memaux()
        continue
      }

      if(A==3004 || A==3005)
      {
        if(indep1)
        {
          indep1 = 0
          select 30 04; set #20
          select 31 04; set #B3
          select 30 05; set #FE
          select 31 05; set #C5
          print_bit(44,43,0)
        }
        else
        {
          indep1 = 1
          select 30 04; set #FE
          select 31 04; set #C5
          select 30 05; set #20
          select 31 05; set #B3
          print_bit(44,43,1)
        }
        draw_memaux()
        continue
      }

      if(A==3024 || A==3025)
      {
        if(indep3)
        {
          indep3 = 0
          select 30 24; set #20
          select 31 24; set #B3
          select 30 25; set #FE
          select 31 25; set #C5
          print_bit(43,43,0)
        }
        else
        {
          indep3 = 1
          select 30 24; set #FE
          select 31 24; set #C5
          select 30 25; set #20
          select 31 25; set #B3
          print_bit(43,43,1)
        }
        draw_memaux()
        continue
      }

      if(A==4214 || A==4215)
      {
        if(simp1)
        {
          simp1 = 0
          select 42 14; set #FE
          select 43 14; set #C5
          select 42 15; set #20
          select 43 15; set #B3
          print_bit(47,43,0)
        }
        else
        {
          simp1 = 1
          select 42 14; set #20
          select 43 14; set #B3
          select 42 15; set #FE
          select 43 15; set #C5
          print_bit(47,43,1)
        }
        draw_memaux()
        continue
      }

      if(A==3818 || A==3819)
      {
        if(simp2)
        {
          simp2 = 0
          select 38 18; set #FE
          select 39 18; set #C5
          select 38 19; set #20
          select 39 19; set #B3
          print_bit(46,43,0)
        }
        else
        {
          simp2 = 1
          select 38 18; set #20
          select 39 18; set #B3
          select 38 19; set #FE
          select 39 19; set #C5
          print_bit(46,43,1)
        }
        draw_memaux()
        continue
      }

      if(A==4221 || A==4222)
      {
        if(simp3)
        {
          simp3 = 0
          select 42 21; set #FE
          select 43 21; set #C5
          select 42 22; set #20
          select 43 22; set #B3
          print_bit(45,43,0)
        }
        else
        {
          simp3 = 1
          select 42 21; set #20
          select 43 21; set #B3
          select 42 22; set #FE
          select 43 22; set #C5
          print_bit(45,43,1)
        }
        draw_memaux()
        continue
      }

      if(A==4925)
      {
        if(aux==0)
        {
           continue
        }
        if(aux==1)
        {
           select 80 17; set #20
           select 81 17; set #20
           select 82 17; set #20
        }
        else
        {
           select 80 25; set #20
           select 81 25; set #20
           select 82 25; set #20
        }
        aux = 0
        select 49 25; set #FE
        select 50 25; set #C5
        select 49 26; set #20
        select 50 26; set #B3
        select 49 27; set #20
        select 50 27; set #B3
        select 49 28; set #20
        select 50 28; set #B3
        print_bit(41,43,0)
        print_bit(42,43,0)
        draw_memaux()
        continue
      }
      if(A==4926)
      {
        if(aux==1)
        {
           continue
        }
        if(aux==2 || aux==3)
        {
           select 80 25; set #20
           select 81 25; set #20
           select 82 25; set #20
        }
        select 80 17; set 'A'
        select 81 17; set 'U'
        select 82 17; set 'X'
        aux = 1
        select 49 25; set #20
        select 50 25; set #B3
        select 49 26; set #FE
        select 50 26; set #C5
        select 49 27; set #20
        select 50 27; set #B3
        select 49 28; set #20
        select 50 28; set #B3
        print_bit(41,43,0)
        print_bit(42,43,1)
        draw_memaux()
        continue
      }
      if(A==4927)
      {
        if(aux==2)
        {
           continue
        }
        if(aux==1)
        {
           select 80 17; set #20
           select 81 17; set #20
           select 82 17; set #20
        }
        select 80 25; set 'A'
        select 81 25; set 'U'
        select 82 25; set 'X'
        aux = 2
        select 49 25; set #20
        select 50 25; set #B3
        select 49 26; set #20
        select 50 26; set #B3
        select 49 27; set #FE
        select 50 27; set #C5
        select 49 28; set #20
        select 50 28; set #B3
        print_bit(41,43,1)
        print_bit(42,43,0)
        draw_memaux()
        continue
      }
      if(A==4928)
      {
        if(aux==3)
        {
           continue
        }
        if(aux==1)
        {
           select 80 17; set #20
           select 81 17; set #20
           select 82 17; set #20
        }
        select 80 25; set 'A'
        select 81 25; set 'U'
        select 82 25; set 'X'
        aux = 3
        select 49 25; set #20
        select 50 25; set #B3
        select 49 26; set #20
        select 50 26; set #B3
        select 49 27; set #20
        select 50 27; set #B3
        select 49 28; set #FE
        select 50 28; set #C5
        print_bit(41,43,1)
        print_bit(42,43,1)
        draw_memaux()
        continue
      }

//      print A
590 591
      continue
   }
592

593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613
   if(N==@filesystem)
   {
      aa = @filebuffer
      while(TRUE)
      {
        xxx = xx
        A = aa
        while(A[0])
        {
          select xxx yy
          outc = A[0]
          set outc
          A = A + 1
          xxx = xxx + 1
        }
        if(!A[1]) break
        yy = yy + 1
        aa = A + 1
      }
      if(xx==0)
      {
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
         select 63 8; set #20
         select 64 8; set #20
         select 65 8; set #20
         select 66 8; set #20
         select 67 8; set #20
         select 68 8; set #20
         select 69 8; set #20
         select 69 9; set #C4
         select 63 10; set 'A'
         select 64 10; set #FE
         select 65 10; set #C4
         select 66 10; set #C4
         select 67 10; set #C4
         select 68 10; set #C4
         select 69 10; set #BF
Alexander Shabarshin's avatar
Alexander Shabarshin committed
629
         select 80 21; set 'O'
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
         select 81 21; set 'U'
         select 82 21; set 'T'
         for(yy=6;yy<=30;yy++)
         {
            if(yy!=12 && yy!=14 && yy!=22 && yy!=24)
            {
               select 22 yy; set '0'
               select 23 yy; set '0'
            }
            yy = yy + 1
         }
         draw_triad(1)
         draw_triad(2)
         draw_triad(3)
         select 2 43; set 'B'
         select 3 43; set 'I'
         select 4 43; set 'T'
         select 5 43; set 'S'
         select 6 43; set 'T'
         select 7 43; set 'R'
         select 8 43; set 'E'
         select 9 43; set 'A'
         select 10 43; set 'M'
         select 11 43; set #3A
         xx = 14
         for(ii=0;ii<32;ii++)
         {
             select xx 43; set '0'
             if((ii&7)==7)
             {
                xx = xx + 2
             }
             else
             {
                xx = xx + 1
             }
         }
//         select 51 43; set '['
//         select 53 43; set '0'
//         select 54 43; set '0'
//         select 56 43; set '0'
//         select 57 43; set '0'
//         select 59 43; set '0'
//         select 60 43; set '0'
//         select 62 43; set '0'
//         select 63 43; set '0'
//         select 65 43; set ']'
      }
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765
      else
      {
         if(simp1)
         {
            select 75 19; set '4'
            select 75 18
            if(mem)
            {
              set #C4
            }
            else
            {
              set #20
            }
            select 75 17
            if(aux==1)
            {
              set #C0
            }
            else
            {
              set #20
            }
         }
         if(simp2)
         {
            select 75 21; set 'C'
            select 74 21
            if(aux==2)
            {
               set #BF
            }
            else
            {
               set #20
            }
         }
         if(simp3)
         {
            select 75 23; set '6'
            select 75 24; set #20
            select 75 25
            if(aux==3)
            {
              set #DA
            }
            else
            {
              if(aux==2)
              {
                 set #C4
                 select 75 26
              }
              set #20
            }
         }
         if(indep)
         {
            indep = 0
            xx = 69
            yy = 11
            tmp[0] = 4
            tmp[1] = 'I'
            tmp[2] = 'N'
            tmp[3] = 'D'
            if(indep1)
            {
              tmp[4] = '1'
            }
            if(indep3)
            {
              if(indep1)
              {
                tmp[4] = '4'
              }
              else
              {
                tmp[4] = '3'
              }
            }
            if(mem)
            {
              tmp[0] = 5
              tmp[5] = 'M'
            }
            sendp tmp[0] @filesystem
         }
      }
766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785
      continue
   }
 }
}

next_val() // A-value to increment
{
        if(A>=3)
        {
           A = 0
        }
        else
        {
           A = A+1
        }
}

draw_triad() // A-triad(1,2,3)
{
 iii = 0
Alexander Shabarshin's avatar
Alexander Shabarshin committed
786
 jjj = A-1
787 788 789
 yyy = 11
 box1 = 0
 box2 = 0
Alexander Shabarshin's avatar
Alexander Shabarshin committed
790
 above3 = 0
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844
 if(A==2)
 {
    iii = 3
    yyy = 18
 }
 if(A==3)
 {
    iii = 6
    yyy = 25
 }
 yyyy = yyy + 1
 select 66 yyyy
 bb = inp[iii]
 if(bb==0)
 {
    set 'O'
    box1 = 1
 }
 if(bb==1)
 {
    set 'P'
    box1 = 1
 }
 if(bb==2)
 {
    set 'N'
    box1 = 1
 }
 if(bb==3)
 {
    set #C4
    select 67 yyyy
    set #C4
    select 65 yyyy
    set #C4
    select 64 yyyy
    set #FE
    select 63 yyyy
    bb = (A-1)*3+'1'
    set bb
    yyyy = yyyy - 1
    select 65 yyyy
    set #20
    select 66 yyyy
    set #20
    select 67 yyyy
    set #20
    yyyy = yyyy + 2
    select 65 yyyy
    set #DA
    select 66 yyyy
    set #C4
    select 67 yyyy
    set #BF
Alexander Shabarshin's avatar
Alexander Shabarshin committed
845 846 847

    select 64 yyyy
    set #20
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899
 }
 else
 {
    select 67 yyyy
    set #C3
    select 65 yyyy
    set #B3
    select 64 yyyy
    set #20
    select 63 yyyy
    set #20
    yyyy = yyyy - 1
    select 65 yyyy
    set #DA
    select 66 yyyy
    set #C4
    select 67 yyyy
    set #BF
    yyyy = yyyy + 2
    select 65 yyyy
    set #C3
    select 66 yyyy
    set #C4
    select 67 yyyy
    set #B4
 }
 yyyy = yyy + 3
 select 66 yyyy
 bb = inp[iii+1]
 if(bb==0)
 {
    set 'O'
    box2 = 1
 }
 if(bb==1)
 {
    set 'P'
    box2 = 1
 }
 if(bb==2)
 {
    set 'N'
    box2 = 1
 }
 if(bb==3)
 {
    set #C4
    select 67 yyyy
    set #C4
    select 65 yyyy
    set #C4
    select 64 yyyy
Alexander Shabarshin's avatar
Alexander Shabarshin committed
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951
    bbb = xyz[jjj]
    if(bbb==0)
    {
      set #FE
      select 63 yyyy
      bb = (A-1)*3+'2'
      set bb
      yyyyy = yyyy - 1
      select 64 yyyyy
      set #20
      yyyyy = yyyy + 1
      select 64 yyyyy
      set #20
    }
    if(bbb==1)
    {
      set #C0
      select 63 yyyy
      set #20
      yyyyy = yyyy + 1
      select 64 yyyyy
      set #20
      yyyyy = yyyy - 2
      select 63 yyyyy
      bb = (A-1)*3+'1'
      set bb
      select 64 yyyyy
      if(box1)
      {
         set #BF
      }
      else
      {
         set #F2
      }
      yyyyy = yyyyy + 1
      select 64 yyyyy
      set #B3
    }
    if(bbb==2)
    {
      set #DA
      select 63 yyyy
      set #20
      yyyyy = yyyy - 1
      select 64 yyyyy
      set #20
      yyyyy = yyyy + 1
      select 64 yyyyy
      set #B3
      above3 = 1
    }
952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988
    yyyy = yyyy - 1
    select 65 yyyy
    if(box1)
    {
      set #C0
      select 66 yyyy
      set #C4
      select 67 yyyy
      set #D9
    }
    else
    {
      set #20
      select 66 yyyy
      set #20
      select 67 yyyy
      set #20
    }
    yyyy = yyyy + 2
    select 65 yyyy
    set #DA
    select 66 yyyy
    set #C4
    select 67 yyyy
    set #BF
 }
 else
 {
    select 67 yyyy
    set #C3
    select 65 yyyy
    set #B3
    select 64 yyyy
    set #20
    select 63 yyyy
    set #20
    yyyy = yyyy - 1
989 990
    select 64 yyyy
    set #20
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038
    select 65 yyyy
    if(box1)
    {
      set #C3
      select 66 yyyy
      set #C4
      select 67 yyyy
      set #B4
    }
    else
    {
      set #DA
      select 66 yyyy
      set #C4
      select 67 yyyy
      set #BF
    }
    yyyy = yyyy + 2
    select 65 yyyy
    set #C3
    select 66 yyyy
    set #C4
    select 67 yyyy
    set #B4
 }
 yyyy = yyy + 5
 select 66 yyyy
 bb = inp[iii+2]
 if(bb==0)
 {
    set 'O'
 }
 if(bb==1)
 {
    set 'P'
 }
 if(bb==2)
 {
    set 'N'
 }
 if(bb==3)
 {
    set #C4
    select 67 yyyy
    set #C4
    select 65 yyyy
    set #C4
    select 64 yyyy
Alexander Shabarshin's avatar
Alexander Shabarshin committed
1039 1040 1041 1042 1043 1044 1045 1046
    if(above3)
    {
      set #F4
    }
    else
    {
      set #FE
    }
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086
    select 63 yyyy
    bb = (A-1)*3+'3'
    set bb
    yyyy = yyyy - 1
    select 65 yyyy
    if(box2)
    {
      set #C0
      select 66 yyyy
      set #C4
      select 67 yyyy
      set #D9
    }
    else
    {
      set #20
      select 66 yyyy
      set #20
      select 67 yyyy
      set #20
    }
    yyyy = yyyy + 2
    select 65 yyyy
    set #20
    select 66 yyyy
    set #20
    select 67 yyyy
    set #20
 }
 else
 {
    select 67 yyyy
    set #C3
    select 65 yyyy
    set #B3
    select 64 yyyy
    set #20
    select 63 yyyy
    set #20
    yyyy = yyyy - 1
Alexander Shabarshin's avatar
Alexander Shabarshin committed
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101
    select 64 yyyy
    if(above3)
    {
       set #B3
       yyyyy = yyyy + 1
       select 64 yyyyy
       set #D9
       select 63 yyyyy
       bb = (A-1)*3+'3'
       set bb
    }
    else
    {
       set #20
    }
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
    select 65 yyyy
    if(box2)
    {
      set #C3
      select 66 yyyy
      set #C4
      select 67 yyyy
      set #B4
    }
    else
    {
      set #DA
      select 66 yyyy
      set #C4
      select 67 yyyy
      set #BF
    }
    yyyy = yyyy + 2
    select 65 yyyy
    set #C0
    select 66 yyyy
    set #C4
    select 67 yyyy
    set #D9
 }
}

1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149
draw_memaux()
{
 xx = 69
 yy = 11
 tmp[0] = 4
 tmp[1] = 'A'
 tmp[2] = 'U'
 tmp[3] = 'X'
 tmp[4] = '0' + aux
 if(mem)
 {
   tmp[0] = 5
   tmp[5] = 'M'
 }
 if(indep1 || indep3)
 {
    indep = 1
 }
 sendp tmp[0] @filesystem
}

1150 1151 1152 1153 1154 1155
print_bit() // A-X,B-Y,C-bit
{
 select A B
 bb = '0' + C
 set bb
}