mirror of
https://github.com/antoinevignau/source.git
synced 2025-01-23 21:31:02 +00:00
1 line
5.6 KiB
ArmAsm
1 line
5.6 KiB
ArmAsm
|
load 'macros.dump'
include 'driver.equ'
include 'pl.equ'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT X_CopyOneHandle
IMPORT D_MainZPage
IMPORT D_NeedHand
IMPORT P_BuildUndo
IMPORT P_DefJust
IMPORT P_DefSpacing
IMPORT P_DrawTabs
IMPORT P_EraseTabs
IMPORT T_DotObj
IMPORT T_DotParag
IMPORT T_Editing
IMPORT T_EraseCaret
IMPORT T_GetParPtr
IMPORT T_MarkParag
IMPORT T_RulDrawn
IMPORT T_RulObj
IMPORT T_TextSelect
IMPORT T_UpdatePars
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY T_ClearRulers
ENTRY T_SetRulers
;------------------------------------------------------------------------------
;
; T_UseRuler (RulerHdl:ax)
;
T_UseRuler PROC EXPORT
;Using D_GlobalData
RulerHdl equ 0
RulerPtr equ 4
phd
pha
lda >D_MainZPage
tcd
pla
movelong ax,RulerHdl
movelong [RulerHdl],RulerPtr
lda [RulerPtr]
inc a
sta [RulerPtr]
pld
rtl
ENDP
;------------------------------------------------------------------------------
;
; T_UsUseRuler (RulerHdl:ax)
;
T_UnUseRuler PROC EXPORT
;Using D_GlobalData
;Using T_Data
RulerHdl equ 0
RulerPtr equ 4
phd
pha
lda >D_MainZPage
tcd
pla
movelong ax,RulerHdl
movelong [RulerHdl],RulerPtr
lda [RulerPtr]
dec a
sta [RulerPtr]
bne Exit
cmpl RulerHdl,T_RulDrawn
bne Okay
stzl T_RulDrawn
Okay tool _DisposeHandle,in=(RulerHdl:l)
Exit pld
rtl
ENDP
;------------------------------------------------------------------------------
;
; T_NewRuler() : RulerHdl:l
;
T_NewRuler PROC EXPORT
;Using P_Data
;Using T_TextEqu
;Using D_GlobalData
OUTPUT RulerHdl:l
LOCAL RulerPtr:l
ERROR Err
BEGIN
call D_NeedHand,in=(#T_RulerInfoSize:l),out=(RulerHdl:l),err=(Err)
movelong [RulerHdl],RulerPtr
moveword #1,[RulerPtr]:#T_ParsUsing
lda P_DefJust
ora P_DefSpacing
moveword a,[RulerPtr]:#T_RulBits
moveword #0,[RulerPtr]:#T_TabCount
moveword #0,[RulerPtr]:#T_Indent
moveword #P_IndentTab,[RulerPtr]:#T_Indent+2
RETURN
ENDP
;------------------------------------------------------------------------------
;
; T_DrawRuler ()
;
T_DrawRuler PROC EXPORT
;Using T_Data
;Using T_TextEqu
LOCAL ParagPtr:l,RulerHdl:l
BEGIN
lda T_Editing
beq Exit
rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax)
movelong [ParagPtr]:#T_RulerHdl,RulerHdl
cmpl T_DotObj,T_RulObj
bne DrawIt
cmpl RulerHdl,T_RulDrawn
beq Exit
DrawIt
movelong T_DotObj,T_RulObj
movelong RulerHdl,T_RulDrawn
call P_EraseTabs
call P_DrawTabs
Exit RETURN
ENDP
;------------------------------------------------------------------------------
;
; T_ChangeRuls (ModType:w,Data:w,TabList:l)
;
T_ChangeRuls PROC EXPORT
;Using P_Data
;Using T_TextEqu
;Using T_Data
INPUT ModType:w,Data:w,TabList:l
LOCAL CurPar:w,ParagPtr:l,NewRuler:l,NewPtr:l,TabPtr:l
LOCAL RulerHdl:l
BEGIN
call P_BuildUndo,in=(#0:w)
lda T_TextSelect
bne Range
call T_EraseCaret
moveword T_DotParag,T_MarkParag
Range
moveword T_DotParag,CurPar
ParLoop
rcall T_GetParPtr,in=(CurPar:a),out=(ParagPtr:ax)
movelong [ParagPtr]:#T_RulerHdl,RulerHdl
lda RulerHdl+2
and #T_MarkBit
bne NextParag
call X_CopyOneHandle,in=(RulerHdl:l),out=(NewRuler:l)
movelong [NewRuler],NewPtr
moveword #0,[NewPtr] ;ParsUsing set by T_SetRulers
lda ModType
asl a
tax
jsr (ModTable,x)
in NewRuler:l,RulerHdl:l,CurPar:w,T_MarkParag:w,#1:w
xcall T_SetRulers
NextParag
inc CurPar
cmpw T_MarkParag,CurPar
bge ParLoop
call T_ClearRulers,in=(T_DotParag:w,T_MarkParag:w)
call T_UpdatePars,in=(T_DotParag:w,T_MarkParag:w)
RETURN
ModTable
DC.W Spacing
DC.W Justif
DC.W Indent
DC.W Tabs
Spacing
ldy #T_RulBits
lda [NewPtr],y
and #T_NoSpacing
ora Data
sta [NewPtr],y
rts
Justif
ldy #T_RulBits
lda [NewPtr],y
and #T_NoJust
ora Data
sta [NewPtr],y
rts
Indent
moveword Data,[NewPtr]:#T_Indent
|