********************************************************************************
* Micro-Painter, by Bob Bishop *
* Copyright 1980 Datasoft, Inc. All Rights Reserved. *
* *
* Disassembly of "CURSOR" routines. *
********************************************************************************
* Disassembly by Andy McFadden, using 6502bench SourceGen v1.4. *
* Last updated 2019/10/23. *
********************************************************************************
color_black .eq 0 {const}
color_white .eq 5 {const}
saved_xc .eq $67d0 {addr/16}
saved_yc .eq $67e0 {addr/16}
saved_color .eq $67f0 {addr/16}
PLT .eq $6903
.org $6700
********************************************************************************
* CROSS - draw a flickering cross on the hi-res screen. *
* *
* A cross centered on X,Y is drawn in black, then white, then erased with the *
* original screen contents. *
* *
* On entry: *
* $01 - X-coord *
* $02 - Y-coord *
* *
* Preserves X/Y registers. *
********************************************************************************
xc .var $01 {addr/1}
yc .var $02 {addr/1}
back .var $03 {addr/1}
cur_color .var $10 {addr/1}
delay_ctr .var $11 {addr/2}
num_saved .var $13 {addr/1}
6700: 8a CROSS txa
6701: 48 pha
6702: 98 tya
6703: 48 pha
; Save the pixels in a cross-shaped area.
6704: a2 01 ldx #$01
6706: e6 01 inc xc
6708: 20 9f 67 jsr SavePixel ;X+1,Y
670b: e6 01 inc xc
670d: 20 9f 67 jsr SavePixel ;X+2,Y
6710: c6 01 dec xc
6712: c6 01 dec xc
6714: e6 02 inc yc
6716: e6 02 inc yc
6718: 20 9f 67 jsr SavePixel ;X,Y+2
671b: e6 02 inc yc
671d: 20 9f 67 jsr SavePixel ;X,Y+3
6720: e6 02 inc yc
6722: 20 9f 67 jsr SavePixel ;X,Y+4
6725: 38 sec
6726: a5 02 lda yc
6728: e9 04 sbc #4 ;reset Y
672a: 85 02 sta yc
672c: c6 01 dec xc
672e: 20 9f 67 jsr SavePixel ;X-1,Y
6731: c6 01 dec xc
6733: 20 9f 67 jsr SavePixel ;X-2,Y
6736: e6 01 inc xc
6738: e6 01 inc xc
673a: c6 02 dec yc
673c: c6 02 dec yc
673e: 20 9f 67 jsr SavePixel ;X,Y-2
6741: c6 02 dec yc
6743: 20 9f 67 jsr SavePixel ;X,Y-3
6746: c6 02 dec yc
6748: 20 9f 67 jsr SavePixel ;X,Y-4
674b: ca dex
674c: 86 13 stx num_saved ;number of saved pixels
674e: a9 00 lda #color_black
6750: 85 10 sta cur_color ;start by drawing black
; Draw cross in current color.
6752: a0 02 ldy #2 ;two iterations: one black, one white
6754: a6 13 L6754 ldx num_saved ;loop over saved coords
6756: bd d0 67 L6756 lda saved_xc,x
6759: 85 01 sta xc
675b: bd e0 67 lda saved_yc,x
675e: 85 02 sta yc
6760: a5 10 lda cur_color
6762: 85 03 sta back
6764: 20 03 69 jsr PLT ;plot point
6767: ca dex
6768: d0 ec bne L6756
; Pause briefly so it'll be visible. About 8 * (8*256 + 8) = 16448 cycles.
676a: a9 00 lda #$00
676c: 85 11 sta delay_ctr
676e: a9 08 lda #$08
6770: 85 12 sta delay_ctr+1
6772: c6 11 L6772 dec delay_ctr
6774: d0 fc bne L6772
6776: c6 12 dec delay_ctr+1
6778: d0 f8 bne L6772
; Flip colors and loop.
677a: a5 10 lda cur_color
677c: 49 05 eor #color_white
677e: 85 10 sta cur_color
6780: 88 dey
6781: d0 d1 bne L6754
; Restore previous contents.
6783: a6 13 ldx num_saved
6785: bd d0 67 L6785 lda saved_xc,x
6788: 85 01 sta xc
678a: bd e0 67 lda saved_yc,x
678d: 85 02 sta yc
678f: bd f0 67 lda saved_color,x
6792: 85 03 sta back
6794: 20 03 69 jsr PLT
6797: ca dex
6798: d0 eb bne L6785
679a: 68 pla
679b: a8 tay
679c: 68 pla
679d: aa tax
679e: 60 rts
;
; Saves the pixel color at xc,yc into local storage. The coordinates and
; current pixel color value are stored.
;
; On entry:
; X-reg is index of entry in storage
;
; On exit:
; X-reg incremented by one
;
679f: a5 01 SavePixel lda xc
67a1: c9 8c cmp #140 ;is X-coord negative or > 139?
67a3: b0 19 bcs L67BE ;yes, no good
67a5: 9d d0 67 sta saved_xc,x
67a8: a5 02 lda yc
67aa: c9 c0 cmp #192 ;is Y-coord negative or > 191?
67ac: b0 10 bcs L67BE ;yes, no good
67ae: 9d e0 67 sta saved_yc,x
67b1: a9 80 lda #$80
67b3: 85 03 sta back
67b5: 20 03 69 jsr PLT ;get current pixel color
67b8: a5 03 lda back
67ba: 9d f0 67 sta saved_color,x
67bd: e8 inx
67be: 60 L67BE rts