antoine-source/appleworksgs/PL/Src/PRIM2.S

1 line
12 KiB
ArmAsm
Raw Normal View History

2023-03-04 02:45:20 +00:00
load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_GetWdth IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_Fix2Int IMPORT P_H IMPORT P_Page IMPORT P_V IMPORT D_SelectFont IMPORT T_CaretDrawn IMPORT T_CountSpaces IMPORT T_CurFont IMPORT T_CurIndent IMPORT T_CurRulBits IMPORT T_CurSize IMPORT T_CurStyle IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_DotPixs IMPORT T_GetLinePtr IMPORT T_GetObject IMPORT T_GetParPtr IMPORT T_GetRulBits IMPORT T_GetSpacing IMPORT T_LockRuler IMPORT T_TopLine IMPORT T_TrackFont IMPORT T_UnlockRuler IMPORT T_UseTab ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_Pix2Offset ;------------------------------------------------------------------------------ ; ; T_GetStart (LineWidth:w,MaxWidth:w,NoIndent:w) : StartWidth:w ; ; Returns the starting horiz offset for a Q_Line of Q_Text, using the current ; ruler information. T_GetStart PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT LineWidth:w,MaxWidth:w,NoIndent:w OUTPUT StartWidth:w BEGIN stz StartWidth lda T_CurRulBits and #T_Center bne DoCenter lda T_CurRulBits and #T_Right beq DoIndent DoRight subword MaxWidth,LineWidth,StartWidth bra DoIndent DoCenter subword MaxWidth,LineWidth,a lsr a sta StartWidth DoIndent lda NoIndent bne Exit addword StartWidth,T_CurIndent,StartWidth Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; T_Pt2Offset (ObjHdl:l,Pt:l) : ParagNo:w,Offset:w,LineNo:w,Q_Pixels:w ; T_Pt2Offset PROC EXPORT ;Using P_ObjData ;Using T_TextEqu ;Using T_Data INPUT ObjHdl:l,Pt:l OUTPUT ParagNo:w,Offset:w,LineNo:w,Q_Pixels:w LOCAL ObjPtr:l,ParagPtr:l,LinePtr:l LOCAL EndParag:w,EndLine:w,ParagCount:w,LineCount:w,Q_Rect:r LOCAL RulBits:w,TotHeight:w,Leading:w,Ascent:w,Descent:w LOCAL MaxWidth:w BEGIN movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_StartParag,ParagNo moveword [ObjPtr]:#P_StartLine,LineNo moveword [ObjPtr]:#P_EndParag,EndParag moveword [ObjPtr]:#P_EndLine,EndLine moverect [ObjPtr]:#P_TRect,Q_Rect subword Pt,Q_Rect,Pt subword Pt+2,Q_Rect+2,Pt+2 subword Q_Rect+6,Q_Rect+2,MaxWidth rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],ParagCount stz TotHeight ; Find the Q_Line and the parag ParagLoop rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,LineCount rcall T_GetRulBits,in=(ParagNo:a),out=(RulBits:a) rcall T_GetLinePtr,in=(ParagNo:a,LineNo:x),out=(LinePtr:ax) LineLoop cmpw ParagNo,EndParag blt CheckCount cmpw LineNo,EndLine blt CheckCount brl PastEnd CheckCount cmpw LineNo,LineCount bge NextParag moveword [LinePtr]:#T_Ascent,a and #$ff sta Ascent moveword [LinePtr]:#T_Descent,a and #$ff sta Descent rcall T_GetSpacing,in=(RulBits:a,Ascent:x,Descent:y),out=(a:a) addword a,Ascent,a addword a,Descent,a addword a,TotHeight,TotHeight scmpw a,Pt bge FindPixels addwl #T_LineInfoSize,LinePtr inc LineNo bra LineLoop NextParag stz LineNo inc ParagNo cmpw ParagNo,ParagCount bge PastEnd addwl #T_ParInfoSize,ParagPtr brl ParagLoop PastEnd moveword MaxWidth,Pt+2 lda LineNo bne Skip lda ParagNo beq FindPixels dec ParagNo rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,LineNo Skip dec LineNo FindPixels in ParagNo:w,LineNo:w,Pt+2:w,MaxWidth:w out Offset:w,Q_Pixels:w xcall T_Pix2Offset RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_Pix2Offset (ParagNo:w,LineNo:w,Pix:w,MaxWidth:w) : Offset:w,Q_Pixels:w ; ; T_Pix2Offset PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,LineNo:w,Pix:w,MaxWidth:w OUTPUT Offset:w,Q_Pix