NEW
  AUTO 3,1
*--------------------------------------
PTR.Update		lda PTR.T
				cmp #PTR.T.WAIT
				bcc PTR.Set.RTS

				inc
				inc
				cmp #PTR.T.WAIT+12
				bne PTR.Set

				lda #PTR.T.WAIT
*--------------------------------------
* Set SrcPtr, SrcW, SrcH
*--------------------------------------
PTR.Set			sta PTR.T

				jsr PTR.Disable

				ldx PTR.T
				lda L.Cursors,x
				sta CB.PTR+S.CB.SrcPtr
				sta ZPPtr1
				lda L.Cursors+1,x
				sta CB.PTR+S.CB.SrcPtr+1
				sta ZPPtr1+1

				ldy #S.BM.W+3
				ldx #3

.1				lda (ZPPtr1),y
				sta CB.PTR+S.CB.SrcW,x
				dey
				dex
				bpl .1

				bra PTR.Enable

PTR.Set.RTS		rts
*--------------------------------------
PTR.SetRect		>STYA ZPPtr1
				jsr PTR.Disable
				sec
				ror PTR.T

				ldy #7

.1				lda (ZPPtr1),y
				sta PTR.Rect,y
				dey
				bpl .1

				bra PTR.Enable
*--------------------------------------
* SetPos DestX,DestY
*--------------------------------------
PTR.SetPos		>PULLW ZPPtr1
				jsr PTR.Disable

.1				ldy #S.POINT-1

.2				lda (ZPPtr1),y
				sta PTR.Pos,y
				dey
				bpl .2
*--------------------------------------
PTR.Enable		bit PTR.bVisible
				bmi PTR.Show.I

				clc
				rts
*--------------------------------------
PTR.Disable		bit PTR.bVisible
				bmi PTR.Hide.I

PTR.Disable.8	clc
				rts
*--------------------------------------
PTR.Hide		lda PTR.bVisible
				bpl PTR.Disable.8

				stz PTR.bVisible
*--------------------------------------
PTR.Hide.I		bit PTR.T
				bpl .1

				jmp PTR.ShowRect.I

.1				lda #S.CB.OP.RESTORE
				bra PTR.Draw.I
*--------------------------------------
PTR.Show		lda PTR.bVisible
				bmi PTR.Disable.8

				dec PTR.bVisible
*--------------------------------------
PTR.Show.I		ldx PTR.T
				bpl .10

				jmp PTR.ShowRect.I

.10				lda PTR.Pos+S.POINT.X
				sec
				sbc PTR.HotPoints,x
				sta CB.PTR+S.CB.X1

				lda PTR.Pos+S.POINT.X+1
				sbc #0
				sta CB.PTR+S.CB.X1+1

				lda PTR.Pos+S.POINT.Y
				sec
				sbc PTR.HotPoints+1,x
				sta CB.PTR+S.CB.Y1

				lda PTR.Pos+S.POINT.Y+1
				sbc #0
				sta CB.PTR+S.CB.Y1+1

				ldx CB.PTR+S.CB.SrcW+1
				lda CB.PTR+S.CB.SrcW
				bne .1

				dex

.1				dec
				clc
				adc CB.PTR+S.CB.X1
				sta CB.PTR+S.CB.X2
				txa
				adc CB.PTR+S.CB.X1+1
				sta CB.PTR+S.CB.X2+1

				ldx CB.PTR+S.CB.SrcH+1
				lda CB.PTR+S.CB.SrcH
				bne .2

				dex

.2				dec
				clc
				adc CB.PTR+S.CB.Y1
				sta CB.PTR+S.CB.Y2
				txa
				adc CB.PTR+S.CB.Y1+1
				sta CB.PTR+S.CB.Y2+1

				lda #S.CB.OP.ORA+S.CB.OP.MASK+S.CB.OP.SAVE
*--------------------------------------
PTR.Draw.I		sta CB.PTR+S.CB.OP

				ldx #S.CB

.1				lda CB.PTR-1,x
				sta CLIP.Cache-1,x
				dex
				bne .1

*				ldx #0					select CLIP.Sreen
				jsr CLIP.BitBltX
				bcs .8

				jsr CB.GFXWrite

.8				clc

				rts
*--------------------------------------
PTR.ShowRect.I	lda #S.CB.CMD.HLINE
				sta CLIP.Cache+S.CB.CMD
				lda #S.CB.OP.XOR
				sta CLIP.Cache+S.CB.OP
				lda #S.CB.M.MONO
				sta CLIP.Cache+S.CB.M
				lda #C.WHITE
				sta CLIP.Cache+S.CB.COLOR
*			>DEBUG
				ldx #5					X1,Y1,X2

.1				lda PTR.Rect+S.RECT.X1,x
				sta CLIP.Cache+S.CB.X1,x
				dex
				bpl .1

				jsr .7

				>LDYA PTR.Rect+S.RECT.Y2
				>STYA CLIP.Cache+S.CB.Y1


.7		
*				ldx #0					select CLIP.Sreen
*				jsr CLIP.HLine
*				bcs .8

				jsr CB.GFXWrite

.8				clc

				rts
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s.ptr
LOAD usr/src/lib/libgui.s
ASM
