A2osX/LIB/LIBGUI.S.MOU.txt

425 lines
6.6 KiB
Plaintext
Raw Normal View History

2018-05-16 06:02:57 +00:00
NEW
2019-07-30 08:57:25 +00:00
AUTO 3,1
2018-05-16 06:02:57 +00:00
*--------------------------------------
2021-06-03 17:43:28 +00:00
MOU.Init >PUSHW L.DEVNAME.MOUSE
>PUSHBI 0
2019-05-05 17:15:37 +00:00
>SYSCALL2 open
2018-05-16 06:02:57 +00:00
bcc .2
2020-09-05 13:38:04 +00:00
2019-01-08 16:29:26 +00:00
inc DEVNAME.MOUSE+8
lda DEVNAME.MOUSE+8
2018-05-16 06:02:57 +00:00
cmp #'8'
2020-10-20 06:01:04 +00:00
bne MOU.Init
2020-09-05 13:38:04 +00:00
2020-10-20 06:01:04 +00:00
* sec
2020-10-26 06:38:50 +00:00
rts
2018-05-16 06:02:57 +00:00
2019-01-08 16:29:26 +00:00
.2 sta hDevMouse
2020-09-05 13:38:04 +00:00
2019-01-09 06:58:19 +00:00
clc
rts
*--------------------------------------
* make sure mouse X,Y always in Screen
*--------------------------------------
MOU.Setup lda CLIP.Screen+S.RECT.X2+1
2018-05-16 06:02:57 +00:00
sta MouseClamp+3
lsr
sta PTR.Pos+S.POINT.X+1
lda CLIP.Screen+S.RECT.X2
2018-05-16 06:02:57 +00:00
sta MouseClamp+2
ror
sta PTR.Pos+S.POINT.X
lda CLIP.Screen+S.RECT.Y2+1
2018-05-16 06:02:57 +00:00
sta MouseClamp+7
lsr
sta PTR.Pos+S.POINT.Y+1
lda CLIP.Screen+S.RECT.Y2
2018-05-16 06:02:57 +00:00
sta MouseClamp+6
ror
sta PTR.Pos+S.POINT.Y
2020-09-02 15:47:23 +00:00
>PUSHB hDevMouse
2019-01-08 16:29:26 +00:00
>PUSHBI IOCTL.CONTROL
2020-09-02 15:47:23 +00:00
>PUSHW L.MouseClamp
2019-05-05 17:15:37 +00:00
>SYSCALL2 IOCTL
2019-01-09 06:58:19 +00:00
bcs .9
2020-09-02 15:47:23 +00:00
>LDYA L.PTR.SaveBuf
2020-10-06 06:27:35 +00:00
>STYA CB.PTR+S.CB.DstPtr
2020-09-02 15:47:23 +00:00
2020-09-03 15:19:25 +00:00
* clc
2018-05-16 06:02:57 +00:00
.9 rts
*--------------------------------------
MOU.Quit lda hDevMouse
beq .8
2020-09-02 15:47:23 +00:00
>PUSHA
2019-01-08 16:29:26 +00:00
>PUSHBI IOCTL.CLOSE
2019-06-07 15:02:51 +00:00
>PUSHWZ
2019-05-05 17:15:37 +00:00
>SYSCALL2 IOCTL
2018-05-16 06:02:57 +00:00
.8 clc
rts
*--------------------------------------
2020-10-16 06:10:02 +00:00
MOU.CheckOverMenu
.1 ldx MENU.Stack.Cnt
2020-10-20 06:01:04 +00:00
beq .9
2020-10-26 06:38:50 +00:00
2022-10-25 06:05:54 +00:00
.2 dex
stx MENU.Stack.Idx
lda MENU.Stack,x
2020-10-26 06:38:50 +00:00
2021-02-22 17:17:37 +00:00
>SYSCALL2 GetMemPtr
>STYA ZPObjPtr
jsr MOU.InObj
2022-10-25 06:05:54 +00:00
bcs .3
lda #PTR.T.ARROW
jsr PTR.Set
jmp MENU.Enter
2020-10-20 06:01:04 +00:00
2022-10-25 06:05:54 +00:00
.3 ldx MENU.Stack.Idx
bne .2
lda MSG+S.MSG.S
bit #S.XY.S.CLK
beq .9
jsr MENU.DestroyAll
2022-10-25 06:05:54 +00:00
.9 sec
rts
2020-10-20 06:01:04 +00:00
*--------------------------------------
MOU.CheckOverSysBut
>LDYA L.RECT.SysBut
jsr MOU.InRectYA
bcs .9
2020-10-20 06:01:04 +00:00
jmp SYSBUT.Enter
2020-10-26 06:38:50 +00:00
2020-10-22 15:33:10 +00:00
.9 jsr SYSBUT.Leave
sec
MOU.CheckOverSysBut.RTS
2020-10-22 15:33:10 +00:00
rts
2020-10-16 06:10:02 +00:00
*--------------------------------------
MOU.CheckOverWND
ldx WND.Stack.Top
beq MOU.CheckOverSysBut.RTS
2020-10-26 06:38:50 +00:00
2020-10-23 15:23:19 +00:00
.1 stx WND.Stack.Idx
2020-10-26 06:38:50 +00:00
2020-10-23 15:23:19 +00:00
lda WND.Stack-1,x
2022-11-02 06:54:30 +00:00
jsr OBJ.GetHWNDA
2020-10-26 06:38:50 +00:00
2020-10-22 15:33:10 +00:00
jsr MOU.ChkWNDBorders
bcc MOU.CheckOverSysBut.RTS
2020-10-26 06:38:50 +00:00
lda ZPWNDPtr
2020-10-22 15:33:10 +00:00
clc
adc #S.OBJ.X1
tay
lda ZPWNDPtr+1
adc /S.OBJ.X1
2020-10-22 15:33:10 +00:00
jsr MOU.InRectYA
2020-10-26 06:38:50 +00:00
bcs .7 not over this WND
lda MSG+S.MSG.S
bit #S.XY.S.CLK
beq .2
2020-10-26 06:38:50 +00:00
jsr WND.Bring2Front
.2 lda ZPWNDPtr
clc
adc #S.WND.InnerX1
tay
lda ZPWNDPtr+1
adc /S.WND.InnerX1
jsr MOU.InRectYA
bcc .8 in Inner Space
ldy #S.OBJ.S
2020-10-23 15:23:19 +00:00
lda (ZPWNDPtr),y
and #S.WND.S.HASTBAR
beq .3
ldy #S.WND.TBarY2
jsr MOU.WNDCmpY
2020-10-26 06:38:50 +00:00
bcc .3 not in TBAR
jmp MOU.MoveWND
2020-10-26 06:38:50 +00:00
.3 ldy #S.OBJ.S
2020-10-23 15:23:19 +00:00
lda (ZPWNDPtr),y
and #S.WND.S.HASMBAR
beq .4
ldy #S.WND.MBarY2
jsr MOU.WNDCmpY
2020-10-26 06:38:50 +00:00
bcc .4 not in MBAR
jsr MBAR.Enter
2021-02-22 17:17:37 +00:00
2020-10-26 06:38:50 +00:00
bra .5
.4 ldy #S.OBJ.S
2020-10-26 06:38:50 +00:00
lda (ZPWNDPtr),y
and #S.WND.S.HASSBAR
beq .5
2020-10-26 06:38:50 +00:00
ldy #S.WND.SBarY1
jsr MOU.WNDCmpY
bcs .5 not in SBAR
2020-10-26 06:38:50 +00:00
.5 lda #PTR.T.ARROW
2020-10-26 06:38:50 +00:00
.6 jmp PTR.Set
2020-10-23 15:23:19 +00:00
.7 ldx WND.Stack.Idx
dex
bne .1
lda #PTR.T.ARROW
jsr PTR.Set
2020-10-15 15:19:13 +00:00
.9 sec
rts
*--------------------------------------
.8 ldy #S.WND.hPTR
lda (ZPWNDPtr),y
jsr PTR.Set
jsr MOU.ToLocal
jsr MOU.ChkWNDChilds
bcc .99
clc
2020-10-22 15:33:10 +00:00
.99 rts
*--------------------------------------
MOU.MoveWND lda MSG+S.MSG.S
bit #S.XY.S.DRAGSTART
beq .8
lda ZPWNDPtr
clc
adc #S.OBJ.X1
tay
lda ZPWNDPtr+1
adc /S.OBJ.X1
jmp PTR.SetRect
.8 lda #PTR.T.MOVE
jmp PTR.Set
*--------------------------------------
MOU.ChkWNDChilds
jsr WND.GetChilds
beq .9
.1 jsr MOU.InObj
bcs .7 not over this Child
jsr OBJ.Enter
bra .8
.7 jsr OBJ.Leave
.8 jsr OBJ.GetNext
bne .1
.9
MOU.ChkWNDChilds.9
sec
rts
*--------------------------------------
2020-10-22 15:33:10 +00:00
MOU.ChkWNDBorders
ldy #S.OBJ.F
lda (ZPWNDPtr),y
and #S.OBJ.F.BORDER
beq MOU.ChkWNDChilds.9
2020-10-22 15:33:10 +00:00
stz IY
2020-10-26 06:38:50 +00:00
2020-10-22 15:33:10 +00:00
ldy #S.OBJ.X1
2020-10-23 06:03:23 +00:00
lda (ZPWNDPtr),y
sec
sbc #1
eor MSG+S.MSG.X1
2020-10-22 15:33:10 +00:00
bne .1
iny
2020-10-23 06:03:23 +00:00
lda (ZPWNDPtr),y
sbc #0
eor MSG+S.MSG.X1+1
2020-10-22 15:33:10 +00:00
bne .1
lda #PTR.T.RESIZEX
2020-10-22 15:33:10 +00:00
sta IY
2020-10-26 06:38:50 +00:00
2020-10-22 15:33:10 +00:00
.1 ldy #S.OBJ.Y1
2020-10-23 06:03:23 +00:00
lda (ZPWNDPtr),y
sec
sbc #1
eor MSG+S.MSG.Y1
2020-10-22 15:33:10 +00:00
bne .3
iny
2020-10-23 06:03:23 +00:00
lda (ZPWNDPtr),y
sbc #0
eor MSG+S.MSG.Y1+1
2020-10-22 15:33:10 +00:00
bne .3
lda IY
beq .2
lda #PTR.T.RESIZEXY1
jmp PTR.Set
2020-10-26 06:38:50 +00:00
.2 lda #PTR.T.RESIZEY
2020-10-22 15:33:10 +00:00
sta IY
2020-10-26 06:38:50 +00:00
2020-10-22 15:33:10 +00:00
.3 ldy #S.OBJ.X2
2020-10-23 06:03:23 +00:00
lda (ZPWNDPtr),y
clc
adc #1
eor MSG+S.MSG.X1
2020-10-22 15:33:10 +00:00
bne .5
iny
2020-10-23 06:03:23 +00:00
lda (ZPWNDPtr),y
adc #0
eor MSG+S.MSG.X1+1
2020-10-22 15:33:10 +00:00
bne .5
2020-10-26 06:38:50 +00:00
2020-10-22 15:33:10 +00:00
lda IY
beq .4
2020-10-26 06:38:50 +00:00
lda #PTR.T.RESIZEXY2
jmp PTR.Set
2020-10-22 15:33:10 +00:00
.4 lda #PTR.T.RESIZEX
2020-10-22 15:33:10 +00:00
sta IY
.5 ldy #S.OBJ.Y2
2020-10-23 06:03:23 +00:00
lda (ZPWNDPtr),y
clc
adc #1
eor MSG+S.MSG.Y1
2020-10-22 15:33:10 +00:00
bne .7
iny
2020-10-23 06:03:23 +00:00
lda (ZPWNDPtr),y
adc #0
eor MSG+S.MSG.Y1+1
2020-10-22 15:33:10 +00:00
bne .7
lda #PTR.T.RESIZEXY1
.6 jmp PTR.Set
2020-10-26 06:38:50 +00:00
2020-10-22 15:33:10 +00:00
.7 lda IY
bne .6
.9 sec
2020-10-16 06:10:02 +00:00
rts
2020-10-15 15:19:13 +00:00
*--------------------------------------
MOU.InObj lda ZPObjPtr
clc
adc #S.OBJ.X1
tay
lda ZPObjPtr+1
adc /S.OBJ.X1
*--------------------------------------
2020-10-15 15:19:13 +00:00
MOU.InRectYA >STYA ZPRECTPtr
ldy #S.RECT.X1
2020-10-26 06:38:50 +00:00
lda MSG+S.MSG.X1
2020-10-15 15:19:13 +00:00
cmp (ZPRECTPtr),y
iny
lda MSG+S.MSG.X1+1
2020-10-15 15:19:13 +00:00
sbc (ZPRECTPtr),y
bcc .9
2020-10-26 06:38:50 +00:00
2020-10-15 15:19:13 +00:00
iny #S.RECT.Y1
2020-10-26 06:38:50 +00:00
lda MSG+S.MSG.Y1
2020-10-15 15:19:13 +00:00
cmp (ZPRECTPtr),y
iny
lda MSG+S.MSG.Y1+1
2020-10-15 15:19:13 +00:00
sbc (ZPRECTPtr),y
bcc .9
2020-10-26 06:38:50 +00:00
2020-10-15 15:19:13 +00:00
iny #S.RECT.X2
2020-10-16 06:10:02 +00:00
lda (ZPRECTPtr),y
cmp MSG+S.MSG.X1
2020-10-15 15:19:13 +00:00
iny
2020-10-16 06:10:02 +00:00
lda (ZPRECTPtr),y
sbc MSG+S.MSG.X1+1
2020-10-16 06:10:02 +00:00
bcc .9
2020-10-26 06:38:50 +00:00
iny #S.RECT.Y2
2020-10-15 15:19:13 +00:00
2020-10-16 06:10:02 +00:00
lda (ZPRECTPtr),y
cmp MSG+S.MSG.Y1
2020-10-15 15:19:13 +00:00
iny
2020-10-16 06:10:02 +00:00
lda (ZPRECTPtr),y
sbc MSG+S.MSG.Y1+1
2020-10-16 06:10:02 +00:00
bcc .9
2020-10-26 06:38:50 +00:00
2020-10-16 06:10:02 +00:00
clc
2020-10-13 15:54:55 +00:00
rts
2019-01-09 16:42:20 +00:00
.9 sec
2020-10-26 06:38:50 +00:00
.99 rts
2020-10-06 06:27:35 +00:00
*--------------------------------------
MOU.WNDCmpY lda (ZPWNDPtr),y
cmp MSG+S.MSG.Y1
iny
lda (ZPWNDPtr),y
sbc MSG+S.MSG.Y1+1
rts
*--------------------------------------
MOU.ToLocal ldy #S.WND.InnerX1
lda MSG+S.MSG.X1
sec
sbc (ZPWNDPtr),y
sta MSG+S.MSG.X1
iny
lda MSG+S.MSG.X1+1
sbc (ZPWNDPtr),y
sta MSG+S.MSG.X1+1
iny #S.WND.InnerY1
lda MSG+S.MSG.Y1
sec
sbc (ZPWNDPtr),y
sta MSG+S.MSG.Y1
iny
lda MSG+S.MSG.Y1+1
sbc (ZPWNDPtr),y
sta MSG+S.MSG.Y1+1
rts
*--------------------------------------
2018-05-16 06:02:57 +00:00
MAN
2020-06-30 15:32:23 +00:00
SAVE usr/src/lib/libgui.s.mou
LOAD usr/src/lib/libgui.s
2018-05-16 06:02:57 +00:00
ASM