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

1 line
7.7 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_FastMult IMPORT P_DrawTabs IMPORT P_Fix2Int IMPORT P_LShift IMPORT D_SelectFont IMPORT D_Set4Pat ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY ruler_marks ;------------------------------------------------------------------------------ ; ; P_Do_Ruler () ; P_Do_Ruler PROC EXPORT ;Using P_RulerData input ppi:l,start:w,vis_start:w,vis_end:w,vert:w ; pass in necess. globals input hrulrect:l,vrulrect:l,portrect:l,contentrect:l,pagemode:w output mindist:w local max:w,min:w,gran:w,i:w,length:w,space:w local tmp:w,j:w,k:w,v_line:l,h_line:l,start_offset:w local dist:l,tmp_dist:l,min_pix:l,h_pos:l,v_pos:l,pos:l local v_end:l,ruleraddr:l,Q_Line:w,inch_min:w local tmprect:r,foorect:r BEGIN _PenNormal cmpw vis_start,vis_end jeq EXIT stz Q_Line stz length stzl dist movelong #ruler_marks,ruleraddr call D_Set4Pat,in=(#LightYellow:w) ; ; if (vert) lda vert jeq ELSE1 ; ; { moverect [vrulrect],tmprect moveword vis_start,tmprect moveword vis_end,tmprect+4 tool _ClipRect,in=(!tmprect:l) tool _PaintRect,in=(!tmprect:l) tool _SetPenSize,in=(#2:w,#1:w) call D_Set4Pat,in=(#Black:w) moverect [portrect],foorect moveword [contentrect]:#4,foorect+4 tool _ClipRect,in=(!foorect:l) subword [vrulrect]:#6,#2,s pushword #0 _MoveTo tool _Line,in=(#0:w,#P_VRulLength:w) tool _ClipRect,in=(!tmprect:l) movelong !tmp_dist,v_pos movelong !pos,h_pos movelong !Q_Line,v_line movelong !length,h_line moveword #4,start_offset subword [vrulrect]:#6,#2,a movefixword a,pos movefixword #P_MIN_VPIX,min_pix brl ENDIF1 ; ; } else { ELSE1 moverect [hrulrect],tmprect moveword vis_start,tmprect+2 moveword vis_end,tmprect+6 tool _ClipRect,in=(!tmprect:l) tool _PaintRect,in=(!tmprect:l) call D_Set4Pat,in=(#Black:w) moverect [portrect],foorect moveword [contentrect]:#6,foorect+6 tool _ClipRect,in=(!foorect:l) tool _MoveTo,in=(tmprect+2:w,#P_HRulTop+P_HRulWdth-7:w) tool _Line,in=(#640:w,#0:w) tool _MoveTo,in=([vrulrect]:#2:w,#P_HRulTop+P_HRulWdth-1:w) tool _Line,in=(#640:w,#0:w) tool _ClipRect,in=(!tmprect:l) movelong !pos,v_pos movelong !tmp_dist,h_pos movelong !length,v_line movelong !Q_Line,h_line moveword #2,start_offset subword [hrulrect]:#4,#7,a movefixword a,pos movefixword #P_MIN_HPIX,min_pix ; ; } ENDIF1 _PenNormal ; More inits. ; ; max = (short) Fix2Long(FixDiv(Int2Fix(vis_end-start),ppi))+1; spacelong subword vis_end,start,a pushfixword a pushlong ppi _FixDiv pulllong ax rcall P_Fix2Int,in=(ax:ax) inc a sta max ; ; min = (short) Fix2Long(FixDiv(Int2Fix(vis_start-start),ppi))-1; spacelong subword vis_start,start,a pushfixword a pushlong ppi _FixDiv pulllong ax rcall P_Fix2Int,in=(ax:ax) dec a sta min ; ; ---- movefixword vis_end,v_end ; ; for (gran=7;(dist<ppi) && (gran>=0);gran--) moveword #7,gran brl FOR1 ; ; { LOOP1 ; dist = ppi / (1<<gran); movelong ppi,dist bmi NegDist ldx gran bra DivLoop1 Div1 clc ror dist+2 ror dist dex DivLoop1 bne Div1 bra doneDiv NegDist ldx gran bra DivLoop2 Div2 sec ; sign extension. ror dist+2 ror dist dex DivLoop2 bne Div2 DoneDiv scmpw dist+2,min_pix+2 jlt CONT1 bne NoCONT cmpw min_pix,dist jge CONT1 NoCONT pushfixword start tool _FixMul,in=(min:w,#0:w,ppi:l),out=(:l) addlong s,dist,tmp_dist addlong s,tmp_dist,tmp_dist clc rol dist rol dist+2 lda gran asl a pha rcall P_LShift,in=(vert:a,#4:x) addword a,s,y moveword [ruleraddr]:y,length ; ; for (;tmp_dist<=v_end;) bra FOR0 ; ; { LOOP0 rcall P_Fix2Int,in=([h_pos]:ax),out=(a:a) pha rcall P_Fix2Int,in=([v_pos]:ax),out=(a:a) pha _MoveTo tool _Line,in=([h_line]:w,[v_l