1 line
10 KiB
ArmAsm
1 line
10 KiB
ArmAsm
|
load 'macros.dump'
include 'driver.equ'
include 'pl.equ'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT D_DrawIcon
IMPORT D_FastMult
IMPORT P_ChangePage
IMPORT P_ContentRect
IMPORT P_DblPage
IMPORT P_Do_Ruler
IMPORT P_DrawAPage
IMPORT P_DrawContent
IMPORT P_FirstPOff
IMPORT P_H
IMPORT P_HRulRect
IMPORT P_L_ArrFilledIcon
IMPORT P_L_ArrHollowIcon
IMPORT P_Page
IMPORT P_PageCount
IMPORT P_PageStart
IMPORT P_Pagemode
IMPORT P_PortRect
IMPORT P_PrintHand
IMPORT P_R_ArrFilledIcon
IMPORT P_R_ArrHollowIcon
IMPORT P_TrackCursor
IMPORT P_V
IMPORT P_VRulRect
IMPORT P_VScroll
IMPORT P_VisPalette
IMPORT P_VisRuler
IMPORT T_ClipThread
IMPORT T_DotObj
;---------------------------------------------------------------------------
;
; P_ActionProc (PartCode:w,CtlHdl:l) : Result:w
;
P_ActionProc PROC EXPORT
;Using P_Data
;Using P_RulerData
;Using T_Data
input PartCode:w,CtlHdl:l
output Result:w
local UpdateRgn:l,UpdateRect:r,SRect:r,CtlMax:w
local Amount:w,NewValue:w,Width:w,Height:w
local PHdl:l,PPtr:l,TempPtr:l
begin +b
; Get rid of any possible scritch marks before possible scrolling
moveword #-10,PPtr
moveword #-10,PPtr+2
call P_TrackCursor,in=(!PPtr:l)
tool _ClipRect,in=(#P_PortRect:l)
moverect P_ContentRect,SRect
tool _NewRgn,out=(UpdateRgn:l)
movelong P_PrintHand,PHdl
movelong [PHdl],PPtr
spacelong
pushlong CtlHdl
_GetCtlParams
subword s,s,CtlMax
cmpl CtlHdl,P_VScroll
jeq Vertical
subword P_ContentRect+6,P_ContentRect+2,Width
lda PartCode
cmp #Thumb
beq HThumb
cmp #5 ;UpArrow
beq HUpArrow
cmp #6 ;DownArrow
beq HDownArrow
cmp #PageUp
beq HPageUp
cmp #PageDown
beq HPageDown
brl Exit
HThumb
tool _GetCtlValue,in=(CtlHdl:l),out=(a:w)
and #$fffe
sta NewValue
tool _SetCtlValue,in=(a:w,CtlHdl:l)
subword NewValue,P_H,Amount
moveword NewValue,P_H
lda Amount
abs a
cmp Width
blt HSmall
lda Width
ldy Amount
bpl HStore
neg a
HStore sta Amount
HSmall brl HDoScroll
HUpArrow
moveword #-32,Amount
bra HCheckValue
HDownArrow
moveword #32,Amount
bra HCheckValue
HPageUp
lda Width
lsr a
neg a
sta Amount
bra HCheckValue
HPageDown
lda Width
lsr a
sta Amount
HCheckValue lda Amount
and #$fffe
sta Amount
addword a,P_H,NewValue
bpl HCheckMax
stz NewValue
bra HSet
HCheckMax cmp CtlMax
bmi HSet
moveword CtlMax,NewValue
HSet
subword NewValue,P_H,Amount
moveword NewValue,P_H
pushword NewValue
pushlong CtlHdl
_SetCtlValue
HDoScroll
stz SRect
pushlong !SRect
subword #0,Amount,s
pushword #0
pushlong UpdateRgn
_ScrollRect
movelong [UpdateRgn],TempPtr
moverect [TempPtr]:#2,UpdateRect
moveword P_ContentRect,UpdateRect
lda P_VisRuler
beq ToUpdate
pushword [PPtr]:#6
pushword #0
subword P_ContentRect+2,P_H,s
in UpdateRect+2:w,UpdateRect+6:w,#0:w
in #P_HRulRect:l,#P_VRulRect:l,#P_PortRect:l
in #P_ContentRect:l,P_Pagemode:w
xcall P_Do_Ruler
ToUpdate brl DoUpdate
Vertical
subword P_ContentRect+4,P_ContentRect,Height
lda PartCode
cmp #Thumb
beq VThumb
cmp #5 ;UpArrow
beq VUpArrow
cmp #6 ;DownArrow
beq VDownArrow
cmp #PageUp
beq VPageUp
cmp #PageDown
beq VPageDown
brl Exit
VThumb
tool _GetCtlValue,in=(CtlHdl:l),out=(a:w)
and #$fffe
sta NewValue
tool _SetCtlValue,in=(a:w,CtlHdl:l)
subword NewValue,P_V,Amount
moveword NewValue,P_V
lda Amount
abs a
cmp Height
blt VSmall
lda Height
ldy Amount
bpl VStore
neg a
VStore sta Amount
VSmall brl VDoScroll
VUpArrow
moveword #-16,Amount
bra VCheckValue
VDownArrow
moveword #16,Amount
bra VCheckValue
VPageUp
lda Height
lsr a
neg a
sta Amount
bra VCheckValue
VPageDown
lda Height
lsr a
sta Amount
VCheckValue lda Amount
and #$fffe
sta Amount
addword a,P_V,NewValue
bpl VCheckMax
stz NewValue
bra VSet
VCheckMax cmp CtlMax
bmi VSet
moveword CtlMax,NewValue
VSet
subword N
|