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

1 line
13 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_CheckMenuFID IMPORT D_IsLetter IMPORT D_ToLowerTable IMPORT D_ToUpperTable IMPORT P_BuildUndo IMPORT P_SetFormat IMPORT T_BumpParags IMPORT T_CalcFBytes IMPORT T_CurColor IMPORT T_CurFont IMPORT T_CurSize IMPORT T_CurStyle IMPORT T_DoRoom IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_FontFlags IMPORT T_GetParPtr IMPORT T_GetParSize IMPORT T_GetRulBits IMPORT T_GetTextPtr IMPORT T_JunkLeft IMPORT T_JunkRight IMPORT T_MarkLine IMPORT T_MarkObj IMPORT T_MarkOffset IMPORT T_MarkParag IMPORT T_NewAddStyle IMPORT T_NewColor IMPORT T_NewFont IMPORT T_NewSize IMPORT T_NewSubStyle IMPORT T_NextChar IMPORT T_Offset2Line IMPORT T_PrevChar IMPORT T_RecutParag IMPORT T_Refresh IMPORT T_TextSelect IMPORT T_TrackFont IMPORT T_WriteFBytes ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_ChangeCase ENTRY T_IsSpace ;------------------------------------------------------------------------------ ; ; T_UpdatePars (SPar:w,EPar:w) ; T_UpdatePars PROC EXPORT ;Using T_Data ;Using T_TextEqu input SPar:w,EPar:w local ParagPtr:l,ObjHdl:l,VertPos:w begin rcall T_GetParPtr,in=(SPar:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_ObjHdl,ObjHdl moveword [ParagPtr]:#T_ParStart,VertPos ParLoop in ObjHdl:l,SPar:w,VertPos:w out ObjHdl:l,VertPos:w xcall T_RecutParag rcall T_GetParPtr,in=(SPar:a),out=(ParagPtr:ax) tool _DisposeHandle,in=([ParagPtr]:#T_LinesHdl:l) movelong #0,[ParagPtr]:#T_LinesHdl inc SPar cmpw EPar,SPar bge ParLoop Bump call T_BumpParags,in=(SPar:w,ObjHdl:l,VertPos:w,#0:w) lda T_TextSelect beq No in T_DotParag:w,T_DotOffset:w out T_DotObj:l,T_DotLine:w xcall T_Offset2Line in T_MarkParag:w,T_MarkOffset:w out T_MarkObj:l,T_MarkLine:w xcall T_Offset2Line No call T_Refresh return ENDP ;------------------------------------------------------------------------------- ; ; T_DoChange (ChangeByte:w,Data:w,Data2:w) ; T_DoChange PROC EXPORT ;Using T_Data ;Using T_TextEqu input ChangeByte:w,Data:w,Data2:w local CurPar:w,TextPtr:l begin moveword T_DotParag,CurPar ldy T_DotOffset cpy #T_ParHeader+1 blt ParLoop rcall T_GetTextPtr,in=(CurPar:a),out=(TextPtr:ax) ldy T_DotOffset jsr FlipStuff inc CurPar ParLoop lda CurPar cmp T_MarkParag bgt EndLoop rcall T_GetTextPtr,in=(a:a),out=(TextPtr:ax) ldy #T_ParHeader jsr FlipStuff lda ChangeByte dec a asl a tax lda Table,x tay jsr (JumpTable,x) inc CurPar bra ParLoop EndLoop return FlipStuff CharLoop cmpw CurPar,T_MarkParag blt Skip cpy T_MarkOffset bge EndLoop2 Skip lda [TextPtr],y iny and #$ff cmp #CR beq EndLoop2 cmp ChangeByte beq FlipIt cmp #T_ColorChange+1 bge CharLoop iny cmp #T_FontChange bne CharLoop iny bra CharLoop EndLoop2 rts FlipIt lda ChangeByte dec a asl a tax jsr (JumpTable,x) iny bra CharLoop DoFont moveword Data,[TextPtr]:y iny rts DoStyle shortm lda Data ora Data2 beq SetStyle lda Data2 eor #$ff and [TextPtr],y ora Data SetStyle sta [TextPtr],y longm rts DoSize DoColor shortm moveword Data,[TextPtr]:y longm rts JumpTable DC.W DoFont DC.W DoStyle DC.W DoSize DC.W DoColor Table DC.W 0 DC.W 2 DC.W 3 DC.W 4 ENDP ;----------------------------------------------------------------------------- ; ; T_InsertFont (ParagNo:w,Offset:w,Mode:w) : Room:w ; ; If Mode is true, the style is set to T_NewAddStyle. Otherwise T_NewAddStyle ; is added and T_NewSubStyle is subtracted. T_InsertFont PROC EXPORT ;Using T_Data ;Using T_TextEqu input ParagNo:w,Offset:w,Mode:w OUTPUT Room:w local LeftOffset:w,RightOffset:w,SFlag:w,EFlag:w local LeftFont:l,RightFont:l,Le