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

1 line
6.3 KiB
ArmAsm
Raw Normal View History

2023-03-04 02:45:20 +00:00
load 'macros.dump' include 'driver.equ' include 'pl.equ' ;------------------------------------------ ; ; Equates from procedure T_WPRulData ; ;------------------------------------------ T_WPParsUsing EQU 0 T_WPRulBits EQU 2 T_WPLeftMarg EQU 4 T_WPIndent EQU 6 T_WPRightMarg EQU 8 T_WPTabCount EQU 10 T_WPTabArray EQU 12 T_WPDefLM EQU 80 ;Defualt margins for D_WP T_WPDefRM EQU 600 ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_FastMult IMPORT D_GrowHandle IMPORT P_FixRect IMPORT T_MulParag IMPORT T_NewRuler ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_ClearMarks ;---------------------------------------------------------------------------- ; ; T_ClearBottom (ObjHdl:l,VertPos:w,CurPage:w) ; ; Clears the bottom of a Q_Text thread, whatever that means T_ClearBottom PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_TextEqu INPUT ObjHdl:l,VertPos:w,CurPage:w LOCAL ObjPtr:l,Q_Rect:r BEGIN movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_PageNo,CurPage bne ObjLoop moverect [ObjPtr]:#P_TRect,Q_Rect addword Q_Rect,VertPos,Q_Rect cmpw Q_Rect,Q_Rect+4 bge ObjLoop call P_FixRect,in=(!Q_Rect:l,#P_RECTANGLE:w,#0:w,#1:w) tool _EraseRect,in=(!Q_Rect:l) ObjLoop movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_NThread,ObjHdl cpzl ObjHdl beq Exit movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_PageNo,CurPage bne ObjLoop moverect [ObjPtr]:#P_TRect,Q_Rect call P_FixRect,in=(!Q_Rect:l,#P_RECTANGLE:w,#0:w,#1:w) tool _EraseRect,in=(!Q_Rect:l) bra ObjLoop Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_WP2PLText (ParagHdl:l) ; ; Convert D_WP scrap to my scrap. Expand each Parag record by 4 bytes ; and convert the rulers. T_WP2PLText PROC EXPORT ;Using P_Data ;Using T_Data ;Using T_TextEqu ;Using T_WPRulData INPUT ParagHdl:l ERROR Err LOCAL ParagPtr:l,RulerHdl:l,RulerPtr:l LOCAL ParagCount:w,SrcPtr:l,DestPtr:l LOCAL LeftMarg:w,TabCount:w,Indent:w BEGIN ; Grow handle movelong [ParagHdl],ParagPtr moveword [ParagPtr],ParagCount lda ParagCount jsl T_MulParag pushword #0 addword a,#2,s pushlong ParagHdl jsl D_GrowHandle sta Err jcs Exit movelong [ParagHdl],ParagPtr addwl #2,ParagPtr ldx ParagCount dex ldy #T_ParInfoSize-4 jsl D_FastMult addlong a,ParagPtr,SrcPtr lda ParagCount dec a jsl T_MulParag addlong a,ParagPtr,DestPtr ParLoop tool _BlockMove,in=(SrcPtr:l,DestPtr:l,#T_ParInfoSize-4:l) moveword [DestPtr]:#T_ParStart-2,a beq Normal ; Paragraph is a page break. Get it a valid ruler call T_NewRuler,out=(RulerHdl:l),err=(Err) jcs Exit movelong RulerHdl,[DestPtr]:#T_RulerHdl-2 moveword #0,[DestPtr]:#T_ParStart-2 brl DoneTabs Normal movelong [DestPtr]:#T_RulerHdl-2,RulerHdl movelong [RulerHdl],RulerPtr ldy #T_WPRulBits moveword [RulerPtr]:y,a and #T_MarkBit bne DoneTabs moveword [RulerPtr]:y,a ora #T_MarkBit and #T_KillWidow moveword a,[RulerPtr]:y moveword [RulerPtr]:#T_WPLeftMarg,LeftMarg moveword [RulerPtr]:#T_WPTabCount,TabCount moveword [RulerPtr]:#T_WPIndent,Indent moveword TabCount,[RulerPtr]:#T_TabCount subword Indent,LeftMarg,a bpl NotNeg lda #0 NotNeg moveword a,[RulerPtr]:#T_Indent moveword #P_IndentTab,[RulerPtr]:#T_Indent+2 ldy #T_TabArray TabLoop ldx TabCount beq DoneTabs subword [RulerPtr]:y,LeftMarg,[RulerPtr]:y iny iny iny iny dec TabCount bra TabLoop DoneTabs sublong DestPtr,#T_ParInfoSize,DestPtr sublong SrcPtr,#T_ParInfoSize-4,SrcPtr dec ParagCount lda ParagCount jne ParLoop call T_ClearMarks,in=(ParagHdl:l,#T_ParInfoSize:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_PL2WPText (ParagHdl:l) ; ; Convert my scrap to D_WP scrap. Shrink each Parag record by 4 bytes ;