mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-01 14:50:10 +00:00
9a7d20a7e1
FORMAT: new switches & checks SH:BREAK in FOR and WHILE ASM / S-C MASM: new directives, CString support and .HX LC / UC:bugfix DHGR.DRV:bugfix LIBGUI:wip CC:wip
425 lines
6.6 KiB
Plaintext
425 lines
6.6 KiB
Plaintext
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
|
||
*--------------------------------------
|
||
* make sure mouse X,Y always in Screen
|
||
*--------------------------------------
|
||
MOU.Setup lda CLIP.Screen+S.RECT.X2+1
|
||
sta MouseClamp+3
|
||
lsr
|
||
sta PTR.Pos+S.POINT.X+1
|
||
|
||
lda CLIP.Screen+S.RECT.X2
|
||
sta MouseClamp+2
|
||
ror
|
||
sta PTR.Pos+S.POINT.X
|
||
|
||
lda CLIP.Screen+S.RECT.Y2+1
|
||
sta MouseClamp+7
|
||
lsr
|
||
sta PTR.Pos+S.POINT.Y+1
|
||
|
||
lda CLIP.Screen+S.RECT.Y2
|
||
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.CheckOverMenu
|
||
.1 ldx MENU.Stack.Cnt
|
||
beq .9
|
||
|
||
.2 dex
|
||
stx MENU.Stack.Idx
|
||
lda MENU.Stack,x
|
||
|
||
>SYSCALL2 GetMemPtr
|
||
>STYA ZPObjPtr
|
||
|
||
jsr MOU.InObj
|
||
bcs .3
|
||
|
||
lda #PTR.T.ARROW
|
||
jsr PTR.Set
|
||
|
||
jmp MENU.Enter
|
||
|
||
.3 ldx MENU.Stack.Idx
|
||
bne .2
|
||
|
||
lda MSG+S.MSG.S
|
||
bit #S.XY.S.CLK
|
||
beq .9
|
||
|
||
jsr MENU.DestroyAll
|
||
|
||
.9 sec
|
||
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
|
||
jsr OBJ.GetHWNDA
|
||
|
||
jsr MOU.ChkWNDBorders
|
||
bcc MOU.CheckOverSysBut.RTS
|
||
|
||
lda ZPWNDPtr
|
||
clc
|
||
adc #S.OBJ.X1
|
||
tay
|
||
lda ZPWNDPtr+1
|
||
adc /S.OBJ.X1
|
||
jsr MOU.InRectYA
|
||
bcs .7 not over this WND
|
||
|
||
lda MSG+S.MSG.S
|
||
bit #S.XY.S.CLK
|
||
beq .2
|
||
|
||
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
|
||
lda (ZPWNDPtr),y
|
||
and #S.WND.S.HASTBAR
|
||
beq .3
|
||
|
||
ldy #S.WND.TBarY2
|
||
jsr MOU.WNDCmpY
|
||
bcc .3 not in TBAR
|
||
|
||
jmp MOU.MoveWND
|
||
|
||
.3 ldy #S.OBJ.S
|
||
lda (ZPWNDPtr),y
|
||
and #S.WND.S.HASMBAR
|
||
beq .4
|
||
|
||
ldy #S.WND.MBarY2
|
||
jsr MOU.WNDCmpY
|
||
bcc .4 not in MBAR
|
||
|
||
jsr MBAR.Enter
|
||
|
||
bra .5
|
||
|
||
.4 ldy #S.OBJ.S
|
||
lda (ZPWNDPtr),y
|
||
and #S.WND.S.HASSBAR
|
||
beq .5
|
||
|
||
ldy #S.WND.SBarY1
|
||
jsr MOU.WNDCmpY
|
||
bcs .5 not in SBAR
|
||
|
||
|
||
|
||
.5 lda #PTR.T.ARROW
|
||
|
||
.6 jmp PTR.Set
|
||
|
||
.7 ldx WND.Stack.Idx
|
||
|
||
dex
|
||
bne .1
|
||
|
||
lda #PTR.T.ARROW
|
||
jsr PTR.Set
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
.8 ldy #S.WND.hPTR
|
||
lda (ZPWNDPtr),y
|
||
jsr PTR.Set
|
||
|
||
jsr MOU.ToLocal
|
||
|
||
jsr MOU.ChkWNDChilds
|
||
bcc .99
|
||
|
||
clc
|
||
.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
|
||
*--------------------------------------
|
||
MOU.ChkWNDBorders
|
||
ldy #S.OBJ.F
|
||
lda (ZPWNDPtr),y
|
||
and #S.OBJ.F.BORDER
|
||
beq MOU.ChkWNDChilds.9
|
||
|
||
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.X1
|
||
bne .5
|
||
|
||
iny
|
||
lda (ZPWNDPtr),y
|
||
adc #0
|
||
eor MSG+S.MSG.X1+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.Y1
|
||
bne .7
|
||
|
||
iny
|
||
lda (ZPWNDPtr),y
|
||
adc #0
|
||
eor MSG+S.MSG.Y1+1
|
||
bne .7
|
||
|
||
lda #PTR.T.RESIZEXY1
|
||
.6 jmp PTR.Set
|
||
|
||
.7 lda IY
|
||
bne .6
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
MOU.InObj lda ZPObjPtr
|
||
clc
|
||
adc #S.OBJ.X1
|
||
tay
|
||
lda ZPObjPtr+1
|
||
adc /S.OBJ.X1
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/lib/libgui.s.mou
|
||
LOAD usr/src/lib/libgui.s
|
||
ASM
|