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

1 line
29 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_GrowHandle IMPORT D_MainZPage IMPORT D_NeedHand IMPORT P_ChangePage IMPORT P_ContentRect IMPORT P_DefFont IMPORT P_DefSize IMPORT P_DefStyle IMPORT P_H IMPORT P_Page IMPORT P_V IMPORT T_CurColor IMPORT T_CurFont IMPORT T_CurIndent IMPORT T_CurParHdl IMPORT T_CurRulBits IMPORT T_CurRulHdl IMPORT T_CurRulPtr IMPORT T_CutParag IMPORT T_Deactivate IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_DotPixs IMPORT T_DrawRuler IMPORT T_EraseCaret IMPORT T_FontFlags IMPORT T_InsertFont IMPORT T_LessRoom IMPORT T_MakeRoom IMPORT T_MarkLine IMPORT T_MarkObj IMPORT T_MarkOffset IMPORT T_MarkParag IMPORT T_MarkPixs IMPORT T_NewAddStyle IMPORT T_NewColor IMPORT T_NewFont IMPORT T_NewRuler IMPORT T_NewSize IMPORT T_Offset2Line IMPORT T_Offset2Pix IMPORT T_TextSelect IMPORT T_TrackFont IMPORT T_UnUseRuler ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_LineHeight ENTRY T_OffThread ;--------------------------------------------------------------------------- ; T_MulLine ; T_MulLine PROC EXPORT asl a asl a asl a rtl ENDP ;--------------------------------------------------------------------------- ; T_MulParag ; T_MulParag PROC EXPORT asl a asl a asl a pha asl a clc adc 1,s plx rtl ENDP ;------------------------------------------------------------------------------- ; ; T_GetParPtr (ParagNo:a) : ParagPtr:ax ; ; Operates on the current thread. The ParagHdl is not X_Locked down. T_GetParPtr PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData ParagHdl equ 0 ParagPtr equ 4 phd pha lda >D_MainZPage tcd movelong T_CurParHdl,ParagHdl movelong [ParagHdl],ParagPtr pla jsl T_MulParag addwl a,ParagPtr movelong ParagPtr,ax pld rtl ENDP ;------------------------------------------------------------------------------- ; ; T_GetTextPtr (ParagNo:a) : TextPtr:ax ; ; Operates on the current thread. The TextHdl is not X_Locked down. T_GetTextPtr PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData ParagHdl equ 0 ParagPtr equ 4 TextHdl equ 8 TextPtr equ 12 phd pha lda >D_MainZPage tcd movelong T_CurParHdl,ParagHdl movelong [ParagHdl],ParagPtr pla jsl T_MulParag addwl a,ParagPtr movelong [ParagPtr]:#T_TextBlock,TextHdl movelong [TextHdl],TextPtr moveword [ParagPtr]:#T_ParOffset,a addwl a,TextPtr movelong TextPtr,ax pld rtl ENDP ;------------------------------------------------------------------------------- ; ; T_GetRulBits (ParagNo:a) : RulBits:a ; ; Operates on the current thread. T_GetRulBits PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData ParagPtr equ 20 RulerHdl equ 24 RulerPtr equ 28 phd pha lda >D_MainZPage tcd pla rcall T_GetParPtr,in=(a:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_RulerHdl,RulerHdl movelong [RulerHdl],RulerPtr moveword [RulerPtr]:#T_RulBits,a pld rtl ENDP ;----------------------------------------------------------------------------- ; ; T_GetSpacing (RulBits:a; Ascent:x; Descent:y) : Spacing:a ; T_GetSpacing PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData RulBits equ 0 Ascent equ 2 Descent equ 4 TextHeight equ 6 phd pha lda >D_MainZPage tcd stx Ascent sty Descent pullword RulBits and #T_CustSpace bne Custom lda RulBits and #T_Single bne Single lda RulBits and #T_Double bne Double Triple addword Ascent,#2,a bra Exit Double lda Ascent lsr a addword a,#2,a bra Exit Single lda #1 bra Exit Custom addword Ascent,Descent,TextHeight lda RulBits xba and #T_GetCustSpace inc a ; 1-64 subword a,TextHeight,a bpl Exit NoSpace lda #0 Exit