A2osX/LIB/LIBGUI.S.MOU.txt
2022-10-20 08:07:40 +02:00

373 lines
5.4 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
MOU.Init >PUSHW L.DEVNAME.MOUSE
>PUSHBI 0
>SYSCALL2 open
bcc .2
inc DEVNAME.MOUSE+8
lda DEVNAME.MOUSE+8
cmp #'8'
bne MOU.Init
* sec
rts
.2 sta hDevMouse
clc
rts
*--------------------------------------
MOU.Setup lda DCB.GFX+S.DCB.GFX.W+1
sta MouseClamp+3
lsr
sta PTR.Pos+S.POINT.X+1
lda DCB.GFX+S.DCB.GFX.W
sta MouseClamp+2
ror
sta PTR.Pos+S.POINT.X
lda DCB.GFX+S.DCB.GFX.H+1
sta MouseClamp+7
lsr
sta PTR.Pos+S.POINT.Y+1
lda DCB.GFX+S.DCB.GFX.H
sta MouseClamp+6
ror
sta PTR.Pos+S.POINT.Y
>PUSHB hDevMouse
>PUSHBI IOCTL.CONTROL
>PUSHW L.MouseClamp
>SYSCALL2 IOCTL
bcs .9
>LDYA L.PTR.SaveBuf
>STYA CB.PTR+S.CB.DstPtr
* clc
.9 rts
*--------------------------------------
MOU.Quit lda hDevMouse
beq .8
>PUSHA
>PUSHBI IOCTL.CLOSE
>PUSHWZ
>SYSCALL2 IOCTL
.8 clc
rts
*--------------------------------------
MOU.ReadMouse >PULLW ZPPtr1 pS.XY
lda A2osX.ASCREEN GUI screen active ?
cmp DCB.GFX+S.DCB.GFX.DEVID
bne .9 no, exit....
lda hDevMouse
beq .99 CS
>PUSHA
>PUSHBI IOCTL.READ
>PUSHW L.XY
>SYSCALL2 IOCTL
bcs .99
ldy #S.XY-1
.1 lda XY,y
sta (ZPPtr1),y
dey
bpl .1
* clc
rts
.9 sec
.99 rts
*--------------------------------------
MOU.CheckOverMenu
.1 ldx MENU.Stack.Cnt
beq .9
lda MENU.Stack-1,x
.2 phx
>SYSCALL2 GetMemPtr
>STYA ZPMENUPtr
pha
tya
clc
adc #S.OBJ.X1
tay
pla
adc /S.OBJ.X1
jsr MOU.InRectYA
bcc .3
plx
dex
bne .2
.9 sec
rts
.3 plx
cpx MENU.Stack.Cnt
beq .7
* TODO:destroy from TOP to current, then enter current
* inx
* phx
* jsr MENU.Destroy
* bra .3
.7 jmp MENU.Enter
.8 clc
rts
*--------------------------------------
MOU.CheckOverSysBut
>LDYA L.RECT.SysBut
jsr MOU.InRectYA
bcs .9
jmp SYSBUT.Enter
.9 jsr SYSBUT.Leave
sec
MOU.CheckOverSysBut.RTS
rts
*--------------------------------------
MOU.CheckOverWND
ldx WND.Stack.Top
beq MOU.CheckOverSysBut.RTS
.1 stx WND.Stack.Idx
lda WND.Stack-1,x
>SYSCALL2 GetMemPtr
>STYA ZPWNDPtr
ldy #S.OBJ.F
lda (ZPWNDPtr),y
bit #S.WND.F.BORDER
beq .2
jsr MOU.ChkWNDBorders
bcc .99
.2 lda ZPWNDPtr
clc
adc #S.OBJ.X1
tay
lda ZPWNDPtr+1
adc #0
jsr MOU.InRectYA
bcs .7 not over this WND
lda MSG+S.MSG.S
bit #S.MSG.S.CLK
beq .22
jsr WND.Bring2Front
.22 ldy #S.WND.TBarY2
lda (ZPWNDPtr),y
cmp MSG+S.MSG.Y1
iny
lda (ZPWNDPtr),y
sbc MSG+S.MSG.Y1+1
bcc .3 not in TBAR
bra .5
.3 iny #S.WND.MBarY2
lda (ZPWNDPtr),y
cmp MSG+S.MSG.Y1
iny
lda (ZPWNDPtr),y
sbc MSG+S.MSG.Y1+1
bcc .4 not in MBAR
jsr MBAR.Enter
bra .5
.4 iny #S.WND.SBarY1
lda (ZPWNDPtr),y
cmp MSG+S.MSG.Y1
iny
lda (ZPWNDPtr),y
sbc MSG+S.MSG.Y1+1
bcs .6 not in SBAR
.5 lda #PTR.T.ARROW
jsr PTR.Set
clc
rts
.6 lda #PTR.T.WAIT
jsr PTR.Set
clc
rts
.7 ldx WND.Stack.Idx
dex
bne .1
lda #PTR.T.ARROW
jsr PTR.Set
.9 sec
.99 rts
*--------------------------------------
MOU.ChkWNDBorders
stz IY
ldy #S.OBJ.X1
lda (ZPWNDPtr),y
sec
sbc #1
eor MSG+S.MSG.X1
bne .1
iny
lda (ZPWNDPtr),y
sbc #0
eor MSG+S.MSG.X1+1
bne .1
lda #PTR.T.RESIZEX
sta IY
.1 ldy #S.OBJ.Y1
lda (ZPWNDPtr),y
sec
sbc #1
eor MSG+S.MSG.Y1
bne .3
iny
lda (ZPWNDPtr),y
sbc #0
eor MSG+S.MSG.Y1+1
bne .3
lda IY
beq .2
lda #PTR.T.RESIZEXY1
jmp PTR.Set
.2 lda #PTR.T.RESIZEY
sta IY
.3 ldy #S.OBJ.X2
lda (ZPWNDPtr),y
clc
adc #1
eor MSG+S.MSG.X2
bne .5
iny
lda (ZPWNDPtr),y
adc #0
eor MSG+S.MSG.X2+1
bne .5
lda IY
beq .4
lda #PTR.T.RESIZEXY2
jmp PTR.Set
.4 lda #PTR.T.RESIZEX
sta IY
.5 ldy #S.OBJ.Y2
lda (ZPWNDPtr),y
clc
adc #1
eor MSG+S.MSG.Y2
bne .7
iny
lda (ZPWNDPtr),y
adc #0
eor MSG+S.MSG.Y2+1
bne .7
lda #PTR.T.RESIZEXY1
.6 jmp PTR.Set
.7 lda IY
bne .6
sec
rts
*--------------------------------------
MOU.InRectYA >STYA ZPRECTPtr
ldy #S.RECT.X1
lda MSG+S.MSG.X1
cmp (ZPRECTPtr),y
iny
lda MSG+S.MSG.X1+1
sbc (ZPRECTPtr),y
bcc .9
iny #S.RECT.Y1
lda MSG+S.MSG.Y1
cmp (ZPRECTPtr),y
iny
lda MSG+S.MSG.Y1+1
sbc (ZPRECTPtr),y
bcc .9
iny #S.RECT.X2
lda (ZPRECTPtr),y
cmp MSG+S.MSG.X1
iny
lda (ZPRECTPtr),y
sbc MSG+S.MSG.X1+1
bcc .9
iny #S.RECT.Y2
lda (ZPRECTPtr),y
cmp MSG+S.MSG.Y1
iny
lda (ZPRECTPtr),y
sbc MSG+S.MSG.Y1+1
bcc .9
clc
rts
.9 sec
.99 rts
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s.mou
LOAD usr/src/lib/libgui.s
ASM