A2osX/LIB/LIBGUI.S.MOU.txt
2020-10-16 08:10:02 +02:00

214 lines
3.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
.1 >PUSHBI 0
>LDYA L.DEVNAME.MOUSE
>SYSCALL2 open
bcc .2
inc DEVNAME.MOUSE+8
lda DEVNAME.MOUSE+8
cmp #'8'
bne .1
rts
.2 sta hDevMouse
clc
rts
*--------------------------------------
MOU.Setup lda DCB.GFX+S.DCB.GFX.W+1
sta MouseClamp+3
lsr
sta CUR.Pos+S.POINT.X+1
lda DCB.GFX+S.DCB.GFX.W
sta MouseClamp+2
ror
sta CUR.Pos+S.POINT.X
lda DCB.GFX+S.DCB.GFX.H+1
sta MouseClamp+7
lsr
sta CUR.Pos+S.POINT.Y+1
lda DCB.GFX+S.DCB.GFX.H
sta MouseClamp+6
ror
sta CUR.Pos+S.POINT.Y
>PUSHB hDevMouse
>PUSHBI IOCTL.CONTROL
>PUSHW L.MouseClamp
>SYSCALL2 IOCTL
bcs .9
>LDYA L.CUR.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
lda A2osX.ASCREEN GUI screen active ?
cmp DCB.GFX+S.DCB.GFX.DEVID
bne .9 no, exit....
lda hDevMouse
beq .9
>PUSHA
>PUSHBI IOCTL.READ
>PUSHW L.MouseData
>SYSCALL2 IOCTL
bcs .99
ldy #S.MOUSE-1
.1 lda MouseData,y
sta (ZPPtr1),y
dey
bpl .1
ldy #S.MOUSE.S
lda (ZPPtr1),y
bit #S.MOUSE.S.MOVE
beq .8
.2 ldx MENU.Stack.Top
beq .3
lda MENU.Stack-1,x
jsr MOU.CheckOverMenu
bcc .8
jsr MENU.Destroy
bra .2
.9 sec
.99 rts
.3 jsr MOU.CheckOverWND
bcc .8
.4 lda WND.SysBar+S.OBJ.Y1
ldy #S.MOUSE.Y1
cmp (ZPPtr1),y
lda WND.SysBar+S.OBJ.Y1+1
iny
sbc (ZPPtr1),y
bcs .7
jmp SYSBAR.Enter
.7 jmp SYSBAR.Leave
.8 clc
rts
*--------------------------------------
MOU.CheckOverMenu
>SYSCALL GetMemPtr
>STYA ZPPtr1
pha
tya
clc
adc #S.OBJ.X1
tay
pla
adc /S.OBJ.X1
jsr MOU.InRectYA
bcc .8
lda ZPPtr1
clc
adc #S.MENU.pX1
tay
lda ZPPtr1+1
adc /S.MENU.pX1
jsr MOU.InRectYA
.8 rts
*--------------------------------------
MOU.CheckOverWND
ldx WND.Stack.Top
beq .9
>SYSCALL GetMemPtr
>STYA ZPWNDPtr
ldy #S.OBJ.F
lda (ZPWNDPtr),y
bit #S.WND.F.BORDER
beq .1
.1
.9 sec
rts
*--------------------------------------
MOU.InRectYA >STYA ZPRECTPtr
ldy #S.RECT.X1
lda MouseData+S.MOUSE.X1
cmp (ZPRECTPtr),y
iny
lda MouseData+S.MOUSE.X1+1
sbc (ZPRECTPtr),y
bcc .9
iny #S.RECT.Y1
lda MouseData+S.MOUSE.Y1
cmp (ZPRECTPtr),y
iny
lda MouseData+S.MOUSE.Y1+1
sbc (ZPRECTPtr),y
bcc .9
iny #S.RECT.X2
lda (ZPRECTPtr),y
cmp MouseData+S.MOUSE.X1
iny
lda (ZPRECTPtr),y
sbc MouseData+S.MOUSE.X1+1
bcc .9
iny #S.RECT.Y2
lda (ZPRECTPtr),y
cmp MouseData+S.MOUSE.Y1
iny
lda (ZPRECTPtr),y
sbc MouseData+S.MOUSE.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