mirror of
https://github.com/antoinevignau/source.git
synced 2024-06-18 04:29:36 +00:00
1 line
14 KiB
ArmAsm
1 line
14 KiB
ArmAsm
|
load 'macros.dump'
include 'driver.equ'
include 'pl.equ'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT P_BuildType
IMPORT P_BuildUndo
IMPORT P_FixMenus
IMPORT P_Page
IMPORT T_CalcFBytes
IMPORT T_Clear
IMPORT T_ClearBottom
IMPORT T_CopyParEnd
IMPORT T_CurColor
IMPORT T_CurFont
IMPORT T_CurStyleSize
IMPORT T_CutParag
IMPORT T_DeletePars
IMPORT T_DoControl
IMPORT T_DoRoom
IMPORT T_DotLine
IMPORT T_DotObj
IMPORT T_DotOffset
IMPORT T_DotParag
IMPORT T_DrawOneLine
IMPORT T_DrawParag
IMPORT T_DrawRuler
IMPORT T_EraseCaret
IMPORT T_FontFlags
IMPORT T_GetParPtr
IMPORT T_GetParSize
IMPORT T_GetTextPtr
IMPORT T_InsertFont
IMPORT T_JunkRight
IMPORT T_LockLines
IMPORT T_MakeRoom
IMPORT T_MovedDot
IMPORT T_NewAddStyle
IMPORT T_NewColor
IMPORT T_NewFont
IMPORT T_NewPars
IMPORT T_NewSize
IMPORT T_Offset2Line
IMPORT T_OffsetPCount
IMPORT T_PadThread
IMPORT T_PastePar
IMPORT T_PrevChar
IMPORT T_RecutParag
IMPORT T_TextSelect
IMPORT T_TopLine
IMPORT T_TrackFont
IMPORT T_UseRuler
IMPORT T_WriteFBytes
IMPORT T_JunkLeft
IMPORT T_JunkRight
;-----------------------------------------------------------------------------
;
; T_BumpParags (ParagNo:w; ObjHdl:l; ParStart:w; DoDraw:w);
;
; The starting position of ParagNo has changed. I need to recalculate all
; the paragraphs below this one until a paragraph doesn't move and D_Update the
; ones that are currently on the screen.
;
; ObjHdl is the object that ParagNo starts in.
; ParStart is the pixel count from the top of ObjHdl to the top of ParagNo.
T_BumpParags PROC EXPORT
;Using P_Data
;Using P_ObjData
;Using T_Data
;Using T_TextEqu
INPUT ParagNo:w,ObjHdl:l,ParStart:w,DoDraw:w
LOCAL ParagPtr:l,ParagCount:w
LOCAL ObjPtr:l,MaxVert:w,ParEnd:w
LOCAL OldObj:l,OldParStart:w,OldParHeight:w
BEGIN
rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax)
moveword [ParagPtr],ParagCount
movelong [ObjHdl],ObjPtr
subword [ObjPtr]:#P_TRect+4,[ObjPtr]:#P_TRect,MaxVert
ParLoop
lda ParagNo
cmp ParagCount
jge EraseBottom
rcall T_GetParPtr,in=(a:a),out=(ParagPtr:ax)
movelong [ParagPtr]:#T_ObjHdl,OldObj
moveword [ParagPtr]:#T_ParStart,OldParStart
moveword [ParagPtr]:#T_ParHeight,OldParHeight
cmpl ObjHdl,OldObj
bne Recut
cmpw ParStart,OldParStart
jeq Done
; If it used to cross object boundaries, recut it.
addword OldParStart,OldParHeight,a
cmp MaxVert
bge Recut
; If it crosses object boundaries for D_New ParStart, recut it.
addword ParStart,OldParHeight,a
sta ParEnd
cmp MaxVert
bge Recut
; Set the ParStart since it could have changed and redraw paragraph
rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax)
moveword ParStart,[ParagPtr]:#T_ParStart
lda DoDraw
beq NextPar
in ParagNo:w,#0:w,[ParagPtr]:#T_LineCount:w,ParStart:w
xcall T_DrawParag
bra NextPar
Recut
in ObjHdl:l,ParagNo:w,ParStart:w
out ObjHdl:l,ParEnd:w
xcall T_RecutParag
lda DoDraw
beq NoDraw
in ParagNo:w,#0:w,[ParagPtr]:#T_LineCount:w,ParStart:w
xcall T_DrawParag
NoDraw
movelong [ObjHdl],ObjPtr
subword [ObjPtr]:#P_TRect+4,[ObjPtr]:#P_TRect,MaxVert
NextPar
moveword ParEnd,ParStart
inc ParagNo
brl ParLoop
EraseBottom
call T_PadThread,in=(ObjHdl:l,ParStart:w)
lda DoDraw
beq Done
call T_ClearBottom,in=(ObjHdl:l,ParStart:w,P_Page:w)
Done
jsl T_MovedDot
Exit
RETURN
ENDP
;----------------------------------------------------------------------------
;
; T_CmpLines (LHdl1:l,LHdl2:l,LCount1:w,LCount2:w,Bytes:w) :
; FirstLine:w,LastLine:w
;
T_CmpLines PROC EXPORT
;Using T_TextEqu
;Using T_Data
INPUT LHdl1:l,LHdl2:l
INPUT LCount1:w,LCount2:w
INPUT Bytes:w
OUTPUT FirstLine:w,LastLine:w
LOCAL LPtr1:l,LPtr2:l,LineNo:w
LOCAL TotLength1:w,TotLength2:w
BEGIN
movelong [LHdl1],LPtr1
movelong [LHdl2],LPtr2
stz TotLength1
stz TotLength2
stz LineNo
FirstLoop
ldy #T_Length
addword [LPtr1]:y,TotLength1,TotLength1
addword [LPtr2]:y,TotLength2,TotLeng
|