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