kthacker | 62e146c | 2006-04-17 15:11:35 +0000 | [diff] [blame] | 1 | |
| 2 | ;--------------------------------------------------------------------- |
| 3 | .importzp ptr1, ptr2, ptr3, ptr4, sreg |
| 4 | .importzp sp |
| 5 | |
| 6 | .import incsp2 |
| 7 | |
| 8 | |
| 9 | .import _ctk_hires_cursx |
| 10 | .import _ctk_hires_cursy |
| 11 | .import _ctk_hires_color |
| 12 | .import _ctk_hires_underline |
| 13 | .import _ctk_hires_reversed |
| 14 | |
| 15 | .import _ctk_hires_yscreenaddr |
| 16 | .import _ctk_hires_yhiresaddr |
| 17 | |
| 18 | .import _ctk_hires_windowparams |
| 19 | |
| 20 | .import _ctk_hires_bitmapptr |
| 21 | |
| 22 | .import _ctk_hires_theme |
| 23 | |
| 24 | .export _ctk_hires_cclear |
| 25 | .export _ctk_hires_chline |
| 26 | .export _ctk_hires_cputc |
| 27 | .export _ctk_hires_cputsn |
| 28 | |
| 29 | .export _ctk_hires_draw_buttonleft |
| 30 | .export _ctk_hires_draw_buttonright |
| 31 | |
| 32 | .export _ctk_hires_draw_windowborders |
| 33 | |
| 34 | .export _ctk_hires_draw_bitmapline |
| 35 | ;--------------------------------------------------------------------- |
| 36 | |
| 37 | ptr5 = sreg |
| 38 | |
| 39 | ;; Offsets in the theme struct |
| 40 | |
| 41 | ulcornerpattern = 8 |
| 42 | titlebarpattern = ulcornerpattern+8 |
| 43 | urcornerpattern = titlebarpattern+8 |
| 44 | rborderpattern = urcornerpattern+8 |
| 45 | lrcornerpattern = rborderpattern+8 |
| 46 | lowerborderpattern = lrcornerpattern+8 |
| 47 | llcornerpattern = lowerborderpattern+8 |
| 48 | lborderpattern = llcornerpattern+8 |
| 49 | |
| 50 | |
| 51 | buttonleftpattern = lborderpattern+8 |
| 52 | buttonrightpattern = buttonleftpattern+8 |
| 53 | |
| 54 | |
| 55 | .bss |
| 56 | tmp01: .res 1 |
| 57 | tmpl: .res 1 |
| 58 | tmpf: .res 1 |
| 59 | tmpc: .res 1 |
| 60 | tmpw: .res 1 |
| 61 | tmpptr: .res 2 |
| 62 | |
| 63 | tmpy: .res 1 |
| 64 | tmph: .res 1 |
| 65 | |
| 66 | ;; Window border parameters |
| 67 | w: .res 1 |
| 68 | wpw = 0 |
| 69 | h: .res 1 |
| 70 | wph = 1 |
| 71 | clipy1: .res 1 |
| 72 | wpclipy1 = 2 |
| 73 | clipy2: .res 1 |
| 74 | wpclipy2 = 3 |
| 75 | color1: .res 1 |
| 76 | wpcolor1 = 4 |
| 77 | color2: .res 1 |
| 78 | wpcolor2 = 5 |
| 79 | titlelen: .res 1 |
| 80 | wptitlelen = 6 |
| 81 | title: .res 2 |
| 82 | wptitle = 7 |
| 83 | |
| 84 | ;--------------------------------------------------------------------- |
| 85 | .data |
| 86 | ;--------------------------------------------------------------------- |
| 87 | .code |
| 88 | setupptrs: |
| 89 | ;; Find hires address. |
| 90 | lda _ctk_hires_cursy |
| 91 | asl |
| 92 | tax |
| 93 | lda _ctk_hires_yhiresaddr,x |
| 94 | sta ptr2 |
| 95 | lda _ctk_hires_yhiresaddr+1,x |
| 96 | sta ptr2+1 |
| 97 | |
| 98 | ;; Add X coordinate to the hires address. |
| 99 | lda #0 |
| 100 | sta ptr1+1 |
| 101 | lda _ctk_hires_cursx |
| 102 | asl |
| 103 | rol ptr1+1 |
| 104 | asl |
| 105 | rol ptr1+1 |
| 106 | asl |
| 107 | rol ptr1+1 |
| 108 | clc |
| 109 | adc ptr2 |
| 110 | sta ptr2 |
| 111 | lda ptr2+1 |
| 112 | adc ptr1+1 |
| 113 | sta ptr2+1 |
| 114 | |
| 115 | |
| 116 | ;; Find screen address. |
| 117 | lda _ctk_hires_cursy |
| 118 | asl |
| 119 | tax |
| 120 | lda _ctk_hires_yscreenaddr,x |
| 121 | clc |
| 122 | adc _ctk_hires_cursx |
| 123 | sta ptr1 |
| 124 | lda _ctk_hires_yscreenaddr+1,x |
| 125 | adc #0 |
| 126 | sta ptr1+1 |
| 127 | |
| 128 | ;; Turn off interrupts, prepare $01 to store color data in RAM |
| 129 | ;; under I/O area. |
| 130 | sei |
| 131 | lda $01 |
| 132 | sta tmp01 |
| 133 | and #$f8 |
| 134 | sta $01 |
| 135 | rts |
| 136 | ;--------------------------------------------------------------------- |
| 137 | restore01: |
| 138 | lda tmp01 |
| 139 | sta $01 |
| 140 | cli |
| 141 | rts |
| 142 | ;--------------------------------------------------------------------- |
| 143 | _ctk_hires_cclear: |
| 144 | sta tmpl |
| 145 | cmp #0 |
| 146 | bne @norts |
| 147 | rts |
| 148 | @norts: |
| 149 | |
| 150 | jsr setupptrs |
| 151 | |
| 152 | ;; Store color value in color memory |
| 153 | |
| 154 | ldy tmpl |
| 155 | dey |
| 156 | lda _ctk_hires_color |
| 157 | @loop0: |
| 158 | sta (ptr1),y |
| 159 | dey |
| 160 | bpl @loop0 |
| 161 | |
| 162 | ;; Store either $00 or $ff in hires memory, depending on the |
| 163 | ;; reversed flag |
| 164 | |
| 165 | ldx tmpl |
| 166 | lda _ctk_hires_reversed |
| 167 | beq @noff |
| 168 | lda #$ff |
| 169 | @noff: |
| 170 | sta tmpf |
| 171 | @loop1: |
| 172 | ldy #7 |
| 173 | lda tmpf |
| 174 | @loop2: |
| 175 | sta (ptr2),y |
| 176 | dey |
| 177 | bpl @loop2 |
| 178 | |
| 179 | lda ptr2 |
| 180 | clc |
| 181 | adc #8 |
| 182 | sta ptr2 |
| 183 | bcc @noinc |
| 184 | inc ptr2+1 |
| 185 | @noinc: |
| 186 | |
| 187 | inc _ctk_hires_cursx |
| 188 | |
| 189 | dex |
| 190 | bne @loop1 |
| 191 | |
| 192 | jmp restore01 |
| 193 | ;--------------------------------------------------------------------- |
| 194 | _ctk_hires_chline: |
| 195 | sta tmpl |
| 196 | cmp #0 |
| 197 | bne @norts |
| 198 | rts |
| 199 | @norts: |
| 200 | |
| 201 | jsr setupptrs |
| 202 | |
| 203 | ;; Store color value in color memory |
| 204 | |
| 205 | ldy tmpl |
| 206 | dey |
| 207 | lda _ctk_hires_color |
| 208 | @loop0: |
| 209 | sta (ptr1),y |
| 210 | dey |
| 211 | bpl @loop0 |
| 212 | |
| 213 | ;; Store horizontal line pattern in hires memory |
| 214 | ldx tmpl |
| 215 | @loop1: |
| 216 | ldy #0 |
| 217 | lda #$00 |
| 218 | sta (ptr2),y |
| 219 | iny |
| 220 | lda #$00 |
| 221 | sta (ptr2),y |
| 222 | iny |
| 223 | lda #$00 |
| 224 | sta (ptr2),y |
| 225 | iny |
| 226 | lda #$ff |
| 227 | sta (ptr2),y |
| 228 | iny |
| 229 | lda #$ff |
| 230 | sta (ptr2),y |
| 231 | iny |
| 232 | lda #$00 |
| 233 | sta (ptr2),y |
| 234 | iny |
| 235 | lda #$00 |
| 236 | sta (ptr2),y |
| 237 | iny |
| 238 | lda #$00 |
| 239 | sta (ptr2),y |
| 240 | |
| 241 | |
| 242 | lda ptr2 |
| 243 | clc |
| 244 | adc #8 |
| 245 | sta ptr2 |
| 246 | bcc @noinc |
| 247 | inc ptr2+1 |
| 248 | @noinc: |
| 249 | |
| 250 | inc _ctk_hires_cursx |
| 251 | |
| 252 | dex |
| 253 | bne @loop1 |
| 254 | |
| 255 | jmp restore01 |
| 256 | ;--------------------------------------------------------------------- |
| 257 | _ctk_hires_cputc: |
| 258 | sta tmpc |
| 259 | |
| 260 | jsr setupptrs |
| 261 | |
| 262 | ldy #0 |
| 263 | lda _ctk_hires_color |
| 264 | sta (ptr1),y |
| 265 | |
| 266 | ;; Turn on font ROM |
| 267 | lda tmp01 |
| 268 | and #$f8 |
| 269 | ora #$01 |
| 270 | sta $01 |
| 271 | |
| 272 | lda #0 |
| 273 | sta ptr1+1 |
| 274 | |
| 275 | ;; Convert from PETSCII to screen encoding |
| 276 | lda tmpc |
| 277 | eor #$e0 |
| 278 | clc |
| 279 | adc #$20 |
| 280 | bpl @cont |
| 281 | adc #$40 |
| 282 | bpl @cont |
| 283 | eor #$a0 |
| 284 | @cont: |
| 285 | ldx _ctk_hires_reversed |
| 286 | beq :+ |
| 287 | eor #$80 |
| 288 | : |
| 289 | |
| 290 | ;; Convert to address in character ROM |
| 291 | asl |
| 292 | rol ptr1+1 |
| 293 | asl |
| 294 | rol ptr1+1 |
| 295 | asl |
| 296 | rol ptr1+1 |
| 297 | sta ptr1 |
| 298 | lda #$d8 |
| 299 | adc ptr1+1 |
| 300 | sta ptr1+1 |
| 301 | |
| 302 | ;; Print on hires screen, bottom-up. If we should underline, |
| 303 | ;; we do this by eor:ing the bottom line with #$ff |
| 304 | ldy #7 |
| 305 | lda (ptr1),y |
| 306 | ldx _ctk_hires_underline |
| 307 | beq @nounderline |
| 308 | eor #$ff |
| 309 | @nounderline: |
| 310 | sta (ptr2),y |
| 311 | dey |
| 312 | @loop: |
| 313 | lda (ptr1),y |
| 314 | sta (ptr2),y |
| 315 | dey |
| 316 | bpl @loop |
| 317 | |
| 318 | inc _ctk_hires_cursx |
| 319 | |
| 320 | jmp restore01 |
| 321 | ;--------------------------------------------------------------------- |
| 322 | _ctk_hires_cputsn: |
| 323 | sta tmpl |
| 324 | cmp #0 |
| 325 | bne :+ |
| 326 | rts |
| 327 | : |
| 328 | |
| 329 | jsr setupptrs |
| 330 | |
| 331 | ldy tmpl |
| 332 | dey |
| 333 | lda _ctk_hires_color |
| 334 | @loop0: |
| 335 | sta (ptr1),y |
| 336 | dey |
| 337 | bpl @loop0 |
| 338 | |
| 339 | ;; Turn on font ROM |
| 340 | lda tmp01 |
| 341 | and #$f8 |
| 342 | ora #$01 |
| 343 | sta $01 |
| 344 | |
| 345 | |
| 346 | ;; Output each character from the string |
| 347 | lda #0 |
| 348 | sta tmpc |
| 349 | ldy #0 |
| 350 | lda (sp),y |
| 351 | sta ptr3 |
| 352 | iny |
| 353 | lda (sp),y |
| 354 | sta ptr3+1 |
| 355 | |
| 356 | @loop1: |
| 357 | |
| 358 | lda #0 |
| 359 | sta ptr1+1 |
| 360 | |
| 361 | ldy tmpc |
| 362 | lda (ptr3),y |
| 363 | beq @end |
| 364 | |
| 365 | ;; Convert from PETSCII to screen encoding |
| 366 | eor #$e0 |
| 367 | clc |
| 368 | adc #$20 |
| 369 | bpl @cont |
| 370 | adc #$40 |
| 371 | bpl @cont |
| 372 | eor #$a0 |
| 373 | @cont: |
| 374 | ldx _ctk_hires_reversed |
| 375 | beq :+ |
| 376 | eor #$80 |
| 377 | : |
| 378 | |
| 379 | ;; Convert to address in character ROM |
| 380 | asl |
| 381 | rol ptr1+1 |
| 382 | asl |
| 383 | rol ptr1+1 |
| 384 | asl |
| 385 | rol ptr1+1 |
| 386 | sta ptr1 |
| 387 | lda #$d8 |
| 388 | adc ptr1+1 |
| 389 | sta ptr1+1 |
| 390 | |
| 391 | ;; Print on hires screen, bottom-up. If we should underline, |
| 392 | ;; we do this by eor:ing the bottom line with #$ff |
| 393 | ldy #7 |
| 394 | lda (ptr1),y |
| 395 | ldx _ctk_hires_underline |
| 396 | beq @nounderline |
| 397 | eor #$ff |
| 398 | @nounderline: |
| 399 | sta (ptr2),y |
| 400 | dey |
| 401 | @loop: |
| 402 | lda (ptr1),y |
| 403 | sta (ptr2),y |
| 404 | dey |
| 405 | bpl @loop |
| 406 | |
| 407 | inc _ctk_hires_cursx |
| 408 | |
| 409 | lda ptr2 |
| 410 | clc |
| 411 | adc #8 |
| 412 | sta ptr2 |
| 413 | bcc :+ |
| 414 | inc ptr2+1 |
| 415 | : |
| 416 | inc tmpc |
| 417 | lda tmpc |
| 418 | cmp tmpl |
| 419 | bne @loop1 |
| 420 | |
| 421 | @end: |
| 422 | jsr restore01 |
| 423 | |
| 424 | jmp incsp2 |
| 425 | |
| 426 | ;--------------------------------------------------------------------- |
| 427 | _ctk_hires_draw_windowborders: |
| 428 | |
| 429 | jsr setupptrs |
| 430 | |
| 431 | lda _ctk_hires_windowparams + wpclipy1 |
| 432 | beq :+ |
| 433 | jmp @nofirstline |
| 434 | : |
| 435 | |
| 436 | ;; Draw first line of the border, including the window title |
| 437 | |
| 438 | ;; Start with filling color memory |
| 439 | ldy _ctk_hires_windowparams + wpw |
| 440 | iny |
| 441 | lda _ctk_hires_windowparams + wpcolor1 |
| 442 | sta (ptr1),y |
| 443 | dey |
| 444 | dey |
| 445 | dey |
| 446 | sty tmpw |
| 447 | |
| 448 | ldy _ctk_hires_windowparams + wptitlelen |
| 449 | iny |
| 450 | iny |
| 451 | iny |
| 452 | : |
| 453 | sta (ptr1),y |
| 454 | iny |
| 455 | cpy tmpw |
| 456 | bcc :- |
| 457 | |
| 458 | inc tmpw |
| 459 | |
| 460 | ;; Set color for upper left corner |
| 461 | ldy #0 |
| 462 | lda _ctk_hires_windowparams + wpcolor1 |
| 463 | sta (ptr1),y |
| 464 | |
| 465 | |
| 466 | ;; Turn on font ROM for drawing the title |
| 467 | lda tmp01 |
| 468 | and #$f8 |
| 469 | ora #$01 |
| 470 | sta $01 |
| 471 | |
| 472 | ;; Use a temporary pointer (ptr3) rather than ptr2 so we can |
| 473 | ;; reuse it later. |
| 474 | lda ptr2 |
| 475 | sta ptr3 |
| 476 | lda ptr2+1 |
| 477 | sta ptr3+1 |
| 478 | |
| 479 | ;; Draw upper left corner |
| 480 | ldy #7 |
| 481 | : |
| 482 | lda _ctk_hires_theme+ulcornerpattern,y |
| 483 | sta (ptr3),y |
| 484 | dey |
| 485 | bpl :- |
| 486 | |
| 487 | ;; Draw first empty char left of the title |
| 488 | ldy #8 |
| 489 | lda #0 |
| 490 | : |
| 491 | ; sta (ptr3),y |
| 492 | iny |
| 493 | cpy #$10 |
| 494 | bne :- |
| 495 | |
| 496 | lda ptr3 |
| 497 | clc |
| 498 | adc #$10 |
| 499 | sta ptr3 |
| 500 | bcc :+ |
| 501 | inc ptr3+1 |
| 502 | : |
| 503 | dec tmpw |
| 504 | |
| 505 | ;; Draw the title |
| 506 | lda _ctk_hires_windowparams + wptitle |
| 507 | sta ptr4 |
| 508 | lda _ctk_hires_windowparams + wptitle+1 |
| 509 | sta ptr4+1 |
| 510 | |
| 511 | |
| 512 | lda #0 |
| 513 | sta tmpc |
| 514 | @titleloop: |
| 515 | lda #0 |
| 516 | sta ptr5+1 |
| 517 | |
| 518 | ldy tmpc |
| 519 | lda (ptr4),y |
| 520 | |
| 521 | |
| 522 | ;; Convert from PETSCII to screen encoding |
| 523 | eor #$e0 |
| 524 | clc |
| 525 | adc #$20 |
| 526 | bpl @cont |
| 527 | adc #$40 |
| 528 | bpl @cont |
| 529 | eor #$a0 |
| 530 | @cont: |
| 531 | ;; Convert to address in character ROM |
| 532 | asl |
| 533 | rol ptr5+1 |
| 534 | asl |
| 535 | rol ptr5+1 |
| 536 | asl |
| 537 | rol ptr5+1 |
| 538 | sta ptr5 |
| 539 | lda #$d8 |
| 540 | adc ptr5+1 |
| 541 | sta ptr5+1 |
| 542 | |
| 543 | ;; Print on hires screen, character by character, bottom-up. |
| 544 | ldy #7 |
| 545 | : |
| 546 | lda (ptr5),y |
| 547 | ; sta (ptr3),y |
| 548 | dey |
| 549 | bpl :- |
| 550 | |
| 551 | lda ptr3 |
| 552 | clc |
| 553 | adc #8 |
| 554 | sta ptr3 |
| 555 | bcc :+ |
| 556 | inc ptr3+1 |
| 557 | : |
| 558 | dec tmpw |
| 559 | |
| 560 | inc tmpc |
| 561 | lda tmpc |
| 562 | cmp _ctk_hires_windowparams + wptitlelen |
| 563 | bne @titleloop |
| 564 | |
| 565 | ;; Draw empty char after the title |
| 566 | ldy #7 |
| 567 | lda #0 |
| 568 | : |
| 569 | ; sta (ptr3),y |
| 570 | dey |
| 571 | bpl :- |
| 572 | |
| 573 | lda ptr3 |
| 574 | clc |
| 575 | adc #$8 |
| 576 | sta ptr3 |
| 577 | bcc :+ |
| 578 | inc ptr3+1 |
| 579 | : |
| 580 | dec tmpw |
| 581 | |
| 582 | ;; Draw window title bar pattern |
| 583 | @titlebarloop: |
| 584 | ldy #7 |
| 585 | : |
| 586 | lda _ctk_hires_theme+titlebarpattern,y |
| 587 | sta (ptr3),y |
| 588 | dey |
| 589 | bpl :- |
| 590 | |
| 591 | lda ptr3 |
| 592 | clc |
| 593 | adc #$8 |
| 594 | sta ptr3 |
| 595 | bcc :+ |
| 596 | inc ptr3+1 |
| 597 | : |
| 598 | ;; Loop until we are three characters away from right border |
| 599 | ;; to avoid flickering since we would be overwriting the close |
| 600 | ;; button. |
| 601 | dec tmpw |
| 602 | lda tmpw |
| 603 | cmp #3 |
| 604 | bcs @titlebarloop |
| 605 | |
| 606 | lda ptr3 |
| 607 | clc |
| 608 | adc #$18 |
| 609 | sta ptr3 |
| 610 | bcc :+ |
| 611 | inc ptr3+1 |
| 612 | : |
| 613 | ;; Draw upper right corner piece |
| 614 | ldy #7 |
| 615 | : |
| 616 | lda _ctk_hires_theme+urcornerpattern,y |
| 617 | sta (ptr3),y |
| 618 | dey |
| 619 | bpl :- |
| 620 | |
| 621 | |
| 622 | @nofirstline: |
| 623 | |
| 624 | |
| 625 | ldx _ctk_hires_windowparams + wph |
| 626 | inx |
| 627 | stx tmph |
| 628 | |
| 629 | ;; Draw left and right borders |
| 630 | |
| 631 | ;; Fill color memory (pointer in ptr1, setup by setupptrs) |
| 632 | |
| 633 | ;; First check how much we actually should draw by inspecting |
| 634 | ;; the clipy1 and clipy2 fields in the _ctk_hires_windowparams |
| 635 | ;; structure |
| 636 | |
| 637 | lda #1 |
| 638 | sta tmpy |
| 639 | |
| 640 | ldx _ctk_hires_windowparams + wpclipy1 |
| 641 | @clipy1loop: |
| 642 | cpx #0 |
| 643 | beq @clipy1loopend |
| 644 | lda ptr1 |
| 645 | clc |
| 646 | adc #$28 |
| 647 | sta ptr1 |
| 648 | bcc :+ |
| 649 | inc ptr1+1 |
| 650 | : |
| 651 | lda ptr3 |
| 652 | clc |
| 653 | adc #$40 |
| 654 | sta ptr3 |
| 655 | lda ptr3+1 |
| 656 | adc #1 |
| 657 | sta ptr3+1 |
| 658 | |
| 659 | inc tmpy |
| 660 | |
| 661 | dex |
| 662 | jmp @clipy1loop |
| 663 | @clipy1loopend: |
| 664 | |
| 665 | lda ptr1 |
| 666 | clc |
| 667 | adc #$28 |
| 668 | sta ptr1 |
| 669 | bcc :+ |
| 670 | inc ptr1+1 |
| 671 | : |
| 672 | |
| 673 | ldx tmpy |
| 674 | ldy _ctk_hires_windowparams + wpw |
| 675 | iny |
| 676 | sty tmpw |
| 677 | @bordercloop: |
| 678 | cpx _ctk_hires_windowparams + wpclipy2 |
| 679 | beq @bordercloopend |
| 680 | |
| 681 | ldy tmpw |
| 682 | lda _ctk_hires_windowparams + wpcolor2 |
| 683 | sta (ptr1),y |
| 684 | ldy #0 |
| 685 | lda _ctk_hires_windowparams + wpcolor1 |
| 686 | sta (ptr1),y |
| 687 | |
| 688 | lda ptr1 |
| 689 | clc |
| 690 | adc #$28 |
| 691 | sta ptr1 |
| 692 | bcc :+ |
| 693 | inc ptr1+1 |
| 694 | : |
| 695 | |
| 696 | inx |
| 697 | cpx tmph |
| 698 | bcc @bordercloop |
| 699 | beq @bordercloop |
| 700 | @bordercloopend: |
| 701 | |
| 702 | |
| 703 | ;; Fill color memory for lower border, if clipy2 allows |
| 704 | cpx _ctk_hires_windowparams + wpclipy2 |
| 705 | beq @noclowerborder |
| 706 | |
| 707 | lda ptr1 |
| 708 | sec |
| 709 | sbc #$28 |
| 710 | sta ptr1 |
| 711 | bcs :+ |
| 712 | dec ptr1+1 |
| 713 | : |
| 714 | |
| 715 | ldy _ctk_hires_windowparams + wpw |
| 716 | lda _ctk_hires_windowparams + wpcolor2 |
| 717 | @lbordercloop: |
| 718 | sta (ptr1),y |
| 719 | dey |
| 720 | bne @lbordercloop |
| 721 | |
| 722 | @noclowerborder: |
| 723 | |
| 724 | ;; Draw right border |
| 725 | ldx tmpy |
| 726 | @rborderloop: |
| 727 | cpx _ctk_hires_windowparams + wpclipy2 |
| 728 | beq @rborderloopend |
| 729 | |
| 730 | lda ptr3 |
| 731 | clc |
| 732 | adc #$40 |
| 733 | sta ptr3 |
| 734 | lda ptr3+1 |
| 735 | adc #1 |
| 736 | sta ptr3+1 |
| 737 | |
| 738 | ldy #7 |
| 739 | : |
| 740 | lda _ctk_hires_theme+rborderpattern,y |
| 741 | sta (ptr3),y |
| 742 | dey |
| 743 | bpl :- |
| 744 | |
| 745 | inx |
| 746 | cpx tmph |
| 747 | bne @rborderloop |
| 748 | @rborderloopend: |
| 749 | |
| 750 | cpx _ctk_hires_windowparams + wpclipy2 |
| 751 | beq @norbordercorner |
| 752 | |
| 753 | lda ptr3 |
| 754 | clc |
| 755 | adc #$40 |
| 756 | sta ptr3 |
| 757 | lda ptr3+1 |
| 758 | adc #1 |
| 759 | sta ptr3+1 |
| 760 | |
| 761 | ;; Draw lower right corner, if clipy2 allows it |
| 762 | ldy #7 |
| 763 | : |
| 764 | lda _ctk_hires_theme+lrcornerpattern,y |
| 765 | sta (ptr3),y |
| 766 | dey |
| 767 | bpl :- |
| 768 | |
| 769 | @norbordercorner: |
| 770 | |
| 771 | stx tmpy |
| 772 | |
| 773 | ;; Draw lower border |
| 774 | ldx _ctk_hires_windowparams + wpw |
| 775 | |
| 776 | @lowerborderloop: |
| 777 | lda ptr3 |
| 778 | sec |
| 779 | sbc #$8 |
| 780 | sta ptr3 |
| 781 | bcs :+ |
| 782 | dec ptr3+1 |
| 783 | : |
| 784 | |
| 785 | lda tmpy |
| 786 | cmp _ctk_hires_windowparams + wpclipy2 |
| 787 | beq @nolowerborder |
| 788 | |
| 789 | ldy #7 |
| 790 | : |
| 791 | lda _ctk_hires_theme+lowerborderpattern,y |
| 792 | sta (ptr3),y |
| 793 | dey |
| 794 | bpl :- |
| 795 | @nolowerborder: |
| 796 | |
| 797 | dex |
| 798 | bne @lowerborderloop |
| 799 | |
| 800 | lda ptr3 |
| 801 | sec |
| 802 | sbc #$8 |
| 803 | sta ptr3 |
| 804 | bcs :+ |
| 805 | dec ptr3+1 |
| 806 | : |
| 807 | |
| 808 | |
| 809 | ldx tmpy |
| 810 | cpx tmph |
| 811 | bne @nolbordercorner |
| 812 | |
| 813 | ;; Draw lower left corner, if clipy2 allows it |
| 814 | ldy #7 |
| 815 | : |
| 816 | lda _ctk_hires_theme+llcornerpattern,y |
| 817 | sta (ptr3),y |
| 818 | dey |
| 819 | bpl :- |
| 820 | |
| 821 | lda ptr3 |
| 822 | sec |
| 823 | sbc #$40 |
| 824 | sta ptr3 |
| 825 | lda ptr3+1 |
| 826 | sbc #1 |
| 827 | sta ptr3+1 |
| 828 | |
| 829 | @nolbordercorner: |
| 830 | |
| 831 | ;; Draw left border |
| 832 | |
| 833 | |
| 834 | |
| 835 | @lborderloop: |
| 836 | cpx #1 |
| 837 | beq @lborderloopend |
| 838 | cpx _ctk_hires_windowparams + wpclipy1 |
| 839 | bcc @lborderloopend |
| 840 | |
| 841 | ldy #7 |
| 842 | : |
| 843 | lda _ctk_hires_theme+lborderpattern,y |
| 844 | sta (ptr3),y |
| 845 | dey |
| 846 | bpl :- |
| 847 | |
| 848 | lda ptr3 |
| 849 | sec |
| 850 | sbc #$40 |
| 851 | sta ptr3 |
| 852 | lda ptr3+1 |
| 853 | sbc #1 |
| 854 | sta ptr3+1 |
| 855 | |
| 856 | dex |
| 857 | jmp @lborderloop |
| 858 | |
| 859 | @lborderloopend: |
| 860 | |
| 861 | |
| 862 | jmp restore01 |
| 863 | ;--------------------------------------------------------------------- |
| 864 | _ctk_hires_draw_buttonleft: |
| 865 | jsr setupptrs |
| 866 | |
| 867 | ldy #0 |
| 868 | lda _ctk_hires_color |
| 869 | sta (ptr1),y |
| 870 | |
| 871 | : |
| 872 | lda _ctk_hires_theme+buttonleftpattern,y |
| 873 | sta (ptr2),y |
| 874 | iny |
| 875 | cpy #8 |
| 876 | bne :- |
| 877 | |
| 878 | jmp restore01 |
| 879 | ;--------------------------------------------------------------------- |
| 880 | _ctk_hires_draw_buttonright: |
| 881 | jsr setupptrs |
| 882 | ldy #0 |
| 883 | lda _ctk_hires_color |
| 884 | sta (ptr1),y |
| 885 | |
| 886 | : |
| 887 | lda _ctk_hires_theme+buttonrightpattern,y |
| 888 | sta (ptr2),y |
| 889 | iny |
| 890 | cpy #8 |
| 891 | bne :- |
| 892 | |
| 893 | jmp restore01 |
| 894 | ;--------------------------------------------------------------------- |
| 895 | _ctk_hires_draw_bitmapline: |
| 896 | sta tmpl |
| 897 | cmp #0 |
| 898 | bne :+ |
| 899 | rts |
| 900 | : |
| 901 | |
| 902 | jsr setupptrs |
| 903 | |
| 904 | ldy #0 |
| 905 | lda _ctk_hires_color |
| 906 | : |
| 907 | sta (ptr1),y |
| 908 | iny |
| 909 | cpy tmpl |
| 910 | bne :- |
| 911 | |
| 912 | lda _ctk_hires_bitmapptr |
| 913 | sta ptr1 |
| 914 | lda _ctk_hires_bitmapptr+1 |
| 915 | sta ptr1+1 |
| 916 | |
| 917 | ldy #0 |
| 918 | ldx #0 |
| 919 | : |
| 920 | lda (ptr1),y |
| 921 | sta (ptr2),y |
| 922 | iny |
| 923 | inx |
| 924 | cpx #8 |
| 925 | bne :- |
| 926 | |
| 927 | ldx #0 |
| 928 | |
| 929 | dec tmpl |
| 930 | bne :- |
| 931 | |
| 932 | jmp restore01 |
| 933 | ;--------------------------------------------------------------------- |
| 934 | |