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

1 line
14 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_DateToStr IMPORT D_FastMult IMPORT D_GetRefCon IMPORT D_KillFont IMPORT P_AllHGCount IMPORT P_AllHGuides IMPORT P_AllVGCount IMPORT P_AllVGuides IMPORT P_ContentRect IMPORT P_CurDate IMPORT P_CurrentWin IMPORT P_Cursor IMPORT P_FindGuide IMPORT P_FirstPOff IMPORT P_FullPageRect IMPORT P_FullPaperRect IMPORT P_H IMPORT P_ImportType IMPORT P_LineSize IMPORT P_MagGuides IMPORT P_OldIdlePt IMPORT P_Page IMPORT P_PageMode IMPORT P_PageRect IMPORT P_PaperRect IMPORT P_Placing IMPORT P_PortRect IMPORT P_PrintHand IMPORT P_SetCursor IMPORT P_SpecStr IMPORT P_TrackMaskHorz IMPORT P_TrackMaskVert IMPORT P_TrackOn IMPORT P_V IMPORT P_ValidRect IMPORT P_VisRuler IMPORT P_WinStuffSize IMPORT P_WindowStuff IMPORT D_PrintToLW IMPORT D_SelectFont IMPORT D_Set4Pat IMPORT T_DotObj ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ;-------------------------------------------------------------------------------- ; ; This is a massive kludge to get around Apple's fucked up LaserWriter driver. ; The LaserWriter driver uses the current pen D_Pattern for drawing Q_Text instead ; of the current Q_Text pen. Furthermore, because of the way Quickdraw records ; pictures, it is not sufficient to just set the pen D_Pattern, because Quickdraw ; will not record the change until something it applies to, i.e. not Q_Text, is ; drawn. Therefore the bogus call to FrameRect. Argggg!! ; P_AppleFuck PROC EXPORT ;Using D_GlobalData lda >D_PrintToLW beq Exit tool _PenNormal tool _FrameRect,in=(#BogusRect:l) Exit rtl BogusRect DC.W 0,0,0,0 ENDP ;------------------------------------------------------------------------------ ; ; P_Entry () ; ; Entry routine. P_Entry PROC EXPORT ;Using P_Data tool _SetPort,in=(P_CurrentWin:l) jsl D_KillFont rtl ENDP ;--------------------------------------------------------------------------- ; ; P_SaveWindowStuff ; P_SaveWindowStuff PROC EXPORT ;Using P_Data input window:l local tmp:l begin IsNil window beq Exit call D_GetRefCon,in=(window:l),out=(tmp:l) tool _BlockMove,in=(#P_WindowStuff:l,[tmp]:l,#P_WinStuffSize:l) Exit return ENDP ;--------------------------------------------------------------------------- ; ; P_LoadWindowStuff ; P_LoadWindowStuff PROC EXPORT ;Using P_Data input NewWindow:l local tmp:l begin cmpl NewWindow,P_CurrentWin beq Done call P_SaveWindowStuff,in=(P_CurrentWin:l) IsNil NewWindow beq SetWin call D_GetRefCon,in=(NewWindow:l),out=(tmp:l) tool _BlockMove,in=([tmp]:l,#P_WindowStuff:l,#P_WinStuffSize:l) SetWin movelong NewWindow,P_CurrentWin Done return ENDP ;--------------------------------------------------------------------------- ; ; P_LShift ; ; shifts A to the left X bits ; trashes Y. ; returns in A P_LShift PROC EXPORT txy Shift beq DoneShift asl a dex bra Shift DoneShift rtl ENDP ;--------------------------------------------------------------------------- ; ; P_RShift ; ; shifts A to the right X bits ; trashes Y. ; returns in A P_RShift PROC EXPORT txy Shift beq DoneShift lsr a dex bra Shift DoneShift rtl ENDP ;--------------------------------------------------------------------------- ; ; P_Fix2Int ; ; converts <ax> fp to <a> short, rounding accordingly. ; P_Fix2Int PROC EXPORT tay bpl exit inx exit txa rtl ENDP ;-------------------------------------------------------------------------- ; ; P_DoScritch ; P_DoScritch PROC EXPORT ;Using P_Data ;Using P_RulerData input Pt:l begin lda P_VisRuler jeq Exit tool _SetPort,in=(P_CurrentWin:l) tool _GetPenState,in=(#P_PennState:l) call D_Set4Pat,in=(#Black:w) tool _SetPenMode,in=(#notXOR:w) tool _SetPenMask,in=(#