antoine-source/appleworksgs/PL/Src/MAIN.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_BitMapChanged IMPORT D_BitMapPtr IMPORT D_ClearBitMap IMPORT D_Deref IMPORT P_AddThreadRgn IMPORT P_CheckHand IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DoThread IMPORT P_DrawContent IMPORT P_DrawHandles IMPORT P_ErrorAlert IMPORT P_FixMenus IMPORT P_FixSpecRect IMPORT P_HideTabs IMPORT P_KillUndo IMPORT P_Page IMPORT P_PageMode IMPORT P_Placing IMPORT P_ThreadDir IMPORT P_ThreadHdl IMPORT D_RectZap IMPORT T_BlinkCaret IMPORT T_Click IMPORT T_GetParPtr IMPORT T_InvSelect IMPORT T_NewParHdl IMPORT T_OffThread IMPORT T_PadThread IMPORT T_Pt2Offset IMPORT T_RecutParag ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_CInterval ENTRY T_CaretDrawn ENTRY T_CaretTime ENTRY T_ClickCount ENTRY T_ClipThread ENTRY T_CurParHdl ENTRY T_Editing ENTRY T_FontFlags ENTRY T_ReThread ENTRY T_Refresh ENTRY T_RulDrawn ENTRY T_TextSelect ENTRY T_ThreadRgn ;----------------------------------------------------------------------------- ; ; T_New (ObjHdl:l,ParagHdl:l) ; ; Returns any errors. ObjHdl should be X_Locked when T_New is called. T_New PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu input ObjHdl:l,ParagHdl:l local ObjPtr:l,ParagPtr:l,PThread:l,ReThreadHdl:l,TempPtr:l error Err begin stz Err movelong [ObjHdl],ObjPtr call P_FixSpecRect,in=(ObjPtr:l) ; Make a D_New parag array if neccessary cpzl ParagHdl bne ThreadExists call T_NewParHdl,out=(ParagHdl:l),err=(Err) jcs Exit ThreadExists movelong ParagHdl,[ObjPtr]:#P_ParagHdl moveword P_Page,[ObjPtr]:#P_PageNo moveword #0,[ObjPtr]:#P_NThread moveword a,[ObjPtr]:#P_NThread+2 moveword a,[ObjPtr]:#P_PThread moveword a,[ObjPtr]:#P_PThread+2 ; Do threading lda P_Placing beq NoThread cpzl P_ThreadHdl beq NoThread rcall D_Deref,in=(P_ThreadHdl:ax),out=(TempPtr:ax) cmpw [TempPtr]:#P_PageNo,P_Page bne NoHand1 call P_DrawHandles,in=(TempPtr:l) NoHand1 call P_DoThread,in=(P_ThreadHdl:l,ObjHdl:l,P_ThreadDir:w) cmpw [TempPtr]:#P_PageNo,P_Page bne NoHand2 call P_DrawHandles,in=(TempPtr:l) NoHand2 tool _HUnlock,in=(P_ThreadHdl:l) NoThread ; Setup and rethread movelong [ObjPtr]:#P_PThread,PThread cpzl PThread bne PrevExists movelong ObjHdl,ReThreadHdl movelong [ParagHdl],ParagPtr movelong ObjHdl,[ParagPtr]:#T_ObjHdl lda #0 moveword a,[ParagPtr]:#T_ParStart moveword a,[ObjPtr]:#P_StartParag moveword a,[ObjPtr]:#P_StartLine lda #$FFFF moveword a,[ObjPtr]:#P_EndParag moveword a,[ObjPtr]:#P_EndLine bra Done PrevExists movelong PThread,ReThreadHdl Done call T_ReThread,in=(ReThreadHdl:l) Exit return ENDP ;------------------------------------------------------------------------------- ; ; T_ReThread (ObjHdl:l) ; T_ReThread PROC EXPORT ;Using P_ObjData ;Using T_Data ;Using T_TextEqu input ObjHdl:l local ObjPtr:l,ParagHdl:l,ParagPtr:l local ParagNo:w,ParagCount:w,VertPos:w error Err begin +b stz Err ; D_Save on stack pushlong T_CurParHdl movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_ParagHdl,ParagHdl movelong ParagHdl,T_CurParHdl rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],ParagCount cpzl [ObjPtr]:#P_PThread bne NotStart lda #0 moveword a,[ObjPtr]:#P_StartParag moveword a,[ObjPtr]:#P_StartLine sta ParagNo sta VertPos bra ParagLoop NotStart moveword [ObjPtr]:#P_StartParag,ParagNo bpl NotEnd moveword ParagCount,ParagNo NotEnd lda ParagNo beq NoDec dec ParagNo NoDec rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_ObjHdl,ObjHdl moveword [ParagPtr]:#T_ParStart,VertPos ParagLoop in ObjHdl:l,ParagNo:w,VertPos:w out ObjHdl:l,VertPos:w xcall T_RecutParag rcall T_GetParPtr,in