a2-chemi-gs-1993/xform.asm

1 line
3.9 KiB
NASM
Raw Permalink Normal View History

2017-10-22 14:30:14 +00:00
keep XFORM **************************************************************** * ChemiGS * **************************************************************** * A Drawing Program for Chemical Structures * * (c) 1992-93 by Urs Hochstrasser * * Buendtenweg 6 * * 5105 AUENSTEIN (SWITZERLAND) * **************************************************************** * Module XFORM **************************************************************** * * USES ... * mcopy xform.macros copy equates.asm ************************************************************************ * Display procedures * * Make Matrix: rotation and stretching of stored primitives, as * ------------ hatched and dotted lines, wedges etc. * * x' = x * TM11 + y * TM12; TM11 = S * cos theta, TM12 = -S * sin theta * y' = x * TM21 + y * TM22; TM21 = S * sin theta, TM22 = S * cos theta * * Transform: transform points in primitive definition with * ---------- Transformation Matrix * MakeMatrix start using Globals using TransData ph4 #0 Create a FIXed '2' ~Long2Fix #2 pl4 Fix_2 ph4 #0 ~Long2Fix #-2 Create a FIXed '-2' pl4 Fix_Neg2 sub2 xx2,xx,dx sub2 yy2,yy,dy DIV2 dx,#2 dx/2, then stretch later (for asp. rat) ph4 #0 ~Multiply dx,dx (dx/2)^2 -> dx2 pl4 dx2 ph4 #0 ~Multiply dy,dy dy^2 -> dy2 pl4 dy2 ADD4 dx2,dy2,L sum of it -> L SQRT4 L Square root of L into L ph4 #0 ~FixRatio L,ex L/ex -> S (only loWrd of L) pl4 S ph4 #0 ~FixRatio dx,L dx/L -> cos_th pl4 cos_th ph4 #0 ~FixRatio dy,L dy/L -> sin_th pl4 sin_th ph4 #0 ~FixMul S,cos_th pl4 tm22 S * cos_th -> tm22 ph4 #0 ~FixMul tm22,Fix_2 pl4 tm11 S * cos_th * 2 -> tm11 ph4 #0 ~FixMul S,sin_th pl4 tm21 S * sin_th -> tm21 ph4 #0 ~FixMul tm21,Fix_Neg2 pl4 tm12 S * sin_th * -2 -> tm12 rts Transform entry ph4 #0 ~FixMul px,tm11 pl4 temp ph4 #0 ~FixMul py,tm12 pl4 temp2 ADD4 temp,temp2 ph4 #0 ~Fix2Long temp pl4 temp add2 temp,xx,pxx ph4 #0 ~FixMul px,tm21 pl4 temp ph4 #0 ~FixMul py,tm22 pl4 temp2 ADD4 temp,temp2 ph4 #0 ~Fix2Long temp pl4 temp add2 temp,yy,pyy rts Fix_2 ds 4 Fix_Neg2 ds 4 temp ds 4 temp2 ds 4 dx ds 2 dx2 ds 4 dy ds 2 dy2 ds 4 L ds 4 LONG, INTEGER ex dc i2'16' INTEGER s ds 4 FIX cos_th ds 4 FIX sin_th ds 4 FIX end TransData data tm11 ds 4 FIX tm12 ds 4 FIX tm21 ds 4 FIX tm22 ds 4 FIX px ds 4 FIXed points from primitive def py ds 4 pxx ds 2 Integer Results from Transform Proc pyy ds 2 count ds 2 doubleBData dc i2'2' dc i2'0,0,0,-1,0,16,0,-1' FIX '0,-1,16,-1' dc i2'0,0,0, 1,0,16,0, 1' FIX '0, 1,16, 1' hatchData dc i2'9' number of line segments dc i2'0, 0,0,-1,0, 0,0,1' FIX ' 0,-1, 0,1' dc i2'0, 2,0,-1,0, 2,0,1' FIX ' 2,-1, 2,1' dc i2'0, 4,0,-1,0, 4,0,1' FIX ' 4,-1, 4,1' dc i2'0, 6,0,-1,0, 6,0,1' FIX ' 6,-1, 6,1' dc i2'0, 8,0,-1,0, 8,0,1' FIX ' 8,-1, 8,1' dc i2'0,10,0,-1,0,10,0,1' FIX '10,-1,10,1' dc i2'0,12,0,-1,0,12,0,1' FIX '12,-1,12,1' dc i2'0,14,0,-1,0,14,0,1' FIX '14,-1,14,1' dc i2'0,16,0,-1,0,16,0,1' FIX '16,-1,16,1' wedgeBData dc i2'3' dc i2'0,0,0,0,0,16,0,-2' dc i2'0,16,0,2,0,0,0,0' dottedBData dc i2'4' dc i2'0, 0,0,0,0, 2,0,0' FIX ' 0,0, 2,0' dc i2'0, 4,0,0,0, 6,0,0' FIX ' 4,0, 6,0' dc i2'0, 8,0,0,0,10,0,0' FIX ' 8,0,10,0' dc i2'0,12,0,0,0,14,0,0' FIX '12,0,14,0' tripleBData dc i2'3' dc i2'0,0,0,-2,0,16,0,-2' FIX '0,-2,16,-2' dc i2'0,0,0, 0,0,16,0, 0' FIX '0, 0,16, 0' dc i2'0,0,0, 2,0,16,0, 2' FIX '0, 2,16, 2' wHatchData dc i2'9' dc i2'0,0,0,0,0,0,0,0' dc i2'0,2,$C000,-1,0,2,$4000,0' dc i2'0,4,$8000,-1,0,4,$8000,0' dc i2'0,6,$4000,-1,0,6,$C000,0' dc i2'0,8,0,-1,0,8,0,1' dc i2'0,10,$C000,-2,0,10,$4000,1' dc i2'0,12,$8000,-2,0,12,$8000,1' dc i2'0,14,$4000,-2,0,14,$C000,1' dc i2'0,16,0,-2,0,16,0,2' cchainData dc i2'2' ...not really a c chain any more... dc i2'0,0,0,0,0,16,0,0' FIX '0,0,16,0' dc i2'0,3,0,3,0,13,$FF00,2' FIX '3,3,13,2.9' end