-not a Macintosh disk-F"GDPaPGDPa%a%vaBH@%_kNF,  8!"@$|Gn"`I N.@A,H<( F<B<H111Bx<kNNF`, 8! "NH@"|J(g g`LNu"_ |a||a0@||9݁g|w|a||NH瀀 |(_@"g2<@gBA?N`Fa`||aPLNu  fBR$N"NBH@&|݁ |B$<0HN~NL@dBgg>N&|)`RNuBBBA*2h/ BBB N _"_$_"H&|݁ |B$<0NNd 0<`L$|J HA H  2I<FFI<<FFfHHFFfHHH?B@L"_2N _0H 2<@I6@o Az:<2`6@oJA~:<26" @n2BDBB(`EB@nAJEkz`z2<HAIL0.NL0.N  / p? O@ 0  0  XO _,_2_!.NBBB/ BBBN08 @ gNu@ f"_E!NH\O/ ?`@&x|N _!@"|xEx En"`CE"|xN"Ҹ< A  33"|@E E4n"`C&E"|@.N _LHNFLN*8&E@CJJKK f`  f `><$CS*<F|4>BRIBC Gff&<CBSC`D GnKG45BQf` f `Ns |0< BXHQ!4 _$_"_!XOHH/8/ $ f0<? QN ! N.x $_$ g ! N.x !C !!LLyp!N\OFN  l0P߀ Aǀ`  6lo6@ 0_an*>]> j 56, l602  ۰Poo A` &ll6p@ 0?۷a?^ ꭕ 5o6, l602 8!ED91kE"0369? CoNGNOS BOOT FAILED TRY A NEWER MACHINE AND BOOT PROM _"_NN o0<BAN o0 _PON _"_$|0<J"PJQN _"_$|0<"PJQNHL$ orD?|?@?e\SFk!!QSWk:CL<HL|hH>L|4H>L|H>SWjTO>SGk\!Q`TSFk QSWk8L|H|L|H|4L|H|hL|H|LSGkQLx _O NNVH8=| f=|G* G, &N(N n"n$n 0.  S@ZeJ S@BBDBG S@gg.BC CJDg720faL`fa:` 320f8<S@`JDg  fa$` fa`  U@o$SBjt`(N&N><`JGg (Ev#$#$QNukJDg`g 3$f(N`BnLN^ _NUNPACK NV;n N^.NuEVINIT NVH,. ^J]g n0`4B?N. f n0`/.//. /.N(n)FLN^ _NEAD_BLONV/ (n Jno./.?././ /.Nj nJPg`RSn`(_N^ _NEAD_SEQHNT"|E.|r |BBByBygRBf~NuLHPPNqNqpS_n.0<QLHPPNqNqpS_n|~By&JM*Np|azJGfb|a|,Mpa`JGfH|a<<AaJGf0Avtp BQvr BQH@02N\LhL"4NtB@6Kd a"JDf`02IP g a JDf`Nub SBg pxNuBDNu><Nu4< vB@bp2IPSCfSBfNuppB@(4<dBC(4< CBC(C"H4<BACSBf(CAg><NuJoNV?-Nh.H|)?NpN^ _TONRAP NV.HgVS@g`J.f& -XмS//<N(/<N+_X-mX . ѭX -Xo<Np`B . TJ.f/-T/<N/<N+_T-mT -Tl<N,N^ _PONGETSPACNV .мS//<N/<NJ-_ .=@ N^.NuINDSPARNVH.. Bg/N0Hހ m0.@I/./<N( 8//<N @n ?.Bg?<BgN(LN^ _ NETMMU NV0. S@g S@gS@g`=|`=|` =|`BnN^ _\ONONV_DEVNVH nCJp"S@n2BgHnNE g BgNN=_   nV@g8B. Bmh|` @BvRF Fo mXf=|;|@`Bm@`|BgN;_hBgN> Ggd G] G^g$ GdfBgN;_@BgN>`<ND`.BgN8JD] D^g<N$ @=BgN>`|`.H@ABpR. .oBg?./N;_"Bg?./Nz;_,Bg?./Nj;_.Bg?./NZ;_0-| nBPLN^.NuEAD_CONNVH nCJp"S@n~`LH6p@J@^H6pA A_gH6p@H"AA1`H @ABpR o;nh0.H@;@@A r<Ё(@&|H@6LN^.NuROCESS_NVLH nCJp"S@n2BgHnNAx/NAx/HndNJndV nxVgB-e`|e  gHnxNA&HA(AL,*<Hnf?-Z E0-NPH///NJnfg<N(A(H/ HndN.JndV TVg B-fmeg`l-eg*0.zlW"-BWD@f-f @g` B-g -Bf|f/ N`B-f  -e -fg/ NLN^.NuNIT_CONNVH+| \+|l+|(|+|t+|+|l+|(|;TN(|;TZ(|;TX&| n!SLN^.NuETVARS NVH/Nt;| ./+@ .м/м+@+|X*<(< E"D +@T&|?-Z0-NS?NHnHmBNJngp+@BAC6 0HnNBBg/-BgN+_ -Э+@PBB<0<H/BgNZN<+_H+mHBG` m @I G~V GTVgd Gl|p@ @8`$ Gf|p@BT`| p@BT H< @"@=A?.??<BgNJRG Gox mI|p@BT mIP|p@/-H/<N 8LN^NuOOTINIT system.configNVH(nB BgN@BgN8HH,BgNp0HѬ f,/, NBgNBgNHH,BgN>0HѬ f,/, NZBgNBgNHH,BgN 0HѬ f:J`f< N/, NBgNBgNHH,BgN0HѬ g<NHBN,BN+_ n/BN  _r Ё0p//-XN /-/-XN&mX:=E E0o<N0<H+@d+| -dЭ\ n2HҀ -Ё"-Ҁ(Bg Э/N0Hѭ -Є+@B</-BgN+_+m` -\Э`+@h -dЭh, n0HІ+@ -Э+@ -Э+@?<f/-/-?<N^-m/ /./-N n LN^ _ NUILD_SYNVH(nBGBF. gB `P-n n0. PoB."` n0. A-H&n/+/<N&  n0>+<+/, N$BgNBgNHH-@BgN0H(٬ JVJ_gB."`4JGW WJGV WgJFf n `H n n/B."n/BgN.  _ BN-_JGf n Q/ n P/N` Q@H/ n P/N|B. n=h-nA-H n-P/./.p/NJGgR-m`Bg n/( n r Ё/ n P/ nP/ | ? Q@?N9_Jlg< N( nQ f|"LN^ _NOADSEG NV/ BBg/-lBgN+_p -p"-Ҁ+Al(|`p}//<N -Пp((|p}//<N -Пp(?<}/-p/-l?<N(_N^.NuLLOC_SCNVHAC 0BgHnN __m_^+m-^gBBg/-BgNX+_`+m-_gBBg/<BgN4 м,BgBgBHnBgHnHnBg/.N g<NACD 0BgHnN p g B-n`.BgBgBHnBgHnHnBg/.N g<Nn .@+@n -Эn+@j` B -@+@n -м@+@j?</-n/-j?<NH <逐n.JfB` .ЇP-@JfB` .ЇP-@-_g -Ї/ -Ї//./.N\`/-/-BBNJ(|p((|t(LN^.NuOAD_DEB SYSTEM.DEBUG2 SYSTEM.DEBUGNVH nCJp"S@n2&n (nBBgHnN gZB /, N BgN FBgN >HH(BgN v0H* f&.B</BgN&B /, N ~//N LN^ _ NOAD_UNPNVBgBgBHn</. /.Bg/.N g<NN^ _ NOAD_LLDNVH(n 0-F|>Jg,, .* Ю(H//<N ( Д-@`,.(.H//<N p-_?//?<N6 .P/N LN^ _NNSTALL_NVH(n=n ~`/, N dBgN _BgN HH(BgN 0H-@Jg .Ѭ `<N .fBN 4(BN ,( GfAqB0pB5pB`ACZ 0z`BgN f_ .ARE EoHn?<?<HnN AC 0HnHzNdg(AqB0pp @A^B @AB`2HnHzN,gAqB0pB5pB`Aqpp| 5pgnBg?/.Hn @AHp @A^Hp</.Nd g<NN?. @A^/0 @A"0Ҽ/?<NPRGinoLLN^ _ NOADCODEkrni NVBBg/-BgN +_?<e/-/-?<NN^.NuAKESUPSNVH(m . R A T&@-kLN^ _ NINDMAINNVBg/-|NN0Hѭ|B</-|BgN+_?<g/-/-|?<NdBg/-tN0HѭtB</-tBgNF+_x?<{/-x/-t?<N*N^.NuREATEOPNV/Jmho@ mFhomFh0-hH.//<N .0<AHЭX"-ToT.N^.NuONFIG_DNV A0C ArC 0AC 0/NHnHm`/NBgHn0N g< N0HnHn/NfBgHnrN g<N/NBg/.Hn$/N;_F/./.Hm`/Nh-MgN/.$?-F/N/N n /B/.$0-FH//N  _ /N&/NN^ _PONOADSYS $ SYSTEM.UNPACK SYSTEM.OS SYSTEM.LLDN NV,_NUTN z+|T mT PVD@MN0HmHmNHm?- -tЭx//-NNިNRN]N (NuN^NuOADER NVHAT(HA<&HHn?-0-H".Ҁ// / N Jng<NLN^.NuEAD_PAGNV0.H H"-"Ҁ-A0.H H@J@=@/.NvAT0.HЈ-@ N^ _TONIND_SENNVH n-h .S/0-H/N ;@8-n p+@4;m:BF` ATIBBlRF Fo=mA-HA<-HBE n0-HА(BnJf<NHn?-0-HЄ//./.NJng<NxBGA0.HЈ&@Bn=knnZ Eo<NJ ATI ( 9s Jlf<N0,n0.ްm8o`RERG`(-L`HLN^.NuPEN_FILNVH(n| @=@~`84p@k|nAP2IDA0 <f 4pAFRGinoLN^.NuHIFTNAMNVH(n @:JEnBn`pp4A4P@R@H. Eo U@<`BFJFo$ R@4A T@4BRBHށSF`Jl D./0.H/N =@LN^ _\ONDHASH NV~H n CJp"S@n2BA&/Nb 8<-HnNBgHn?-N>H/p6/NNBp6/A/NdACp S@n0HnN^J.gHHnHnN .Wgz n/B?.N~  _ `SFRGmfBGBNJFfELN^ _PONOOKUP_ENVH;n ;m?.?-N;nBNAT(HJg<N;l~+l";l ;l;l;lB?,N&_+S&+k*+k.LN^.NuNITMEDINVBg/.HnNr_n .gB/.N-_N^.NuPENINPUNVH(.BGBF Go<N AT:0JEf<N EHl@ ATH"Ұ n n Jf<NHH " n ``RGE`LN^ _ NIND_POSNV-m4/.0-H/N+_4J4]2-8H4]g<N&0-H/-4/Nl .;@: -4g/-4HnHnN/.NN^.NuILLBUF NV0-:mf -4R2-H//NNT0-:ATpRm:N^NuETBYTE NVHBgNHH<BgNH>JGl H м> G=@LN^NuETWORD NVHBgN0H//<N~,BgN0H.Jl޼ Ї-@LN^NuETLONG NVH,. 0-m:>HǼl>JGo0-:ATA//.H/N$H߮Hǜm:0-HnJ4]2-8H4]g<N -4R/HnHnNn-nA<(H/0-H/N*l-EJoZHn?-0-H".Ҁ/?././ NJng<N0-H/./NV(ٮ .Ѯ .ѭ4`:Jo -4R2-H//N"NhJfLN^ _PONOVEMULT//0/2/ AH@B@2/Ё/@" /WXNu// /"/ N2/A" /WXNu// /"/ N/@" /WXNuH>*jD,jD$&BBx㉰mRSDlJjDjDL|NuH0/ oC"4JBAR`$aJBBB`QQ oC"0/H#//IL._NuH oJB@BA"o JBBBlBA`$HR` fQ`RS@`?A"/oL\NuH o0/2/SA"o JBBA@m`Q/o L NuB`$_02 _ @o0 Ao*BBAm"6@SCBoSA`@"H`RCoN$_0"_ _J/ S@m*BABB@m6B$I”@`!Q`QNuHr`HBA oJ"oJB@f`fQ AA/oL\NuH"o J oJv`:H"o J oJBC`&H o J"oJv`H o J"oJBCB@BA@m4`4`fQ@n C`cC"/oL\NuNuNuJoNu3%WMacSupplement 2 (Feb 85)&;f/Nt0. @ g0@#g2S@g6U@g:_@W4*`$kT@kW $&$N LpLTT>L(`n$,`<0 (0!@d"r<# $ % &'&( rootcatalogːHp8*4:2W  TLAsm/PrEqu.texthEqu.text 3.0only/intrfc/SaneLib.textib.texserial/Async/Mac.objsync/Macserial/Async/MacXL.objync/MacTLAsm/ToolTraps.textolTraps.TLAsm/QuickTraps.textickTrapsTLAsm/SysTraps.textsTraps.tTLAsm/SysTraps.textsTraps.t3.0only/obj/SaneLib.objLib.objtexTLAsm/FSEqu.texthEqu.text 3.0only/obj/SaneLibAsm.objAsm.objdefProcs/SBarCDef.textSBarCDe TLAsm/SysErr.texthsErr.texTLAsm/ToolEqu.textholEqu.tedefProcs/ButCDef.text/ButCDefdefProcs/RDocWDef.textRDocWDeTLAsm/SysEqu.text-#2#2Z̨TLAsm/QuickEqu.textickEqu.t TLAsm/SaneMacs.textneMacs.tdefProcs/WDef.textN N^.WorkShop.TempNZ:.TLAsm/PackMacs.textckMacs.t defProcs/MDef.texth/MDef.teserial/AsyncR.texthsyncR.tedefProcs/WDef.textN N^.4 yN^:3>10&NV n 8 L8defProcs/ButCDef.text/ButCDefΞ3%W&O͞:3&10!& &defProcs/MDef.texth/MDef.teΞ3%W&N/:3+1/* *defProcs/RDocWDef.textRDocWDeΞ3%W&M:3110* *defProcs/SBarCDef.textSBarCDeΞ3%W&H:381/@ @TLAsm/FSEqu.texthEqu.textΞ3%W&fQ42 >TLAsm/PackMacs.textckMacs.tΞ3%W&Q2|:2 LTLAsm/PrEqu.texthEqu.textΞ3%W&ߠQ42 `TLAsm/QuickEqu.textickEqu.tΞ3%W&Q42  nTLAsm/QuickTraps.textickTrapsΞ3%W&R2}2  TLAsm/SaneMacs.textneMacs.tΞ3%W&0R2}U2 0 03.0only/intrfc/SaneLib.textib.tex8}y:3NV n  TLAsm/SysErr.texthsErr.texΞ3%W&[2~"2  TLAsm/SysTraps.textsTraps.tΞ3%W&栳R (TLAsm/ToolEqu.textholEqu.teΞ3%W&q42 2 @2TLAsm/ToolTraps.textolTraps.Ξ3%W&;Y rserial/Async/Mac.objsync/MacΞ6=*W&5i:3C5 serial/Async/MacXL.objync/MacΞ6=+W&5:3G5 serial/AsyncR.texthsyncR.teΞ6=,W&6H:3K6I TLAsm/SysEqu.text-#2#2Z̨̞8yt;82 NV n J J3.0only/obj/SaneLib.objLib.objtex8~y-:3-NV n  3.0only/obj/SaneLibAsm.objAsm.obj8y- :3!-bNV n  example/SineGrid.textid.text_PONО8y9:a9NV n  example/SineGridR.textdR.textPONО8y9ϧ:e9ϨNV n   W^å9P:H r^՞10#W̙IS'X. &W.*.,hh*ISAGC>2ISAh >AA2ISAhA2>64; ;File defProcs/WDef.TEXT ;-------------------------------------------------------------------------- ; ; Window Definition Routine for the ; MacIntosh Window Manager ; ; written by Andy Hertzfeld Aug 4, 1982 ; ; (c) 1982 by Apple Computer, Inc. All rights reserved. ; ; This file contains the window definition procedure ; "DocumentProc", the standard Mac window type. It is ; a rectangular window with a title bar. It is assembled ; part of the window manager. ; ; Modification History: ; ; 21-Aug-82 AJH Made DocumentProc support rectangular windows only ; 30-Aug-82 AJH Added growIcon hit detection, fixed hit to exclude perimeter drag ; 07-Sep-82 AJH Added handler for grow message ; 12-Sep-82 AJH Made it so proc doesn't have to calcRgns when not visible ; 20-Sep-82 AJH Added go-away button drawing and hit-testing ; 25-Sep-82 AJH Added cheap dialogBox window definition proc ; 28-Sep-82 AJH New GoAway button; restructured goAway drawing ; 05-Oct-82 AJH Removed Init message to save code ; 06-Oct-82 AJH Fixed dialogBox dragRgn bug ; 10-Oct-82 AJH Converted to QuickDraw trap interface ; 16-Oct-82 AJH Fixed GoAway hit-test origin bug ; 17-OCt-82 AJH Made both windowProcs preserve A1 ; 07-Nov-82 AJH Changed DocumentProc hiliting to Lisa way ; 14-Nov-82 AJH Improved shape of Grow outline ala Lisa ; 16-Nov-82 AJH Made branch table offset-based to save space ; 16-Nov-82 AJH Special-cased hiliting of small windows ; 20-Dec-82 AJH Changed title bar to 20 pixels tall ; 24-Dec-82 AJH Made wProcAsm a separate assembly ; 17-Mar-83 AJH Added third variant -- shadowless dBoxProc ; 27-Apr-83 AJH only plot, hit-test goAway if window is active ; 25-Jul-83 SC Fixed third variant -- frame was incorrect, see DrawDBox ; 06-Aug-83 AJH changed hiliting to use pattern ; 09-Aug-83 AJH added draw grow icon message receiver ; 20-Aug-83 AJH made it only hit-test or draws goAway if window is active ; 29-Oct-83 AJH new dBox border ; 10-Nov-83 AJH added variant 4 -- just like variant 0, but no inGrow ; 24-Dec-83 AJH fixed structRgn calc bug in variant 1 ; 24-Feb-84 AJH fixed hit-testing of go-away -- was off by 2 ; 02-Feb-85 HAA changed INCLUDEs to use new TLAsm file names ; ;---------------------------------------------------------------------------- 0.INCLUDE TLAsm/SysEqu.text 0.INCLUDE TLAsm/SysTraps.text 0.INCLUDE TLAsm/QuickEqu.text 0.INCLUDE TLAsm/ToolEqu.text 0.INCLUDE TLAsm/QuickTraps.text 0.INCLUDE TLAsm/ToolTraps.text ; 0.PROC WDEF,0 ; ; FUNCTION DocumentProc(selector: INTEGER; ; window: WindowPtr, ; message: INTEGER; ; parameter: LongInt): LongInt ; DocProc 0BRA.S DP1 ; ; standard header ; 0.WORD 0 ;flags word 0.ASCII 'WDEF' ;resource type 0.WORD 0 ;resource ID 0.WORD 2 ;version number DP1 0LINK A6,#0 ;set up a stack frame to address parameters 0MOVEM.L D3-D6/A1/A3-A4,-(SP) ;save work registers ; ; fetch the parameters into registers ; 0LEA 8(A6),A0 ;get ptr to first parameter 0MOVE.L (A0)+,D3 ;get param in D3 0MOVE.W (A0)+,D0 ;get message 0MOVE.L (A0)+,A3 ;get the window pointer 0MOVE.W (A0)+,D5 ;get the selector integer 0MOVE D5,D6 ;keep copy in D6 0AND #3,D5 ;ignore "inGrow" variant 0CLR.L (A0) ;clear out function result ; ; case out on the message number ; 0ADD D0,D0 ;double for word index 0LEA GoDocProc,A0 ;get jump table address 0ADD.W GODOCPROC(D0),A0 ;compute dispatch address 0JSR (A0) ; ; we're done -- restore registers and return to caller ; 0MOVEM.L (SP)+,D3-D6/A1/A3-A4 ;restore work registers 0UNLK A6 ;unlink stack frame 0MOVE.L (SP)+,A0 ;get return address 0ADD #12,SP ;strip parameters 0JMP (A0) ;return to caller ; ; DocumentProc dispatch table -- entries must be long branches! ; GODOCPROC 0.WORD DrawDoc-GoDocProc ;draw is message 0 0.WORD HitDoc-GoDocProc ;hit test is message 1 0.WORD CalcDoc-GoDocProc ;calc test is message 2 0.WORD DoneDoc-GoDocProc ;it doesn't need init 0.WORD DoneDoc-GoDocProc ;it doesn't need dispose 0.WORD GrowDoc-GoDocProc ;grow message is #5 0.WORD DrawGIcon-GoDocProc ;draw grow icon is #6 ; ; DrawDoc -- draw the document window. The windowPtr is in A3 ; DrawDoc 0TST.B WVISIBLE(A3) ;is it visible? 0BEQ DoneDoc ;if not, don't do anything ; ; see if its a EORGoAway call and special case it ; 0CMP #wInGoAway,D3 ;is it a goAway call? 0BEQ EorGoAway ;if so, go handle it ; 0_PenNormal ;we want the normal pen 0TST.W D5 ;test dialogBox flag 0BNE DrawDBox ;dBox window has no title bar ; ; derive the titleBar rectangle from the structRgn and keep it in TempRect ; 0BSR BuildTBarRect ; ; draw the title bar ; 0PEA TEMPRECT ;tempRect bounds the title bar 0MOVE.L (SP),-(SP) ;make another copy of tempRect pointer 0MOVE.L (SP),-(SP) ;and yet another 0_FrameRect ;frame the title bar 0MOVE.L OneOne,-(SP) ;push inset factor 0_InsetRect 0_EraseRect ;clear the inside ; ; hilite the title bar by filling it with specified pattern ; CheckHilite 0TST.B WHILITED(A3) ;is it hilited? 0BEQ.S DrawTheTitle ;if not, just draw the title 0PEA TEMPRECT ;push the title rect 0MOVE.L (SP),-(SP) ;push a second copy 0MOVE.L #$00030001,-(SP) 0_InsetRect ;inset it some 0MOVE.L (A5),A0 ;get grafGlobals 0MOVE.L TempRect,D0 ;get topLeft 0AND.L #$00070007,D0 ;only use mod 8 0MOVE.L D0,PatAlign(A0) ;get up patAlign 0PEA HilitePattern ;push the pattern address 0_FillRect ;fill the titleBar with the pattern ; 0MOVE.L (A5),A0 0CLR.L PatAlign(A0) DrawTheTitle 0BSR DoTitleString ;draw the centered Title ; ; plot the goAway button, if necessary ; 0TST.B WGoAway(A3) ;is the a goaway button? 0BEQ.S DrawBody ;if not, skip ; 0TST.B WHilited(A3) ;only plot goAway if hilited 0BEQ.S DrawBody ;if not, don't plot goAway 0BSR BuildTBarRect 0LEA GoAwayData,A1 ;get the goAway symbol 0MOVEQ #srcCopy,D1 ;plot in srcCopy mode 0BSR PlotGoAway DrawBody 0MOVE.L OneOne,D4 ;constant for shadowing ; ; frame the body of the window ; DrawFrame 0MOVE.L STRUCTRGN(A3),A0 ;get region handle 0MOVE.L (A0),A0 ;get region ptr 0LEA RGNBBOX(A0),A4 ;point A4 at the bounding box 0SUB D4,Bottom(A4) ;inset the bottom (ignore shadow) 0SUB D4,Right(A4) ;inset the right to ignore shadow 0MOVE.L A4,-(SP) ;push bounding box 0_FrameRect ;frame the body ; ; draw the drop shadow (for variant 0 and 3) ; 0CMP #3,D5 ;variant 3? 0BEQ.S @3 ;if so, paint it 0TST.W D5 ;variant 0? 0BNE.S @1 ;if not, skip @3 0BSR PaintDropShadow ;paint the drop shadow ; ; draw fancy for dialog box ( only for variant 1) ; @1 0CMP #1,D5 ;dialog box? 0BNE.S @2 ;if not, skip 0MOVE.L (A4),TempRect ;copy bounds into tempRect 0MOVE.L 4(A4),TempRect+4 0PEA TempRect 0MOVE.L (SP),-(SP) ;copy it 0MOVE.L (SP),-(SP) 0MOVE.L OneOne,-(SP) 0_InsetRect ;inset it 0MOVE.L #$000A000A,-(SP) ;set pen size 0_PenSize 0MOVE.L (A5),A0 0PEA White(A0) 0_PenPat 0_FrameRect 0MOVE.L (A5),A0 0PEA Black(A0) 0_PenPat 0MOVE.L #$00020002,-(SP) ;push inset factor 0MOVE.L #$00020002,-(SP) ;push new pen size 0_PenSize ;set new pen size 0_InsetRect 0PEA TempRect 0_FrameRect ;and frame it 0_PenNormal @2 ADD D4,Bottom(A4) 0ADD D4,Right(A4) DoneDoc 0RTS HilitePattern 0.WORD $FF00,$FF00,$FF00,$FF00 ; ; BuildTBarRect builds a rectangle enclosing the titleBar in TempRect ; BuildTBarRect 0LEA TEMPRECT,A0 ;get pointer to tempRect 0MOVE.L STRUCTRGN(A3),A1 ;get structure region handle 0MOVE.L (A1),A1 ;get strucRgn pointer 0ADDQ #RGNBBOX,A1 ;point A1 at the bounding box 0MOVE.L (A1)+,(A0) ;copy bounding box into tempRect 0MOVE.L (A1),4(A0) ; ; make bottom := top + 19 ; 0MOVE Top(A0),D0 ;get top 0ADD #19,D0 ;compute top+19 0MOVE D0,Bottom(A0) ;update bottom 0SUBQ #1,Right(A0) ;inset right 0RTS ;return to caller ; ; EORGoAway hilites/unhilites the goAway button. It falls through into PlotGoAway ; EorGoAway 0BSR.S BuildTBarRect ;build the bounding rect 0LEA GoAwayData,A1 ;get the bitMap 0ADD.W #32,A1 ;bump to the EOR Mask 0MOVEQ #2,D1 ;set EOR as the plot mode ; ; PlotGoAway plots the goAway button. A1 holds the symbol, D1 the plotting mode ; PlotGoAway 0LEA TempRect,A0 ;get pointer to tempRect 0MOVE Left(A0),D0 ;get left edge 0ADDQ #7,D0 ;leave some margin 0MOVE D0,Left(A0) ;update left 0ADD #16,D0 0MOVE D0,Right(A0) ;update right ; 0MOVE D1,D0 ;set plotting mode 0ADDQ #2,TempRect+Top 0SUBQ #1,TempRect+Bottom 0MOVE.L #$00100010,D1 0BSR PlotSymbol ;plot it in tempRect 0BSR.S BuildTBarRect ;rebuild tempRect 0RTS ; ; DialogBoxes have no title bar and extra shadow ; DrawDBox 0MOVE.L #$00020002,D4 ;get shadow factor 0CMP.W #3,D5 ;does it have shadow? 0BEQ.S DrawFrame ;if so, we're cool 0MOVEQ #0,D4 ;otherwise no shadow 0BRA.S DrawFrame ;go draw it ; ; DoTitleString is the common code that draws the title centered in tempRect. Warning -- ; it trashes D3. ; DoTitleString 0BSR BuildTBarRect ;calculate title bar rect ; ; compute indent factor based on GoAwayButton state ; @1 MOVE.W TempRect+Right,D3 ;get right 0SUB.W TempRect+Left,D3 ;compute width ; 0SUB.W WTITLEWIDTH(A3),D3 ;compute extra x 0ASR.W #1,D3 ;divide by 2 ; ; if there's a goAway button, make sure the margin is at least 32pixels ; 0TST.B WGoAway(A3) ;is there a go away button 0BEQ.S @2 ;skip if there's not 0TST D3 ;is it negative? 0BMI.S @3 ;if so, pin at 32 0CMP.W #32,D3 ;if goAway button, must have some margin 0BGT.S @2 @3 MOVEQ #32,D3 ; @2 ADD TempRect+Left,D3 ;compute x position 0MOVE.W D3,-(SP) ;and push for MoveTo ; 0MOVE TempRect+Bottom,-(SP) ;push bottom 0SUBQ #5,(SP) ;leave room for descenders 0_MoveTo ; clear it out if it was hilited 0TST.B WHilited(A3) ;was it hilited? 0BEQ.S @4 ;if not, skip 0SUBQ #6,D3 ;indent to the left 0MOVE D3,TempRect+Left 0ADD.W WTitleWidth(A3),D3 ;add in the length 0ADD #12,D3 ;indent on right 0MOVE D3,TempRect+Right 0SUBQ #2,TempRect+Bottom ;protect bottom line (in business) 0PEA TempRect 0_EraseRect ;erase it ; ; draw the string ; @4 0MOVE.L WTITLEHANDLE(A3),A0 ;get titleHandle 0MOVE.L (A0),-(SP) ;push title pointer 0_DrawString ;draw it ; DoneDString 0RTS ;all done drawing title... ; ; BitMap for default GoAway button ; GoAwayData 0.WORD $0000,$0000,$BFFB,$2008 0.WORD $A00B,$2008,$A00B,$2008 0.WORD $A00B,$2008,$A00B,$2008 0.WORD $BFFB,$0000,$0000,$0000 ; Mask for goAway button ; 0;.WORD $0000,$0000,$FFF4,$4110 0;.WORD $C934,$4550,$C014,$5C60 0;.WORD $C014,$4550,$C934,$4110 0;.WORD $FFF4,$0000,$0000,$0000 ; .WORD $0000,$0000,$0000,$0118 ; .WORD $093C,$0558,$001C,$1C68 ; .WORD $001C,$0558,$093C,$0118 ; .WORD $0000,$0000,$0000,$0000 0.WORD $0000,$0000,$0000,$0100 0.WORD $0920,$0540,$0000,$1C70 0.WORD $0000,$0540,$0920,$0100 0.WORD $0000,$0000,$0000,$0000 ; ; ; HitDoc -- perform a hit test on the document. On entry, D3 contains the mousePoint ; in global coordinates while A3 holds the window pointer ; HitDoc 0MOVEQ #16,D4 ;keep 16 in a register to save code 0CLR.W -(SP) ;make room for function result 0MOVE.L D3,-(SP) ;push the mouse point 0MOVE.L CONTRGN(A3),-(SP) ;push content region handle 0_PtInRgn ;is the point in the content region? 0TST.B (SP)+ ;well, is it? 0BEQ.S NotInContent ;if not, go check out drag region ; ; its in the content region -- see if its in the grow icon area ; 0TST.W D5 ;is it a dialogBox? 0BNE.S justContent ;if so, its only in the content 0SUBQ #3,D6 ;inGrow enabled? 0BGT.S justContent ;if not, skip 0TST.B WHilited(A3) ;is it active? 0BEQ.S justContent ;if not, it cant be in grow ; 0MOVE.L ContRgn(A3),A0 ;get region handle 0MOVE.L (A0),A0 ;get region ptr 0MOVE.L RgnBBox+botRight(A0),D0 ;get bottom left of content ; ; first consider the x coordinate ; 0SUB D4,D0 ;offset x by 16 0CMP D0,D3 ;if <, just in content 0BLT.S justContent ; ; its within range on x so try y ; 0SWAP D0 0SUB D4,D0 ;check out y dimension 0SWAP D3 0CMP D0,D3 ;compare y coordinates 0BLT.S justContent ; 0MOVEQ #wInGrow,D0 ;flag in grow Icon 0BRA.S DoneHitDoc ; ; the point is in the content region so return a '1' ; justContent 0MOVEQ #wInContent,D0 ;return in content 0BRA.S DoneHitDoc ;go store function result and return ; ; its not in the content -- see if its in the dragRgn (content extended by titleBar) ; NotInContent ; 0TST D5 ;is it a dialogBox? 0BNE.S DoneHit1 ;dBoxes have no drag region ; 0CLR.W -(SP) ;make room for function result 0MOVE.L D3,-(SP) ;push the mouse point 0MOVE.L ContRgn(A3),A4 ;get content region handle 0MOVE.L (A4),A4 ;get region ptr 0ADDQ #RgnBBox,A4 ;get bounding box ptr 0SUB #19,Top(A4) ;make it 19 higher 0MOVE.L A4,-(SP) ;push the rect 0_PtInRect ;is the point in the title bar? 0ADD #19,Top(A4) ;fix up content bounds ; 0TST.B (SP)+ ;examine result 0BEQ.S DoneHit1 ;if not, return 0 (do nothing) ; ; see if its in leftmost 16 of drag, which is the goAway button ; 0TST.B WHilited(A3) ;is it hilited? 0BEQ.S ItsInDrag ;if not, can't be in GoAway 0TST.B WGoAway(A3) ;is there a goAway button? 0BEQ.S ItsInDrag ;if not, skip 0MOVE D3,D0 ;get mousePt 0ADD PortBounds+Left(A3),D0 ;convert to local 0SUB PortRect+Left(A3),D0 ;compensate for origin 0CMP #18,D0 ;is it too far right? 0BGT.S ItsInDrag ;if so, its in drag 0SUBQ #8,D0 ;it must be at least 6 0BMI.S ItsInDrag ; ; its in the goAway button so signal it ; 0MOVEQ #wInGoAway,D0 0BRA.S DoneHitDoc ; ItsInDrag 0MOVEQ #wInDrag,D0 ;flag in drag region DoneHitDoc 0MOVE.L D0,20(A6) ;update function result DoneHit1 RTS ; ; CalcDoc -- calculate the structure and content regions for the window pointed ; to by A3. ; CalcDoc 0LEA TEMPRECT,A0 ;get a pointer to the work rectangle 0MOVE.L A0,-(SP) ;push for later offset 0MOVE.L PORTRECT(A3),(A0)+ ;copy topLeft of portRect 0MOVE.L PORTRECT+4(A3),(A0) ;copy botLeft of portRect ; ; offset it to global coordinates ; 0MOVE.L PORTBOUNDS(A3),-(SP) ;push topLeft of port.portBits.bounds 0NEG 0(SP) ;negate offset 0NEG 2(SP) ;both words 0_OffsetRect ;offset tempRect to global coordinates ; ; make the rectangular content region ; 0MOVE.L CONTRGN(A3),-(SP) ;content region gets the esult 0PEA TempRect ;tempRect is the rectangle 0_RectRgn ;go make the region into content region ; ; now do the structure region. First correct the bounding rectangle (tempRect) for ; structure instead of content ; 0MOVE.L #$00020002,D4 ;get the shadow factor for DBox 0MOVE.L STRUCTRGN(A3),-(SP) ;push the structRgn for later 0PEA TEMPRECT ;push a pointer to the rect 0MOVE.L (SP),-(SP) ;make two copies 0MOVE.L MinusOne,-(SP) ;make 1 pixel bigger, all around 0_InsetRect ;make it bigger 0TST.W D5 ;is it dBox? 0BNE.S DoDBoxCalc ;skip if it is 0SUB #18,TempRect+Top ;make top 18 pixels higher 0LSR.L #1,D4 ;adjust shadow factor CalcCommon 0_RectRgn ;RectRgn(structRgn,tempRect) ; ; now add in the 1 or 2 pixel drop shadow (if necessary) ; 0TST D5 0BEQ.S @1 ;if so, it has shadow 0CMP #3,D5 ;is it variant 3? 0BNE.S NoDropShadow ;if not, no shadow @1 0CLR.L -(SP) ;make space for result 0_NewRgn ;allocate new region 0MOVE.L (SP),A4 ;remember it 0PEA TempRect ;push tempRect 0MOVE.L (SP),-(SP) ;save another copy 0MOVE.L D4,-(SP) ;push shadow factor 0_OffsetRect ;offset it 0_RectRgn ; 0MOVE.L StructRgn(A3),-(SP) 0MOVE.L A4,-(SP) ;offset region 0MOVE.L StructRgn(A3),-(SP) ;structure gets the result 0_UnionRgn ;add it in ; 0MOVE.L A4,-(SP) ;we're done with it so 0_DisposRgn ;dispose of it ; ; all done with CalcDocRgns ; NoDropShadow 0RTS DoDBoxCalc 0CMP #1,D5 ;is it variant 1? 0BNE.S CalcCommon 0PEA TempRect ;push our rectangle 0MOVE.L #$FFF9FFF9,-(SP) ;push (-7,-7) 0_InsetRect ;inset it 0BRA.S CalcCommon ;use common code for the rest ; ; GrowDoc handles the grow message by drawing a grow outline based on the rectangle ; passed in D3 ; GrowDoc ; ; first make it one pixel bigger to jibe with the structure ; 0MOVE.L D3,-(SP) ;push the rect 0MOVE.L MinusOne,-(SP) ;push (-1,-1) 0_InsetRect 0MOVE.L D3,A0 ;get rect ptr 0SUB #18,Top(A0) ;make it higher ; 0MOVE.L D3,-(SP) ;push the rectangle 0_FrameRect ;frame it 0MOVE.L D3,A3 ;keep rectangle pointer in A-reg ; ; now that the rectangle is drawn, draw the lower horizontal line ; 0MOVE.W Left(A3),-(SP) ;push left 0MOVE.W (SP),-(SP) ;save for upper line 0MOVE.W Bottom(A3),-(SP) ;push bottom 0SUB #16,(SP) ;really 16 pixels above bottom 0MOVE.L (SP),-(SP) ;make a copy of this point 0_MoveTo ;move to it 0MOVE.W Right(A3),2(SP) ;now go to the right edge 0_LineTo ;draw the horizontal line ; ; draw the upper horizontal line ; 0MOVE.W Top(A3),-(SP) ;push top 0ADD #18,(SP) ;really 18 pixels below top 0MOVE.L (SP),-(SP) ;make a copy of this point 0_MoveTo ;move to it 0MOVE.W Right(A3),2(SP) ;now go to the right edge 0_LineTo ;draw the horizontal line ; ; draw the vertical line ; 0MOVE.W Right(A3),-(SP) ;push right 0SUB #16,(SP) ;really want right - 16 0MOVE.W Top(A3),-(SP) ;push top 0ADD #18,(SP) ;really want top + 18 0MOVE.L (SP),-(SP) ;make a copy of this point 0_MoveTo ;and move to it 0MOVE.W Bottom(A3),(SP) ;now go to bottom edge 0_LineTo ;draw the vertical line ; ; restore the rect back to how it was when we got it ; 0MOVE.L D3,-(SP) ;push the rect 0MOVE.L OneOne,-(SP) ;push (1,1) 0_InsetRect 0MOVE.L D3,A0 ;get it in an A-reg 0ADD #18,Top(A0) ;fix up the top ; 0RTS ;all done! ; ; Utility PaintDropShadow -- drop shadows the rectangle in A4, by the amount in D4 ; PaintDropShadow 0MOVE.L D4,-(SP) ;push shadow factor 0_PenSize ;make penSize = shadow factor ; 0MOVE RIGHT(A4),D0 ;get right of menuRect 0MOVE D0,-(SP) ;push right 0MOVE TOP(A4),-(SP) ;push top 0ADD D4,(SP) ;want top+shadow 0MOVE D0,-(SP) ;push right 0MOVE BOTTOM(A4),D0 ;get bottom 0MOVE D0,-(SP) ;push bottom 0MOVE LEFT(A4),-(SP) ;push left 0ADD D4,(SP) ;want left+shadow 0MOVE D0,-(SP) ;push bottom ; 0_MoveTo ;MoveTo(left+shadow,bottom) 0_LineTo ;LineTo(right,bottom) 0_LineTo ;LineTo(right,top+shadow) ; 0_PenNormal ;restore normal pen 0RTS ; ; PlotSymbol -- plot the little 16 by 16 symbol bitmap pointed to by A1 into the rectangle ; pointed held in TempRect. D0 holds the mode. ; PlotSymbol 0LEA IconBitMap,A0 ;get pointer to source bitmap 0MOVE.L A1,(A0)+ ;update base address of bitMap 0MOVE #2,(A0)+ ;update rowBytes 0CLR.L (A0)+ ;topLeft is zero, zero 0MOVE.L D1,(A0) ;adjust boundsRect ; ; push parameters for CopyBits call to transfer arrow bitMap ; 0PEA IconBitMap ;push pointer source bitmap 0MOVE.L (SP),A0 ;remember in A0, too 0MOVE.L GrafGlobals(A5),A1 ;get GrafGlobals baseaddress 0MOVE.L THEPORT(A1),A1 ;get thePort 0PEA PORTBITS(A1) ;that's the destination bitmap ; 0PEA BOUNDS(A0) ;boundsRect of bitmap is source 0PEA TempRect ;tempRect is the destination 0MOVE.W D0,-(SP) ;theMode is in D0 0CLR.L -(SP) ;no mask region ; ; transfer the bitMap (stretching as necessary...) ; 0_CopyBits ;let Bill stretch those bits 0RTS ;return to caller ; Draw the grow icon. First make this window the current grafPort DrawGIcon 0MOVE.L A3,-(SP) ;push it 0_SetPort ;make that the port ; ; compute the grow icon rectangle in tempRect ; 0LEA TempRect,A4 ;get pointer to tempRect 0MOVE.L PortRect+4(A3),4(A4) ;copy in botRight of tempRect 0MOVE.L 4(A4),(A4) ;into the topLeft, too 0SUB.W #15, Top(A4) ;subtract from Top 0SUB.W #15,Left(A4) ;and left, too ; ; plot the grow icon ; 0TST.B WHilited(A3) ;is it hilited? 0BEQ.S ClearGoAway ;if not, go clear it 0LEA GrowBits,A1 ;get pointer to the bits 0MOVEQ #0,D0 ;use srcCopy 0MOVE.L #$00100010,D1 0BSR PlotSymbol ;plot it ; ; plot the boundary lines ; PlotBoundary 0MOVE.W Left(A4),-(SP) ;push tempRect.left 0MOVE.W (SP),-(SP) ;copy it again for later 0MOVE PortRect+Top(A3),-(SP) ;push portRect.top 0_MoveTo ;move to it 0MOVE PortRect+Bottom(A3),-(SP) ;push portRect.bottom 0_LineTo ;draw the vertical line ; ; now draw the horizontal line ; 0MOVE.W PortRect+Left(A3),-(SP) ;push portRect.left 0MOVE.W Top(A4),-(SP) ;push tempRect.top 0_MoveTo 0MOVE.W PortRect+right(A3),-(SP) ;push portRect.right 0MOVE.W Top(A4),-(SP) ;push tempRect.top 0_LineTo ; ; all done with DrawDocGrow ; DoneDDG 0RTS ClearGoAway 0PEA TempRect 0_EraseRect 0BRA.S PlotBoundary ; ; BitMap for GrowIcon ; GrowBits 0.WORD $0000,$0000,$0000,$1FE0 0.WORD $1020,$103E,$1022,$1022 0.WORD $1022,$1022,$1FE2,$0402 0.WORD $0402,$0402,$07FE,$0000 0;.WORD $0000,$0000,$3E00,$2200 0;.WORD $2FC0,$2840,$3840,$09FC 0;.WORD $0904,$0F04,$0104,$0104 0;.WORD $0104,$01FC,$0000,$0000 ; 0.END 3. "6F^9PͪH r^՞10W̙IS'X. &W.*.,hh*ISAGC>2ISAh >AA2ISAhA2>64; ;File defProcs/ButCDef.TEXT ;-------------------------------------------------------------------------- ; ; Standard Button Definition Procedure for the ; MacIntosh Control Manager ; ; written by Andy Hertzfeld August, 1982 ; ; (c) 1982 by Apple Computer, Inc. All rights reserved. ; ; This file contains the control definition procedures ; that define the standard "button" type controls. These ; include PushButtons, CheckBoxes, and a checkBox variant called ; RadioButton ; ; Modification History: ; ; 22-Aug-82 AJH Added clipping, centering to PushButProc ; 25-Aug-82 AJH Fixed corner-clobber bug in pushButProc ; 29-Aug-82 AJH Added "255" hiliting, ; 29-Sep-82 AJH Added CheckBox control definition procedure ; 03-Oct-82 AJH Fixed bug in scrollBar positioning -- wasn't ctl relative ; 05-Oct-82 AJH Fixed checkBox flashing, added code saving optimizations ; 10-Oct-82 AJH Converted for QuickDraw Trap Interface ; 17-Oct-82 AJH Made controlProcs preserve A1 ; 14-Nov-82 AJH Improved PushButton roundness scaling; removed box in arrowBits ; 16-Nov-82 AJH Made branch tables offset based ; 28-Dec-82 AJH Put button definitions in their own file ; 11-Mar-83 AJH fixed up check box drawing ; 27-Mar-83 AJH made it respect initial clip in button drawing ; 01-Apr-83 AJH made it use hardwired gray ; 04-Apr-83 AJH made it force size 12 for text ; 07-Jun-83 AJH fixed scrambling bug, changed check draw for new QuickDraw ; 29-Aug-83 AJH fixed scrambling bug in CalcPBut ; 27-Sep-83 AJH made variants > 7 not force the system font ; 12-Oct-83 AJH changed button disabling ; 17-Oct-83 AJH back to "gray-out" button disabling ; 31-Dec-83 AJH made text of checkBox/radioButttons grayed out if disabled ; 02-Feb-85 HAA changed INCLUDEs to use new TLAsm file names ; ;---------------------------------------------------------------------------- 0.INCLUDE TLAsm/SysEqu.text 0.INCLUDE TLAsm/SysTraps.text 0.INCLUDE TLAsm/QuickEqu.text 0.INCLUDE TLAsm/ToolEqu.text 0.INCLUDE TLAsm/QuickTraps.text 0.INCLUDE TLAsm/ToolTraps.text ; 0.PROC BDEF,0 ; ; FUNCTION PushButProc( selector: INTEGER; ; theControl: ControlHandle; ; message: INTEGER; ; param: LongInt): LongInt; ; ; PushButProc is the control definition procedure for simple pushButtons, one of the ; standard control types supported by the user interface toolBox. mon ; SavePen .EQU -20 IndicatorRect .EQU -30 ; 0BRA.S @0 ;skip header ; standard header 0.WORD 0 ;flags 0.ASCII 'CDEF' 0.WORD 0 0.WORD 1 ;version # @0 0LINK A6,#-30 ;set up a stack frame to address parameters 0MOVEM.L D3-D7/A1-A4,-(SP) ;save work registers ; ; buttons only handle messages 0,1 and 2 ; /CMP #3,12(A6) ;inspect message value /BGE.S DoneP1 ;if >2, nothing to do ; ; save the penState and set it our way ; 0PEA SavePen(A6) ;push pointer to savePenState 0_GetPenState ;remember current penState 0_PenNormal ;set the pen the way we want it ; ; fetch the parameters into registers ; 0LEA 8(A6),A0 ;get ptr to first parameter 0MOVE.L (A0)+,D3 ;get param in D3 0MOVE.W (A0)+,D0 ;get message 0MOVE.L (A0)+,A3 ;get the control handle 0MOVE.W (A0)+,D6 ;get selection index 0MOVE.W D6,D7 ;remember raw selection code 0AND #7,D6 ;strip high part of selection code 0CLR.L (A0) ;clear out function result 0MOVE.L (A3),A0 ;get control pointer in A0 ; ; case out on the message number ; 0ADD D0,D0 ;double for word index 0LEA GoPushBut,A1 ;get table address 0ADD 0(A1,D0),A1 ;compute dispatch address 0JSR (A1) ;dispatch to appropriate routine ; ; restore original pen state ; 0PEA SavePen(A6) ;push savePenState 0_SetPenState ;restore original pen state ; ; we're done -- restore registers and return to caller ; DoneP1 0MOVEM.L (SP)+,D3-D7/A1-A4 ;restore work registers 0UNLK A6 ;unlink stack frame TenBytExit MOVE.L (SP)+,A0 ;get return address 0ADD #12,SP ;strip parameters 0JMP (A0) ;return to caller ; ; PushButProc dispatch table -- entries must be long branches! ; GoPushBut 0.WORD DrawPBut-GoPushBut ;draw is message 0 0.WORD HitPBut-GoPushBut ;hit test is message 1 0.WORD CalcPBut-GoPushBut ;calc regions is message 2 ButStub RTS ; ; DrawPBut draws the pushButton ; DrawPBut 0TST.B ContrlVis(A0) ;is it visible? 0BEQ.S ButStub ;if not, we're done ; ; calculate roundness as function of rectangle size ; 0BSR RoundCalc ;compute roundNess factor in D4 ; ; erase the bounding rectangle (if necessary) ; 0LEA ContrlRect(A0),A4 ;get pointer to bounding rect 0TST.B D6 ;is it a pushButton? 0BEQ.S EraseCBound ;push buttons are always erased 0TST.B D3 ;draw all? 0BNE.S SkipCErase ;if not, don't bother to erase ; EraseCBound 0MOVE.L A4,-(SP) ;push rect 0MOVE.L D4,-(SP) ;push rounding factor 0_EraseRoundRect ;paint it the background color ; ; save the current font and force the system font ; SkipCErase 0MOVE.L GrafGlobals(A5),A0 ;get GrafGlobals base 0MOVE.L ThePort(A0),A0 ;get current port 0MOVE.L txFont(A0),D3 ;remember the font,face 0MOVE D7,D0 ;save selection code 0MOVE.W txSize(A0),D7 ;remember the size 0SUBQ #8,D0 ;was code 8 or greater? 0BGE.S @1 ;if so, use window's font 0CLR.L txFont(A0) ;force system font, normal face 0MOVE #12,TxSize(A0) ;force size = 12 @1 0MOVE.L ClipRgn(A0),-(SP) ;push the current clipRgn handle ; ; save old clip region and clip to the bounding rectangle sected with oldClip ; 0CLR.L -(SP) ;make space for region handle 0_NewRgn ;allocate a region 0MOVE.L (SP),A2 ;remember region but leave on stack 0_GetClip ;remember the current clipRgn 0MOVE.L (A3),A0 ;get control pointer 0PEA ContrlRect(A0) ;push pointer to its bounding rect 0_ClipRect ;make that the clipping region 0MOVE.L A2,-(SP) ;push the old ClipRgn 0MOVE.L 4(SP),-(SP) ;the answer goes into current clip 0_SectRgn ;intersect new and old ; ; get a pointer to the title string and push it ; 0MOVE.L (A3),A0 ;get control pointer 0PEA ContrlTitle(A0) ;point to title string ; ; position the pen to center the string in its rectangle ; 0CLR.W -(SP) ;make room for function result 0PEA ContrlTitle(A0) ;point to title string 0_StringWidth ;Get width of string 0MOVE.W (SP)+, D0 ;String width in D0 ; 0MOVE.L (A3),A0 ;handle -> pointer 0LEA ContrlRect(A0),A4 ;set up pointer to bounding rect 0TST D6 ;is it a checkBox? 0BNE PosCheck ;checkBoxes center differently ; 0MOVE RIGHT(A4),D1 ;get right coordinate 0SUB LEFT(A4),D1 ;get width of button 0SUB D0,D1 ;get buttonWidth -stringWidth 0ASR #1,D1 ;divide by 2 0ADD LEFT(A4),D1 ;add to left for starting X ; DrawBTitle 0MOVE.W D1, -(SP) ;push left coordinate ; 0MOVE.W Bottom(A4), D0 ;Get bottom coordinate 0MOVE D0,D1 ;remember in D1 0SUB.W Top(A4),D0 ;get height 0SUB #16,D0 ;subtract 16 0ASR #1,D0 ;divide by 2 0SUB D0,D1 ;compute centered baseline 0SUBQ #4,D1 ;leave 4 for descenders 0MOVE.W D1, -(SP) ;Push it 0MOVE.W D1,D5 ;remember y position 0_MoveTo ;Move the pen there 0_DrawString ;draw it ; ; restore original font, face and size ; 0MOVE.L GrafGlobals(A5),A0 ;get GrafGlobals base 0MOVE.L ThePort(A0),A0 ;get current port 0MOVE.L D3,txFont(A0) ;restore the font,face 0MOVE.W D7,TxSize(A0) ;restore the size 0TST D6 ;is it a checkBox? 0BNE PlotCheck ;if so, go draw it ; 0MOVE.L A4,-(SP) ;push the rectangle pointer 0MOVE.L D4,-(SP) ;push rounding factor 0_FrameRoundRect ;frame the button ; ; hilite the button if necessary ; 0MOVE.L (A3),A0 ;get control pointer 0MOVE.B ContrlHilite(A0),D0 ;is it hilited? 0BEQ.S DoneDrwBut ;if not, we're done ; 0CMP.B #$FE,D0 ;is it the special hilite state? 0BHS.S SpecialHilite ;if so, go do it ; 0MOVE.L A4,-(SP) ;push rectangle 0MOVE.L D4,-(SP) ;push rounding factor 0_InverRoundRect ;hilite by inverting ; ; restore original clipping region and we're done ; DoneDrwBut 0_PenNormal ;set the pen back to normal 0MOVE.L A2,-(SP) ;push old clip region 0_SetClip ;restore it 0MOVE.L A2,-(SP) ;dispose of temporary region 0_DisposRgn ;de-allocate it 0RTS ;all done! ; ; SpecialHilite handles drawing the disabled button SpecialHilite /BSR.S DisableText /BRA.S DoneDrwBut DisableText /MOVE.L A4,-(SP) ;push rectangle /MOVE.L #$00010003,-(SP) /_InsetRect /MOVE.L A4,-(SP) /MOVE.L (A5),A0 /PEA Gray(A0) /_PenPat /MOVE #patBIC,-(SP) /_PenMode /_PaintRect ;gray it out /_PenNormal /MOVE.L A4,-(SP) /MOVE.L #$FFFFFFFD,-(SP) /_InsetRect /RTS ; ; PosCheck does horizontal position for check box buttons. It computes the position ; in D1 and dives back into common code ; PosCheck 0MOVE.W Left(A4),D1 ;get the left edge 0ADD.W #18,D1 ;leave room for check box 0BRA.S DrawBTitle ;back to common code ; ; RoundCalc calculates the rounding factor in D4 based on the control's rect ; RoundCalc 0TST D6 ;is it a checkBox? 0BNE.S CheckRound ;if so, special case it ; 0MOVE.W ContrlRect+Bottom(A0),D4 ;get bottom coordinate 0SUB.W ContrlRect+Top(A0),D4 ;figure out vertical height 0LSR #1,D4 ;scale it down by a factor of 2 0MOVE D4,D0 ;fill both halves with it 0SWAP D4 ;get in high part 0MOVE D0,D4 ;and in low part 0RTS ; CheckRound MOVEQ #0,D4 ;checkBoxes are square! 0RTS ; ; HitPBut handles the button hit-test ; HitPBut 0MOVE.B ContrlHilite(A0),D0 ;get hiliteState 0ADDQ.B #1,D0 ;is it 255? 0BEQ.S @1 ;if so, skip 0ADDQ.B #1,D0 ;how about 254? 0BEQ.S Return254 ;if so, we're done ; 0CLR.W -(SP) ;make room for function result 0MOVE.L D3,-(SP) ;push the point 0PEA ContrlRect(A0) ;push address of rect 0_PtInRect ;in the rectangle? 0TST.B (SP)+ ;examine result 0BEQ.S @1 ;if not, we're done 0MOVE #inButton,22(A6) ;return that it was 0TST D6 ;a checkBox? 0BEQ.S @1 ;if not, we're done 0ADDQ #1,22(A6) ;if so, flag it @1 RTS Return254 0MOVE #254,22(A6) ;indicate its 254-disabled 0RTS ; ; CalcPBut returns the bounding region of the button ; CalcPBut 0TST D6 ;is it a checkBox? 0BNE.S CalcSquare ;check box bounds are just rects ; 0BSR.S RoundCalc ;calculate rounding factor 0_HidePen ;dont draw anything 0_OpenRgn 0BSET #7,(A3) ;lock it down 0MOVE.L (A3),A0 ;get pointer to control 0PEA ContrlRect(A0) ;push rectangle pointer 0MOVE.L D4,-(SP) ;push rounding factor 0_FrameRoundRect ;frame the button 0MOVE.L D3,-(SP) ;push the region 0_CloseRgn ;make the rounded rectangular region 0_ShowPen 0BCLR #7,(A3) ;unlock the control ; ; set the pattern for indicator dragging ; DragGray 0MOVE.L (A5),A0 ;get qDraw globals 0LEA Gray(A0),A0 ;point to gray pattern 0MOVE.L (A0)+,DragPattern ;move in the 1st half 0MOVE.L (A0),DragPattern+4 ;move in the 2nd half 0RTS ;all done! ; CalcSquare 0MOVE.L D3,-(SP) ;push the region 0PEA ContrlRect(A0) ;push the rectangle pointer 0_RectRgn ;make a rectangulare region 0BRA.S DragGray ;all done -- go set drag pattern ; ; PlotCheck takes care of drawing the actual check box of the check box button. It ; figures out where to draw the box, draws it, and then checks it or not based on ; the current value and hilite state of the button ; PlotCheck 0SUBQ #8,SP ;allocate a rectangle on the stack 0ADDQ #2,D5 ;bump down a little 0MOVE D5,Bottom(SP) ;set up the bottom 0SUB #12,D5 ;compute the top 0MOVE D5,Top(SP) ;set up the top 0MOVE Left(A4),D5 ;get left edge of boundsRect 0ADDQ #2,D5 ;indent 2 pixels 0MOVE D5,Left(SP) ;that's the left of the checkRect 0ADD #12,D5 ;compute right edge 0MOVE D5,Right(SP) ;update the right edge ; ; erase the check box ; 0MOVE.L SP,-(SP) ;push rectangle pointer 0_EraseRect ;erase it ; ; OK, now we must fill in the checkBox rectangle based on the value and hilite state ; of the control ; 0MOVE.L (A3),A0 ;get control handle 0MOVE.W ContrlValue(A0),D5 ;get the value 0MOVE.B ContrlHilite(A0),D0 ;is it hilited? 0BEQ.S FrameCheck ;if not, skip ; ; its hilited so up the penSize to indicate its hilited ; 0CMP.B #$FE,D0 ;disabled? 0BLO.S SkipDis ;if so, skip doubling ; 0BSR DisableText 0BRA.S FrameCheck SkipDis 0MOVE.L #$00020002,-(SP) 0_PenSize ;up the penSize FrameCheck 0MOVE.L SP,-(SP) ;push the rectangle 0CMP.W #2,D6 ;test for radio button 0BEQ.S @1 ;if its a radio button, go do it 0_FrameRect ;frame it 0BRA.S @2 @1 0_FrameOval @2 0_PenNormal ; ; now we can draw the check if we're supposed to ; 0LSR #1,D5 ;check out the low bit of D5 0BCC.S DonePCheck ;if its off, we're done ; 0CMP.W #2,D6 ;test for radio button 0BEQ.S DrawRButton ;if its a radio button, go do it ; 0MOVE.L SP,-(SP) ;push the rectangle pointer 0MOVE.L OneOne,-(SP) ;push the inset factor 0_InsetRect ;inset the rectangle 0MOVE.L TopLeft(SP),-(SP) ;push top left 0_MoveTo ;move to it 0MOVE.L BotRight(SP),-(SP) ;push bottom right 0_LineTo ;draw one line of the cross ; 0MOVE Right(SP),-(SP) ;push right 0MOVE Top+2(SP),-(SP) ;push top 0SUBQ #1,(SP) ;bias the top 0_MoveTo ;move to it 0MOVE Left(SP),-(SP) ;push left 0SUBQ #1,(SP) ;bias the left 0MOVE Bottom+2(SP),-(SP) ;push bottom 0_LineTo ;draw the line 0BRA.S DonePCheck ; ; draw the radio button check mark -- a little circle ; DrawRButton 0MOVE.L SP,-(SP) ;push pointer to rect 0MOVE.L #$00030003,-(SP) ;push inset factor 0_InsetRect ;inset it 0MOVE.L SP,-(SP) ;push rect again 0_PaintOval ;draw the circle? ; DonePCheck 0ADDQ #8,SP ;pop off the rectangle 0BRA DoneDrwBut ;all done! /.END 3. "6F^9 PH r^ x1/meter bottom s r. e BitMap,A0 ;get pointer to source bitmap 0MOVE.L A1,(A0)+ ;update base address of bitMap 0MOVE #2,(A0)+ ;update rowByt; Utility RoundOff -- RoundOff the number in D1 to the nearest integer. The remainder ; from dividing by D2 is in the high part of the word. ; RoundOff MOVE.W D0,-(SP) ;preserve D0 0MOVE D2,D0 ;File defProcs/MDef.Text ;------------------------------------------------------------ ; ; Standard Menu Definition Procedure for Text Menus ; ; written by Andy Hertzfeld July 1982 ; ; Here is the default menu definition procedure for text menus. It knows how to ; draw a text menu, or select from within a text menu. It is always called from the ; window manager port with clipping set to the menuRect. ; ; MODIFICATION HISTORY: ; ; 27-Dec-82 AJH Broke off into separate file for resources ; 28-Jan-83 AJH made "GrayRect" use FillRect and a hardwired gray ; 17-Mar-83 AJH Fixed 4 pixel choosing offset ; 17-Mar-83 AJH no more forcing bold ; 28-Apr-83 AJH added "calcMenuSize" message ; 30-Oct-83 AJH changed disabling ; 06-Nov-83 AJH back to old disabling; special-cased "-" item ; 13-Feb-84 AJH speeded up CalcMenuSize message (linear instead of N squared) ; 02-Feb-85 HAA changed INCLUDEs to use new TLAsm file names ; ;---------------------------------------------------------------------------- 0.INCLUDE TLAsm/SysEqu.text 0.INCLUDE TLAsm/SysTraps.text 0.INCLUDE TLAsm/QuickEqu.text 0.INCLUDE TLAsm/ToolEqu.text 0.INCLUDE TLAsm/QuickTraps.text 0.INCLUDE TLAsm/ToolTraps.text 0.PROC MDEF,0 ; ; PROCEDURE TextMenuProc(message: INTEGER,menuHandle,menuRect,point,VAR whichItem:INTEGER); ; ; ; Stack Frame Definition for TextMenuProc ; MWHICHITEM .EQU 8 MPOINT .EQU MWHICHITEM+4 MMENURECT .EQU MPOINT+4 MMENUHANDLE .EQU MMENURECT+4 MMESSAGE .EQU MMENUHANDLE+4 ; 0BRA.S @0 ; standard header /.WORD 0 ;flags word /.ASCII 'MDEF' ;type /.WORD 0 ;ID /.WORD 2 ;version @0 0LINK A6,#0 ;set up a stack frame 0MOVEM.L D3-D7/A2-A4,-(SP) ;save a whole bunch of work registers 0MOVE.L MMENUHANDLE(A6),A3 ;keep menuHandle in A3 ; 0MOVE MMESSAGE(A6),D0 ;draw or choose or calc? 0BEQ DRAWMPROC ;if zero, go draw it 0SUBQ #1,D0 ;is it choose? 0BNE DoCalcMsg ;if not, go calculate its size ; ; the message was "choose" so examine the mouse position and hilite the appropriate item ; 0MOVE.L MWHICHITEM(A6),A4 ;get pointer to whichItem 0MOVE.W (A4),D3 ;remember oldWhichItem 0CLR (A4) ;set whichItem to zero ; ; if the point isn't in the menuRect, things are easy so test it ; 0CLR.W -(SP) ;make from for PtInRect result 0MOVE.L MPOINT(A6),-(SP) ;push the point 0MOVE.L MMENURECT(A6),-(SP) ;push the rect 0_PtInRect ;test if the point is in the rect 0TST.B (SP)+ ;was it? 0BEQ.S NOITEMSEL ;if not, don't bother checking for the item ; ; the point is in the menu, so waltz through the itemList keeping track of vertical ; position seeing which item its in. In the following loop, D4 holds the item number ; while D2 has the cumulative vertical space ; 0MOVEQ #1,D4 ;start with 1st item 0MOVEQ #20,D2 ;menuBar ends at 19, so start at 20 ; MSELOOP MOVE.L (A3),A0 ;get menuPtr 0MOVE D4,D0 ;get item number 0BSR GETITEMRECORD ;look it up 0BEQ.S NOITEMSEL ;if so, nothing selected ; 0ADD #16,D2 ;bump vertical by itemSize 0TST.B ITEMICON(A1) ;does it have an icon? 0BEQ.S @1 ;skip if it doesn't 0ADD #20,D2 ;icon entries 36 high @1 CMP MPOINT+V(A6),D2 ;compare with mouse point 0BGT.S GOTSEL ;when D2 is bigger, we found it ; ; we didn't reach it yet, so keep stepping down till we do ; NEXTMSEL ADDQ #1,D4 ;bump to next item 0BRA.S MSELOOP ;loop till we find it ; ; we found it so update whichItem. First we better make sure its enabled ; GOTSEL BSR.S ENABLETEST ;make sure whole menu is enabled 0BEQ.S NOITEMSEL ;if not, no selection ; 0MOVE D4,(A4) ; ; see if whichItem changed; if it has, unselect the old item and select the new one ; NOITEMSEL CMP (A4),D3 ;have they changed? 0BEQ.S DONEMPROC ;if not, we're all done ; 0MOVE D3,D0 ;unhilite old item 0BSR.S INVERTITEM ;do it 0MOVE (A4),D0 ;hilite new item 0BSR.S INVERTITEM ;do it ; DONEMPROC MOVEM.L (SP)+,D3-D7/A2-A4 ;restore work registers 0UNLK A6 ;unbuild the stack frame ; 0MOVE.L (SP)+,A0 0ADD #18,SP ;strip parameters 0JMP (A0) ;return to caller ; ; EnableTest is a utility which tests if an item is enabled. It expects a menuHandle ; in A3 and the item number in D4. It returns the result in the Z-flag ; ENABLETEST MOVE.L (A3),A0 ;get menu pointer 0MOVE.L MENUENABLE(A0),D0 ;get enable flags 0BTST D4,D0 ;is item enabled? 0BEQ.S ETDONE ;if not, return 0 0BTST #0,D0 ;test menu bit ETDONE RTS ;return to caller ; ; InvertItem is an internal utility that hilites/unHilites an item. The item number is ; passed in D0. It also assumes A3 has the menuHandle. If the high bit of D0 ; is set, bit-clear with gray instead of inverting the item. ; INVERTITEM MOVEM.L D3-D4,-(SP) ;save work registers 0MOVE D0,D3 ;keep item number in safe place 0BEQ.S INVERTDONE ;if zero, ignore 0MOVEQ #20,D2 ;D2 hold the vertical position 0MOVEQ #1,D4 ;D4 hold item index ; IILOOP MOVE D4,D0 ;get item 0MOVE.L (A3),A0 ;get menuPtr 0BSR GETITEMRECORD ;look it up 0MOVEQ #16,D0 ;its at least 16 long 0TST.B ITEMICON(A1) ;does it have an icon? 0BEQ.S @1 ;skip if it doesn't 0MOVEQ #36,D0 ;icon items are 36 high ; @1 CMP.B D3,D4 ;found the item we want yet? 0BEQ.S GOINVERT ;if so, go invert it 0ADD D0,D2 ;add total to cumulative v position 0ADDQ #1,D4 ;bump to next position 0BRA.S IILOOP ;loop till we find it ; ; its time to invert the item. The menuRect contains the horizontal bounds, D2 contains ; the top of the vertical, D0 has the vertical size ; GOINVERT MOVE.B 1(A0),D1 ;remember 1st char of item 0LEA TEMPRECT,A0 ;get pointer to temporary rectangle 0MOVE.L MMENURECT(A6),A1 ;point to menuRect 0MOVE.L (A1)+,(A0) ;copy menuRect into tempRect 0MOVE.L (A1),4(A0) 0MOVE D2,TOP(A0) ;D2 has the top coordinate 0ADD D0,D2 ;add in the height 0MOVE D2,BOTTOM(A0) ;set up the bottom ; 0TST.W D3 ;invert or bit clear? 0BMI.S GOBITCLEAR ;hi bit set so go bit clear ; 0MOVE.L A0,-(SP) ;push a pointer to the rectangle 0_InverRect ;invert it INVERTDONE MOVEM.L (SP)+,D3-D4 ;recover work regs 0RTS ; GOBITCLEAR CMP.B #$2D,D1 ;is it the dash? 0BEQ.S InvertDone ;if so, don't hilite 0BSR GRAYRECT ;bit clear tempRect with gray 0BRA.S INVERTDONE ;all done! ; ; here is the part of the TextMenuProc that draws the menu. For most of this routine, ; A3 holds the menuHandle, D4 is the item counter and D3 holds the cumulative ; vertical position ; DRAWMPROC MOVEQ #1,D4 ;start with item 1 0MOVEQ #32,D3 ;baseline of 1st item is 12 + 20 0MOVE.L MMENURECT(A6),A0 ;get menuRect pointer 0MOVE.W LEFT(A0),D5 ;get left edge 0MOVE.W RIGHT(A0),D6 ;get right edge, too ; DRAW1MLOOP MOVE D4,D0 ;get item number in D0 0MOVE.L (A3),A0 ;get menu pointer 0BSR GETITEMRECORD ;look it up 0BEQ.S DONEMPROC ;if null item, all done 0MOVE.L A0,A2 ;keep string pointer in A2 0MOVE.L A1,A4 ;keep properties in A4 ; ; draw the mark ; 0TST.B ITEMMARK(A4) ;does it have a mark? 0BEQ.S CHKDRAWICON ;if not, skip ; 0MOVE D5,-(SP) ;push menuRect.left 0ADDQ #2,(SP) ;move in two pixels 0MOVE D3,-(SP) ;push v position 0TST.B ITEMICON(A4) ;does it have an icon 0BEQ.S @1 ;if not, skip 0ADDQ #8,(SP) ;offset checkmark position @1 _MoveTo ;position pen 0CLR D0 ;clear out high part 0MOVE.B ITEMMARK(A4),D0 ;get the mark character 0MOVE.W D0,-(SP) ;push it 0_DrawChar ; ; if its an icon item, bump baseLine by 8 and draw the icon ; CHKDRAWICON MOVE.W #$0100,D0 ;menu icons are 256-511 0MOVE.B ITEMICON(A4),D0 ;does it have an icon? 0BEQ.S DRAWITEXT ;if not, skip ; 0ADDQ #8,D3 ;bump baseLine ; ; draw the icon ; 0LEA TEMPRECT,A0 ;get pointer to rectangle 0MOVE.L A0,-(SP) ;push rect for plotIcon call 0MOVE D3,(A0) ;push top 0SUB #18,(A0)+ ;adjust top 0MOVE D5,(A0) ;push left 0ADD #12,(A0)+ ;dont forget indent 0MOVE.L -4(A0),(A0) ;copy bottom right 0ADD #32,(A0)+ ;bottom := top + 32 0ADD #32,(A0) ;right := left + 32 ; 0CLR.L -(SP) ;make room for function result 0MOVE.L #'ICON',-(SP) ;push the resource type 0MOVE D0,-(SP) ;push icon number 0_GetResource ;get the icon handle 0_PlotIcon ;plot the icon 0ADD #40,D5 ;indent past icon ; ; draw the text of the item ; DRAWITEXT CLR D0 ;clear it out 0MOVE.B ITEMSTYLE(A4),D0 ;push the style parameter 0MOVE.W D0,-(SP) ;push style parameter @1 _TextFace ;get into that face 0CMP.B #$2D,1(A2) ;first char a dash? 0BEQ.S DrawDash ;if so, handle specially 0MOVE D5,-(SP) ;push the x position 0ADD #12,(SP) ;don't forget indent 0MOVE D3,-(SP) ;push y position 0_MoveTo ;position pen 0MOVE.L A2,-(SP) ;push string pointer 0_DrawString ;draw it 0CLR -(SP) ;push empty set 0_TextFace ;restore textface to normal ; ; draw apple character ; 0TST.B ITEMCMD(A4) ;is there one? 0BEQ.S NXTDRAWITEM ;if not, skip @4 MOVE D6,-(SP) ;push right edge 0SUB #24,(SP) ;leave some room 0MOVE.W D3,-(SP) ;push vertical position 0_MoveTo ;position pen 0MOVE.W #APPLEMARK,-(SP) ;push apple character 0_DrawChar ;draw the character 0CLR D0 ;clear high part 0MOVE.B ITEMCMD(A4),D0 ;get command character 0MOVE.W D0,-(SP) ;push command char 0_DrawChar ;draw it 0CLR.W -(SP) ;push normal style 0_TextFace ;restore normal textFace ; ; if the item is disabled, gray it out ; NXTDRAWITEM BSR ENABLETEST ;is it enabled? 0BNE.S NXTDRAW1 ;branch if it is 0MOVE D4,D0 ;get item 0OR #$8000,D0 ;set high bit 0BSR INVERTITEM ;bit clear item with gray ; ; we're done with this item so bump to the next one ; NXTDRAW1 TST.B ITEMICON(A4) ;does it have an icon? 0BEQ.S @1 ;skip if it doesnt 0SUB #40,D5 ;re-adjust D5 0ADD #12,D3 ;bump an extra 12 (36 total) for icon ; @1 ADD #16,D3 ;bump 16 for item 0ADDQ #1,D4 ;bump to next item 0BRA.S DRAW1MLOOP ;loop till done ; handle the case of a dash item by drawing a line DrawDash 0MOVE.L (A5),A0 ;get QuickDraw globals 0PEA Gray(A0) ;set pattern to gray 0_PenPat 0MOVE.W D5,-(SP) ;push x position 0MOVE.W D3,-(SP) ;push y position 0SUBQ #6,(SP) ;center it 0_MoveTo 0MOVE.W D6,-(SP) ;push right edge 0MOVE D3,-(SP) ;push y 0SUBQ #6,(SP) ;center it 0_LineTo ;draw the line 0_PenNormal ;pen back to normal 0BRA.S NxtDraw1 ;dive back into mainstream ; ; GetItemRecord is the main utility used for accessing the menu item data structure. ; It has a register interface to save code. On entry, A0 points to a menuInfo block, ; while D0 has the item number of interest. On exit, A0 points to the item string ; of interest while A1 points to that item's attribute byte list. If the item can't ; be found, A0 and A1 both return NIL. ; GETITEMRECORD TST D0 ;make sure item number is valid 0BLE.S NOITEM ;if its not, don't bother ; 0MOVEQ #0,D1 ;clear D1 for byte arithmetic 0LEA MENUDATA(A0),A1 ;get menuData handle 0MOVE.B (A1)+,D1 ;get title length 0ADD D1,A1 ;skip over title string ; ; here is the item search loop. A1 points to the beginning of the next item. ; GETILOOP SUBQ #1,D0 ;is this the one we're looking for? 0BEQ.S GOTITEM ;if so, we got it 0MOVE.B (A1)+,D1 ;get length of current item 0BEQ.S NOITEM ;length zero marks end of list ; 0ADDQ #4,D1 ;there are 4 bytes of item properties 0ADD D1,A1 ;bump to next item 0BRA.S GETILOOP ;loop till done ; ; the item couldn't be found so return NIL ; NOITEM SUB.L A0,A0 ;zero A0 0MOVE.L A0,A1 ;and A1 too 0MOVE.L A0,D0 ;and set the z-flag 0RTS ;return to caller ; ; we found the item so return a pointer to it in A0 and a pointer to the item properties ; in A1 ; GOTITEM TST.B (A1) ;is this the NIL item? 0BEQ.S NOITEM ;if so, we really didn't get one ; 0MOVE.L A1,A0 ;A0 points to item string 0MOVE.B (A1)+,D1 ;get length 0ADD D1,A1 ;bump to item properties 0RTS ;return to caller ; Calculate the menu size for the given text menu. The handle is in A3. DoCalcMsg 0SUBQ #4,SP 0MOVE.L SP,-(SP) ;point to top of stack 0_GetPort ;get the current port 0MOVE.L WmgrPort,-(SP) ;push the wmgr port 0_SetPort ;set it ; 0MOVEQ #0,D6 ;set initial to 0 0MOVEQ #1,D0 ;find item 1 0MOVE.L (A3),A0 ;point to the menuRecord 0BSR.S GetItemRecord ;point to first item 0MOVE.L A0,A4 ;keep pointer in A4 ; ; here is the main loop of calcMenuSize. Process each item one at a time, keeping the ; height and maximum width in D6 ; CMLOOP 0MOVEQ #0,D7 ;set "extra" width to zero 0MOVE.L (A3),A0 ;handle -> pointer 0MOVEQ #0,D0 ;clear out high part 0MOVE.B (A4),D0 ;get length of item 0BEQ.S CMDONE ;if zero, we're done with this menu 0LEA 1(A4,D0),A1 ;point A1 at the properties ; ; handle the vertical ; 0MOVEQ #16,D0 ;most of the time the item is 16 tall 0TST.B ITEMICON(A1) ;is there an icon for this item? 0BEQ.S @1 ;if not, don't adjust height 0MOVEQ #40,D7 ;add 40 to width for icons 0MOVEQ #36,D0 ;icon entries are 36 tall @1 SWAP D0 ;get vertical into high word 0ADD.L D0,D6 ;increment vertical height ; ; handle the horizontal ; 0TST.B ITEMCMD(A1) ;is there a mark? 0BEQ.S @2 ;if not, skip 0ADD #32,D7 ;add 32 dots extra for commandChar ; @2 0MOVEQ #0,D1 ;clear out high byte 0MOVE.B ITEMSTYLE(A1),D1 ;get style setting @3 MOVE.W D1,-(SP) ;push the style 0_TextFace ;tell LisaGraf about new style 0CLR -(SP) ;make room for stringWidth result 0MOVE.L A4,-(SP) ;move string pointer 0_StringWidth ;find out the width 0ADD.W (SP)+,D7 ;add width to extra 0CMP D7,D6 ;compare with maxWidth 0BGE.S CALCNEXT ;if max is bigger, go process next one 0MOVE D7,D6 ;this one was the biggest ; ; go process next item; loop till we get a null one ; CALCNEXT 0MOVEQ #0,D0 ;zero high part 0MOVE.B (A4),D0 ;get the length of current item 0LEA 5(A4,D0),A4 ;point to the next item 0BRA.S CMLOOP ;loop till done ; ; we've scanned all the items update menuHeight and menuWidth ; CMDONE ADD.W #16,D6 ;leave left and right margin 0MOVE.L (A3),A0 ;get menu pointer 0MOVE.W D6,MENUWIDTH(A0) ;update menu width 0SWAP D6 0MOVE.W D6,MENUHEIGHT(A0) ;update menu height ; 0CLR.W -(SP) ;better restore style to normal 0_TextFace ;set the style 0_SetPort ;restore original grafPort 0BRA DoneMProc ;all done! ; ; GrayRect is a utility that bit-clears the current "tempRect" with gray ; GRAYRECT 0MOVE.L A0,-(SP) 0MOVE.L (A5),A0 ;get QuickDraw globals 0PEA Gray(A0) ;psuh gray 0_PenPat ;set pen to it 0MOVE #PatBIC,-(SP) ;push patBIC penMode 0_PenMode ;set penMode 0_PaintRect ;or on the dim pattern 0_PenNormal 0RTS /.END W^å9H rd^&՞10W̙IS'X. &W.*.,hh*ISAGC>2ISAh >AA2ISAhA2>64; ;File defProcs/RDocWDef.TEXT ;------------------------------------------------------- ; ; Rounded Corner Window Definition Routine "RDocProc" ; ; written by Andy Hertzfeld Aug 4, 1982 ; ; (c) 1982 by Apple Computer, Inc. All rights reserved. ; ; This file contains the window definition procedure ; "RDocProc", a standard Mac window type similar to the ; "DocumentProc" included in the ROM. It is indentical if ; the refCon is zero, otherwise the roundness of the corners ; is specified using the high 2 bytes of the window ; refCon. It is intended to be linked with applications or ; desk ornaments. ; ; Modification History: ; ; 16-OCt-82 AJH Converted to QuickDraw Trap Interface ; 15-Nov-82 AJH Added GoAway button, made content rectangular ; 02-Jan-83 AJH Made it a "WDEF" resource ; 07-Mar-83 AJH Made it dispose the title region (bug fix) ; 17-Mar-83 AJH Fixed D4 trash bug ; 27-Apr-83 AJH only plot, hit-test goAway if window is active ; 20-Aug-83 AJH made it get roundness from selector instead of refCon ; 18-Oct-83 AJH made it ignore unwanted messages; new hiliting ; 02-Feb-85 HAA changed INCLUDEs to use new TLAsm file names ; ;---------------------------------------------------------------------------- 0.INCLUDE TLAsm/SysEqu.text 0.INCLUDE TLAsm/QuickEqu.text 0.INCLUDE TLAsm/ToolEqu.text 0.INCLUDE TLAsm/QuickTraps.text 0.FUNC RDocPRoc,4 ; ; FUNCTION RDocProc( selector: INTEGER ; window: WindowPtr, ; message: INTEGER; ; parameter: LongInt): LongInt ; 0BRA.S @0 ; standard header 0.WORD 0 ;flags word 0.ASCII 'WDEF' ;type 0.WORD 1 ;ID 0.WORD 1 ;version @0 0LINK A6,#0 ;set up a stack frame to address parameters 0MOVEM.L D3-D5/A3-A4,-(SP) ;save work registers ; ; fetch the parameters into registers ; 0LEA 8(A6),A0 ;get ptr to first parameter 0MOVE.L (A0)+,D3 ;get param in D3 0MOVE.W (A0)+,D0 ;get message 0MOVE.L (A0)+,A3 ;get the window pointer 0MOVE.W (A0)+,D5 ;get the selector 0LSR #1,D5 ;only use 8 alternatives 0ASL #2,D5 ;quadruple for long index 0CLR.L (A0) ;clear out function result ; ; case out on the message number ; 0CMP #3,D0 ;is it one we deal with? 0BGE.S @1 ;if not, skip 0ASL #2,D0 ;quadruple for long index 0JSR GODOCPROC(D0) ;dispatch to appropriate routine ; ; we're done -- restore registers and return to caller ; @1 MOVEM.L (SP)+,D3-D5/A3-A4 ;restore work registers 0UNLK A6 ;unlink stack frame 0MOVE.L (SP)+,A0 0ADD #12,SP ;strip parameters 0JMP (A0) ;return to caller ; ; DocumentProc dispatch table -- entries must be long branches! ; GODOCPROC 0BRA DRAWDOC ;draw is message 0 0BRA HITDOC ;hit test is message 1 0BRA CALCDOC ;calc test is message 2 DoneDoc RTS ;nor does it need dispose call ; ; DrawDoc -- draw the document window. The windowPtr is in A3 ; DrawDoc 0TST.B WVISIBLE(A3) ;is it visible? 0BEQ.S DoneDoc ;if not, don't do anything ; ; see if its a EORGoAway call and special case it ; 0CMP #wInGoAway,D3 ;is it a goAway call? 0BEQ EorGoAway ;if so, go handle it ; ; ; derive the titleBar rectangle from the structRgn and keep it in TempRect ; 0LEA TEMPRECT,A0 ;get pointer to tempRect 0MOVE.L STRUCTRGN(A3),A1 ;get structure region handle 0MOVE.L (A1),A1 ;get strucRgn pointer 0ADDQ #RGNBBOX,A1 ;point A1 at the bounding box 0MOVE.L (A1)+,(A0)+ ;copy bounding box into tempRect 0MOVE.L (A1),(A0) ; ; make bottom := top + 20 ; 0MOVE -4(A0),D0 ;get top 0ADD #20,D0 ;compute top+20 0MOVE D0,(A0) ;update bottom ; ; ; handle the case of non-rectangular titleBar -- we must allocate a region ; 0CLR.L -(SP) ;make space for function result 0_NewRgn ;allocate a region 0MOVE.L (SP),A4 ;keep it in A4 -- and don't pop it off 0PEA TEMPRECT ;tempRect defines the bounding rect 0BSR GetRadPoint ;get the radius point in D0 0MOVE.L D0,-(SP) ;push the radius factor 0ST -(SP) ;topRound is true 0CLR -(SP) ;botRound is false 0BSR MakeRoundRgn ;make the region ; 0MOVE.L A4,-(SP) ;push the region 0_FrameRgn ;frame it 0MOVE.L A4,-(SP) ;push it again 0MOVE.L OneOne,-(SP) ;inset by 1 0_InsetRgn ;inset it 0MOVE.L A4,-(SP) ;push for erase 0_EraseRgn ;erase it ; ; hilite the title bar by filling it with specified pattern ; DrawTheTitle 0BSR DoTitleString ;draw the centered Title ; ; plot the goAway button, if necessary ; 0TST.B WGoAway(A3) ;is the a goaway button? 0BEQ.S DoHilite ;if not, skip ; 0TST.B WHilited(A3) ;only plot goAway if hilited 0BEQ.S DoHilite ;if not, don't plot goAway 0BSR.S BuildTBarRect 0LEA GoAwaySymbol,A1 ;get the goAway symbol @1 MOVEQ #0,D1 ;plot in srcCopy mode 0BSR PlotGoAway DoHilite 0TST.B WHILITED(A3) ;is it hilited? 0BEQ.S DisposIt ;if not, skip 0SUBQ #1,TempRect+Bottom ;adjust bottom 0PEA TEMPRECT ;push the title rect 0_InverRect DisposIt 0MOVE.L A4,-(SP) ;push the region handle 0_DisposRgn ;deallocate it ; ; frame the body of the window ; DrawFrame 0MOVE.L STRUCTRGN(A3),-(SP) ;push the structure 0_FrameRgn ;frame the body 0RTS ; ; BuildTBarRect builds a rectangle enclosing the titleBar in TempRect ; BuildTBarRect 0LEA TEMPRECT,A0 ;get pointer to tempRect 0MOVE.L STRUCTRGN(A3),A1 ;get structure region handle 0MOVE.L (A1),A1 ;get strucRgn pointer 0ADDQ #RGNBBOX,A1 ;point A1 at the bounding box 0MOVE.L (A1)+,(A0) ;copy bounding box into tempRect 0MOVE.L (A1),4(A0) ; ; make bottom := top + 20 ; 0MOVE Top(A0),D0 ;get top 0ADD #20,D0 ;compute top+20 0MOVE D0,Bottom(A0) ;update bottom 0SUBQ #1,Right(A0) ;inset right 0RTS ;return to caller ; ; EORGoAway hilites/unhilites the goAway button. It falls through into PlotGoAway ; EorGoAway 0BSR.S BuildTBarRect ;build the bounding rect 0LEA GoAwaySymbol,A1 ;get the bitMap 0ADD.W #32,A1 ;bump to the EOR Mask 0MOVEQ #2,D1 ;set EOR as the plot mode ; ; PlotGoAway plots the goAway button. A1 holds the symbol, D1 the plotting mode ; PlotGoAway 0LEA TempRect,A0 ;get pointer to tempRect 0MOVE Left(A0),D0 ;get left edge 0ADDQ #8,D0 ;leave some margin 0MOVE D0,Left(A0) ;update left 0ADD #16,D0 0MOVE D0,Right(A0) ;update right ; 0MOVE D1,D0 ;set plotting mode 0ADDQ #2,TempRect+Top ;adjust for 16 by 16 0SUBQ #2,TempRect+Bottom ;fix bottom, too 0MOVE.L #$00100010,D1 0BSR PlotSymbol ;plot it in tempRect 0BSR.S BuildTBarRect ;rebuild tempRect 0RTS ; ; PlotSymbol -- plot the little 16 by 16 symbol bitmap pointed to by A1 into the rectangle ; pointed held in TempRect. D0 holds the mode. ; PlotSymbol 0LEA IconBitMap,A0 ;get pointer to source bitmap 0MOVE.L A1,(A0) ;update base address of bitMap 0MOVE #2,4(A0) ;update rowBytes 0MOVE.L #$00100010,10(A0) ;adjust boundsRect ; ; push parameters for CopyBits call to transfer arrow bitMap ; 0MOVE.L A0,-(SP) ;push pointer source bitmap 0MOVE.L GrafGlobals(A5),A1 ;get GrafGlobals baseaddress 0MOVE.L THEPORT(A1),A1 ;get thePort 0PEA PORTBITS(A1) ;that's the destination bitmap ; 0PEA BOUNDS(A0) ;boundsRect of bitmap is source 0PEA TempRect ;tempRect is the destination 0MOVE.W D0,-(SP) ;theMode is in D0 0CLR.L -(SP) ;no mask region ; ; transfer the bitMap (stretching as necessary...) ; 0_CopyBits ;let Bill stretch those bits 0RTS ;return to caller ; ; DoTitleString is the common code that draws the title centered in tempRect ; DoTitleString 0BSR BuildTBarRect ;calculate title bar rect ; ; compute indent factor based on GoAwayButton state ; @1 MOVE.W TempRect+Right,D3 ;get right 0SUB.W TempRect+Left,D3 ;compute width 0SUB.W WTITLEWIDTH(A3),D3 ;compute extra x 0ASR.W #1,D3 ;divide by 2 ; ; if there's a goAway button, make sure the margin is at least 28 pixels ; 0TST.B WGoAway(A3) ;is there a go away button 0BEQ.S @2 ;skip if there's not 0TST D3 ;is it negative? 0BMI.S @3 ;if so, pin at 28 0CMP.W #28,D3 ;if goAway button, must have some margin 0BGT.S @2 @3 MOVEQ #28,D3 @2 ADD TempRect+Left,D3 ;compute x position 0MOVE.W D3,-(SP) ;and push for MoveTo 0MOVE TempRect+Bottom,-(SP) ;push bottom 0SUBQ #6,(SP) ;leave room for descenders 0_MoveTo ; draw the string 0MOVE.L WTITLEHANDLE(A3),A0 ;get titleHandle 0MOVE.L (A0),-(SP) ;push title pointer 0_DrawString ;draw it DoneDString 0RTS ;all done drawing title... ; ; GetRadPoint returns the radius in D0 of the round rect parameter defined ; by the selector parameter ; GetRadPoint 0MOVE.L RadiusTable(D5),D0 0RTS RadiusTable 0.LONG $00100010 ;(16,16) 0.LONG $00040004 ;(4,4) 0.LONG $00060006 ;(6,6) 0.LONG $00080008 ;(8,8) 0.LONG $000A000A ;(10,10) 0.LONG $000C000C ;(12,12) 0.LONG $00140014 ;(20,20) 0.LONG $00180018 ;(24,24) ; ; MakeRoundRegion -- makes a round region given a bounding rectandle and a radius ; value. Also, half round regions (top round, bottom square) are supported ; by the topRound,botRound booleans ; ; MakeRoundRegion( theRgn:RegionHandle ; theRect: Rect ; xRad,yRad: INTEGER ; topRound,botRound: BOOLEAN) ; MakeRoundRgn 0LINK A6,#0 ;set up stack frame 0MOVE.L A3,-(SP) ;save work registers 0TST.L 8(A6) ;are flags both false? 0BEQ.S PlainRect ;if so, its just a rectangle 0TST.L 12(A6) ;is radius factor 0? 0BNE.S ComplexRect ;if not, its a round one ; ; optimize for the rectangular case ; PlainRect 0MOVE.L 20(A6),-(SP) ;push region handle 0MOVE.L 16(A6),-(SP) ;push rectangle pointer 0_RectRgn ;make a rectangular region 0BRA.S MMRDone ;all done! ; ; make a region with top and bottom corners rounded ; ComplexRect 0_HidePen ;hide the pen 0_OpenRgn ;start recording the region ; 0MOVE.L 16(A6),-(SP) ;push the rectangle pointer 0MOVE.L 12(A6),-(SP) ;push the radius point 0_FrameRoundRect ;define the region 0MOVE.L 20(A6),-(SP) ;push region handle 0_CloseRgn ;assign roundRect region ; 0_ShowPen ;enable drawing again ; ; now square up either the top or bottom of the region (or neither) ; 0MOVE.L 16(A6),A0 ;get rectangle pointer 0TST.W 8(A6) ;examine 'botRound' flag 0BNE.S CheckTRound ;if true, see if top needs squaring 0MOVE BOTTOM(A0),D1 ;get bottom y coordinate 0MOVE D1,D0 0SUBQ #8,D0 ;compute top 0BRA.S SquareIt ; CheckTRound 0TST.W 10(A6) ;examine 'topRound' flag 0BNE.S MMRDone ;if that true, we're done 0MOVE Top(A0),D0 ;get top y coordinate 0MOVE D0,D1 0ADDQ #8,D1 ;get bottom ; ; here we build a rect in ToolScratch that has the same X as tempRect, but centered ; around the top or bottom ; SquareIt 0LEA ToolScratch,A1 ;get pointer to dest Rect 0MOVE D0,(A1)+ ;update top 0MOVE Left(A0),(A1)+ ;copy left 0MOVE D1,(A1)+ ;update bottom 0MOVE Right(A0),(A1) ;copy right ; ; now make a region out of that rectangle ; 0CLR.L -(SP) ;make space for result 0_NewRgn ;allocate a new region 0MOVE.L (SP),A3 ;keep a copy in A3 0PEA ToolScratch ;push the rectangle pointer 0_RectRgn ;make the rectangular region ; ; now union with the parameter region to square up the edges ; 0MOVE.L 20(A6),-(SP) ;push destination region 0MOVE.L A3,-(SP) ;push square region 0MOVE.L 20(A6),-(SP) ;dest gets the result 0_UnionRgn ; ; all done -- deallocate the temporary region ; 0MOVE.L A3,-(SP) 0_DisposRgn ; MMRDone 0MOVE.L (SP)+,A3 ;restore work reg 0UNLK A6 ;unlink stack frame 0MOVE.L (SP)+,A0 ;get return address 0ADD #16,SP ;strip parameters 0JMP (A0) ;all done! ; HitDoc -- perform a hit test on the document. On entry, D3 contains the mousePoint ; in global coordinates while A3 holds the window pointer ; HitDoc 0MOVEQ #16,D4 ;keep 16 in a register to save code 0CLR.W -(SP) ;make room for function result 0MOVE.L D3,-(SP) ;push the mouse point 0MOVE.L CONTRGN(A3),-(SP) ;push content region handle 0_PtInRgn ;is the point in the content region? 0TST.B (SP)+ ;well, is it? 0BEQ.S NotInContent ;if not, go check out drag region ; the point is in the content region so return a '1' justContent 0MOVEQ #wInContent,D0 ;return in content 0BRA.S DoneHitDoc ;go store function result and return ; its not in the content -- see if its in the dragRgn (content extended by titleBar) NotInContent 0CLR.W -(SP) 0MOVE.L D3,-(SP) 0MOVE.L StructRgn(A3),-(SP) 0_PtInRgn 0TST.B (SP)+ 0BEQ.S DoneHit1 0CLR.W -(SP) ;make room for function result 0MOVE.L D3,-(SP) ;push the mouse point 0MOVE.L ContRgn(A3),A4 ;get content region handle 0MOVE.L (A4),A4 ;get region ptr 0ADDQ #RgnBBox,A4 ;get bounding box ptr 0SUB #20,Top(A4) ;make it 20 higher 0MOVE.L A4,-(SP) ;push the rect 0_PtInRect ;is the point in the title bar? 0ADD #20,Top(A4) ;fix up content bounds 0TST.B (SP)+ ;examine result 0BEQ.S DoneHit1 ;if not, return 0 (do nothing) ; see if its in leftmost 16 of drag, which is the goAway button 0TST.B WGoAway(A3) ;is there a goAway button? 0BEQ.S ItsInDrag ;if not, skip 0TST.B WHilited(A3) ;only draw it for the active one 0BEQ.S ItsInDrag 0MOVE D3,D0 ;get mousePt 0ADD PortBounds+Left(A3),D0 ;convert to local 0SUB PortRect+Left(A3),D0 ;compensate for origin 0CMP #18,D0 ;is it too far right? 0BGT.S ItsInDrag ;if so, its in drag 0SUBQ #8,D0 ;it must be at least 8 0BMI.S ItsInDrag ; its in the goAway button so signal it 0MOVEQ #wInGoAway,D0 0BRA.S DoneHitDoc ItsInDrag 0MOVEQ #wInDrag,D0 ;flag in drag region DoneHitDoc 0MOVE.L D0,20(A6) ;update function result DoneHit1 RTS ; CalcDoc -- calculate the structure and content regions for the window pointed ; to by A3. CalcDoc 0LEA TEMPRECT,A0 ;get a pointer to the work rectangle 0MOVE.L A0,-(SP) ;push for later offset 0MOVE.L PORTRECT(A3),(A0)+ ;copy topLeft of portRect 0MOVE.L PORTRECT+4(A3),(A0) ;copy botLeft of portRect ; offset it to global coordinates 0MOVE.L PORTBOUNDS(A3),-(SP) ;push topLeft of port.portBits.bounds 0NEG 2(SP) ;negate offset 0NEG (SP) 0_OffsetRect ;offset tempRect to global coordinates ; make the content region square for fast updating 0MOVE.L CONTRGN(A3),A0 ;A0 holds the content region 0CLR D1 ;topround is false 0BSR.S GOMAKERGN ;go make the region into content region ; now do the structure region. First correct the bounding rectangle (tempRect) for ; structure instead of content 0PEA TEMPRECT ;push a pointer to the rect 0MOVE.L MinusOne,-(SP) ;make 1 pixel bigger, all around 0_InsetRect ;make it bigger 0SUB #19,TempRect+Top ;make top 19 pixels higher 0MOVEQ #1,D1 ;topRound is true 0MOVE.L STRUCTRGN(A3),A0 ;A0 holds the structRgn pointer GoMakeRgn 0MOVE.L A0,-(SP) ;push the region handle 0PEA TEMPRECT ;push bounding rectangle pointer 0BSR GETRADPOINT ;get the radius factor 0MOVE.L D0,-(SP) ;push it 0MOVE.W D1,-(SP) ;topRound is in D1 0ST -(SP) ;so is botRound 0BSR MakeRoundRegion ;go make the region ; all done with CalcDocRgns 0RTS ; ; BitMap for default GoAway button GoAwaySymbol 0.WORD $0000,$0000,$7FF0,$4010 0.WORD $4010,$4010,$4010,$4010 0.WORD $4010,$4010,$4010,$4010 0.WORD $7FF0,$0000,$0000,$0000 ; Mask for goAway button 0.WORD $0000,$0000,$7FF0,$4110 0.WORD $4930,$4550,$4010,$5C60 0.WORD $4010,$4550,$4930,$4110 0.WORD $7FF0,$0000,$0000,$0000 ; 0.END ; 3. "6F^9 P:H r^x1/meter bottom s r. e BitMap,A0 ;get pointer to source bitmap 0MOVE.L A1,(A0)+ ;update base address of bitMap 0MOVE #2,(A0)+ ;update rowByt; Utility RoundOff -- RoundOff the number in D1 to the nearest integer. The remainder ; from dividing by D2 is in the high part of the word. ; RoundOff MOVE.W D0,-(SP) ;preserve D0 0MOVE D2,D0 ; ;File defProcs/SBarCDef.TEXT ;-------------------------------------------------------------------------- ; ; Standard ScrollBar Dial Definition Procedure for the ; MacIntosh Control Manager ; ; written by Andy Hertzfeld August, 1982 ; ; (c) 1982 by Apple Computer, Inc. All rights reserved. ; ; This file contains the control definition procedure ; that defines scrollBar-type dials. ; ; Modification History: ; ; 29-Aug-82 AJH Added "255" hiliting, non-rectangular indicators ; to ScrollBarProc ; 31-Aug-82 AJH Added hysterisis to scrollBar, ronding to value calculations ; 19-Sep-82 AJH Re-arranged ScrollBar proc, removed DragThumb ; 03-Oct-82 AJH Fixed bug in scrollBar positioning -- wasn't ctl relative ; 10-Oct-82 AJH Converted for QuickDraw Trap Interface ; 17-Oct-82 AJH Made controlProcs preserve A1 ; 07-Nov-82 AJH Made wide scrollBars look better ; 11-Nov-82 AJH fixed thumb scaling problem in CalcIBox (subtract min) ; 14-Nov-82 AJH removed box in arrowBits ; 16-Nov-82 AJH Made branch tables offset based ; 28-Dec-82 AJH Put scrollBar definition proc in its own file ; 30-Dec-82 AJH Changed hystersis for thumbDrag to 24 pixels ; 30-Jul-83 SC Variant 1 for microsoft - no grey or elevator (Yuck) ; 04-Sep-83 AJH Made it respond to message 8 (just a stub) ; 08-Oct-83 AJH Changed rounding to fix "off by 1" bug ; 10-Nov-83 AJH Changed disabling -- don't fill with gray ; 11-Nov-83 AJH Made it redraw all if disabled ; 27-Dec-83 AJH Made min=max act disabled; added "254" hiliting ; 13-Apr-84 SC Replaced _EraseRgn with _FillRgn,white ; 02-Feb-85 HAA Changed INCLUDEs to use new TLAsm file names ; ;---------------------------------------------------------------------------- 0.INCLUDE TLAsm/SysEqu.text 0.INCLUDE TLAsm/SysTraps.text 0.INCLUDE TLAsm/QuickEqu.text 0.INCLUDE TLAsm/ToolEqu.text 0.INCLUDE TLAsm/QuickTraps.text 0.INCLUDE TLAsm/ToolTraps.text ; 0.PROC SDEF,0 ; ; FUNCTION ScrollBarProc( theControl: ControlHandle; ; message: INTEGER; ; param: LongInt): LongInt; ; ; Here is the dispatch table for the scrollBar definition procedure, which implements ; semi-Lisa style scrollBar type controls for the Mac toolBox. It shares a common ; dispatcher with the pushButton proc (see above) ; ; SavePen .EQU -20 IndicatorRect .EQU -30 ; 0BRA.S @0 0.WORD 0 0.ASCII 'CDEF' 0.WORD 1 0.WORD 1 ;version # @0 0LINK A6,#-30 ;set up a stack frame to address parameters 0MOVEM.L D3-D6/A1-A4,-(SP) ;save work registers ; ; save the penState and set it our way ; 0PEA SavePen(A6) ;push pointer to savePenState 0_GetPenState ;remember current penState 0_PenNormal ;set the pen the way we want it ; ; fetch the parameters into registers ; 0LEA 8(A6),A0 ;get ptr to first parameter 0MOVE.L (A0)+,D3 ;get param in D3 0MOVE.W (A0)+,D0 ;get message 0MOVE.L (A0)+,A3 ;get the control handle 0MOVE.W (A0)+,D6 ;get selection index 0CLR.L (A0) ;clear out function result 0MOVE.L (A3),A0 ;get control pointer in A0 ; ; case out on the message number ; 0ADD D0,D0 ;double for word index 0LEA GoScrollBar,A1 ;get table address 0ADD 0(A1,D0),A1 ;compute dispatch address 0JSR (A1) ;dispatch to appropriate routine ; ; restore original pen state ; 0PEA SavePen(A6) ;push savePenState 0_SetPenState ;restore original pen state ; ; we're done -- restore registers and return to caller ; 0MOVEM.L (SP)+,D3-D6/A1-A4 ;restore work registers 0UNLK A6 ;unlink stack frame TenBytExit MOVE.L (SP)+,A0 ;get return address 0ADD #12,SP ;strip parameters 0JMP (A0) ;return to caller GoScrollBar 0.WORD DrawSBar-GoScrollBar ;draw is message 0 0.WORD HitSBar-GoScrollBar ;hit test is message 1 0.WORD CalcSBar-GoScrollBar ;calc regions is message 2 0.WORD InitSBar-GoScrollBar ;allocate indicator region (3) 0.WORD DispSBar-GoScrollBar ;de-allocate indicator region (4) 0.WORD MoveSBar-GoScrollBar ;message 5 is move indicator call (5) 0.WORD ThumbSBar-GoScrollBar ;message 6 is thumb dragging 0.WORD StubSBar-GoScrollBar ;no custom dragging (7) 0.WORD StubSBar-GoScrollBar ;no built-in action proc ; ; 16 wide by 16 high little bitMaps used for scrollBar arrows ; ; (the comments as to which are left/right or up/down may lie) ; ; ; Left Arrow BitMap ; LArrowData 0.WORD $FFFF,$8081,$80C1,$80A1,$8F91,$8809,$8805,$8803 0.WORD $8805,$8809,$8F91,$80A1,$80C1,$8081,$8001,$FFFF LArrowMask 0.WORD $FFFF,$8081,$80C1,$80E1,$8FF1,$8FF9,$8FFD,$8FFF 0.WORD $8FFD,$8FF9,$8FF1,$80E1,$80C1,$8081,$8001,$FFFF ; ; Right Arrow BitMap ; RArrowData 0.WORD $FFFF,$8101,$8301,$8501,$89F1,$9011,$A011,$C011 0.WORD $A011,$9011,$89F1,$8501,$8301,$8101,$8001,$FFFF RArrowMask 0.WORD $FFFF,$8101,$8301,$8701,$8FF1,$9FF1,$BFF1,$FFF1 0.WORD $BFF1,$9FF1,$8FF1,$8701,$8301,$8101,$8001,$FFFF ; ; Up Arrow BitMap ; UArrowData 0.WORD $FFFF,$8001,$8001,$8FE1,$8821,$8821,$8821,$F83D 0.WORD $A009,$9011,$8821,$8441,$8281,$8101,$8001,$FFFF UArrowMask 0.WORD $FFFF,$8001,$8001,$8FE1,$8FE1,$8FE1,$8FE1,$FFFD 0.WORD $BFF9,$9FF1,$8FE1,$87C1,$8381,$8101,$8001,$FFFF ; ; Down Arrow BitMap ; DArrowData 0.WORD $FFFF,$8001,$8101,$8281,$8441,$8821,$9011,$A009 0.WORD $F83D,$8821,$8821,$8821,$8FE1,$8001,$8001,$FFFF DArrowMask 0.WORD $FFFF,$8001,$8101,$8381,$87C1,$8FE1,$9FF1,$BFF9 0.WORD $FFFD,$8FE1,$8FE1,$8FE1,$8FE1,$8001,$8001,$FFFF ; ; DrawSBar draws a scroll bar as specified by the controlHandle in A3. D3 has the ; desired "hilite" area code. ; DrawSBar ; ; Figure out if the scroll bar is horizontal or vertical and handle each ; case separately. see if its more horizontal or vertical -- A0 points to the ; rect to be tested. D0 returns 0 to select vertical and two to select horizontal. ; After we know which axis, draw the arrows. ; 0TST.B ContrlVis(A0) ;is it visible? 0BEQ StubSBar ;if not, don't draw ; if it was disabled, draw the whole thing 0CMP.B #$FF,D3 ;disabled part code? 0BNE.S @0 ;if not, skip 0MOVEQ #0,D3 ;if so, draw all @0 0MOVE.B ContrlHilite(A0),D4 ;get current hilite in register 0BSR GetTCtlRect ;copy the control rect into tempRect 0BSR TestHV ;get horizontal/vertical index in D0 ; ; adjust for 1st arrow (if we're supposed to) ; 0MOVE.W Top(A1,D0),D1 ;get vertical coordinate 0ADD D2,D1 ;compute bottom 0MOVE.W D1,Bottom(A1,D0) ;update bottom 0LEA RArrowData,A1 ;point to right arrow bitMap 0MOVEQ #inUpButton,D1 ;signal 1st arrow ; 0MOVEM D0/D2,-(SP) ;remember hv selector ; 0BSR.S ShouldIDraw ;test hilite to see if we should draw 0BNE.S SkipUp 0BSR DrawArrowBox ;draw the arrow box ; ; now do the other arrow ; SkipUp 0BSR GetTCtlRect ;copy bounding rect into tempRect 0MOVEM (SP)+,D0/D2 ;restore hv selector ; ; adjust rect for 2nd arrow ; 0MOVE Bottom(A1,D0),D1 ;get bottom coordinate 0SUB D2,D1 ;compute top 0MOVE D1,Top(A1,D0) ;adjust box top 0LEA LArrowData,A1 ;point to 1st set of bitMaps 0MOVEQ #inDownButton,D1 ;signal in 2nd arrow ; 0BSR.S ShouldIDraw ;dont't draw if we done have to 0BNE.S SkipDown 0BSR DrawArrowBox ;draw the arrow box ; ; paint the body of the scrollBar light gray ; SkipDown ; 0CMP #1,D6 ;flavor one has no grey 0BEQ FrameCtl 0MOVE.W #inThumb,D1 ;get thumb part code 0BSR.S ShouldIDraw ;draw it? 0BNE FrameCtl ;if not, skip 0;CMP #inThumb,D3 ;if we're just drawing, just remove it 0;BEQ.S GrayIndicator ;dont do the whole rect 0BSR GetTCtlRect ;get control bounding rectangle 0MOVE.L A1,-(SP) ;push tempRect 0BSR GetLtGray ;get pointer to light gray pattern 0MOVE.L A0,-(SP) ;push it ; 0BSR.S IsDisabled ;is it disabled? 0BNE.S @0 ;if not, skip 0MOVE.L (A5),A0 ;get grafGlobals 0LEA White(A0),A0 ;get address of white pattern 0MOVE.L A0,(SP) ;use it @0 0LEA TempRect,A1 ;get tempRect pointer back 0MOVE.L A1,A0 ;put in A0 for TestHV 0BSR.S TestHV ;get h/v index 0SWAP D2 ;get width in high part 0MOVE.W #1,D2 ;get 1 in low part 0TST.W D0 ;which dimension? 0BEQ.S @1 ;skip correction if vertical 0SWAP D2 ; @1 MOVE.L A1,-(SP) ;push a pointer to the rectangle 0MOVE.L D2,-(SP) ;push inset factor ; 0_InsetRect ;inset it appropriately 0_FillRect ;paint the body gray 0BRA.S DoIndicator ;go plot the indicator ; ; Utility ShouldIDraw -- to test when to skip drawing a part of the scrollBar. ; On entry, D3 has parameter indicating part that needs drawing while D1 holds ; the part we are about to draw. If D3 is zero, always draw it. Otherwise, ; draw only if it matches. Returning 0 in the Z-flag means you should draw ; ShouldIDraw 0TST D3 ;examine the parameter 0BEQ.S StubSBar ;its zero so don't test further 0CMP D1,D3 ;the right part StubSBar RTS ;the z-flag has the answer ; IsDisabled is a utility to check to see if a scrollBar is disabled or not. ; It returns with the z-flag set if it is disabled IsDisabled 0MOVE.L (A3),A0 ;get sBar pointer 0MOVE.B ContrlHilite(A0),D0 ;get the hilite parameter 0ADDQ.B #1,D0 ;was it 255? 0BEQ.S @0 ;if so, its disabled 0ADDQ.B #1,D0 ;how about 254? 0BEQ.S @0 ;if so, its disabled also 0MOVE.W ContrlMin(A0),D0 ;get the min 0CMP.W ContrlMax(A0),D0 ;same as the max? @0 0RTS ;return to caller with z-flag result ; ; We're just changing the indicator so gray it out. ; ;GrayIndicator 0;BSR.S IsDisabled 0;BEQ.S FrameCtl ;if so, skip 0;MOVE.L ContrlData(A0),-(SP) ;push handle to indicator region 0;BSR GetLtGray ;get pointer to light gray 0;MOVE.L A0,-(SP) ;push light gray 0;_FillRgn ;erase the indicator ; ; Check the hilite state. If the control is inactive (hilite = 255), don't draw ; the indicator at all. ; DoIndicator 0BSR CalcIBox ;calculate the indicator box 0BSR.S IsDisabled 0BEQ.S FrameCtl ;if so, skip 0MOVE.L ContrlData(A0),-(SP) ;push indicator region handle 0MOVE.L (SP),-(SP) ;we need it again 0MOVE.L GrafGlobals(A5),A0 ; our erase rect 0PEA white(A0) 0_FillRgn ;paint it white 0_FrameRgn ;and frame it ; ; frame the whole rect ; FrameCtl 0MOVE.L (A3),A0 0PEA ContrlRect(A0) ;push pointer to scrollBar rect 0_FrameRect ;frame it ; ; all done drawing the scroll bar ; 0RTS ; ; TestHV is a utility that determines if the rectangle pointed to by A0 is more horizontal ; or vertical. Return 0 in D0 if its more vertical and 2 if its more horizontal. ; This routine trashes D1. The result is also reflected in the condition code. ; It also returns the width/height of the minor dimension in D2. ; TestHV 0MOVE Bottom(A0),D0 0SUB Top(A0),D0 ;get height 0MOVE Right(A0),D1 0SUB Left(A0),D1 ;get width 0CMP D0,D1 ;compare width and height 0BGT.S @1 ;branch it width is greater 0MOVE D1,D2 ;horizontal in D2 0MOVEQ #0,D0 ;signal its vertical 0RTS @1 MOVE D0,D2 ;vertical in D2 0MOVEQ #2,D0 ;signal its horizontal 0RTS ; ; DrawArrowBox is a routine that clears and frames an arrow box and then blits ; across the appropriate arrow (looks at hilite state). On entry, TempRect has the ; box for the arrow, D0 has h/v selector, D1 has left/right selector,A1 points to the ; arrow bitMap, A3 has the control handle. ; DrawArrowBox 0MOVE.L (A3),A0 ;get the control pointer 0CMP.B ContrlHilite(A0),D1 ;should it be hilited? 0BNE.S @1 ;if not, skip 0ADD #32,A1 ;if so, bump to hilite mask ; ; adjust bitMap for vertical or horizontal arrows ; @1 TST D0 0BNE.S @2 0ADD #128,A1 ;bump to horizontal ; ; plot the arrow ; @2 CLR D0 ;mode is srcCopy 0BSR.S PlotSymbol ;plot the bitmap in the tempRect box ; ; Now frame the box and we're done! ; 0PEA TempRect ;push the rectangle 0_FrameRect ;frame it and we're done SBarStub 0RTS ; ; PlotSymbol -- plot the little 16 by 16 symbol bitmap pointed to by A1 into the rectangle ; pointed held in TempRect. D0 holds the mode. ; PlotSymbol 0LEA IconBitMap,A0 ;get pointer to source bitmap 0MOVE.L A1,(A0)+ ;update base address of bitMap 0MOVE #2,(A0)+ ;update rowBytes 0CLR.L (A0)+ ;topLeft is zero, zero 0MOVE.L #$00100010,(A0) ;adjust boundsRect ; ; push parameters for CopyBits call to transfer arrow bitMap ; 0PEA IconBitMap ;push pointer source bitmap 0MOVE.L (SP),A0 ;remember in A0, too 0MOVE.L GrafGlobals(A5),A1 ;get GrafGlobals baseaddress 0MOVE.L THEPORT(A1),A1 ;get thePort 0PEA PORTBITS(A1) ;that's the destination bitmap ; 0PEA BOUNDS(A0) ;boundsRect of bitmap is source 0PEA TempRect ;tempRect is the destination 0MOVE.W D0,-(SP) ;theMode is in D0 0CLR.L -(SP) ;no mask region ; ; transfer the bitMap (stretching as necessary...) ; 0_CopyBits ;let Bill stretch those bits 0RTS ;return to caller ; ; CalcIBox is the crucial routine that computes the position of the top/left of the ; thumb by scaling the control's value according to its range and the screen area. ; Return the rectangle in IndicatorRect(A6). It expects that A3 will hold the ; control handle as usual ; CalcIBox 0MOVE D3,-(SP) ;preserve D3 0LEA IndicatorRect(A6),A1 ;get address of indicator rectangle 0BSR.S GetCtlRect ;first set it to control bounding rect ; 0MOVEQ #0,D1 ;clear out high part of D1 0MOVE.L (A3),A0 ;get pointer to control 0LEA ContrlRect(A0),A0 ;get pointer to the bounding rectangle 0BSR.S TestHV ;get h/V selector index in D0 0MOVE D2,D3 ;keep minor dimension in D3 ; ; compute control screen area in relevant dimension ; 0MOVE Bottom(A0,D0),D1 ;get logical "bottom" 0SUB Top(A0,D0),D1 ;compute "height" 0SUB D2,D1 ;discount arrow box 0SUB D2,D1 ;discount other one, too 0SUB D2,D1 ;and the indicator ; ; compute "screenSize times value" ; 0MOVE.L (A3),A0 ;get control pointer 0MOVE.W ContrlValue(A0),D2 ;get current value 0SUB.W ContrlMin(A0),D2 ;get delta from min 0MULU D2,D1 ;compute value*screensize ; ; compute size of logical space ; 0MOVE ContrlMax(A0),D2 ;get max 0SUB ContrlMin(A0),D2 ;compute size of space 0BEQ.S Scale0 ;dont divide by 0 ; ; perform the scaling ; 0DIVU D2,D1 ;compute where iBox should go 0BSR RoundOff ;round off D1 0ADD D3,D1 ;skip over arrow box ; ; update indicator rect to correct position ; UpdateIRect 0LEA IndicatorRect(A6),A1 ;get pointer to rect 0ADD Top(A1,D0),D1 ;compute the logical "top" 0MOVE D1,Top(A1,D0) ;update it 0ADD D3,D1 ;bump to "bottom" 0MOVE D1,Bottom(A1,D0) ;update "bottom" ; 0EOR #2,D0 ;flip to minor dimension 0ADDQ #1,Top(A1,D0) ;inset logical "left" 0SUBQ #1,Bottom(A1,D0) ;inset logical "right" ; ; set up the indicator region ; 0MOVE.L ContrlData(A0),-(SP) ;push indicator region handle 0MOVE.L A1,-(SP) ;push rect ptr 0_RectRgn ;make a rectangular region ; CalcIDone MOVE (SP)+,D3 ;restore D3 0RTS ; ; if min = max, pin at top ; Scale0 MOVE D3,D1 0BRA.S UpdateIRect ; ; GetCtlRect is a code saving utility that copies the bounding rectangle of the control ; whose handle is in A3 into the rectangle pointed to by A1. This routine blows ; A0 but preserves A1. GetTCtlRect is an alternative entry used to save code ; GetTCtlRect LEA TempRect,A1 GetCtlRect MOVE.L (A3),A0 ;get pointer to control 0LEA ContrlRect(A0),A0 ;get pointer to bounding rect 0MOVE.L (A0),(A1) ;copy topLeft 0MOVE.L 4(A0),4(A1) ;copy botRight NoSBarHit 0RTS ; ; HitSBar is the hit test routine for the scroll bar definition routine. It classifies ; the position of the mouse passed in D3 ; HitSBar 0CMP.B #254,ContrlHilite(A0) ;254 hilited? 0BEQ.S Return254 0BSR IsDisabled ;is it otherwise disabled? 0BEQ.S NoSBarHit ;if so, return 0 0LEA ContrlRect(A0),A4 ;keep rect pointer in A4 0CLR.W -(SP) ;make room for function result 0MOVE.L D3,-(SP) ;push the point 0MOVE.L A4,-(SP) ;push address of rect 0_PtInRect ;in the rectangle? 0TST.B (SP)+ ;examine result 0BEQ.S NoSBarHit ;if not, we're done ; ; its in the rect, so classify if in upButton,downButton,pageUp,pageDown or thumb ; 0BSR.S NormalizePt ;swap relevant coordinate into low part ; ;and set up D0,D2 ; see if its in the top button ; @1 MOVE D3,D1 ;get copy of mousePoint 0SUB 0(A4,D0),D1 ;subtract rectangle top 0CMP D2,D1 ;is it within width of the top? 0BGT.S @2 ;it not, go check bottom 0MOVEQ #inUpButton,D0 ;classify it 0BRA.S UpdateResult ;all done ; ; see if its in the bottom button ; @2 MOVE 4(A4,D0),D1 ;get bottom 0SUB D3,D1 ;get distance from bottom 0CMP D2,D1 ;is it in it? 0BGT.S CheckInd ;if not, go check indicator ; 0MOVEQ #inDownButton,D0 UpdateResult 0MOVE D0,22(A6) ;return result 0RTS Return254 0MOVE #254,D0 0BRA.S UpdateResult ; ; its not in either button so it must be the thumb or one of the page areas. Check ; for the thumb first ; CheckInd 0CMP #1,D6 ; for flavor one don't test 0BEQ.S NoSBarHit 0BSR CalcIBox ;calculate the indicator rectangle 0BSR.S NormalizePt ;restore back to normal point 0CLR.W -(SP) ;make space for boolean result 0MOVE.L D3,-(SP) ;push the point 0MOVE.L (A3),A0 0MOVE.L ContrlData(A0),-(SP) ;push the indicator region 0_PtInRgn ;is the mouse in the indicator? 0TST.B (SP)+ ;(..the suspense builds...) 0BEQ.S CheckPage ;branch if its not in the indicator ; ; its in the thumb so report that to the application ; 0MOVE #inThumb,D0 ;get result 0BRA.S UpdateResult ;all done -- go update result ; ; it must be in one of the two page areas. Determine which one by looking at the ; midPoint of the indicator's bounding rectangle. ; CheckPage 0BSR.S NormalizePt ;normalize (get interesting low word) 0MOVE.L (A3),A0 ;get control pointer 0MOVE.L ContrlData(A0),A0 ;get region handle 0MOVE.L (A0),A0 ;get region pointer 0LEA RgnBBox(A0),A0 ;point to the region bounding box ; ; determine midpoint ; 0MOVE Bottom(A0,D0),D1 ;get logical bottom 0SUB Top(A0,D0),D1 ;get logical height 0LSR #1,D1 ;divide by 2 0ADD Top(A0,D0),D1 ;add to get the midpoint ; ; at this point, D1 has the midpoint in the important dimension. Compare with the ; mouse point to decide if its page up or down. ; 0CMP D1,D3 ;compare mousePt with midPoint 0BLT.S PageItUp ;if above its the logical "top" 0MOVEQ #inPageDown,D0 ;set result code 0BRA.S UpdateResult ;all done -- go update result PageItUp MOVEQ #inPageUp,D0 ;set result code 0BRA.S updateResult ;all done ; ; NormalizePt takes a rect pointer in A4 and a point in D3 and swaps the points ; coordinates according to the relevant dimensions ; NormalizePt 0MOVE.L A4,A0 ;get rect pointer in A0 0BSR TestHV ;get horizontal vertical offset 0BNE.S @1 ;if horizontal, skip 0SWAP D3 ;its vertical so get y in low part @1 RTS ;all done ; ; CalcSBar returns the bounding region of the scroll bar. D3 holds the region parameter. ; If the high bit of D3 is set, return the indicator region, other return the entire ; bounding region ; CalcSBar 0TST.L D3 ;indicator or body? 0BMI.S GetIndRgn ;if negative, go get indicator 0MOVE.L D3,-(SP) ;push the region handle 0PEA ContrlRect(A0) ;push rectangle pointer 0_RectRgn ;return a rectangular region 0RTS ;all done! ; ; the indicator region was requested so copy the one in the dataHandle ; GetIndRgn 0BSR CalcIBox ;calculate indicator region 0MOVE.L (A3),A0 ;get pointer to control 0MOVE.L ContrlData(A0),-(SP) ;push indicator region 0MOVE.L D3,-(SP) ;push result region 0CLR.B (SP) ;clear out high byte 0_CopyRgn ;clone the region ; ; set the pattern for dragging ; 0BSR.S GetLtGray ;get pointer to light gray 0MOVE.L (A0)+,DragPattern ;update the drag pattern 0MOVE.L (A0),DragPattern+4 ;update the drag pattern 0RTS ; ; GetLtGray is a short utility that get a pointer to a lightGray pattern from ; the resource manager. ; GetLtGray /SUBQ #4,SP ;make room for result /MOVE.W #SBarPatID,-(SP) ;push resource ID /_GetPattern ;get the pattern /MOVE.L (SP)+,A0 ;get pattern handle /MOVE.L (A0),A0 ;get pattern ptr /RTS ; ; handle the "position yourself" message by calling figuring out the new value and ; calling SetCtlValue. D3 holds the amount to move by. ; MoveSBar 0MOVE.L ContrlData(A0),A0 ;get handle of indicator region 0MOVE.L (A0),A0 ;get a pointer to it 0LEA RgnBBox(A0),A4 ;get pointer to the bounding rect ; ; figure out new position by adding topLeft of current position to offset ; 0ADD Left(A4),D3 ;add the x coordinates 0SWAP D3 ;get y in low word 0ADD Top(A4),D3 ;add the y coordinates ; ; select the relevant dimension and get it into the low word of D3 ; 0MOVE.L (A3),A0 ;get the control pointer 0LEA ContrlRect(A0),A0 ;get the bounding rectangle 0BSR TestHV ;get h/v index 0BEQ.S @1 ;if its y, we're cool 0SWAP D3 ;get x into D3 ; ; determine amount of screen area devoted to the scrollBar ; @1 SUB Top(A0,D0),D3 ;make size ctl-relative 0SUB D2,D3 ;subtract arrow offset ; 0MOVE Bottom(A0,D0),D1 ;get logical bottom 0SUB Top(A0,D0),D1 ;compute logical height 0SUB D2,D1 ;compute active area 0SUB D2,D1 0SUB D2,D1 0MOVE D1,D2 ;get answer in D2 ; ; compute range of logical values: controlMax - controlMin ; 0MOVE.L (A3),A0 ;get control pointer 0MOVE ContrlMax(A0),D1 ;get max value 0SUB ContrlMin(A0),D1 ;compute range ; ; compute position*logical range/physical range ; 0MULU D3,D1 ;D3 has current position 0DIVU D2,D1 ;divide by physical range 0BSR.S RoundOff ;round to nearest integer ; ; at this point D1 has the value so set it, after offsetting by the minimum ; 0ADD.W ContrlMin(A0),D1 ;offset by minimum 0MOVE.L A3,-(SP) ;push control handle 0MOVE.W D1,-(SP) ;push the new value 0_SetCtlValue ;go set the new value 0RTS ;all done! ; ; InitSBar gets called when the scroll bar is allocated. It allocates an empty region ; to use as the indicator region ; InitSBar SUBQ #4,SP 0_NewRgn ;get a new region on the stack top 0MOVE.L (A3),A0 ;get control pointer 0MOVE.L (SP)+,ContrlData(A0) ;remember new region in control data 0RTS ; ; DispSBar de-allocates the region used for the indicator ; DispSBar MOVE.L ContrlData(A0),A0 ;get handle of indicator region 0_DisposHandle ;dispose of it 0RTS ; ; Utility RoundOff -- RoundOff the number in D1 to the nearest integer. The remainder ; from dividing by D2 is in the high part of the word. ; RoundOff MOVE.W D0,-(SP) ;preserve D0 0MOVE D2,D0 ;get old divisor 0LSR #1,D0 ;divide by 2 0SWAP D1 ;get remainder 0CMP D0,D1 ;compare remainder with 1/2 divisor 0BLE.S TruncateIt ;if smaller, we're done 0SWAP D1 ;get normal D1 back 0ADDQ #1,D1 ;round up ; RoundDone 0MOVE.W (SP)+,D0 ;restore D0 0RTS ; ; no need to round up so just truncate it ; TruncateIt 0SWAP D1 ;restore quotient 0BRA.S RoundDone ;all done with roundOff ; ; ThumbSBar receives the "drag thumb message for the scroll bar. On entry, D3 points ; to a structure that contains the starting point, it returns with pointers to ; the bounds and slopRect and the axis parameter ; ; Local Variable Equates ; BRect .EQU 0 ;boundsRect SRect .EQU 8 ;slopRect TAxis .EQU 16 ;axis ; ThumbSBar 0MOVE.L D3,A4 ;keep pointer to parameter block 0MOVE.L (A4),D3 ;get the mouse point ; 0LEA BRect(A4),A2 ;get pointer to boundsRect 0MOVE.L A2,A1 ;get pointer in A1 0BSR GetCtlRect ;copy control bounds rect ; 0MOVE.L A2,A0 ;point to boundsRect 0BSR TestHV ;get h/v selector in D0 0MOVE D2,-(SP) ;preserve D2 0SWAP D2 0MOVE.W #$FFE8,D2 ;get inset factor (24 pixels hyst) 0MOVE D0,D4 ;keep selector in D4 0BEQ.S @1 ;if vertical, we're cool 0SWAP D2 ;adjust inset factor 0BRA.S @2 ; @1 SWAP D3 ;adjust mouse pt ; @2 MOVE.L A2,-(SP) ;push pointer to rectangle 0MOVE.L D2,-(SP) ;push inset factor 0_InsetRect ;go inset it ; ; build the slopRect by insetting the boundsRect ; 0LEA SRect(A4),A0 ;get slopRect pointer 0MOVE.L (A4),(A0) ;copy boundsRect into slopRect 0MOVE.L 4(A4),4(A0) ;copy botRight, too ; 0MOVE.L #$FF800000,D0 ;get inset factor (assume vertical) 0TST D4 ;which dimension 0BEQ.S @3 ;if vertical, we're cool 0SWAP D0 ; @3 MOVE.L A0,-(SP) ;push slopRect pointer 0MOVE.L D0,-(SP) ;push inset factor 0_InsetRect ;inset it ; ; now further adjust the boundsRect depending where the mousePt is relative to the ; indicator box. ; 0MOVE.L (A3),A0 ;get control pointer 0MOVE.L ContrlData(A0),A0 ;get region handle 0MOVE.L (A0),A0 ;get region pointer 0SUB RgnBBox(A0,D4),D3 ;subtract relevant coordinate 0ADD D3,Top(A2,D4) ;offset logical top ; ; fix up logical bottom, too ; 0MOVE (SP)+,D2 ;get back D2 0SUBQ #1,D2 0SUB D2,Bottom(A2,D4) 0ADD D3,Bottom(A2,D4) ;subtract (15-number) from bottom ; ; now set up axis parameter ; 0LSR #1,D4 ;divide by 2 0EOR #1,D4 ;flip the sense 0ADDQ #1,D4 ;add increment 0MOVE D4,TAxis(A4) ;to derive axis parameter 0RTS /.END 9 *Ѥ ^] 4 volume block; d the second pass uffer . g bits) ) >̔T̔T88j̔T̔T88,FFFo,,VnoTypeErr .EQU -102 ; No object of that type in scrap ; some miscellaneous result codes evtNotEnb .EQU 1 ; event not enabled at PostEvent .IF wholeErrors ; System Error Alert ID d; File: FSEqu.Txt (9 Feb 85) ;_______________________________________________________________________ ; ; File System Equates -- This file contains all file system equates. ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ ; ; General system equates: btsPrBlk .EQU 12 ; twelve bits per block in the volume map. strtDir .EQU 2 ; directory master block is block 2 bufSiz .EQU 512 ; standard file system buffer size in bytes hdrSiz .EQU 10 ; size of header prefixed to buffer bufModBit .EQU 7 ; dirty bit in high byte of buf tag word bufFNum .EQU -10 ; offset from buf start to file number longword bufFlags .EQU -6 ; offset from buf start to file flags word bufFBlk .EQU -4 ; offset from buf start to file block word bufTag .EQU -2 ; offset from buf start to tag word sigWord .EQU $D2D7 ; signature bytes expected on start block ; fixed location labels: (equivalent of zero page) NewMount .EQU $34A ; (1) used by MountVol to flag new mounts DrMstrBlk .EQU $34C ; master directory block in a volume FCBSPtr .EQU $34E ; ptr to FCBs DefVCBPtr .EQU $352 ; pointer to default VCB VCBQHdr .EQU $356 ; VCB queue header FSQHdr .EQU $360 ; file system queue header (10 bytes) FSBusy .EQU $360 ; non-zero when the file system is busy FSQHead .EQU $362 ; ptr to 1st queued cmd: 0 when queue empty FSQTail .EQU $366 ; ptr to last queue element ErCode .EQU $3A2 ; use this loc to report errors during async @; routines FSQueueHook .EQU $3E2 ; hook to capture all FS calls ExtFSHook .EQU $3E6 ; command done hook DskSwtchHook .EQU $3EA ; hook for disk-switch dialog ReqstVol .EQU $3EE ; ptr to VCB of off-line or ext fs volume ToExtFS .EQU $3F2 ; hook for external file systems fsVarEnd .EQU $3F6 ; end of file system variables fsVarLth .EQU $B6 fsClrWDLen .EQU $A2 ;length to clear in boot blocks ; Volume Control Block equates: (prefix: vcb) vcbDirty .EQU 15 ; flags dirty bit (tst.w tests,clr.b clears) vcbWrProt .EQU 7 ; attrib write-protected bit (tst.b ATRB+1 tests) vcbFlags .EQU 6 ; flags word is first word after header ; first 66 bytes of VCB come directly from the directory master block vcbDInfoSt .EQU 8 ; leave room for 6-byte queue header vcbDILen .EQU 64 ; len of VCB data from master directory vcbSigWord .EQU 8 ; signature word vcbCrDate .EQU 10 ; Creation date. vcbLsBkUp .EQU 14 ; last backup date vcbAtrb .EQU 18 ; volume attributes. bit 15 = vol lock (1=locked) @; bit 7 = wr protect @; bit 6 = busy (1=busy) @; bits 0-2 = consistency prob vcbNmFls .EQU 20 ; number files in dir (low byte) vcbDirSt .EQU 22 ; start dir (512-byte) block on diskette vcbBlLn .EQU 24 ; length of dir in (512-byte) blocks vcbNmBlks .EQU 26 ; number of blocks (of alloc size) this device vcbNmAlBlks .EQU 26 ; (alternate label for a while) vcbAlBlkSiz .EQU 28 ; num of bytes in an allocation block vcbClpSiz .EQU 32 ; num of bytes to try to alloc as a clump vcbAlBlSt .EQU 36 ; starting diskette (512-byte) block in block map vcbNxtFNum .EQU 38 ; next free file number vcbFreeBks .EQU 42 ; number of free blocks on this volume vcbVN .EQU 44 ; volume name (including name length byte) vcbMaxNam .EQU 27 ; 27 byte max name length ; next 6 fields should be kept together vcbDrvNum .EQU 72 ; drive number for this VCB vcbDRefNum .EQU 74 ; driver refnum for this VCB vcbFSID .EQU 76 ; ID of file system handling this volume vcbVRefNum .EQU 78 ; unique refnum for this VCB vcbMAdr .EQU 80 ; volume map address vcbBufAdr .EQU 84 ; volume buffer address vcbMLen .EQU 88 ; length of volume map vcbDirIndex .EQU 90 ; directory index, block number used for vcbDirBlk .EQU 92 ; GetFileInfo searches by index ; File Control Block equates: (prefix: fcb) fcbModBit .EQU 7 ; dirty bit for FCB entry in FCBMdRByt fcbRscBit .EQU 1 ; 1 if this is resource part (in FCBMdRByt) fcbFlgRBit .EQU 9 ; resource bit in FCBFlags (word) fcbFlgWBit .EQU 8 ; write permissions bit in FCBFlags (word) fcbWrtBit .EQU 0 ; write permissions bit in FCBTypByt (1 if ok) wrRsMask .EQU $0300 ; rsrc/reg, write permissions mask fcbFlNm .EQU 0 ; FCB file number. Non-zero marks FCB used. fcbFlags .EQU 4 ; FCB flags fcbMdRByt .EQU 4 ; mod, write permissions, resource byte fcbTypByt .EQU 5 ; type byte fcbSBlk .EQU 6 ; File start block (in alloc size blks) fcbEOF .EQU 8 ; logical length or EOF in bytes fcbPLen .EQU 12 ; Physical file length in bytes fcbCrPs .EQU 16 ; current position within file. fcbVPtr .EQU 20 ; Absolute pointer to the corresponding VCB fcbBfAdr .EQU 24 ; file's buffer address. fcbFlPos .EQU 28 ; directory block this file is in ; File: PackMacs.Txt (15 Dec 84) ;_______________________________________________________________________ ; ; Package Equates -- This file defines the high-level equates for the ; Standard File, Disk Initialization, International Utilities, and ; Binary-Decimal Conversion packages. The equates for the Floating-Point ; Arithmetic and Transcendental Functions packages can be found in ; SANEMacs.TXT. This file may be split into its EQU's, which can be packed, ; and its .MACRO's, which cannot. ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ dskInit .EQU 2 ; Disk Initialization stdFile .EQU 3 ; Standard File flPoint .EQU 4 ; Floating-Point Arithmetic trFunc .EQU 5 ; Transcendental Functions intUtil .EQU 6 ; International Utilities bdConv .EQU 7 ; Binary/Decimal Conversion ; Equates for STANDARD FILE PACKAGE putDlgID .EQU -3999 ; SFPutFile dialog template ID getDlgID .EQU -4000 ; SFGetFile dialog template ID putSave .EQU 1 ; save button putCancel .EQU 2 ; cancel button putEject .EQU 5 ; eject button putDrive .EQU 6 ; drive button putName .EQU 7 ; editTExt item for file name getOpen .EQU 1 ; open button getCancel .EQU 3 ; cancel button getEject .EQU 5 ; eject button getDrive .EQU 6 ; drive button getNmList .EQU 7 ; userItem for file name list getScroll .EQU 8 ; userItem for scroll bar ; Reply record data structure rGood .EQU 0 ; ignore command if FALSE rType .EQU 2 ; file type rVolume .EQU 6 ; volume reference number rVersion .EQU 8 ; file's version number rName .EQU 10 ; file name ; Routine selectors sfPutFile .EQU 1 sfPPutFile .EQU 3 sfGetFile .EQU 2 sfPGetFile .EQU 4 ; Equates for DISK INITIALIZATION PACKAGE ; Routine selectors diLoad .EQU 2 diUnload .EQU 4 diBadMount .EQU 0 diFormat .EQU 6 diVerify .EQU 8 diZero .EQU 10 ; Result codes are defined in SysEqu.TXT ; Equates for INTERNATIONAL PACKAGE ; Routine selectors iuGetIntl .EQU 6 iuSetIntl .EQU 8 iuDateString .EQU 0 iuDatePString .EQU 14 iuTimeString .EQU 2 iuTimePString .EQU 16 iuMetric .EQU 4 iuMagString .EQU 10 iuMagIDString .EQU 12 ; Data structures for International Utilities ; International 0 record decimalPt .EQU 0 ; ASCII character for decimal point thousSep .EQU 1 ; ASCII character for thousand separator listSep .EQU 2 ; ASCII character for list separator currSym .EQU 3 ; ASCII for currency symbol (3 bytes long) currFmt .EQU 6 ; currency format flags dateOrder .EQU 7 ; short date form - DMY,YMD, or MDY shrtDateFmt .EQU 8 ; date elements format flag dateSep .EQU 9 ; ASCII for date separator timecycle .EQU 10 ; indicates 12 or 24 hr cycle timeFmt .EQU 11 ; time elements format flags mornStr .EQU 12 ; ASCII for trailing string from 0:00 to 11:59 eveStr .EQU 16 ; ASCII for trailing string from 12:00 to 23:59 timeSep .EQU 20 ; ASCII for the time separator timeSuff .EQU 21 ; suffix string used in 24 hr mode metricSys .EQU 29 ; indicates metric or English system intl0Vers .EQU 30 ; version: high byte = country. low byte = vers ; International 1 record days .EQU 0 months .EQU 112 suppressDay .EQU 304 lngDateFmt .EQU 305 dayLeading0 .EQU 306 abbrLen .EQU 307 st0 .EQU 308 st1 .EQU 312 st2 .EQU 316 st3 .EQU 320 st4 .EQU 324 intl1Vers .EQU 328 localRtn .EQU 330 ; Constants for manipulation of international resources ; Way to specify desired date format shortDate .EQU 0 longDate .EQU 1 abbrevDate .EQU 2 ; Masks used for setting and testing currency format flags currLeadingZ .EQU 128 ; set if leading zero currTrailingZ .EQU 64 ; set if trailing zero currNegSym .EQU 32 ; set if minus sign for negative num, reset if parentheses} currSymLead .EQU 16 ; set if currency symbol leads, reset if trails} ; Constants specifying absolute value of short date form mdy .EQU 0 ; month,day,year dmy .EQU 1 ; day,month,year ymd .EQU 2 ; year,month,day ; Masks used for date element format flags century .EQU 128 ; set if century, reset if no century mntLdingZ .EQU 64 ; set if leading 0 for month dayLdingZ .EQU 32 ; set if leading zero for day ; Masks used for time element format flags hrLeadingZ .EQU 128 ; set if leading zero for hours minLeadingZ .EQU 64 ; set if leading zero for minutes secLeadingZ .EQU 32 ; set if leading zero for seconds ; Country codes for version numbers verUS .EQU 0 verFrance .EQU 1 verBritain .EQU 2 verGermany .EQU 3 verItaly .EQU 4 verNetherlands .EQU 5 verBelgiumLux .EQU 6 verSweden .EQU 7 verSpain .EQU 8 verDenmark .EQU 9 verPortugal .EQU 10 verFrCanada .EQU 11 verNorway .EQU 12 verIsrael .EQU 13 verJapan .EQU 14 verAustralia .EQU 15 verArabia .EQU 16 verFinland .EQU 17 verFrSwiss .EQU 18 verGrSwiss .EQU 19 verGreece .EQU 20 verIceland .EQU 21 verMalta .EQU 22 verCyprus .EQU 23 verTurkey .EQU 24 verYugoslavia .EQU 25 ; Equates for BINARY-DECIMAL CONVERSION PACKAGE ; Routine selectors numToString .EQU 0 stringToNum .EQU 1 ; PackMacs QQ macros for the packages ; ; Macro for package invocation ; First arg is routine selector, second is the trap .MACRO _PackCall MOVE.W %1,-(SP) %2 .ENDM ;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ ; Disk Initialization ;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ .MACRO _DILoad _PackCall #DILoad,_Pack2 .ENDM .MACRO _DIUnLoad _PackCall #DIUnLoad,_Pack2 .ENDM .MACRO _DIBadMount _PackCall #DIBadMount,_Pack2 .ENDM .MACRO _DIFormat _PackCall #DIFormat,_Pack2 .ENDM .MACRO _DIVerify _PackCall #DIVerify,_Pack2 .ENDM .MACRO _DIZero _PackCall #DIZero,_Pack2 .ENDM ;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ ; Standard File ;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ .MACRO _SFPutFile _PackCall #SFPutFile,_Pack3 .ENDM .MACRO _SFPPutFile _PackCall #SFPPutFile,_Pack3 .ENDM .MACRO _SFGetFile _PackCall #SFGetFile,_Pack3 .ENDM .MACRO _SFPGetFile _PackCall #SFPGetFile,_Pack3 .ENDM ;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ ; International Utilities ;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ .MACRO _IUGetIntl _PackCall #IUGetIntl,_Pack6 .ENDM .MACRO _IUSetIntl _PackCall #IUSetIntl,_Pack6 .ENDM .MACRO _IUDateString _PackCall #IUDateString,_Pack6 .ENDM .MACRO _IUDatePString _PackCall #IUDatePString,_Pack6 .ENDM .MACRO _IUTimeString _PackCall #IUTimeString,_Pack6 .ENDM .MACRO _IUTimePString _PackCall #IUTimePString,_Pack6 .ENDM .MACRO _IUMetric _PackCall #IUMetric,_Pack6 .ENDM .MACRO _IUMagString _PackCall #IUMagString,_Pack6 .ENDM .MACRO _IUMagIDString _PackCall #IUMagIDString,_Pack6 .ENDM ;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ ; Binary-Decimal Conversion ;QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ .MACRO _StringToNum _PackCall #stringToNum,_Pack7 .ENDM .MACRO _NumToString _PackCall #numToString,_Pack7 .ENDM 9Iclt .EQU $00048000 ; Pr^5@@;4Print rec printer ting. luding name seconds) s. ing. 12 ; application defined events App2Evt .EQU 13 App3Evt .EQU 14 App4Evt .EQU 15 ; Event RiPrJobSize .EQU 20 ; The PrJob size.[20] ; The universal 120 byte printing record iPrVersion .EQU 0 ; Printing software version prInfo .EQU 2 ; the PrInfo data associated with the curre; File: PrEqu.Txt (9 Feb 85) ;_______________________________________________________________________ ; ; Printing Equates -- This file defines the public high-level equates for the ; Macintosh printing software. Record stuctures may have additional private ; equates which are defined by and reserved for use by Apple Computer, Inc. ; ; Copyright 1984, 1985, Apple Computer, Inc. ;_______________________________________________________________________ ; Printing Code Contsants ; These are the PrDrvr constants. iPrDrvrID .EQU 2 ; Driver's ResID iPrDrvrRef .EQU $FFFD ; Driver's RefNum = NOT ResID iPrDrvrDev .EQU $FD00 ; Driver's QD Dev num = RefNum in Hi Byte, variant in lo iPrBitsCtl .EQU 4 ; The Bitmap Print Proc's ctl number lScreenBits .EQU $00000000; The Bitmap Print Proc's Screen Bitmap param lPaintBits .EQU $00000001; The Bitmap Print Proc's Paint [sq pix] param iPrIOCtl .EQU 5 ; The Raw Byte IO Proc's ctl number iPrEvtCtl .EQU 6 ; The PrEvent Proc's ctl number lPrEvtAll .EQU $00FFFFFD; The PrEvent Proc's CParam for the entire screen lPrEvtTop .EQU $00FEFFFD; The PrEvent Proc's CParam for the top folder iPrDevCtl .EQU 7 ; The PrDevCtl Proc's ctl number iPrReset .EQU 1 ; The PrDevCtl Proc's CParam for reset iPrPageEnd .EQU 2 ; The PrDevCtl Proc's CParam for end page iPrLineFeed .EQU 3 ; The PrDevCtl Proc's CParam for paper advance iFMgrCtl .EQU 8 ; The FMgr's Tail-hook ctl call iFMgrStat .EQU 8 ; The FMgr's Pre-hook status call ; Printing data structures ; Print Info data structure ; The parameters needed for page composition. rPage .EQU 6 ; printable area device coord. [rect] ; Printer Style data structure ; The printer configuration and usage information. iPageV .EQU 2 ; V paper size in units of 1/iPrPgFract [word] iPageH .EQU 4 ; H paper size. [word] feed .EQU 7 ; paper feeder type [byte] ; Print eXtra Info data structure ; The print time eXtra information. iDevBytes .EQU 6 ; Size for allocation. [word] ; Print Job data structure ; Print "form" for a single print request. iFstPage .EQU 0 ; Page Range [word] iLstPage .EQU 2 ; [word] iCopies .EQU 4 ; # copies [word] bJDocLoop .EQU 6 ; Draft quality print flag [byte] fFromApp .EQU 7 ; Printing from an App (not PrApp) flag [byte] pIdleProc .EQU 8 ; Idle Proc [pointer] pFileName .EQU 12 ; Spool File Name: NIL for default [pointer] iFileVol .EQU 16 ; Spool File vol [word] bFileVers .EQU 18 ; Spool File version [byte] iPrJobSize .EQU 20 ; The PrJob size.[20] ; The universal 120 byte printing record iPrVersion .EQU 0 ; Printing software version prInfo .EQU 2 ; the PrInfo data associated with the current style. rPaper .EQU 16 ; The paper rectangle [offset from rPage]. prStl .EQU 24 ; This print request's style. prInfoPT .EQU 32 ; Print Time Imaging metrics prXInfo .EQU 46 ; Print-time (expanded) Print info record. prJob .EQU 62 ; The Print Job request iPrintSize .EQU 120 ; The Print record size.[120] ; Print Port structure ; A graf port, its procs, plus some extra. gPort .EQU 0 ; The Printer's graf port iPrPortSize .EQU 178 ; The PrPort size.[178] ; Print Status data structure iTotPages .EQU 0 ; Total pages in Print File [word] iCurPage .EQU 2 ; Current page number [word] iTotCopies .EQU 4 ; Total copies requested [word] iCurCopy .EQU 6 ; Current copy number [word] iTotBands .EQU 8 ; Total bands per page [word] iCurBand .EQU 10 ; Current band number [word] fPgDirty .EQU 12 ; current page has been written to? [byte] fImaging .EQU 13 ; in band's DrawPic call? [byte] hPrint .EQU 14 ; active Printer record [handle] pPrPort .EQU 18 ; active PrPort [pointer] iPrStatSize .EQU 26 ; The PrStatus size[26 bytes] ; Less common print code stuff ; These are the definitions for the Print code iPrAbort .EQU 128 ; Abort iPrRelease .EQU 3 ; Current version number of the code. iPrPgFract .EQU 120 ; Paper sizes are in 120ths of an inch ; The Private Print Globals; 16 bytes located at [SysEqu] PrintVars iPrErr .EQU 0 ; Current print error. Set to iPrAbort to abort printing. bDraftLoop .EQU 0 ; The DocLoop types bSpoolLoop .EQU 1 bUser1Loop .EQU 2 bUser2Loop .EQU 3 ; Various Resource Types & ID's lPStrType .EQU $53545220 ; "STR ": Res type for the Pr Rsrc file name iPStrRFil .EQU $E000 ; Str -8192 is in SysRes & names the current printer lPrintType .EQU $50524543 ; "PREC": Res type for the hPrint records iPrintDef .EQU 0 ; Default hPrint iPrintLst .EQU 1 ; Last used hPrint iPrintDrvr .EQU 2 ; .Print's parameter record; not a Print rec lPfType .EQU $5046494C ; "PFIL" lPfSig .EQU $50535953 ; "PSYS" iPfIcon .EQU 140 ; lPrType .EQU $4150504C ; "APPL" lPrSig .EQU $50535953 ; "PSYS" iPrIcon .EQU 138 ; 9 *Ѥ ^  4 volume block; d the second pass uffer . g bits) ) >̔T̔T88j̔T̔T88,FFFo,,VnoTypeErr .EQU -102 ; No object of that type in scrap ; some miscellaneous result codes evtNotEnb .EQU 1 ; event not enabled at PostEvent .IF wholeErrors ; System Error Alert ID d; File: QuickEqu.Txt (9 Feb 85) ;_______________________________________________________________________ ; ; QuickDraw Equates -- This file defines the public equates for QuickDraw. ; This is divided into two pieces for assembly space and speed ; considerations. The wholeQuick flag is used to include the less ; common equates which realizes a complete set. ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ wholeQuick .EQU 1 ; Set for complete set of QuickDraw equates ; Transfer modes srcCopy .EQU 0 srcOr .EQU 1 srcXor .EQU 2 srcBic .EQU 3 notSrcCopy .EQU 4 notSrcOr .EQU 5 notSrcXor .EQU 6 notSrcBic .EQU 7 patCopy .EQU 8 patOr .EQU 9 patXor .EQU 10 patBic .EQU 11 notPatCopy .EQU 12 notPatOr .EQU 13 notPatXor .EQU 14 notPatBic .EQU 15 ; Definitions for Font Style Bits (right to left) boldBit .EQU 0 italicBit .EQU 1 ulineBit .EQU 2 outlineBit .EQU 3 shadowBit .EQU 4 condenseBit .EQU 5 extendBit .EQU 6 ; FontInfo record ascent .EQU 0 ; ascent [word] descent .EQU 2 ; descent [word] widMax .EQU 4 ; maximum width [word] leading .EQU 6 ; leading [word] ; Point structure v .EQU 0 ; vertical coordinate [word] h .EQU 2 ; horizontal coordinate [word] ; Rectangle structure topLeft .EQU 0 ; upper left corner [point] botRight .EQU 4 ; lower right corner [point] top .EQU 0 ; top coordinate [word] left .EQU 2 ; left coordinate [word] bottom .EQU 4 ; bottom coordinate [word] right .EQU 6 ; right coordinate [word] ; Bitmap Structure baseAddr .EQU 0 ; bitmap base address [pointer] rowBytes .EQU 4 ; row bytes (must be even) [word] bounds .EQU 6 ; bounding box [rectangle] bitmapRec .EQU 14 ; size of a bitmap ; Cursor Structure data .EQU 0 ; visible bits [32 bytes] mask .EQU $20 ; mask bits [32 bytes] hotSpot .EQU $40 ; relative origin [point] cursRec .EQU 68 ; size of a cursor ; PenState record psLoc .EQU 0 ; pen location [point] psSize .EQU 4 ; pen size [point] psMode .EQU 8 ; pen mode [word] psPat .EQU 10 ; pen [pattern] psRec .EQU 18 ; size of pen state ; Polygon record polySize .EQU 0 ; total bytes [word] polyBBox .EQU 2 ; bounding box [rectangle] polyPoints .EQU 10 ; vertices [Points] ; Region Structure rgnSize .EQU 0 ; total bytes [word] rgnBBox .EQU 2 ; bounding box [rectangle] rgnData .EQU 10 ; region data [array] ; Picture Structure picSize .EQU 0 ; total bytes [word] picFrame .EQU 2 ; bounding box [rectangle] picData .EQU 10 ; picture byte codes [array] ; QDProcs structure textProc .EQU 0 ; [pointer] lineProc .EQU 4 ; [pointer] rectProc .EQU 8 ; [pointer] rRectProc .EQU $C ; [pointer] ovalProc .EQU $10 ; [pointer] arcProc .EQU $14 ; [pointer] polyProc .EQU $18 ; [pointer] rgnProc .EQU $1C ; [pointer] bitsProc .EQU $20 ; [pointer] commentProc .EQU $24 ; [pointer] txMeasProc .EQU $28 ; [pointer] getPicProc .EQU $2C ; [pointer] putPicProc .EQU $30 ; [pointer] qdProcsRec .EQU $34 ; size of QDProcs record ; GrafPort Structure device .EQU $0 ; device code [word] portBits .EQU $2 ; port's bitmap [bitmap] portBounds .EQU $8 ; bounding box of bitmap [rect] portRect .EQU $10 ; port's rectangle [rect] visRgn .EQU $18 ; visible region [handle] clipRgn .EQU $1C ; clipping region [handle] bkPat .EQU $20 ; background [pattern] fillPat .EQU $28 ; fill [pattern] pnLoc .EQU $30 ; pen location [point] pnSize .EQU $34 ; pen size [point] pnMode .EQU $38 ; pen mode [word] pnPat .EQU $3A ; pen [pattern] pnVis .EQU $42 ; pen visible [word] txFont .EQU $44 ; text font [word] txFace .EQU $46 ; text face [word] txMode .EQU $48 ; text mode [word] txSize .EQU $4A ; text size [word] spExtra .EQU $4C ; space extra [fixed] fgColor .EQU $50 ; foreground color mask [long] bkColor .EQU $54 ; background color mask [long] colrBit .EQU $58 ; color bit [word] patStretch .EQU $5A ; pattern stretch [word] picSave .EQU $5C ; picture being saved [handle] rgnSave .EQU $60 ; region being saved [handle] polySave .EQU $64 ; polygon being saved [handle] grafProcs .EQU $68 ; QDProcs array [pointer] portRec .EQU $6C ; size of grafport ; QuickDraw Global Variables GrafGlobals .EQU 0 ; A5 offset to globptr thePort .EQU $0 ; [GrafPtr] white .EQU $FFFFFFF8 ; [Pattern] black .EQU $FFFFFFF0 ; [Pattern] gray .EQU $FFFFFFE8 ; [Pattern] ltGray .EQU $FFFFFFE0 ; [Pattern] dkGray .EQU $FFFFFFD8 ; [Pattern] arrow .EQU $FFFFFF94 ; [Cursor] screenBits .EQU $FFFFFF86 ; [BitMap] randSeed .EQU $FFFFFF82 ; [long] 0.IF wholeQuick ; Color Separation normalBit .EQU 0 ; normal screen mapping inverseBit .EQU 1 ; inverse screen mapping redBit .EQU 4 ; RGB additive mapping greenBit .EQU 3 ; for photos from screen blueBit .EQU 2 cyanBit .EQU 8 ; CMYBk subtractive mapping magentaBit .EQU 7 ; for ink jet printer yellowBit .EQU 6 blackBit .EQU 5 blackColor .EQU 33 whiteColor .EQU 30 redColor .EQU 205 greenColor .EQU 341 blueColor .EQU 409 cyanColor .EQU 273 magentaColor .EQU 137 yellowColor .EQU 69 ; Standard Picture Comments picLParen .EQU 0 picRParen .EQU 1 ; QuickDraw verbs frame .EQU 0 paint .EQU 1 erase .EQU 2 invert .EQU 3 fill .EQU 4 ; QuickDraw private global variables wideOpen .EQU $FFFFFF7E ; RgnHandle wideMaster .EQU $FFFFFF7A ; RgnPtr wideData .EQU $FFFFFF70 ; Fake Region rgnBuf .EQU $FFFFFF6C ; PointsHandle rgnIndex .EQU $FFFFFF6A ; INTEGER rgnMax .EQU $FFFFFF68 ; INTEGER playPic .EQU $FFFFFF64 ; Long playIndex .EQU $FFFFFF62 ; INTEGER thePoly .EQU $FFFFFF5E ; POLYHANDLE polyMax .EQU $FFFFFF5C ; INTEGER patAlign .EQU $FFFFFF58 ; Point fontAdj .EQU $FFFFFF54 ; Fixed Point fontPtr .EQU $FFFFFF50 ; long, ^FMOutput record fontData .EQU $FFFFFF36 ; FMOutput record lastGrafGlob .EQU $FFFFFF36 grafSize .EQU $CE ; total size in bytes 0.ENDC ; File QuickTraps.Txt (15 Dec 84) ;_______________________________________________________________________ ; ; QuickDraw Traps -- defines the trap words for Quickdraw calls. ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ .macro _InitCursor .word $A850 .endm .macro _SetCursor .word $A851 .endm .macro _HideCursor .word $A852 .endm .macro _ShowCursor .word $A853 .endm .macro _ShieldCursor .word $A855 .endm .macro _ObscureCursor .word $A856 .endm .macro _BitAnd .word $A858 .endm .macro _BitXOr .word $A859 .endm .macro _BitNot .word $A85A .endm .macro _BitOr .word $A85B .endm .macro _BitShift .word $A85C .endm .macro _BitTst .word $A85D .endm .macro _BitSet .word $A85E .endm .macro _BitClr .word $A85F .endm .macro _Random .word $A861 .endm .macro _ForeColor .word $A862 .endm .macro _BackColor .word $A863 .endm .macro _ColorBit .word $A864 .endm .macro _GetPixel .word $A865 .endm .macro _StuffHex .word $A866 .endm .macro _LongMul .word $A867 .endm .macro _FixMul .word $A868 .endm .macro _FixRatio .word $A869 .endm .macro _HiWord .word $A86A .endm .macro _LoWord .word $A86B .endm .macro _FixRound .word $A86C .endm .macro _InitPort .word $A86D .endm .macro _InitGraf .word $A86E .endm .macro _OpenPort .word $A86F .endm .macro _LocalToGlobal .word $A870 .endm .macro _GlobalToLocal .word $A871 .endm .macro _GrafDevice .word $A872 .endm .macro _SetPort .word $A873 .endm .macro _GetPort .word $A874 .endm .macro _SetPBits .word $A875 .endm .macro _PortSize .word $A876 .endm .macro _MovePortTo .word $A877 .endm .macro _SetOrigin .word $A878 .endm .macro _SetClip .word $A879 .endm .macro _GetClip .word $A87A .endm .macro _ClipRect .word $A87B .endm .macro _BackPat .word $A87C .endm .macro _ClosePort .word $A87D .endm .macro _AddPt .word $A87E .endm .macro _SubPt .word $A87F .endm .macro _SetPt .word $A880 .endm .macro _EqualPt .word $A881 .endm .macro _StdText .word $A882 .endm .macro _DrawChar .word $A883 .endm .macro _DrawString .word $A884 .endm .macro _DrawText .word $A885 .endm .macro _TextWidth .word $A886 .endm .macro _TextFont .word $A887 .endm .macro _TextFace .word $A888 .endm .macro _TextMode .word $A889 .endm .macro _TextSize .word $A88A .endm .macro _GetFontInfo .word $A88B .endm .macro _StringWidth .word $A88C .endm .macro _CharWidth .word $A88D .endm .macro _SpaceExtra .word $A88E .endm .macro _StdLine .word $A890 .endm .macro _LineTo .word $A891 .endm .macro _Line .word $A892 .endm .macro _MoveTo .word $A893 .endm .macro _Move .word $A894 .endm .macro _Moov .word $A894 .endm .macro _HidePen .word $A896 .endm .macro _ShowPen .word $A897 .endm .macro _GetPenState .word $A898 .endm .macro _SetPenState .word $A899 .endm .macro _GetPen .word $A89A .endm .macro _PenSize .word $A89B .endm .macro _PenMode .word $A89C .endm .macro _PenPat .word $A89D .endm .macro _PenNormal .word $A89E .endm .macro _StdRect .word $A8A0 .endm .macro _FrameRect .word $A8A1 .endm .macro _PaintRect .word $A8A2 .endm .macro _EraseRect .word $A8A3 .endm .macro _InverRect .word $A8A4 .endm .macro _FillRect .word $A8A5 .endm .macro _EqualRect .word $A8A6 .endm .macro _SetRect .word $A8A7 .endm .macro _OffSetRect .word $A8A8 .endm .macro _InSetRect .word $A8A9 .endm .macro _SectRect .word $A8AA .endm .macro _UnionRect .word $A8AB .endm .macro _Pt2Rect .word $A8AC .endm .macro _PtInRect .word $A8AD .endm .macro _EmptyRect .word $A8AE .endm .macro _StdRRect .word $A8AF .endm .macro _FrameRoundRect .word $A8B0 .endm .macro _PaintRoundRect .word $A8B1 .endm .macro _EraseRoundRect .word $A8B2 .endm .macro _InverRoundRect .word $A8B3 .endm .macro _FillRoundRect .word $A8B4 .endm .macro _StdOval .word $A8B6 .endm .macro _FrameOval .word $A8B7 .endm .macro _PaintOval .word $A8B8 .endm .macro _EraseOval .word $A8B9 .endm .macro _InvertOval .word $A8BA .endm .macro _FillOval .word $A8BB .endm .macro _SlopeFromAngle .word $A8BC .endm .macro _StdArc .word $A8BD .endm .macro _FrameArc .word $A8BE .endm .macro _PaintArc .word $A8BF .endm .macro _EraseArc .word $A8C0 .endm .macro _InvertArc .word $A8C1 .endm .macro _FillArc .word $A8C2 .endm .macro _PtToAngle .word $A8C3 .endm .macro _AngleFromSlope .word $A8C4 .endm .macro _StdPoly .word $A8C5 .endm .macro _FramePoly .word $A8C6 .endm .macro _PaintPoly .word $A8C7 .endm .macro _ErasePoly .word $A8C8 .endm .macro _InvertPoly .word $A8C9 .endm .macro _FillPoly .word $A8CA .endm .macro _OpenPoly .word $A8CB .endm .macro _ClosePgon .word $A8CC .endm .macro _KillPoly .word $A8CD .endm .macro _OffSetPoly .word $A8CE .endm .macro _PackBits .word $A8CF .endm .macro _UnpackBits .word $A8D0 .endm .macro _StdRgn .word $A8D1 .endm .macro _FrameRgn .word $A8D2 .endm .macro _PaintRgn .word $A8D3 .endm .macro _EraseRgn .word $A8D4 .endm .macro _InverRgn .word $A8D5 .endm .macro _FillRgn .word $A8D6 .endm .macro _NewRgn .word $A8D8 .endm .macro _DisposRgn .word $A8D9 .endm .macro _OpenRgn .word $A8DA .endm .macro _CloseRgn .word $A8DB .endm .macro _CopyRgn .word $A8DC .endm .macro _SetEmptyRgn .word $A8DD .endm .macro _SetRecRgn .word $A8DE .endm .macro _RectRgn .word $A8DF .endm .macro _OfSetRgn .word $A8E0 .endm .macro _InSetRgn .word $A8E1 .endm .macro _EmptyRgn .word $A8E2 .endm .macro _EqualRgn .word $A8E3 .endm .macro _SectRgn .word $A8E4 .endm .macro _UnionRgn .word $A8E5 .endm .macro _DiffRgn .word $A8E6 .endm .macro _XOrRgn .word $A8E7 .endm .macro _PtInRgn .word $A8E8 .endm .macro _RectInRgn .word $A8E9 .endm .macro _SetStdProcs .word $A8EA .endm .macro _StdBits .word $A8EB .endm .macro _CopyBits .word $A8EC .endm .macro _StdTxMeas .word $A8ED .endm .macro _StdGetPic .word $A8EE .endm .macro _ScrollRect .word $A8EF .endm .macro _StdPutPic .word $A8F0 .endm .macro _StdComment .word $A8F1 .endm .macro _PicComment .word $A8F2 .endm .macro _OpenPicture .word $A8F3 .endm .macro _ClosePicture .word $A8F4 .endm .macro _KillPicture .word $A8F5 .endm .macro _DrawPicture .word $A8F6 .endm .macro _ScalePt .word $A8F8 .endm .macro _MapPt .word $A8F9 .endm .macro _MapRect .word $A8FA .endm .macro _MapRgn .word $A8FB .endm .macro _MapPoly .word $A8FC .endm ; File: SANEMacs.Txt (18 Dec 84) ;_______________________________________________________________________ ; ; SANE Numerics -- These macros and equates give assembly language ; access to the 68K floating-point arithmetic routines. They are ; documented in the Apple Numerics Manual. ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ ;----------------------------------------------------------- ; WARNING: set FPBYTRAP for your system. ;----------------------------------------------------------- FPBYTRAP .EQU 1 ;0 for Lisa, 1 for Macintosh .MACRO JSRFP .IF FPBYTRAP _FP68K ; defined in ToolTraps ELSE .REF FP68K JSR FP68K .ENDC .ENDM .MACRO JSRELEMS .IF FPBYTRAP _ELEMS68K ; defined in ToolTraps ELSE .REF ELEMS68K JSR ELEMS68K .ENDC .ENDM ;----------------------------------------------------------- ; Operation code masks. ;----------------------------------------------------------- FOADD .EQU $0000 ; add FOSUB .EQU $0002 ; subtract FOMUL .EQU $0004 ; multiply FODIV .EQU $0006 ; divide FOCMP .EQU $0008 ; compare, no exception from unordered FOCPX .EQU $000A ; compare, signal invalid if unordered FOREM .EQU $000C ; remainder FOZ2X .EQU $000E ; convert to extended FOX2Z .EQU $0010 ; convert from extended FOSQRT .EQU $0012 ; square root FORTI .EQU $0014 ; round to integral value FOTTI .EQU $0016 ; truncate to integral value FOSCALB .EQU $0018 ; binary scale FOLOGB .EQU $001A ; binary log FOCLASS .EQU $001C ; classify ; UNDEFINED .EQU $001E FOSETENV .EQU $0001 ; set environment FOGETENV .EQU $0003 ; get environment FOSETHV .EQU $0005 ; set halt vector FOGETHV .EQU $0007 ; get halt vector FOD2B .EQU $0009 ; convert decimal to binary FOB2D .EQU $000B ; convert binary to decimal FONEG .EQU $000D ; negate FOABS .EQU $000F ; absolute FOCPYSGN .EQU $0011 ; copy sign FONEXT .EQU $0013 ; next-after FOSETXCP .EQU $0015 ; set exception FOPROCENTRY .EQU $0017 ; procedure entry FOPROCEXIT .EQU $0019 ; procedure exit FOTESTXCP .EQU $001B ; test exception ; UNDEFINED .EQU $001D ; UNDEFINED .EQU $001F ;----------------------------------------------------------- ; Operand format masks. ;----------------------------------------------------------- FFEXT .EQU $0000 ; extended -- 80-bit float FFDBL .EQU $0800 ; double -- 64-bit float FFSGL .EQU $1000 ; single -- 32-bit float FFINT .EQU $2000 ; integer -- 16-bit integer FFLNG .EQU $2800 ; long int -- 32-bit integer FFCOMP .EQU $3000 ; comp -- 64-bit integer ;----------------------------------------------------------- ; Precision code masks: forces a floating point output ; value to be coerced to the range and precision specified. ;----------------------------------------------------------- FCEXT .EQU $0000 ; extended FCDBL .EQU $4000 ; double FCSGL .EQU $8000 ; single ;----------------------------------------------------------- ; Operation macros: operand addresses should already be on ; the stack, with the destination address on top. The ; suffix X, D, S, C, I, or L determines the format of the ; source operand -- extended, double, single, comp, ; integer, or long integer, respectively; the destination ; operand is always extended. ;----------------------------------------------------------- ;----------------------------------------------------------- ; Addition. ;----------------------------------------------------------- .MACRO FADDX MOVE.W #FFEXT+FOADD,-(SP) JSRFP .ENDM .MACRO FADDD MOVE.W #FFDBL+FOADD,-(SP) JSRFP .ENDM .MACRO FADDS MOVE.W #FFSGL+FOADD,-(SP) JSRFP .ENDM .MACRO FADDC MOVE.W #FFCOMP+FOADD,-(SP) JSRFP .ENDM .MACRO FADDI MOVE.W #FFINT+FOADD,-(SP) JSRFP .ENDM .MACRO FADDL MOVE.W #FFLNG+FOADD,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Subtraction. ;----------------------------------------------------------- .MACRO FSUBX MOVE.W #FFEXT+FOSUB,-(SP) JSRFP .ENDM .MACRO FSUBD MOVE.W #FFDBL+FOSUB,-(SP) JSRFP .ENDM .MACRO FSUBS MOVE.W #FFSGL+FOSUB,-(SP) JSRFP .ENDM .MACRO FSUBC MOVE.W #FFCOMP+FOSUB,-(SP) JSRFP .ENDM .MACRO FSUBI MOVE.W #FFINT+FOSUB,-(SP) JSRFP .ENDM .MACRO FSUBL MOVE.W #FFLNG+FOSUB,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Multiplication. ;----------------------------------------------------------- .MACRO FMULX MOVE.W #FFEXT+FOMUL,-(SP) JSRFP .ENDM .MACRO FMULD MOVE.W #FFDBL+FOMUL,-(SP) JSRFP .ENDM .MACRO FMULS MOVE.W #FFSGL+FOMUL,-(SP) JSRFP .ENDM .MACRO FMULC MOVE.W #FFCOMP+FOMUL,-(SP) JSRFP .ENDM .MACRO FMULI MOVE.W #FFINT+FOMUL,-(SP) JSRFP .ENDM .MACRO FMULL MOVE.W #FFLNG+FOMUL,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Division. ;----------------------------------------------------------- .MACRO FDIVX MOVE.W #FFEXT+FODIV,-(SP) JSRFP .ENDM .MACRO FDIVD MOVE.W #FFDBL+FODIV,-(SP) JSRFP .ENDM .MACRO FDIVS MOVE.W #FFSGL+FODIV,-(SP) JSRFP .ENDM .MACRO FDIVC MOVE.W #FFCOMP+FODIV,-(SP) JSRFP .ENDM .MACRO FDIVI MOVE.W #FFINT+FODIV,-(SP) JSRFP .ENDM .MACRO FDIVL MOVE.W #FFLNG+FODIV,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Square root. ;----------------------------------------------------------- .MACRO FSQRTX MOVE.W #FOSQRT,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Round to integer, according to the current rounding mode. ;----------------------------------------------------------- .MACRO FRINTX MOVE.W #FORTI,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Truncate to integer, using round toward zero. ;----------------------------------------------------------- .MACRO FTINTX MOVE.W #FOTTI,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Remainder. ;----------------------------------------------------------- .MACRO FREMX MOVE.W #FFEXT+FOREM,-(SP) JSRFP .ENDM .MACRO FREMD MOVE.W #FFDBL+FOREM,-(SP) JSRFP .ENDM .MACRO FREMS MOVE.W #FFSGL+FOREM,-(SP) JSRFP .ENDM .MACRO FREMC MOVE.W #FFCOMP+FOREM,-(SP) JSRFP .ENDM .MACRO FREMI MOVE.W #FFINT+FOREM,-(SP) JSRFP .ENDM .MACRO FREML MOVE.W #FFLNG+FOREM,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Logb. ;----------------------------------------------------------- .MACRO FLOGBX MOVE.W #FOLOGB,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Scalb. ;----------------------------------------------------------- .MACRO FSCALBX MOVE.W #FFINT+FOSCALB,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Copy-sign. ;----------------------------------------------------------- .MACRO FCPYSGNX MOVE.W #FOCPYSGN,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Negate. ;----------------------------------------------------------- .MACRO FNEGX MOVE.W #FONEG,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Absolute value. ;----------------------------------------------------------- .MACRO FABSX MOVE.W #FOABS,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Next-after. NOTE: both operands are of the same ; format, as specified by the usual suffix. ;----------------------------------------------------------- .MACRO FNEXTS MOVE.W #FFSGL+FONEXT,-(SP) JSRFP .ENDM .MACRO FNEXTD MOVE.W #FFDBL+FONEXT,-(SP) JSRFP .ENDM .MACRO FNEXTX MOVE.W #FFEXT+FONEXT,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Conversion to extended. ;----------------------------------------------------------- .MACRO FX2X MOVE.W #FFEXT+FOZ2X,-(SP) JSRFP .ENDM .MACRO FD2X MOVE.W #FFDBL+FOZ2X,-(SP) JSRFP .ENDM .MACRO FS2X MOVE.W #FFSGL+FOZ2X,-(SP) JSRFP .ENDM .MACRO FI2X MOVE.W #FFINT+FOZ2X,-(SP) JSRFP .ENDM .MACRO FL2X MOVE.W #FFLNG+FOZ2X,-(SP) JSRFP .ENDM .MACRO FC2X MOVE.W #FFCOMP+FOZ2X,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Conversion from extended. ;----------------------------------------------------------- .MACRO FX2D MOVE.W #FFDBL+FOX2Z,-(SP) JSRFP .ENDM .MACRO FX2S MOVE.W #FFSGL+FOX2Z,-(SP) JSRFP .ENDM .MACRO FX2I MOVE.W #FFINT+FOX2Z,-(SP) JSRFP .ENDM .MACRO FX2L MOVE.W #FFLNG+FOX2Z,-(SP) JSRFP .ENDM .MACRO FX2C MOVE.W #FFCOMP+FOX2Z,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Binary to decimal conversion. ;----------------------------------------------------------- .MACRO FX2DEC MOVE.W #FFEXT+FOB2D,-(SP) JSRFP .ENDM .MACRO FD2DEC MOVE.W #FFDBL+FOB2D,-(SP) JSRFP .ENDM .MACRO FS2DEC MOVE.W #FFSGL+FOB2D,-(SP) JSRFP .ENDM .MACRO FC2DEC MOVE.W #FFCOMP+FOB2D,-(SP) JSRFP .ENDM .MACRO FI2DEC MOVE.W #FFINT+FOB2D,-(SP) JSRFP .ENDM .MACRO FL2DEC MOVE.W #FFLNG+FOB2D,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Decimal to binary conversion. ;----------------------------------------------------------- .MACRO FDEC2X MOVE.W #FFEXT+FOD2B,-(SP) JSRFP .ENDM .MACRO FDEC2D MOVE.W #FFDBL+FOD2B,-(SP) JSRFP .ENDM .MACRO FDEC2S MOVE.W #FFSGL+FOD2B,-(SP) JSRFP .ENDM .MACRO FDEC2C MOVE.W #FFCOMP+FOD2B,-(SP) JSRFP .ENDM .MACRO FDEC2I MOVE.W #FFINT+FOD2B,-(SP) JSRFP .ENDM .MACRO FDEC2L MOVE.W #FFLNG+FOD2B,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Compare, not signaling invalid on unordered. ;----------------------------------------------------------- .MACRO FCMPX MOVE.W #FFEXT+FOCMP,-(SP) JSRFP .ENDM .MACRO FCMPD MOVE.W #FFDBL+FOCMP,-(SP) JSRFP .ENDM .MACRO FCMPS MOVE.W #FFSGL+FOCMP,-(SP) JSRFP .ENDM .MACRO FCMPC MOVE.W #FFCOMP+FOCMP,-(SP) JSRFP .ENDM .MACRO FCMPI MOVE.W #FFINT+FOCMP,-(SP) JSRFP .ENDM .MACRO FCMPL MOVE.W #FFLNG+FOCMP,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Compare, signaling invalid on unordered. ;----------------------------------------------------------- .MACRO FCPXX MOVE.W #FFEXT+FOCPX,-(SP) JSRFP .ENDM .MACRO FCPXD MOVE.W #FFDBL+FOCPX,-(SP) JSRFP .ENDM .MACRO FCPXS MOVE.W #FFSGL+FOCPX,-(SP) JSRFP .ENDM .MACRO FCPXC MOVE.W #FFCOMP+FOCPX,-(SP) JSRFP .ENDM .MACRO FCPXI MOVE.W #FFINT+FOCPX,-(SP) JSRFP .ENDM .MACRO FCPXL MOVE.W #FFLNG+FOCPX,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; The following macros define a set of so-called floating ; branches. They presume that the appropriate compare ; operation, macro FCMPz or FCPXz, precedes. ;----------------------------------------------------------- .MACRO FBEQ BEQ %1 .ENDM .MACRO FBLT BCS %1 .ENDM .MACRO FBLE BLS %1 .ENDM .MACRO FBGT BGT %1 .ENDM .MACRO FBGE BGE %1 .ENDM .MACRO FBULT BLT %1 .ENDM .MACRO FBULE BLE %1 .ENDM .MACRO FBUGT BHI %1 .ENDM .MACRO FBUGE BCC %1 .ENDM .MACRO FBU BVS %1 .ENDM .MACRO FBO BVC %1 .ENDM .MACRO FBNE BNE %1 .ENDM .MACRO FBUE BEQ %1 BVS %1 .ENDM .MACRO FBLG BNE %1 BVC %1 .ENDM ;----------------------------------------------------------- ; Short branch versions. ;----------------------------------------------------------- .MACRO FBEQS BEQ.S %1 .ENDM .MACRO FBLTS BCS.S %1 .ENDM .MACRO FBLES BLS.S %1 .ENDM .MACRO FBGTS BGT.S %1 .ENDM .MACRO FBGES BGE.S %1 .ENDM .MACRO FBULTS BLT.S %1 .ENDM .MACRO FBULES BLE.S %1 .ENDM .MACRO FBUGTS BHI.S %1 .ENDM .MACRO FBUGES BCC.S %1 .ENDM .MACRO FBUS BVS.S %1 .ENDM .MACRO FBOS BVC.S %1 .ENDM .MACRO FBNES BNE.S %1 .ENDM .MACRO FBUES BEQ.S %1 BVS.S %1 .ENDM .MACRO FBLGS BNE.S %1 BVC.S %1 .ENDM ;----------------------------------------------------------- ; Class and sign inquiries. ;----------------------------------------------------------- FCSNAN .EQU 1 ; signaling NAN FCQNAN .EQU 2 ; quiet NAN FCINF .EQU 3 ; infinity FCZERO .EQU 4 ; zero FCNORM .EQU 5 ; normal number FCDENORM .EQU 6 ; denormal number .MACRO FCLASSS MOVE.W #FFSGL+FOCLASS,-(SP) JSRFP .ENDM .MACRO FCLASSD MOVE.W #FFDBL+FOCLASS,-(SP) JSRFP .ENDM .MACRO FCLASSX MOVE.W #FFEXT+FOCLASS,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Bit indexes for bytes of floating point environment word. ;----------------------------------------------------------- FBINVALID .EQU 0 ; invalid operation FBUFLOW .EQU 1 ; underflow FBOFLOW .EQU 2 ; overflow FBDIVZER .EQU 3 ; division by zero FBINEXACT .EQU 4 ; inexact FBRNDLO .EQU 5 ; low bit of rounding mode FBRNDHI .EQU 6 ; high bit of rounding mode FBLSTRND .EQU 7 ; last round result bit FBDBL .EQU 5 ; double precision control FBSGL .EQU 6 ; single precision control ;----------------------------------------------------------- ; Get and set environment. ;----------------------------------------------------------- .MACRO FGETENV MOVE.W #FOGETENV,-(SP) JSRFP .ENDM .MACRO FSETENV MOVE.W #FOSETENV,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Test and set exception. ;----------------------------------------------------------- .MACRO FTESTXCP MOVE.W #FOTESTXCP,-(SP) JSRFP .ENDM .MACRO FSETXCP MOVE.W #FOSETXCP,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Procedure entry and exit. ;----------------------------------------------------------- .MACRO FPROCENTRY MOVE.W #FOPROCENTRY,-(SP) JSRFP .ENDM .MACRO FPROCEXIT MOVE.W #FOPROCEXIT,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Get and set halt vector. ;----------------------------------------------------------- .MACRO FGETHV MOVE.W #FOGETHV,-(SP) JSRFP .ENDM .MACRO FSETHV MOVE.W #FOSETHV,-(SP) JSRFP .ENDM ;----------------------------------------------------------- ; Elementary function operation code masks. ;----------------------------------------------------------- FOLNX .EQU $0000 ; base-e log FOLOG2X .EQU $0002 ; base-2 log FOLN1X .EQU $0004 ; ln (1 + x) FOLOG21X .EQU $0006 ; log2 (1 + x) FOEXPX .EQU $0008 ; base-e exponential FOEXP2X .EQU $000A ; base-2 exponential FOEXP1X .EQU $000C ; exp (x) - 1 FOEXP21X .EQU $000E ; exp2 (x) - 1 FOXPWRI .EQU $8010 ; integer exponentiation FOXPWRY .EQU $8012 ; general exponentiation FOCOMPOUND .EQU $C014 ; compound FOANNUITY .EQU $C016 ; annuity FOSINX .EQU $0018 ; sine FOCOSX .EQU $001A ; cosine FOTANX .EQU $001C ; tangent FOATANX .EQU $001E ; arctangent FORANDX .EQU $0020 ; random ;----------------------------------------------------------- ; Elementary function macros. ;----------------------------------------------------------- .MACRO FLNX ; base-e log MOVE.W #FOLNX,-(SP) JSRELEMS .ENDM .MACRO FLOG2X ; base-2 log MOVE.W #FOLOG2X,-(SP) JSRELEMS .ENDM .MACRO FLN1X ; ln (1 + x) MOVE.W #FOLN1X,-(SP) JSRELEMS .ENDM .MACRO FLOG21X ; log2 (1 + x) MOVE.W #FOLOG21X,-(SP) JSRELEMS .ENDM .MACRO FEXPX ; base-e exponential MOVE.W #FOEXPX,-(SP) JSRELEMS .ENDM .MACRO FEXP2X ; base-2 exponential MOVE.W #FOEXP2X,-(SP) JSRELEMS .ENDM .MACRO FEXP1X ; exp (x) - 1 MOVE.W #FOEXP1X,-(SP) JSRELEMS .ENDM .MACRO FEXP21X ; exp2 (x) - 1 MOVE.W #FOEXP21X,-(SP) JSRELEMS .ENDM .MACRO FXPWRI ; integer exponential MOVE.W #FOXPWRI,-(SP) JSRELEMS .ENDM .MACRO FXPWRY ; general exponential MOVE.W #FOXPWRY,-(SP) JSRELEMS .ENDM .MACRO FCOMPOUND ; compound MOVE.W #FOCOMPOUND,-(SP) JSRELEMS .ENDM .MACRO FANNUITY ; annuity MOVE.W #FOANNUITY,-(SP) JSRELEMS .ENDM .MACRO FSINX ; sine MOVE.W #FOSINX,-(SP) JSRELEMS .ENDM .MACRO FCOSX ; cosine MOVE.W #FOCOSX,-(SP) JSRELEMS .ENDM .MACRO FTANX ; tangent MOVE.W #FOTANX,-(SP) JSRELEMS .ENDM .MACRO FATANX ; arctangent MOVE.W #FOATANX,-(SP) JSRELEMS .ENDM .MACRO FRANDX ; random number generator MOVE.W #FORANDX,-(SP) JSRELEMS .ENDM ;----------------------------------------------------------- ; NaN codes. ;----------------------------------------------------------- NANSQRT .EQU 1 ; Invalid square root such as sqrt(-1). NANADD .EQU 2 ; Invalid addition such as +INF - +INF. NANDIV .EQU 4 ; Invalid division such as 0/0. NANMUL .EQU 8 ; Invalid multiply such as 0 * INF. NANREM .EQU 9 ; Invalid remainder or mod such as x REM 0. NANASCBIN .EQU 17 ; Attempt to convert invalid ASCII string. NANCOMP .EQU 20 ; Result of converting comp NaN to floating. NANZERO .EQU 21 ; Attempt to create a NaN with a zero code. NANTRIG .EQU 33 ; Invalid argument to trig routine. NANINVTRIG .EQU 34 ; Invalid argument to inverse trig routine. NANLOG .EQU 36 ; Invalid argument to log routine. NANPOWER .EQU 37 ; Invalid argument to x^i or x^y routine. NANFINAN .EQU 38 ; Invalid argument to financial function. NANINIT .EQU 255 ; Uninitialized storage. ;----------------------------------------------------------- ;----------------------------------------------------------- ;----------------------------------------------------------- 3. "6F^9. ^33}-----------} E $A8ED; ; {------------------------------------------------------------------------------- SANE Pascal Interface SANE NAME &SANE -- Standard Apple Numeric Environment (22 Jan 85) DESCRIPTION &Provides SANE functions and procedures not built into Pascal. &Cannot be used with early versions of the Pascal compiler (2.0 & 3.0). AUTHOR &Clayton Lewis, Apple Numerics Group &SANE Pascal interface designed by the Apple Numerics Group &Copyright 1983, 1984, 1985 Apple Computer Inc. BUGS -------------------------------------------------------------------------------} {$M+} { The M+ option is the only difference between Mac and Lisa versions } Unit SANE; %INTERFACE %const (DecStrLen = 255; (SigDigLen = 20; { for 68K; use 28 in 6502 SANE } ({--------------------------------------------------- (* Exceptions. (---------------------------------------------------} (Invalid = 1; (Underflow = 2; (Overflow = 4; (DivByZero = 8; (Inexact = 16; %type ({--------------------------------------------------- (* Types for handling decimal representations. (---------------------------------------------------} (DecStr = string[DecStrLen]; (CStrPtr = ^char; (Decimal = record :sgn : 0..1; :exp : integer; :sig : string[SigDigLen] 7end; (DecForm = record :style : ( FloatDecimal, FixedDecimal ); :digits : integer; 7end; ({--------------------------------------------------- (* Ordering relations. (---------------------------------------------------} (RelOp = ( GreaterThan, LessThan, EqualTo, Unordered ); ({--------------------------------------------------- (* Inquiry classes. (---------------------------------------------------} (NumClass = ( SNaN, QNaN, Infinite, ZeroNum, NormalNum, DenormalNum ); ({--------------------------------------------------- (* Environmental control. (---------------------------------------------------} (Exception = integer; (RoundDir = ( ToNearest, Upward, Downward, TowardZero ); (RoundPre = ( ExtPrecision, DblPrecision, RealPrecision ); (Environment = integer; {*==============================================================================* * The functions and procedures the SANE library * *==============================================================================*} ({--------------------------------------------------- (* Conversions between numeric binary types. (---------------------------------------------------} *function Num2Integer ( x : extended ) : integer; *function Num2Longint ( x : extended ) : longint; *function Num2Real ( x : extended ) : real; *function Num2Double ( x : extended ) : double; *function Num2Extended ( x : extended ) : extended; *function Num2Comp ( x : extended ) : comp; ({--------------------------------------------------- (* Conversions between binary and decimal. (---------------------------------------------------} *procedure Num2Dec ( f : DecForm; x : extended; var d : Decimal ); 0{ d <-- x according to format f } *function Dec2Num ( d : Decimal ) : extended; 0{ Dec2Num <-- d } *procedure Num2Str ( f : DecForm; x : extended; var s : DecStr ); 0{ s <-- x according to format f } *function Str2Num ( s : DecStr ) : extended; 0{ Str2Num <-- s } ({--------------------------------------------------- (* Conversions between decimal formats. (---------------------------------------------------} *procedure Str2Dec ( s : DecStr; var Index : integer; :var d : Decimal; var ValidPrefix : boolean ); 0{ On input Index is starting index into s, on output Index is one 2greater than index of last character of longest numeric substring; 2d <-- Decimal rep of longest numeric substring; 2ValidPrefix <-- "s, beginning at Index, contains valid numeric Cstring or valid prefix of some numeric string" } *procedure CStr2Dec ( s : CStrPtr; var Index : integer; :var d : Decimal; var ValidPrefix : boolean ); 0{ Str2Dec for character buffers or C strings instead of Pascal 2strings: the first argument is the the address of a character 2buffer and ValidPrefix <-- "scanning ended with a null byte" } *procedure Dec2Str ( f: DecForm; d: Decimal; var s: DecStr ); 0{ s <-- d according to format f } ({--------------------------------------------------- (* Arithmetic, auxiliary, and elementary functions. (---------------------------------------------------} *function Remainder ( x, y : extended; var quo : integer) : extended; 0{ Remainder <-- x rem y; quo <-- low-order seven bits of integer 2quotient x/y so that -127 < quo < 127 } *function Rint ( x : extended ) : extended; 0{ round to integral value } *function Scalb ( n : integer; x : extended ) : extended; 0{ scale binary; Scalb <-- x * 2^n } *function Logb ( x : extended ) : extended; 0{ Logb <-- unbiased exponent of x } *function CopySign ( x, y : extended ) : extended; 0{ CopySign <-- y with sign of x } *function NextReal ( x, y : real ) : real; *function NextDouble ( x, y : double ) : double; *function NextExtended ( x, y : extended ) : extended; 0{ return next representable value from x toward y } *function Log2 ( x : extended ) : extended; 0{ base-2 log } *function Ln1 ( x : extended ) : extended; 0{ Ln1 <-- ln(1+x) } *function Exp2 ( x : extended ) : extended; 0{ base-2 exponential } *function Exp1 ( x : extended ) : extended; 0{ Exp1 <-- exp(x) - 1 } *function XpwrI ( x : extended; i : integer ) : extended; 0{ XpwrI <-- x^i } *function XpwrY ( x, y : extended ) : extended; 0{ XpwrY <-- x^y } *function Compound ( r, n : extended ) : extended; 0{ Compound <-- (1+r)^n } *function Annuity ( r, n : extended ) : extended; 0{ Annuity <-- (1 - (1+r)^(-n)) / r } *function Tan ( x : extended ) : extended; 0{ tangent } *function RandomX ( var x : extended ) : extended; 0{ returns next random number and updates argument; 2x integral, 1 <= x <= (2^31)-2 } ({--------------------------------------------------- (* Inquiry routines. (---------------------------------------------------} *function ClassReal ( x : real ) : NumClass; *function ClassDouble ( x : double ) : NumClass; *function ClassComp ( x : comp ) : NumClass; *function ClassExtended ( x : extended ) : NumClass; 0{ return class of x } *function SignNum ( x : extended ) : integer; 0{ 0 if sign bit clear, 1 if sign bit set } ({--------------------------------------------------- (* NaN function. (---------------------------------------------------} *function NAN ( i : integer ) : extended; 0{ returns NaN with code i } ({--------------------------------------------------- (* Environment access routines. (---------------------------------------------------} *procedure SetException ( e : Exception; b : boolean ); 0{ set e flags if b is true, clear e flags otherwise; may cause halt } *function TestException ( e : Exception) : boolean; 0{ return true if any e flag is set, return false otherwise } *procedure SetHalt ( e : Exception; b : boolean ); 0{ set e halt enables if b is true, clear e halt enables otherwise } *function TestHalt ( e : Exception) : boolean; 0{ return true if any e halt is enabled, return false otherwise } *procedure SetRound ( r : RoundDir ); 0{ set rounding direction to r } *function GetRound : RoundDir; 0{ return rounding direction } *procedure SetPrecision ( p : RoundPre ); 0{ set rounding precision to p } *function GetPrecision : RoundPre; 0{ return rounding precision } *procedure SetEnvironment ( e : Environment ); 0{ set environment to e } *procedure GetEnvironment ( var e : Environment ); 0{ e <-- environment } *procedure ProcEntry ( var e : Environment ); 0{ e <-- environment; environment <-- IEEE default } *procedure ProcExit ( e : Environment ); 0{ temp <-- exceptions; environment <-- e; 2signal exceptions in temp } *function GetHaltVector : longint ; 0{ return halt vector } *procedure SetHaltVector ( v : longint ) ; 0{ halt vector <-- v } ({--------------------------------------------------- (* Comparison routine. (---------------------------------------------------} *function Relation ( x, y : extended ) : Relop; 0{ return Relation such that "x Relation y" is true } {================================================================================} %IMPLEMENTATION ({$I LibSane/fdbgok } { This file defines FDbgOK and FSymOK. } 0{$ifc fdbgok } 8{$R+ } 8{$V+ } 0{$elsec } 8{$R- } 8{$V- } 0{$endc } 0{$ifc fsymok } 8{$D+ } 0{$elsec } 8{$D- } 0{$endc } {$S sane } *function Num2Integer ( x : extended ) : integer; external; *function Num2Longint ( x : extended ) : longint; external; *function Num2Extended ( x : extended ) : extended; external; *function Num2Real ( x : extended ) : real; external; *function Num2Double ( x : extended ) : double; external; *function Num2Comp ( x : extended ) : comp; external; *procedure Num2Dec ( f : DecForm; x : extended; var d : Decimal ); external; *function Dec2Num ( d : Decimal ) : extended; external; *procedure Num2Str ( f:DecForm; x:extended; var s:DecStr ); external; *function Str2Num ( s : DecStr ) : extended; external; *procedure Str2Dec ( s : DecStr; var Index : integer; 9var d : Decimal; var ValidPrefix : boolean ); external; *procedure CStr2Dec ( s : CStrPtr; var Index : integer; 9var d : Decimal; var ValidPrefix : boolean ); external; *procedure Dec2Str ( f: DecForm; d: Decimal; var s: DecStr ); external; *function Remainder ( x, y : extended; var quo : integer):extended;external; *function Rint ( x : extended ) : extended; external; *function Scalb ( n : integer; x : extended ) : extended; external; *function Logb ( x : extended ) : extended; external; *function CopySign ( x, y : extended ) : extended; external; *function NextReal ( x, y : real ) : real; external; *function NextDouble ( x, y : double ) : double; external; *function NextExtended ( x, y : extended ) : extended; external; *function Log2 ( x : extended ) : extended; external; *function Ln1 ( x : extended ) : extended; external; *function Exp2 ( x : extended ) : extended; external; *function Exp1 ( x : extended ) : extended; external; *function XpwrI ( x : extended; i : integer ) : extended; external; *function XpwrY ( x, y : extended ) : extended; external; *function Compound ( r, n : extended ) : extended; external; *function Annuity ( r, n : extended ) : extended; external; *function Tan ( x : extended ) : extended; external; *function RandomX ( var x : extended ) : extended; external; *function ClassReal ( x : real ) : NumClass; external; *function ClassDouble ( x : double ) : NumClass; external; *function ClassComp ( x : comp ) : NumClass; external; *function ClassExtended ( x : extended ) : NumClass; external; *function SignNum ( x : extended ) : integer; external; *function NAN ( i : integer ) : extended; external; *procedure SetException ( e : Exception; b : boolean ); external; *function TestException ( e : Exception) : boolean; external; *procedure SetHalt ( e : Exception; b : boolean ); external; *function TestHalt ( e : Exception) : boolean; external; *procedure SetRound ( r : RoundDir ); external; *function GetRound : RoundDir; external; *procedure SetPrecision ( p : RoundPre ); external; *function GetPrecision : RoundPre; external; *procedure SetEnvironment ( e : Environment ); external; *procedure GetEnvironment ( var e : Environment ); external; *procedure ProcEntry ( var e : Environment ); external; *procedure ProcExit ( e : Environment ); external; *function GetHaltVector : longint; external; *procedure SetHaltVector ( v : Longint ); external; *function Relation ( x, y : extended ) : Relop; external; %END. SANE $ %INTERFACE %const (DecStrLen = 255; (SigDigLen = 20; { for 68K; use 28 in 6502 SANE } ({--------------------------------------------------- (* Exceptions. (---------------------------------------------------} (Invalid = 1; (Underflow = 2; (Overflow = 4; (DivByZero = 8; (Inexact = 16; %type ({--------------------------------------------------- (* Types for handling decimal representations. (---------------------------------------------------} (DecStr = string[DecStrLen]; (CStrPtr = ^char; (Decimal = record :sgn : 0..1; :exp : integer; :sig : string[SigDigLen] 7end; (DecForm = record :style : ( FloatDecimal, FixedDecimal ); :digits : integer; 7end; ({--------------------------------------------------- (* Ordering relations. (---------------------------------------------------} (RelOp = ( GreaterThan, LessThan, EqualTo, Unordered ); ({--------------------------------------------------- (* Inquiry classes. (---------------------------------------------------} (NumClass = ( SNaN, QNaN, Infinite, ZeroNum, NormalNum, DenormalNum ); ({--------------------------------------------------- (* Environmental control. (---------------------------------------------------} (Exception = integer; (RoundDir = ( ToNearest, Upward, Downward, TowardZero ); (RoundPre = ( ExtPrecision, DblPrecision, RealPrecision ); (Environment = integer; {*==============================================================================* * The functions and procedures the SANE library * *==============================================================================*} ({--------------------------------------------------- (* Conversions between numeric binary types. (---------------------------------------------------} *function Num2Integer ( x : extended ) : integer; *function Num2Longint ( x : extended ) : longint; *function Num2Real ( x : extended ) : real; *function Num2Double ( x : extended ) : double; *function Num2Extended ( x : extended ) : extended; *function Num2Comp ( x : extended ) : comp; ({--------------------------------------------------- (* Conversions between binary and decimal. (---------------------------------------------------} *procedure Num2Dec ( f : DecForm; x : extended; var d : Decimal ); 0{ d <-- x according to format f } *function Dec2Num ( d : Decimal ) : extended; 0{ Dec2Num <-- d } *procedure Num2Str ( f : DecForm; x : extended; var s : DecStr ); 0{ s <-- x according to format f } *function Str2Num ( s : DecStr ) : extended; 0{ Str2Num <-- s } ({--------------------------------------------------- (* Conversions between decimal formats. (---------------------------------------------------} *procedure Str2Dec ( s : DecStr; var Index : integer; :var d : Decimal; var ValidPrefix : boolean ); 0{ On input Index is starting index into s, on output Index is one 2greater than index of last character of longest numeric substring; 2d <-- Decimal rep of longest numeric substring; 2ValidPrefix <-- "s, beginning at Index, contains valid numeric Cstring or valid prefix of some numeric string" } *procedure CStr2Dec ( s : CStrPtr; var Index : integer; :var d : Decimal; var ValidPrefix : boolean ); 0{ Str2Dec for character buffers or C strings instead of Pascal 2strings: the first argument is the the address of a character 2buffer and ValidPrefix <-- "scanning ended with a null byte" } *procedure Dec2Str ( f: DecForm; d: Decimal; var s: DecStr ); 0{ s <-- d according to format f } ({--------------------------------------------------- (* Arithmetic, auxiliary, and elementary functions. (---------------------------------------------------} *function Remainder ( x, y : extended; var quo : integer) : extended; 0{ Remainder <-- x rem y; quo <-- low-order seven bits of integer 2quotient x/y so that -127 < quo < 127 } *function Rint ( x : extended ) : extended; 0{ round to integral value } *function Scalb ( n : integer; x : extended ) : extended; 0{ scale binary; Scalb <-- x * 2^n } *function Logb ( x : extended ) : extended; 0{ Logb <-- unbiased exponent of x } *function CopySign ( x, y : extended ) : extended; 0{ CopySign <-- y with sign of x } *function NextReal ( x, y : real ) : real; *function NextDouble ( x, y : double ) : double; *function NextExtended ( x, y : extended ) : extended; 0{ return next representable value from x toward y } *function Log2 ( x : extended ) : extended; 0{ base-2 log } *function Ln1 ( x : extended ) : extended; 0{ Ln1 <-- ln(1+x) } *function Exp2 ( x : extended ) : extended; 0{ base-2 exponential } *function Exp1 ( x : extended ) : extended; 0{ Exp1 <-- exp(x) - 1 } *function XpwrI ( x : extended; i : integer ) : extended; 0{ XpwrI <-- x^i } *function XpwrY ( x, y : extended ) : extended; 0{ XpwrY <-- x^y } *function Compound ( r, n : extended ) : extended; 0{ Compound <-- (1+r)^n } *function Annuity ( r, n : extended ) : extended; 0{ Annuity <-- (1 - (1+r)^(-n)) / r } *function Tan ( x : extended ) : extended; 0{ tangent } *function RandomX ( var x : extended ) : extended; 0{ returns next random number and updates argument; 2x integral, 1 <= x <= (2^31)-2 } ({--------------------------------------------------- (* Inquiry routines. (---------------------------------------------------} *function ClassReal ( x : real ) : NumClass; *function ClassDouble ( x : double ) : NumClass; *function ClassComp ( x : comp ) : NumClass; *function ClassExtended ( x : extended ) : NumClass; 0{ return class of x } *function SignNum ( x : extended ) : integer; 0{ 0 if sign bit clear, 1 if sign bit set } ({--------------------------------------------------- (* NaN function. (---------------------------------------------------} *function NAN ( i : integer ) : extended; 0{ returns NaN with code i } ({--------------------------------------------------- (* Environment access routines. (---------------------------------------------------} *procedure SetException ( e : Exception; b : boolean ); 0{ set e flags if b is true, clear e flags otherwise; may cause halt } *function TestException ( e : Exception) : boolean; 0{ return true if any e flag is set, return false otherwise } *procedure SetHalt ( e : Exception; b : boolean ); 0{ set e halt enables if b is true, clear e halt enables otherwise } *function TestHalt ( e : Exception) : boolean; 0{ return true if any e halt is enabled, return false otherwise } *procedure SetRound ( r : RoundDir ); 0{ set rounding direction to r } *function GetRound : RoundDir; 0{ return rounding direction } *procedure SetPrecision ( p : RoundPre ); 0{ set rounding precision to p } *function GetPrecision : RoundPre; 0{ return rounding precision } *procedure SetEnvironment ( e : Environment ); 0{ set environment to e } *procedure GetEnvironment ( var e : Environment ); 0{ e <-- environment } *procedure ProcEntry ( var e : Environment ); 0{ e <-- environment; environment <-- IEEE default } *procedure ProcExit ( e : Environment ); 0{ temp <-- exceptions; environment <-- e; 2signal exceptions in temp } *function GetHaltVector : longint ; 0{ return halt vector } *procedure SetHaltVector ( v : longint ) ; 0{ halt vector <-- v } ({--------------------------------------------------- (* Comparison routine. (---------------------------------------------------} *function Relation ( x, y : extended ) : Relop; 0{ return Relation such that "x Relation y" is true } {================================================================================} %IMPLEMENTATION DEC2STR SANE DEC2STR DEC2STR NVH<*. n"n (RHtrgg-` f RB ?g igP nfFNAN(|)ZBv ora ap`fSAo1 9o_Nu 0fxfJEnzpab6HSn Eo a`0aN0AahTBnjeHքm+`-DpCT@qe mRBn8C0HCHU@ng`no @n S@nNuRBn.NuRBn 0S@lNu n0?`H6Do"JDl 0aapD` 0a0a0oaa`paapCa0a0Ea nBPLa +g -fa 0e 9b|@ @ E e:< `JjSJf JDj40`BJjDEA3E"n2 n"nHDL N^N gzSvIagb NfTvAafLvNazfD4N400,a (f.vae 9b @@` )faVXaPX4` F`LvNa(fvFa"f4I|JjfN`lF`>az ae zb Nu< c^0Nu%%_TRUNCSANE %%_TRUNC%%_TRUNCGETROUNDGETROUNDSETROUNDSETROUND NUM2LONGNUM2LONG(UN<N0 _N/?NNu %%_ROUNDSANE %%_ROUND%%_ROUNDNVHn?<?<`HW?<TA"n 0QC a@?<HW?<grg<Hz.HP?<aHn?<N^ _NHPHQ?<(Nu?%W_E_EXTSANE %W_E_EXT%W_E_EXTNUM2STR NUM2STR 0%W_STR %W_STR ZnNVp0. @Po0<P @ l0< =@Q@//. HnN0.r.@l RA `A/.Hn?NN^ _ NЁf%W_F_EXTSANE %W_F_EXT%W_F_EXT%W_E_EXT%W_E_EXT.NUM2STR NUM2STR %W_STR %W_STR rNV?.?</. HnN n?f/./. ?. N`Bp0. @Po0<Pr.@l@S@SAn S@n/.Hn?NN^ _ NЁ~%W_E_SGLSANE %SGLE2 %SGLE2 %W_E_SGL%W_E_SGL%W_E_EXT%W_E_EXT 4NV/. Hn?</.Hn?.NN^ _ NЁ,%W_E_DBLSANE %W_E_DBL%W_E_DBL%SGLE2 %SGLE2 NV/. Hn?<N%W_E_COMSANE %W_E_COM%W_E_COM%SGLE2 %SGLE2 NV/. Hn?<0N%W_F_SGLSANE %SGLF2 %SGLF2 %W_F_SGL%W_F_SGL%W_F_EXT%W_F_EXT$8NV/. Hn?</.Hn?. ?.NN^ _ NЁ0%W_F_DBLSANE %W_F_DBL%W_F_DBL%SGLF2 %SGLF2 NV/. Hn?<N%W_F_COMSANE %W_F_COM%W_F_COM%SGLF2 %SGLF2 NV/. Hn?<0N%R_SGL SANE %R_SGL %R_SGL F32%%R_RF32%%R_R0NV/. HnNHn/.?< N^ _NЁ(%R_DBL SANE %R_DBL %R_DBL F32%%R_RF32%%R_R0NV/. HnNHn/.?< N^ _NЁ(%R_COMP SANE %R_COMP %R_COMP F32%%R_RF32%%R_R0NV/. HnNHn/.?<0 N^ _NЁ(%R_EXT SANE %R_EXT %R_EXT F32%%R_RF32%%R_R0NV/. HnNHn/.?< N^ _NЁ(F32%%R_RSANE F32%%R_RF32%%R_R%_BACKUP%_BACKUP%_EOF %_EOF %_IORES %_IORES STR2DEC STR2DEC %R_C %R_C %_SETIOR%_SETIOR%_EOLN %_EOLN %W_STR %W_STR F(NVB=|/. NB@ @f*HzJnoSn` JnoSn/. HzBgNNu @g @f6aJnnJnn`< nlRn2.A`<=|*`B/. Nf/. Ng JnfBn`Jnf @fRnJngBnHnHn/.HnNJ.f /. N2. AonoNJ_f?<NN^ _N  NAN SANE NAN NAN _0fp"W2BB@NЁTESTHALTSANE TESTHALTTESTHALTTESTEXCETESTEXCEGETROUNDGETROUNDSETROUNDSETROUNDRSETHALT SETHALT SETPRECISETPRECIGETPRECIGETPRECISETEXCEPSETEXCEPdPROCEXITPROCEXIT _t_` _t_Ja2BWBgRNa eFBB4B?HW?<TN"_ _t_/ UHW?<0Nu _a@4JB``aJ d2AB?HW?<T?/N _aX` _atJ` _aNЁCOMPOUNDSANE COMPOUNDCOMPOUNDANNUITY ANNUITY ,2|`2|L/H? "x NЁ$REMAINDESANE PROCEXITPROCEXITLOGB LOGB pSETENVIRSETENVIRGETENVIRGETENVIRRELATIONRELATIONڂDEC2NUM DEC2NUM NEXTEXTENEXTEXTEVCOPYSIGNCOPYSIGN&PROCENTRPROCENTRNUM2LONGNUM2LONGԂREMAINDEREMAINDENUM2DEC NUM2DEC SCALB SCALB <NUM2INTENUM2INTE΂RINT RINT lLa// @?< / "A2N""2QQNuLt"WaJj0`,LHW"o/ a4< aNT.`L/ a/ /?< @Np`pL"W/ a A?Nt _HWaTNt`t`t"_`"_?N"_Ho`LHWHt aX`"_$"H`t `4< `4<(` _B@tae ngRRRNЁXPWRY SANE XPWRY XPWRY XPWRI XPWRI RANDOMX RANDOMX DpLaVÉ/H@@?< x `"  o"oa2HW/ ?< x \. @N  W?< "x "Wa`""2QQNuhNEXTREALSANE NEXTDOUBNEXTDOUB0NEXTREALNEXTREALZ _ "X/4<a:Y/Hoa0/HoVBa&XJk. @NLÉQ/ HoH@4<a`"_?NсRCLASSREASANE CLASSDOUCLASSDOUCLASSCOMCLASSCOMVCLASSEXTCLASSEXT^CLASSREACLASSREAr0<r`0<rL$/ Ho?Qn PHW/@ ?0HkS`FNU@HWHo?@/`0<0r ` _Horp`ājLOG2 SANE LOG2 LOG2 %_ARCTAN%_ARCTAN%_LN %_LN %_COS %_COS EXP2 EXP2 LN1 LN1 TAN TAN EXP1 EXP1 %_SIN %_SIN %_EXP %_EXP $Lp`"p`p `p `p`p`p` p`p`pL"W/ ""2 A?"x NЁDSIGNNUM SANE SIGNNUM SIGNNUM LBWJQjRWNЁNUM2REALSANE NUM2REALNUM2REALNUM2EXTENUM2EXTENUM2COMPNUM2COMPNUM2DOUBNUM2DOUB .0< _Ho`0<`p`0<0 _//?NЁ&GETHALTVSANE INITFPLIINITFPLIGETHALTVGETHALTVSETHALTVSETHALTV <Ho?<NuHo?< WPNBgHW?<Tp/?<Nu4STR2NUM SANE STR2NUM STR2NUM STR2DEC STR2DEC >NV-|/.HnHnHnNHn/. ?< N^ WPNЁ6NUM2STR SANE NUM2STR NUM2STR DEC2STR DEC2STR 8FL/NV-IHn/Hn?< n?fp-@`/ Hn/NN^Nu>3. "6F^501 ; port ^.UU9&FOR ix := XLB TO XUB DO &BEGIN )FOR iy := YLB TO Gޒ IN ,sqr := FixMulaa(l( t tZ <`aa(a(`:a(̞ ̞Hiy. t tZ < g ΠƠ :F`(.2V ̠Ba(̠ÂFP̨Fx`:a(N"L{$X-} {$R-} {$D-} Program SineGrid; #USES {$U-} &{$U obj/Memtypes } Memtypes, &{$U obj/QuickDraw } QuickDraw, &{$U obj/OSIntf } OSIntf, &{$U obj/ToolIntf } ToolIntf, &{$U obj/FixMath } FixMath, &{$U obj/Graf3D } Graf3D; #CONST &XLB = -10; &XUB = 10; &YLB = -10; &YUB = 10; {array bounds} &keyOrMouse = mDownMask + keyDownMask; #VAR &gPort: GrafPort; &gPort3D: Port3d; &data: ARRAY [XLB..XUB, YLB..YUB] OF Fixed; &dummy: EventRecord; #PROCEDURE CalcData; #VAR &ix, &iy: INTEGER; #BEGIN &FOR ix := XLB TO XUB DO &BEGIN )FOR iy := YLB TO YUB DO ,data[ix, iy] := FracRatio(FracSin(FixRatio(ix, 3)) + -FracCos(FixRatio(iy, 4)), 1073741824); &END #END; #PROCEDURE PlotGrid; #CONST &fYLB = YLB * 65536; &fXLB = XLB * 65536; #VAR &ix, &iy: INTEGER; #BEGIN &FOR ix := XLB TO XUB DO &BEGIN )MoveTo3D(FixRatio(ix, 1), fYLB, data[ix, YLB]); )FOR iy := YLB TO YUB DO ,LineTo3D(FixRatio(ix, 1), FixRatio(iy, 1), data[ix, iy]); &END; &FOR iy := YLB TO YUB DO &BEGIN )MoveTo3D(fXLB, FixRatio(iy, 1), data[XLB, iy]); )FOR ix := XLB TO XUB DO ,LineTo3D(FixRatio(ix, 1), FixRatio(iy, 1), data[ix, iy]); &END; #END; BEGIN {initialization routines} #InitGraf(@thePort); #InitCursor; #HideCursor; #OpenPort(@gPort); #Open3DPort(@gPort3D); {program begins} #CalcData; #PenPat(White); #BackPat(Black); #EraseRect(gPort.portRect); #FrameRect(gPort.portRect); #LookAt(-983040, 655360, 983040, -655360); {LookAt (-15, 10, 15, -10)}; #ViewAngle(1966080); {ViewAngle(30)} #Scale(65536, 65536, 196608); {Scale(1, 1, 3)} #Roll(1966080); {Roll(30)} #Pitch(4587520); {Pitch(70)} #PlotGrid; #WHILE NOT OSEventAvail(keyOrMouse, dummy) DO; END. 3. "6F^501 ; port B ^9ϧ := FixDiv (Edge, 131072); {Half := Edge / 2} &MoGu Half,-Half); &Linaa(&L t tZ o`aa(a(`:a(̞ ̞H,Eކfix/boxSphe g ΠƠ :F`(.2V ̠Ba(̠ÂFP̨Fx`:a(N"Lexample/SineGrid.rsrc Type CODE "example/SineGridL,0 ; File: SysErr.Txt (8 Feb 85) ;_______________________________________________________________________ ; ; System Error Equates -- This file defines the equates for the Macintosh ; return error codes This is divided into two pieces for assembly ; space and speed considerations. The wholeErrors flag is used to include ; the less common equates which realizes a complete set. ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ wholeErrors .EQU 1 ; Set for complete set ; General System Errors (VBL Mgr, Queueing, Etc.) noErr .EQU 0 ; 0 for success qErr .EQU -1 ; queue element not found during deletion vTypErr .EQU -2 ; invalid queue element corErr .EQU -3 ; core routine number out of range unimpErr .EQU -4 ; unimplemented core routine ; I/O System Errors controlErr .EQU -17 statusErr .EQU -18 readErr .EQU -19 writErr .EQU -20 badUnitErr .EQU -21 unitEmptyErr .EQU -22 openErr .EQU -23 closErr .EQU -24 dRemovErr .EQU -25 ; tried to remove an open driver dInstErr .EQU -26 ; DrvrInstall couldn't find driver in resources abortErr .EQU -27 ; IO call aborted by KillIO notOpenErr .EQU -28 ; Couldn't rd/wr/ctl/sts cause driver not opened ; File System error codes: dirFulErr .EQU -33 ; Directory full dskFulErr .EQU -34 ; disk full nsvErr .EQU -35 ; no such volume ioErr .EQU -36 ; I/O error (bummers) bdNamErr .EQU -37 ; there may be no bad names in the final system! fnOpnErr .EQU -38 ; File not open eofErr .EQU -39 ; End of file posErr .EQU -40 ; tried to position to before start of file (r/w) mFulErr .EQU -41 ; memory full(open) or file won't fit (load) tmfoErr .EQU -42 ; too many files open fnfErr .EQU -43 ; File not found wPrErr .EQU -44 ; diskette is write protected fLckdErr .EQU -45 ; file is locked vLckdErr .EQU -46 ; volume is locked fBsyErr .EQU -47 ; File is busy (delete) dupFNErr .EQU -48 ; duplicate filename (rename) opWrErr .EQU -49 ; file already open with with write permission paramErr .EQU -50 ; error in user parameter list rfNumErr .EQU -51 ; refnum error gfpErr .EQU -52 ; get file position error volOffLinErr .EQU -53 ; volume not on line error (was Ejected) permErr .EQU -54 ; permissions error (on file open) volOnLinErr .EQU -55 ; drive volume already on-line at MountVol nsDrvErr .EQU -56 ; no such drive (tried to mount a bad drive num) noMacDskErr .EQU -57 ; not a mac diskette (sig bytes are wrong) extFSErr .EQU -58 ; volume in question belongs to an external fs fsRnErr .EQU -59 ; file system internal error: ; during rename the old entry was deleted but could ; not be restored . . . badMDBErr .EQU -60 ; bad master directory block wrPermErr .EQU -61 ; write permissions error ; Disk, Serial Ports, Clock Specific Errors firstDskErr .EQU -84 lastDskErr .EQU -64 noDriveErr .EQU -64 ; drive not installed offLinErr .EQU -65 ; r/w requested for an off-line drive noNybErr .EQU -66 ; couldn't find 5 nybbles in 200 tries noAdrMkErr .EQU -67 ; couldn't find valid addr mark dataVerErr .EQU -68 ; read verify compare failed badCkSmErr .EQU -69 ; addr mark checksum didn't check badBtSlpErr .EQU -70 ; bad addr mark bit slip nibbles noDtaMkErr .EQU -71 ; couldn't find a data mark header badDCkSum .EQU -72 ; bad data mark checksum badDBtSlp .EQU -73 ; bad data mark bit slip nibbles wrUnderRun .EQU -74 ; write underrun occurred cantStepErr .EQU -75 ; step handshake failed tk0BadErr .EQU -76 ; track 0 detect doesn't change initIWMErr .EQU -77 ; unable to initialize IWM twoSideErr .EQU -78 ; tried to read 2nd side on a 1-sided drive spdAdjErr .EQU -79 ; unable to correctly adjust disk speed seekErr .EQU -80 ; track number wrong on address mark sectNFErr .EQU -81 ; sector number never found on a track clkRdErr .EQU -85 ; unable to read same clock value twice clkWrErr .EQU -86 ; time written did not verify prWrErr .EQU -87 ; parameter ram written didn't read-verify prInitErr .EQU -88 ; InitUtil found the parameter ram uninitialized rcvrErr .EQU -89 ; SCC receiver error (framing, parity, OR) breakRecd .EQU -90 ; Break received (SCC) ; AppleTalk error codes ddpSktErr .EQU -91 ; error in soket number ddpLenErr .EQU -92 ; data length too big noBridgeErr .EQU -93 ; no network bridge for non-local send lapProtErr .EQU -94 ; error in attaching/detaching protocol excessCollsns .EQU -95 ; excessive collisions on write portInUse .EQU -97 ; driver Open error code (port is in use) portNotCf .EQU -98 ; driver Open error code (parameter RAM not ; configured for this connection) ; Storage allocator error codes memFullErr .EQU -108 ; Not enough room in heap zone nilHandleErr .EQU -109 ; Handle was NIL in HandleZone or other; memWZErr .EQU -111 ; WhichZone failed (applied to free block); memPurErr .EQU -112 ; trying to purge a locked or non-purgeable block; memAdrErr .EQU -110 ; address was odd, or out of range; memAZErr .EQU -113 ; Address in zone check failed; memPCErr .EQU -114 ; Pointer Check failed; memBCErr .EQU -115 ; Block Check failed; memSCErr .EQU -116 ; Size Check failed; memLockedErr .EQU -117 ; trying to move a locked block (MoveHHi) ; Resource Manager error codes (other than I/O errors) resNotFound .EQU -192 ; Resource not found resFNotFound .EQU -193 ; Resource file not found addResFailed .EQU -194 ; AddResource failed addRefFailed .EQU -195 ; AddReference failed rmvResFailed .EQU -196 ; RmveResource failed rmvRefFailed .EQU -197 ; RmveReference failed ; Scrap Manager error codes noScrapErr .EQU -100 ; No scrap exists error noTypeErr .EQU -102 ; No object of that type in scrap ; some miscellaneous result codes evtNotEnb .EQU 1 ; event not enabled at PostEvent .IF wholeErrors ; System Error Alert ID definitions. These are just for reference because ; one cannot intercept the calls and do anything programmatically... dsSysErr .EQU 32767 ; general system error dsBusError .EQU 1 ; bus error dsAddressErr .EQU 2 ; address error dsIllInstErr .EQU 3 ; illegal instruction error dsZeroDivErr .EQU 4 ; zero divide error dsChkErr .EQU 5 ; check trap error dsOvFlowErr .EQU 6 ; overflow trap error dsPrivErr .EQU 7 ; privelege violation error dsTraceErr .EQU 8 ; trace mode error dsLineAErr .EQU 9 ; line 1010 trap error dsLineFErr .EQU 10 ; line 1111 trap error dsMiscErr .EQU 11 ; miscellaneous hardware exception error dsCoreErr .EQU 12 ; unimplemented core routine error dsIrqErr .EQU 13 ; uninstalled interrupt error dsIOCoreErr .EQU 14 ; IO Core Error dsLoadErr .EQU 15 ; Segment Loader Error dsFPErr .EQU 16 ; Floating point error dsNoPackErr .EQU 17 ; package 0 not present dsNoPk1 .EQU 18 ; package 1 not present dsNoPk2 .EQU 19 ; package 2 not present dsNoPk3 .EQU 20 ; package 3 not present dsNoPk4 .EQU 21 ; package 4 not present dsNoPk5 .EQU 22 ; package 5 not present dsNoPk6 .EQU 23 ; package 6 not present dsNoPk7 .EQU 24 ; package 7 not present dsMemFullErr .EQU 25 ; out of memory! dsBadLaunch .EQU 26 ; can't launch file dsFSErr .EQU 27 ; file system map has been trashed dsStknHeap .EQU 28 ; stack has moved into application heap dsReinsert .EQU 30 ; request user to reinsert off-line volume dsNotThe1 .EQU 31 ; not the disk I wanted ; Storage allocator System Error IDs memTrbBase .EQU 32 ; Memory Manager Trouble Code base. mtSetLog .EQU 32 ; Set Logical Size Error. mtAdjFre .EQU 33 ; Adjust Free Error. mtAdjCnt .EQU 34 ; Adjust Counters Error. mtMkeBkf .EQU 35 ; Make Block Free Error. mtSetSiz .EQU 36 ; Set Size Error. mtInitMem .EQU 37 ; Initialize Memory Manager Error. mtBCerr .EQU 38 mtCZerr .EQU 39 mtCZ1err .EQU 40 mtCZ2err .EQU 41 mtCZ3err .EQU 42 mtEqCerr .EQU 43 mtEvCerr .EQU 44 mtHCerr .EQU 45 mtPCerr .EQU 46 mtSCerr .EQU 47 mtRC1err .EQU 48 mtRC2err .EQU 49 mtSABerr .EQU 50 mtACerr .EQU 51 mtIZCerr .EQU 52 mtPrCerr .EQU 53 .ENDC ; File: SysTraps.Text (21 Dec 84) ;_______________________________________________________________________ ; ; SysTraps.Text - System macros include file. All system components ; should include this file of standard system macros. ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ ; Misc. system macros .MACRO __CORE .IF '%1' <> '' LEA %1,A0 .ENDC .IF '%3' = '' .WORD $A000+%2 .ENDC .IF '%3' = 'REGS' .WORD $A100+%2 .ENDC .IF '%3' = 'ASYNC' .WORD $A400+%2 .ENDC .IF '%3' = 'SYS' .WORD $A400+%2 .ENDC .IF '%3' = 'IMMED' .WORD $A200+%2 .ENDC .ENDM .MACRO __MCore .IF '%1' <> '' LEA %1,A0 .ENDC .IF '%3' = '' .WORD $A000+%2 .ENDC .IF '%3' = 'SAVE' .IF '%4' = 'SYS' .WORD $A400+%2 .ELSE .WORD $A000+%2 .ENDC .ENDC .IF '%3' = 'REGS' .IF '%4' = 'SYS' .IF '%5' = 'CLEAR' .WORD $A700+%2 .ELSE .WORD $A500+%2 .ENDC .ELSE .IF '%4' = 'CLEAR' .WORD $A300+%2 .ELSE .WORD $A100+%2 .ENDC .ENDC .ENDC .ENDM ; ; International string comparisons have two boolean parameters: ; bit 9 = 0 if and only if diacritical marks are significant ; bit 10 = 0 if and only if case is insignificant ; .MACRO __StrCore .IF '%1' <> '' LEA %1,A0 .ENDC .IF '%3' = '' .WORD $A000+%2 .ENDC .IF '%3' = 'MARKS' .IF '%4' = 'CASE' .WORD $A600+%2 .ELSE .WORD $A200+%2 .ENDC .ENDC .IF '%3' = 'CASE' .WORD $A400+%2 .ENDC .ENDM ;_______________________________________________________________________ ; ; Core routine system macros ; ;_______________________________________________________________________ ; First we have the I/O core routine macros. These are also used by ; the file system. .MACRO _Open __CORE %1,0,%2 .ENDM .MACRO _Close __CORE %1,1,%2 .ENDM .MACRO _Read __CORE %1,2,%2 .ENDM .MACRO _Write __CORE %1,3,%2 .ENDM .MACRO _Control __CORE %1,4,%2 .ENDM .MACRO _Status __CORE %1,5,%2 .ENDM .MACRO _KillIO __CORE %1,6,%2 .ENDM ; other file system calls go here .MACRO _GetVolInfo __CORE %1,7,%2 .ENDM .MACRO _Create __CORE %1,8,%2 .ENDM .MACRO _Delete __CORE %1,9,%2 .ENDM .MACRO _OpenRF __CORE %1,10,%2 .ENDM .MACRO _Rename __CORE %1,11,%2 .ENDM .MACRO _GetFileInfo __CORE %1,12,%2 .ENDM .MACRO _SetFileInfo __CORE %1,13,%2 .ENDM .MACRO _UnmountVol __CORE %1,14 .ENDM .MACRO _MountVol __CORE %1,15 .ENDM .MACRO _Allocate __CORE %1,16,%2 .ENDM .MACRO _GetEOF __CORE %1,17,%2 .ENDM .MACRO _SetEOF __CORE %1,18,%2 .ENDM .MACRO _FlushVol __CORE %1,19,%2 .ENDM .MACRO _GetVol __CORE %1,20,%2 .ENDM .MACRO _SetVol __CORE %1,21,%2 .ENDM .MACRO _FInitQueue __CORE %1,22 .ENDM .MACRO _Eject __CORE %1,23,%2 .ENDM .MACRO _GetFPos __CORE %1,24,%2 .ENDM ; Here are the storage manager core routine macros .MACRO _InitZone __CORE %1,25 .ENDM .MACRO _GetZone __CORE %1,26,REGS .ENDM .MACRO _SetZone __CORE %1,27 .ENDM .MACRO _FreeMem __MCORE %1,28,SAVE,%2 .ENDM .MACRO _MaxMem __MCORE %1,29,REGS,%2 .ENDM .MACRO _NewPtr __MCORE %1,30,REGS,%2,%3 .ENDM .MACRO _DisposPtr __CORE %1,31 .ENDM .MACRO _SetPtrSize __CORE %1,32 .ENDM .MACRO _GetPtrSize __CORE %1,33 .ENDM .MACRO _NewHandle __MCORE %1,34,REGS,%2,%3 .ENDM .MACRO _DisposHandle __CORE %1,35 .ENDM .MACRO _SetHandleSize __CORE %1,36 .ENDM .MACRO _GetHandleSize __CORE %1,37 .ENDM .MACRO _HandleZone __CORE %1,38,REGS .ENDM .MACRO _ReallocHandle __CORE %1,39 .ENDM .MACRO _RecoverHandle __MCORE %1,40,REGS,%2,%3 .ENDM .MACRO _HLock __CORE %1,41 .ENDM .MACRO _HUnlock __CORE %1,42 .ENDM .MACRO _EmptyHandle __CORE %1,43 .ENDM .MACRO _InitApplZone __CORE %1,44 .ENDM .MACRO _SetApplLimit __CORE %1,45 .ENDM .MACRO _BlockMove __CORE %1,46 .ENDM ; Here are the event manager macros .MACRO _PostEvent __CORE %1,47 .ENDM .MACRO _OSEventAvail __CORE %1,48 .ENDM .MACRO _GetOSEvent __CORE %1,49 .ENDM .MACRO _FlushEvents __CORE %1,50 .ENDM ; Here are the utility core routine macros .MACRO _VInstall __CORE %1,51 .ENDM .MACRO _VRemove __CORE %1,52 .ENDM .MACRO _Offline __CORE %1,53,%2 .ENDM .MACRO _MoreMasters __CORE %1,54 .ENDM .MACRO _WriteParam __CORE %1,56 .ENDM .MACRO _ReadDateTime __CORE %1,57 .ENDM .MACRO _SetDateTime __CORE %1,58 .ENDM .MACRO _Delay __CORE %1,59 .ENDM .MACRO _CmpString __StrCore %1,60,%2,%3 .ENDM .MACRO _DrvrInstall __CORE %1,61 .ENDM .MACRO _DrvrRemove __CORE %1,62 .ENDM .MACRO _InitUtil __CORE %1,63 .ENDM .MACRO _ResrvMem __MCORE %1,64,SAVE,%2 .ENDM .MACRO _SetFilLock __CORE %1,65,%2 .ENDM .MACRO _RstFilLock __CORE %1,66,%2 .ENDM .MACRO _SetFilType __CORE %1,67,%2 .ENDM .MACRO _SetFPos __CORE %1,68,%2 .ENDM .MACRO _FlushFil __CORE %1,69,%2 .ENDM .MACRO _GetTrapAddress __CORE %1,70,REGS .ENDM .MACRO _SetTrapAddress __CORE %1,71 .ENDM .MACRO _PtrZone __CORE %1,72,REGS .ENDM .MACRO _HPurge __CORE %1,73 .ENDM .MACRO _HNoPurge __CORE %1,74 .ENDM .MACRO _SetGrowZone __CORE %1,75 .ENDM .MACRO _CompactMem __MCORE %1,76,SAVE,%2 .ENDM .MACRO _PurgeMem __MCORE %1,77,SAVE,%2 .ENDM .MACRO _AddDrive __CORE %1,78 .ENDM .MACRO _RDrvrInstall __CORE %1,79 .ENDM .MACRO _UprString __StrCore %1,84,%2 .ENDM .MACRO _SetAppBase __CORE %1,87 .ENDM 9 *Ѥ ^DOOv4es) ] [byte] ] or the second pass uffer . g bits) ) >̔T̔T88j̔T̔T88,FFFo,,VAutoInt3 .EQU $6C ; level 3 auto-vector AutoInt4 .EQU $70 ; level 4 auto-vector AutoInt5 .EQU $74 ; level 5 auto-vector AutoInt6 .EQU $78 ; level 6 auto-vector AutoInt7 ; File: ToolEqu.Txt (8 Feb 85) ;_______________________________________________________________________ ; ; Toolbox Equates -- This file defines the high-level equates for the ; Macintosh toolbox software. This is divided into two pieces for assembly ; space and speed considerations. The wholeTools flag is used to include ; the less common equates which realizes a complete set. The comments ; marked with ";+" denote managers. ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ wholeTools .EQU 1 ; Set for complete set of toolbox equates ;+ Resource Manager ; Resource attributes resSysRef .EQU 7 ; reference to system/local reference resSysHeap .EQU 6 ; In system/in application heap resPurgeable .EQU 5 ; Purgeable/not purgeable resLocked .EQU 4 ; Locked/not locked resProtected .EQU 3 ; Protected/not protected resPreload .EQU 2 ; Read in at OpenResource? resChanged .EQU 1 ; Existing resource changed since last update rcbMask .EQU $FD ; Must preserve ResChanged over _SetAttribute ; Map attributes mapReadOnly .EQU 7 ; is this file read-only? mapCompact .EQU 6 ; Is a compact necessary? mapChanged .EQU 5 ; Is it necessary to write map? ; Resource Manager Globals TopMapHndl .EQU $A50 ; topmost map in list [handle] SysMapHndl .EQU $A54 ; system map [handle] SysMap .EQU $A58 ; reference number of system map [word] CurMap .EQU $A5A ; reference number of current map [word] ResReadOnly .EQU $A5C ; Read only flag [word] ResLoad .EQU $A5E ; Auto-load feature [word] ResErr .EQU $A60 ; Resource error code [word] ResErrProc .EQU $AF2 ; Resource error procedure [pointer] SysResName .EQU $AD8 ; Name of system resource file [STRING[19]] ;+ Font Manager ; Standard font ID's sysFont .EQU 0 ; system font ID applFont .EQU 1 ; application font ID newYork .EQU 2 ; standard release fonts geneva .EQU 3 monaco .EQU 4 venice .EQU 5 london .EQU 6 athens .EQU 7 sanFran .EQU 8 toronto .EQU 9 cairo .EQU 11 losAngeles .EQU 12 ; Font Manager Globals ApFontID .EQU $984 ; resource ID of application font [word] FMDefaultSize .EQU $987 ; default size [byte] CurFMInput .EQU $988 ; quickdraw FMInput Record [pointer] FMgrOutRec .EQU $998 ; quickdraw FontOutput Record [pointer] FScaleDisable .EQU $A63 ; disable font scaling? [byte] ;+ Window Manager A; system windows have negative kinds dialogKind .EQU 2 ; dialog windows userKind .EQU 8 ; this and above numbers are for user ; Values returned by window definition function's hit routine wNoHit .EQU 0 ; not in window at all wInContent .EQU 1 ; in content area wInDrag .EQU 2 ; in drag area wInGrow .EQU 3 ; in grow area wInGoAway .EQU 4 ; in go away area ; FindWindow Return Codes inDesk .EQU 0 ; not in any window inMenuBar .EQU 1 ; in the menu bar inSysWindow .EQU 2 ; in a system window inContent .EQU 3 ; in content area of user window inDrag .EQU 4 ; in drag area of user window inGrow .EQU 5 ; in grow area of user window inGoAway .EQU 6 ; in go away area of user window ; Resource ID's for windows deskPatID .EQU 16 ; desk pattern PAT ID documentProc .EQU 0 ; standard document WDEF ID dBoxProc .EQU 1 ; dialog box (document without titleBar) WDEF ID plainDBox .EQU 2 ; no border WDEF ID altDBoxProc .EQU 3 ; no shadow or title WDEF ID noGrowDocProc .EQU 4 ; no grow area WDEF ID rDocProc .EQU 16 ; document with rounded corners WDEF ID ; Window Data Structure Definition windowPort .EQU 0 ; grafPort [108 bytes] windowKind .EQU $6C ; type of window [word] wVisible .EQU $6E ; visible flag [byte] wHilited .EQU $6F ; select (hilite) flag [byte] wGoAway .EQU $70 ; has go away button [byte] structRgn .EQU $72 ; structure region of window [Handle] contRgn .EQU $76 ; content region of window [Handle] updateRgn .EQU $7A ; update region of window [Handle] windowDef .EQU $7E ; window definition procedure [Handle] wDataHandle .EQU $82 ; window proc-defined data [Handle] wTitleHandle .EQU $86 ; title string [Handle] wTitleWidth .EQU $8A ; width in pixels of title string [word] wControlList .EQU $8C ; control list of this window [handle] nextWindow .EQU $90 ; next window in z-ordered list [pointer] windowPic .EQU $94 ; picture handle for updates [handle] wRefCon .EQU $98 ; application use [long] windowSize .EQU $9C ; size of window data structure ; Window Manager Globals WindowList .EQU $9D6 ; Z-ordered linked list of windows [pointer] PaintWhite .EQU $9DC ; erase newly drawn windows? [word] WMgrPort .EQU $9DE ; window manager's grafport [pointer] GrayRgn .EQU $9EE ; rounded gray desk region [handle] CurActivate .EQU $A64 ; window slated for activate event [pointer] CurDeactive .EQU $A68 ; window slated for deactivate event [pointer] DragHook .EQU $9F6 ; user hook during dragging [pointer] DeskPattern .EQU $A3C ; desk pattern [8 bytes] DeskHook .EQU $A6C ; hook for painting the desk [pointer] GhostWindow .EQU $A84 ; window hidden from FrontWindow [pointer] ;+ Menu Manager ; "ASCII" marks for menu characters noMark .EQU 0 commandMark .EQU $11 ; command fan (cloverleaf) checkMark .EQU $12 ; check mark for menus diamondMark .EQU $13 ; diamond mark for menus appleMark .EQU $14 ; desk ornament menu title ; MenuList Data Structure Definition -- one per menuBar lastMenu .EQU 0 ; number of menus in this menuList [word] lastRight .EQU 2 ; coordinate of 1st free point in menuBar [word] A; one of the following per menu menuoH .EQU 0 ; menu handle [handle] menuLeft .EQU 4 ; coordinate of left edge of menu [word] ; MenuInfo Data Structure -- one per menu menuID .EQU 0 ; unique ID for each menuBar [word] menuWidth .EQU 2 ; menu width [word] menuHeight .EQU 4 ; menu height [word] menuDefHandle .EQU 6 ; menu definition proc [handle] menuEnable .EQU $A ; enable flags, one bit/item [long] menuData .EQU $E ; menu item string [STRING] menuBlkSize .EQU $E ; size of a menu block plus dataString ; MenuString Data Structure -- one per menu item itemIcon .EQU 0 ; icon byte itemCmd .EQU 1 ; apple (command key) byte itemMark .EQU 2 ; checkmark character byte itemStyle .EQU 3 ; style byte ; Menu Manager Globals MenuList .EQU $A1C ; current menuBar list structure [handle] MenuFlash .EQU $A24 ; flash feedback count [word] MrMacHook .EQU $A2C ; Mr. Macintosh hook [pointer] MenuHook .EQU $A30 ; user hook during menuSelect [pointer] ;+ Control Manager ; Part Codes inButton .EQU 10 ; in a push button inCheckBox .EQU 11 ; in a checkBox button inUpButton .EQU 20 ; in up button area of a dial inDownButton .EQU 21 ; in down button area of a dial inPageUp .EQU 22 ; in page up (gray) area of a dial inPageDown .EQU 23 ; in page down (gray) area of a dial inThumb .EQU 129 ; in thumb area of a dial ; Constants for axis parameter of DragGrayRgn and DragControl noConstraint .EQU 0 ; free form dragging hAxisOnly .EQU 1 ; horizontally only vAxisOnly .EQU 2 ; vertically only ; Resource ID's for controls pushButProc .EQU 0 ; rounded-corner pushButtons CDEF ID checkBoxProc .EQU 1 ; check-box type buttons CDEF ID radioButProc .EQU 2 ; radio buttons CDEF ID scrollBarProc .EQU 16 ; scrollBar CDEF ID useWFont .EQU 8 ; add this to get window font CDEF ID sBarPatID .EQU 17 ; scrollBar pattern ID ; Control Template nextControl .EQU $0 ; next control in the list [handle] contrlOwner .EQU $4 ; owning window [pointer] contrlRect .EQU $8 ; bounding rectangle [8 bytes] contrlVis .EQU $10 ; visible state [byte] contrlHilite .EQU $11 ; hilite state [byte] contrlValue .EQU $12 ; current value of control [word] contrlMin .EQU $14 ; minimum value of control [word] contrlMax .EQU $16 ; maximum value of control [word] contrlDefHandle .EQU $18 ; control definition procedure [handle] contrlData .EQU $1C ; data for definition proc [handle] contrlAction .EQU $20 ; local actionProc [pointer] contrlRFcon .EQU $24 ; refcon defined by application [long] contrlTitle .EQU $28 ; title string [STRING] contrlSize .EQU $28 ; size of control data structure less title ; Control Manager Globals DragPattern .EQU $A34 ; DragTheRgn pattern [8 bytes] DragFlag .EQU $A44 ; implicit parameter to DragControl [word] CurDragAction .EQU $A46 ; implicit actionProc for dragControl [pointer] ;+ Text Edit ; Justification styles teJustLeft .EQU 0 ; left justified text teJustRight .EQU -1 ; right justified text teJustCenter .EQU 1 ; center justified text ; Text Edit Record teDestRect .EQU $0 ; destination rectangle [8 bytes] teViewRect .EQU $8 ; view rectangle rectangle [8 bytes] teSelRect .EQU $10 ; select rectangle [8 bytes] teLineHite .EQU $18 ; lineheight [word] teAscent .EQU $1A ; first baseline offset [word] teSelPoint .EQU $1C ; selection point [long] teSelStart .EQU $20 ; selection start [word] teSelEnd .EQU $22 ; selection end [word] teActive .EQU $24 ; active [byte] teWordBreak .EQU $26 ; word break routine [pointer] teClikProc .EQU $2A ; click loop routine [pointer] teClikTime .EQU $2E ; time of last click [long] teClikLoc .EQU $32 ; location of double click [long] teCarTime .EQU $34 ; time for next caret toggle [long] teCarOn .EQU $38 ; is caret on? [byte] teCarAct .EQU $39 ; is caret active? [byte] teJust .EQU $3A ; fill style [word] teLength .EQU $3C ; length of text below [word] teTextH .EQU $3E ; text [handle] teRecBack .EQU $42 ; unused [word] teRecLine .EQU $44 ; unused [word] teLftClick .EQU $46 ; click was to left? [byte] teLftCaret .EQU $47 ; caret was to left? [byte] teCROnly .EQU $48 ; only for line breaks? [byte] teFontStuff .EQU $4A ; space for font specifier [8 bytes] teFont .EQU $4A ; text font [word] teFace .EQU $4C ; text face [word] teMode .EQU $4E ; text mode [word] teSize .EQU $50 ; text size [word] teGrafPort .EQU $52 ; grafport for editting [pointer] teHiHook .EQU $56 ; hook for hilite routine [pointer] teCarHook .EQU $5A ; hook for hilite routine [pointer] teNLines .EQU $5E ; number of lines [word] teLines .EQU $60 ; line starts [words...] teRecSize .EQU $68 ; base size of a record w/o lines ; Text Edit Globals TEScrpLength .EQU $AB0 ; textEdit Scrap Length [word] TEScrpHandle .EQU $AB4 ; textEdit Scrap [handle] TEWdBreak .EQU $AF6 ; default word break routine [pointer] ;+ Dialog Manager ; Generic buttons okButton .EQU 1 ; OK button cancelButton .EQU 2 ; Cancel button ; Alert/Dialog Resource ID's stopIcon .EQU 0 ; stop icon ID noteIcon .EQU 1 ; note icon ID cautionIcon .EQU 2 ; caution icon ID ; Dialog Template dBounds .EQU $0 ; dialog bounds rectangle dWindProc .EQU $8 ; window proc ID dVisible .EQU $A ; visible flag dGoAway .EQU $C ; go away flag dRefCon .EQU $E ; reference constant dItems .EQU $12 ; item list ID and handle dTitle .EQU $14 ; dialog window title ; Alert Template aBounds .EQU $0 ; alert box height and width aItems .EQU $8 ; item list ID aStages .EQU $A ; stages word ; Dialog/Alert Window Record dWindow .EQU $0 ; window record items .EQU $9C ; Item list [handle] teHandle .EQU $A0 ; textEdit object [handle] editField .EQU $A4 ; current field being edited [word] editOpen .EQU $A6 ; is editting open? [word] aDefItem .EQU $A8 ; default item for alerts [word] dWindLen .EQU $AA ; dialog record length ; In each item itmHndl .EQU 0 ; handle to the item itmRect .EQU $4 ; bounding rect of item itmType .EQU $C ; item type itmData .EQU $D ; item string, must be even length ; Dialog Manager Globals ANumber .EQU $A98 ; active alert ID [word] ACount .EQU $A9A ; # times this alert called [word] DABeeper .EQU $A9C ; beep routine [pointer] DAStrings .EQU $AA0 ; paramText substutution strings [4 handles] DlgFont .EQU $AFA ; default dialog font ID [word] ;+ Package Globals AppPacks .EQU $AB8 ; packages' code [8 handles] FPState .EQU $A4A ; floating point state [6 bytes] ;+ Finder related Globals FinderName .EQU $2E0 ; "Finder" name [STRING[15]] AppParmHandle .EQU $AEC ; handle to hold application parameters ;+ Miscellaneous Globals ApplScratch .EQU $A78 ; application scratch area [12 Bytes] ToolScratch .EQU $9CE ; scratch area [8 bytes] TempRect .EQU $9FA ; scratch rectangle [8 bytes] 0.IF wholeTools ; Resource Manager mCCMask .EQU $60 ; mapCompact + mapChanged mChMask .EQU $20 ; mapChanged mCoMask .EQU $40 ; mapCompact ; Font Manager ; Font header values propFont .EQU $9000 ; proportional font type fixedFont .EQU $B000 ; fixed-pitch font type fontWid .EQU $ACB0 ; width-only font type ; control/status codes for linkage w/font manager fMgrCtl1 .EQU 8 ; printer drivers fontDecError .EQU -64 ; error during font declaration fontNotDeclared .EQU -65 ; font not declared fontSubErr .EQU -66 ; font substitution occured ; Font Header Data Record fFontType .EQU 0 ; font type [word] fFirstChar .EQU 2 ; ASCII code of first char [word] fLastChar .EQU 4 ; ASCII code of last char [word] fWidMax .EQU 6 ; maximum width of any char in pixels [word] fKernMax .EQU 8 ; Negative of maximum character kern [word] fNDescent .EQU 10 ; negative of descent [word] fFRectWidth .EQU 12 ; width of font rectangle [word] fFRectHeight .EQU 14 ; height of font rectangle [word] fOWTLoc .EQU 16 ; offset to offset/width table [word] fAscent .EQU 18 ; ascent above baseline in pixels [word] fDescent .EQU 20 ; descent below baseline in pixels [word] fLeading .EQU 22 ; space between lines in pixels [word] fRowWords .EQU 24 ; row width of bit image / 2 [word] ; Font Manager Input Record (CurFMInput) fmInFamily .EQU 0 ; family [word] fmInSize .EQU 2 ; size [word] fmInFace .EQU 4 ; face [word] fmInNeedBits .EQU 5 ; needBits [byte] fmInDevice .EQU 6 ; device number [byte] fmInNumer .EQU 8 ; numerator of scale [fixed] fmInDenom .EQU 12 ; denominator of scale [fixed] ; Font Manager Output record (FMgrOutRec) fmOutError .EQU 0 ; error code [word] fmOutFontH .EQU 2 ; the actual font [handle] fmOutBold .EQU 6 ; bolding factor [byte] fmOutItalic .EQU 7 ; italic factor [byte] fmOutULOffset .EQU 8 ; underline offset [byte] fmOutULShadow .EQU 9 ; underline halo [byte] fmOutULThick .EQU 10 ; underline thickness [byte] fmOutShadow .EQU 11 ; shadow factor [byte] fmOutExtra .EQU 12 ; extra horizontal width [byte] fmOutAscent .EQU 13 ; height above baseline [byte] fmOutDescent .EQU 14 ; height below baseline [byte] fmOutWidMax .EQU 15 ; maximum width of character [byte] fmOutLeading .EQU 16 ; space between lines [byte] fmOutNumer .EQU 18 ; point for numerators of scale factor [long] fmOutDenom .EQU 22 ; point for denominators of scale factor [long] ; Font Characterization Table dpiVert .EQU 0 ; vertical dots per inch [word] dpiHoriz .EQU 2 ; horizontal dots per inch [word] boldChr .EQU 4 ; bold characteristics [3 bytes] italChr .EQU 7 ; italic characteristics [3 bytes] A; unused [3 bytes] outlineChr .EQU 13 ; outline characteristics [3 bytes] shadowChr .EQU 16 ; shadow characteristics [3 bytes] condChr .EQU 19 ; condensed characteristics [3 bytes] extendChr .EQU 22 ; extended characteristics [3 bytes] underChr .EQU 25 ; underline characteristics [3 bytes] ; Globals CurFMFamily .EQU $988 ; current font family CurFMSize .EQU $98A ; current font size CurFMFace .EQU $98C ; current font face CurFMNeedBits .EQU $98D ; boolean specifying whether it needs strike CurFMDevice .EQU $98E ; current font device CurFMNumer .EQU $990 ; current numerator of scale factor CurFMDenom .EQU $994 ; current denominator of scale factor FOutRec .EQU $998 ; Font Manager output record FMDotsPerInch .EQU $9B2 ; h,v dotsPerInch of current device FMStyleTab .EQU $9B6 ; style heuristic table supplied by device RomFont0 .EQU $980 ; system font [handle] GotStrike .EQU $986 ; Do we have the strike? [byte] ; Window Manager ; Window Definition Procedure Messages wDrawMsg .EQU 0 ; draw yourself wHitMsg .EQU 1 ; hit test wCalcRgnMsg .EQU 2 ; recalculate your regions wInitMsg .EQU 3 ; initialize yourself wDisposeMsg .EQU 4 ; dispose any private data wGrowMsg .EQU 5 ; drag out grow outline wGIconMsg .EQU 6 ; draw the grow icon OldStructure .EQU $9E6 ; saved structure region [handle] OldContent .EQU $9EA ; saved content region [handle] SaveVisRgn .EQU $9F2 ; temporarily saved visRegion [handle] CurDeKind .EQU $A22 ; window kind of deactivated window [word] SaveUpdate .EQU $9DA ; Enable update accumulation? [word] ; Menu Manager ; Menu Definition Procedure Messages mDrawMsg .EQU 0 ; draw yourself mChooseMsg .EQU 1 ; select an item mSizeMsg .EQU 2 ; calculate your size ; Menu Resource IDs textMenuProc .EQU 0 ; standard text menu MDEF ID maxMenu .EQU $60 ; maximum of 16*6 menus in menuBar mListSize .EQU $66 ; menu list is 102 bytes long MBarEnable .EQU $A20 ; menuBar enable for desk accessories[word] TheMenu .EQU $A26 ; ID of hilited menu [word] SavedHandle .EQU $A28 ; saved bits under a menu [handle] ; Control manager ; Control Definition Procedure Messages drawCtlMsg .EQU 0 ; draw message hitCtlMsg .EQU 1 ; hit test message calcCtlMsg .EQU 2 ; calc region message newCtlMsg .EQU 3 ; init message dispCtlMsg .EQU 4 ; dispose any private data message posCtlMsg .EQU 5 ; adjust indicator position message thumbCtlMsg .EQU 6 ; calculate rectangles for thumb dragging dragCtlMsg .EQU 7 ; custom drag message trackCtlMsg .EQU 8 ; track yourself message ; Text Edit TEDoText .EQU $A70 ; textEdit doText proc hook [pointer] TERecal .EQU $A74 ; textEdit recalText proc hook [pointer] ; Dialog Manager ; Item codes in item list userItem .EQU 0 ; application-defined (dialog only) ctrlItem .EQU 4 ; must be added to following four items btnCtrl .EQU 0 ; standard button chkCtrl .EQU 1 ; standard check box radCtrl .EQU 2 ; standard radio button resCtrl .EQU 3 ; control defined in resource file statText .EQU 8 ; static text editText .EQU 16 ; editable text (dialog only) iconItem .EQU 32 ; icon picItem .EQU 64 ; quickdraw picture itemDisable .EQU 128 ; add to any of above to disable ;stage definition--packed 2 to a byte, 4 stages in a word volBits .EQU 3 ; number of beeps alBit .EQU 4 ; alert bit (put up box this time?) okDismissal .EQU 8 ; bit for OK/Cancel default in each stage ; DialogList Data Structure Definitions dlgMaxIndex .EQU 0 ; maximum index (=items-1) stored here SaveProc .EQU $A90 ; address of Save failsafe procedure SaveSP .EQU $A94 ; Safe SP for restart or save ; Miscellaneous Constants screenRadius .EQU $00100010 ; rounded corners for desk area gPortSize .EQU 108 ; a grafPort is 108 bytes ; Miscellaneous Globals IconBitmap .EQU $A0E ; bitmap used for plotting things TaskLock .EQU $A62 ; re-entering SystemTask [byte] CloseOrnHook .EQU $A88 ; hook for closing desk ornaments MicroSoft .EQU ApplScratch ; for Seattle [12 Bytes] 0.ENDC ; File: ToolTraps.TxT (15 Dec 84) ;_______________________________________________________________________ ; ; User Interface ToolBox Assembly Language Interface ; ; Copyright 1984, Apple Computer, Inc. ;_______________________________________________________________________ .macro _InitFonts .word $A8FE .endm .macro _GetFName .word $A8FF .endm .macro _GetFNum .word $A900 .endm .macro _FMSwapFont .word $A901 .endm .macro _RealFont .word $A902 .endm .macro _SetFontLock .word $A903 .endm .macro _DrawGrowIcon .word $A904 .endm .macro _DragGrayRgn .word $A905 .endm .macro _NewString .word $A906 .endm .macro _SetString .word $A907 .endm .macro _ShowHide .word $A908 .endm .macro _CalcVis .word $A909 .endm .macro _CalcVBehind .word $A90A .endm .macro _ClipAbove .word $A90B .endm .macro _PaintOne .word $A90C .endm .macro _PaintBehind .word $A90D .endm .macro _SaveOld .word $A90E .endm .macro _DrawNew .word $A90F .endm .macro _GetWMgrPort .word $A910 .endm .macro _CheckUpDate .word $A911 .endm .macro _InitWindows .word $A912 .endm .macro _NewWindow .word $A913 .endm .macro _DisposWindow .word $A914 .endm .macro _ShowWindow .word $A915 .endm .macro _HideWindow .word $A916 .endm .macro _GetWRefCon .word $A917 .endm .macro _SetWRefCon .word $A918 .endm .macro _GetWTitle .word $A919 .endm .macro _SetWTitle .word $A91A .endm .macro _MoveWindow .word $A91B .endm .macro _HiliteWindow .word $A91C .endm .macro _SizeWindow .word $A91D .endm .macro _TrackGoAway .word $A91E .endm .macro _SelectWindow .word $A91F .endm .macro _BringToFront .word $A920 .endm .macro _SendBehind .word $A921 .endm .macro _BeginUpDate .word $A922 .endm .macro _EndUpDate .word $A923 .endm .macro _FrontWindow .word $A924 .endm .macro _DragWindow .word $A925 .endm .macro _DragTheRgn .word $A926 .endm .macro _InvalRgn .word $A927 .endm .macro _InvalRect .word $A928 .endm .macro _ValidRgn .word $A929 .endm .macro _ValidRect .word $A92A .endm .macro _GrowWindow .word $A92B .endm .macro _FindWindow .word $A92C .endm .macro _CloseWindow .word $A92D .endm .macro _SetWindowPic .word $A92E .endm .macro _GetWindowPic .word $A92F .endm .macro _InitMenus .word $A930 .endm .macro _NewMenu .word $A931 .endm .macro _DisposMenu .word $A932 .endm .macro _AppendMenu .word $A933 .endm .macro _ClearMenuBar .word $A934 .endm .macro _InsertMenu .word $A935 .endm .macro _DeleteMenu .word $A936 .endm .macro _DrawMenuBar .word $A937 .endm .macro _HiliteMenu .word $A938 .endm .macro _EnableItem .word $A939 .endm .macro _DisableItem .word $A93A .endm .macro _GetMenuBar .word $A93B .endm .macro _SetMenuBar .word $A93C .endm .macro _MenuSelect .word $A93D .endm .macro _MenuKey .word $A93E .endm .macro _GetItmIcon .word $A93F .endm .macro _SetItmIcon .word $A940 .endm .macro _GetItmStyle .word $A941 .endm .macro _SetItmStyle .word $A942 .endm .macro _GetItmMark .word $A943 .endm .macro _SetItmMark .word $A944 .endm .macro _CheckItem .word $A945 .endm .macro _GetItem .word $A946 .endm .macro _SetItem .word $A947 .endm .macro _CalcMenuSize .word $A948 .endm .macro _GetMHandle .word $A949 .endm .macro _SetMFlash .word $A94A .endm .macro _PlotIcon .word $A94B .endm .macro _FlashMenuBar .word $A94C .endm .macro _AddResMenu .word $A94D .endm .macro _PinRect .word $A94E .endm .macro _DeltaPoint .word $A94F .endm .macro _CountMItems .word $A950 .endm .macro _InsertResMenu .word $A951 .endm .macro _NewControl .word $A954 .endm .macro _DisposControl .word $A955 .endm .macro _KillControls .word $A956 .endm .macro _ShowControl .word $A957 .endm .macro _HideControl .word $A958 .endm .macro _MoveControl .word $A959 .endm .macro _GetCRefCon .word $A95A .endm .macro _SetCRefCon .word $A95B .endm .macro _SizeControl .word $A95C .endm .macro _HiliteControl .word $A95D .endm .macro _GetCTitle .word $A95E .endm .macro _SetCTitle .word $A95F .endm .macro _GetCtlValue .word $A960 .endm .macro _GetMinCtl .word $A961 .endm .macro _GetMaxCtl .word $A962 .endm .macro _SetCtlValue .word $A963 .endm .macro _SetMinCtl .word $A964 .endm .macro _SetMaxCtl .word $A965 .endm .macro _TestControl .word $A966 .endm .macro _DragControl .word $A967 .endm .macro _TrackControl .word $A968 .endm .macro _DrawControls .word $A969 .endm .macro _GetCtlAction .word $A96A .endm .macro _SetCtlAction .word $A96B .endm .macro _FindControl .word $A96C .endm .macro _DeQueue .word $A96E .endm .macro _EnQueue .word $A96F .endm .macro _GetNextEvent .word $A970 .endm .macro _EventAvail .word $A971 .endm .macro _GetMouse .word $A972 .endm .macro _StillDown .word $A973 .endm .macro _Button .word $A974 .endm .macro _TickCount .word $A975 .endm .macro _GetKeys .word $A976 .endm .macro _WaitMouseUp .word $A977 .endm .macro _CouldDialog .word $A979 .endm .macro _FreeDialog .word $A97A .endm .macro _InitDialogs .word $A97B .endm .macro _GetNewDialog .word $A97C .endm .macro _NewDialog .word $A97D .endm .macro _SelIText .word $A97E .endm .macro _IsDialogEvent .word $A97F .endm .macro _DialogSelect .word $A980 .endm .macro _DrawDialog .word $A981 .endm .macro _CloseDialog .word $A982 .endm .macro _DisposDialog .word $A983 .endm .macro _Alert .word $A985 .endm .macro _StopAlert .word $A986 .endm .macro _NoteAlert .word $A987 .endm .macro _CautionAlert .word $A988 .endm .macro _CouldAlert .word $A989 .endm .macro _FreeAlert .word $A98A .endm .macro _ParamText .word $A98B .endm .macro _ErrorSound .word $A98C .endm .macro _GetDItem .word $A98D .endm .macro _SetDItem .word $A98E .endm .macro _SetIText .word $A98F .endm .macro _GetIText .word $A990 .endm .macro _ModalDialog .word $A991 .endm .macro _DetachResource .word $A992 .endm .macro _SetResPurge .word $A993 .endm .macro _CurResFile .word $A994 .endm .macro _InitResources .word $A995 .endm .macro _RsrcZoneInit .word $A996 .endm .macro _OpenResFile .word $A997 .endm .macro _UseResFile .word $A998 .endm .macro _UpdateResFile .word $A999 .endm .macro _CloseResFile .word $A99A .endm .macro _SetResLoad .word $A99B .endm .macro _CountResources .word $A99C .endm .macro _GetIndResource .word $A99D .endm .macro _CountTypes .word $A99E .endm .macro _GetIndType .word $A99F .endm .macro _GetResource .word $A9A0 .endm .macro _GetNamedResource .word $A9A1 .endm .macro _LoadResource .word $A9A2 .endm .macro _ReleaseResource .word $A9A3 .endm .macro _HomeResFile .word $A9A4 .endm .macro _SizeRsrc .word $A9A5 .endm .macro _GetResAttrs .word $A9A6 .endm .macro _SetResAttrs .word $A9A7 .endm .macro _GetResInfo .word $A9A8 .endm .macro _SetResInfo .word $A9A9 .endm .macro _ChangedResource .word $A9AA .endm .macro _AddResource .word $A9AB .endm .macro _AddReference .word $A9AC .endm .macro _RmveResource .word $A9AD .endm .macro _RmveReference .word $A9AE .endm .macro _ResError .word $A9AF .endm .macro _WriteResource .word $A9B0 .endm .macro _CreateResFile .word $A9B1 .endm .macro _SystemEvent .word $A9B2 .endm .macro _SystemClick .word $A9B3 .endm .macro _SystemTask .word $A9B4 .endm .macro _SystemMenu .word $A9B5 .endm .macro _OpenDeskAcc .word $A9B6 .endm .macro _CloseDeskAcc .word $A9B7 .endm .macro _GetPattern .word $A9B8 .endm .macro _GetCursor .word $A9B9 .endm .macro _GetString .word $A9BA .endm .macro _GetIcon .word $A9BB .endm .macro _GetPicture .word $A9BC .endm .macro _GetNewWindow .word $A9BD .endm .macro _GetNewControl .word $A9BE .endm .macro _GetRMenu .word $A9BF .endm .macro _GetNewMBar .word $A9C0 .endm .macro _UniqueID .word $A9C1 .endm .macro _SysEdit .word $A9C2 .endm .macro _Secs2Date .word $A9C6 .endm .macro _Date2Secs .word $A9C7 .endm .macro _SysBeep .word $A9C8 .endm .macro _SysError .word $A9C9 .endm .macro _TEGetText .word $A9CB .endm .macro _TEInit .word $A9CC .endm .macro _TEDispose .word $A9CD .endm .macro _TextBox .word $A9CE .endm .macro _TESetText .word $A9CF .endm .macro _TECalText .word $A9D0 .endm .macro _TESetSelect .word $A9D1 .endm .macro _TENew .word $A9D2 .endm .macro _TEUpdate .word $A9D3 .endm .macro _TEClick .word $A9D4 .endm .macro _TECopy .word $A9D5 .endm .macro _TECut .word $A9D6 .endm .macro _TEDelete .word $A9D7 .endm .macro _TEActivate .word $A9D8 .endm .macro _TEDeactivate .word $A9D9 .endm .macro _TEIdle .word $A9DA .endm .macro _TEPaste .word $A9DB .endm .macro _TEKey .word $A9DC .endm .macro _TEScroll .word $A9DD .endm .macro _TEInsert .word $A9DE .endm .macro _TESetJust .word $A9DF .endm .macro _Munger .word $A9E0 .endm .macro _HandToHand .word $A9E1 .endm .macro _PtrToXHand .word $A9E2 .endm .macro _PtrToHand .word $A9E3 .endm .macro _HandAndHand .word $A9E4 .endm .macro _InitPack .word $A9E5 .endm .macro _InitAllPacks .word $A9E6 .endm .macro _Pack0 .word $A9E7 .endm .macro _Pack1 .word $A9E8 .endm .macro _Pack2 .word $A9E9 .endm .macro _Pack3 .word $A9EA .endm .macro _FP68K .word $A9EB .endm .macro _Pack4 .word $A9EB .endm .macro _Elems68K .word $A9EC .endm .macro _Pack5 .word $A9EC .endm .macro _Pack6 .word $A9ED .endm .macro _Pack7 .word $A9EE .endm .macro _PtrAndHand .word $A9EF .endm .macro _LoadSeg .word $A9F0 .endm .macro _UnLoadSeg .word $A9F1 .endm .macro _Launch .word $A9F2 .endm .macro _Chain .word $A9F3 .endm .macro _ExitToShell .word $A9F4 .endm .macro _GetAppParms .word $A9F5 .endm .macro _GetResFileAttrs .word $A9F6 .endm .macro _SetResFileAttrs .word $A9F7 .endm .macro _InfoScrap .word $A9F9 .endm .macro _UnlodeScrap .word $A9FA .endm .macro _LodeScrap .word $A9FB .endm .macro _ZeroScrap .word $A9FC .endm .macro _GetScrap .word $A9FD .endm .macro _PutScrap .word $A9FE .endm .macro _Debugger .word $A9FF .endm ASYNC ASYNCAINASYNCAINASYNCBINASYNCBINASYNCAOUASYNCAOUASYNCBOUASYNCBOU΂ASYNC ASYNC x` SERD xtJgt&gf"C&g`"C$gZ$B$gT$BJ@oANGbJgArG"$`4$:FJg$:n x <gTHSn`\H$B*"B)NuM`xv.AIn N`.AOutM6NF.BIn N|6.BOut!`!|Nu8(g UgpXONu08xf gp`<x1NurtazEGIKMrtv88a0Hz!>NurtazEGIKMHrtvB88pv@pv"fx#H|$$PA!PAE!PH`P&J&6a(PC B)0<Df8< 5D*G!I"p6{QrdA"a@pNu@ `  `   P  Gr$@H4*L|E!0JjXX.UAn L[FNu  B>IK$xv`IK$xvGraGA cNuf(P((+ i#BB08xPx1Nu$x`$x@|5hp%IrAp2UAfaaBX0`^]Af\0B* `L$x`$x@|5hp%IrA2SAf BjB,FNuC:_Ak0 Ab*A21*(Np*pgFNu"jrF/8NuXOp`(4T|x8j*g"`B,(X2fI0r@G&6I66Nu%X5X@@faafa"Nura.Nu$<&p0"Iԁ2UBB%JB&0Bj*`PNuj*`JB**`* r `PNu$x`$x@|PaHf a0g*B*@f xN@J@kpFNuB*Fp`&x NuJ*gJ*f J*g J*gpNupNu$x`$xJ*f J*g af"R@`z(NuB*J*fNu$x`$xa|@|j,g3 RBCft5B.a0FJ@ja `^P`@|J*g a>aLj ba pFNu/8Nug*J*gB*Nu@ag@`&j6* L,Nu0BdCNu(x:!(Jk`gULGACa`.x:/8(NuG`G($[&S*gfJ*gr*g*fP`XJ*g"Ka8jJB*`faXRACfrBf`&5A,J*gaB@jdf*aNuG`G$[&Svp*(*0f*gfg``J*gp"KB*`G`G$[&S*gH瀀0| @H@0+/LJk [jNuJk(NupJ*fNupASYNC ASYNCAINASYNCAINASYNCBINASYNCBINASYNCAOUASYNCAOUASYNCBOUASYNCBOU΂ASYNC ASYNC ` SERD xtJgt&gf"C&g`"C$gZ$B$gT$BJ@oANGbJgArG"$`4$:FJg$:n x <gTHSn`\H$B*"B)NuM`V:.AIn N"~.AOutM6,.BIn Nbb.BOut!`!|Nu8(g UgpXONu08xf gp`<x1NurtazEGpIlKvM rtv88a0Hz&!>NurtazEG8I4K>MrtvB88pv@pv"f#H|$$PA!PAE!PH`P&J&6aPC B)0<Df8< 5D*G!I`p6{QrdA"*&H*%T@2<@g2<cH@2H@ AGoR@U@@%H@&adpNu@ `  `  P     GgGr$@H4*L|E!0JjXX.UAn Lf DJ[FNu  B>IK$xv`IK$xvGravGA cNuf(P((+ i#BB08xPx1Nu$x`$x@|5hp%IrAp2UAfaaBX0`^]Af\0B* `L$x`$x@|5hp%IrA2SAf BjB,FNuC:_Ak0 Ab*A21*(Np*pgFNu"jrF/8NuXOp`(4T|x8j*g"`vB,(X2fI0r@G&6I66Nu%X5X@@faafa0Nura.Nu$<Hg$<&p0"Iԁ2UBB%JB&0Bj*`PNuj*`JB**`* r `PNu$x`$x@|PaHf a0g*B*@f xN@J@kpFNuB*Fp`&xNuJ*gJ*f J*g J*gpNupNu$x`$xJ*f J*g af"R@`z(NuB*J*fNu$x`$xa|@|j,g3 RBCft5B.a0FJ@ja `^P`@|J*g a>aLj ba pFNu/8Nug*J*gB*Nu@ag@`&j6* L,Nu0BdCNu(x:!$Jk`gULGACa`.x:/8$NuG`G($[&S*gfJ*gr*g*fP`XJ*g"Ka8jJB*`faXRACfrBf`&5A,J*gaB@jdf*aNuG`G$[&Svp*(*0f*gfg``J*gp"KB*`zG`G$[&S*gH瀀0| @H@0+/LJkfDJ[jNuJk(NupJ*fNu3. "6F^50 ;resourc^  6H̑<L.:ISTART.T *ӺӪ-#2#1-SerD-serial/AsyncR.text.*.,hh*ISGC>ISserial/AsyncR.text0.A A -#2#1-SerĎfFFxlř ̬bJFPFP* ResDef -- Resource input for RAM-based driver use * Written by Larry Kenyon * * The text of this file should be added to your resource definition file. * * RAM serial drivers: * * Mac driver must have ID=1 * MacXL driver must have ID=2 * * The appropriate driver is loaded by RAMSDOpen depending upon the machine. If a * new version driver is already available in the system (like with MacWorks 3.0), the * RAM driver is not loaded. Serial/Async/Mac and Serial/Async/MacXL are not true drivers * (of type DRVR) but have a different header and are really 4-drivers-in-1: an input and * output driver per port. The DCEs (system I/O data structures) of the ROM drivers are * actually used by the RAM drivers so that the same refnums are used. RAMSDClose MUST BE * CALLED BEFORE YOUR PROGRAM ENDS: this replaces interrupt vectors and the ROM driver * pointers in the DCEs. Type SERD = CDEF %Serial/Async/Mac,1 (16) %Serial/Async/MacXL,2 (16) 9*@Ѥ ^")..8hW.8~]]h'TP'. . TP'xH:>:>hn'NuTP'̗l̗l$tlasm/PrivateParts.TEXTxxutlasm/PrivateParts.TEXTǍ^u"N.8~.8hnTP'̗lTP'̗l|:#'NuTPq'̌^LB.:N^NuUTP D* -#12-tlasm/PrivatePar; File: SysEqu.Txt (8 Feb 85) ;_______________________________________________________________________ ; ; System Equates -- This file defines the low-level equates for the ; Macintosh hardware and software. This is divided into two pieces for ; assembly space and speed considerations. The wholeSystem flag is used ; to include the less common equates which realizes a complete set. The ; comments marked with ";+" denote categories or managers. Record ; stuctures may have additional private equates which are defined by and ; reserved for use by Apple Computer, Inc. ; ; ; Copyright 1984, 1985, Apple Computer, Inc. ;_______________________________________________________________________ wholeSystem .EQU 1 ; Set for complete set of system equates ;+ Hardware Address Equates (for 512K through 128K Macs) SoundLow .EQU $7FD00 ; low sound buffer address ScrVRes .EQU $102 ; screen vertical dots/inch [word] ScrHRes .EQU $104 ; screen horizontal dots/inch [word] ScrnBase .EQU $824 ; Screen Base [pointer] ScreenRow .EQU $106 ; rowBytes of screen [word] ;+ Parameter RAM (a twenty byte copy of the real parameter ram). SPValid .EQU $1F8 ; validation field ($A7) [byte] SPATalkA .EQU $1F9 ; AppleTalk node number hint for port A SPATalkB .EQU $1FA ; AppleTalk node number hint for port B SPConfig .EQU $1FB ; config bits: 4-7 A, 0-3 B (see use type below) SPPortA .EQU $1FC ; SCC port A configuration [word] SPPortB .EQU $1FE ; SCC port B configuration [word] SPAlarm .EQU $200 ; alarm time [long] SPFont .EQU $204 ; default application font number minus 1 [word] SPKbd .EQU $206 ; kbd repeat thresh in 4/60ths [2 4-bit] SPPrint .EQU $207 ; print stuff [byte] SPVolCtl .EQU $208 ; volume control [byte] SPClikCaret .EQU $209 ; double click/caret time in 4/60ths[2 4-bit] SPMisc1 .EQU $20A ; miscellaneous [1 byte] SPMisc2 .EQU $20B ; miscellaneous [1 byte] ; Serial port use type useFree .EQU 0 ; Use undefined useATalk .EQU 1 ; AppleTalk useAsync .EQU 2 ; Async ; Unpacked, user versions of parameter ram DoubleTime .EQU $2F0 ; double click ticks [long] CaretTime .EQU $2F4 ; caret blink ticks [long] KeyThresh .EQU $18E ; threshold for key repeat [word] KeyRepThresh .EQU $190 ; key repeat speed [word] SdVolume .EQU $260 ; Global volume(sound) control [byte] ;+ System Clocks Ticks .EQU $16A ; Tick count, time since boot [long] Time .EQU $20C ; clock time (extrapolated) [long] AlarmState .EQU $21F ; Bit7=parity, Bit6=beeped, Bit0=enable [byte] ;+ Mouse/Keyboard MBState .EQU $172 ; current mouse button state [byte] KeyMap .EQU $174 ; bitmap of the keyboard [2 longs] KeypadMap .EQU $17C ; bitmap for numeric pad-18bits [long] Key1Trans .EQU $29E ; keyboard translator procedure [pointer] Key2Trans .EQU $2A2 ; numeric keypad translator procedure [pointer] JGNEFilter .EQU $29A ; GetNextEvent filter proc [pointer] ;+ Cursor iBeamCursor .EQU 1 ; text selection cursor crossCursor .EQU 2 ; for structured selection plusCursor .EQU 3 ; for drawing graphics watchCursor .EQU 4 ; for indicating a long delay Mouse .EQU $830 ; processed mouse coordinate [long] CrsrPin .EQU $834 ; cursor pinning rectangle [8 bytes] CrsrCouple .EQU $8CF ; cursor coupled to mouse? [byte] CrsrScale .EQU $8D3 ; cursor scaled? [byte] MouseMask .EQU $8D6 ; V-H mask for ANDing with mouse [long] MouseOffset .EQU $8DA ; V-H offset for adding after ANDing [long] ;+ Queue Package qInUse .EQU 7 ; queue-in-use flag bit ; Header Record qHeadSize .EQU $A ; queue header size qFlags .EQU 0 ; miscellaneous flags [word] qHead .EQU 2 ; first element in queue [pointer] qTail .EQU 6 ; last element in queue [pointer] ; General Purpose Queue Element Definition qLink .EQU 0 ; link to next queue element [pointer] qType .EQU 4 ; queue element type [word] ;+ Vertical Blanking Interrupt Handler ; VBL Block Queue Element vType .EQU 1 ; VBL queue element is type 1 inVbl .EQU 6 ; bit index for "in VBL" flag vblink .EQU 0 ; Link to next element [pointer] vblType .EQU 4 ; Unique ID for validity [word] vblAddr .EQU 6 ; service routine [pointer] vblCount .EQU $A ; timeout count [word] vblPhase .EQU $C ; phase count [word] VBLQueue .EQU $160 ; VBL queue header [10 bytes] ;+ Event Manager evType .EQU 4 ; event queue element is type 4 ; Event Type Numbers (in EvtNum) nullEvt .EQU 0 ; event 0 is the null event mButDwnEvt .EQU 1 ; mouse button down is event 1 mButUpEvt .EQU 2 ; mouse button up is event 2 keyDwnEvt .EQU 3 ; key down is event 3 keyUpEvt .EQU 4 ; key up is event 4 autoKeyEvt .EQU 5 ; auto-repeated key is event 5 updatEvt .EQU 6 ; update event diskInsertEvt .EQU 7 ; disk-inserted event activateEvt .EQU 8 ; activate/deactive event netWorkEvt .EQU $A ; network event ioDrvrEvt .EQU $B ; driver-defined event app1Evt .EQU $C ; application defined events app2Evt .EQU $D app3Evt .EQU $E app4Evt .EQU $F ; Modifier bits in event record activeFlag .EQU $0 ; activate? btnState .EQU $7 ; state of button? cmdKey .EQU $8 ; command key down? shiftKey .EQU $9 ; shift key down? alphaLock .EQU $A ; alpha lock down? optionKey .EQU $B ; option key down? ; Event Record Definition evtBlkSize .EQU $10 ; size in bytes of the event record evtQBlkSize .EQU $16 ; size of event record counting queue info evtNum .EQU 0 ; ID number of event [word] evtMessage .EQU 2 ; event-defined msg [long] evtTicks .EQU 6 ; TICKS when event occured [long] evtMouse .EQU $A ; mouse pos. when event occured [long] evtMeta .EQU $E ; meta key flags [byte] evtMBut .EQU $F ; state of mouse button [byte] SEvtEnb .EQU $15C ; enable SysEvent calls from GNE [byte] MonkeyLives .EQU $100 ; monkey lives if >= 0 [word] JournalFlag .EQU $8DE ; journaling state [word] JournalRef .EQU $8E8 ; Journalling driver's refnum [word] ;+ Memory Manager ; Master pointer bits for handles lock .EQU 7 ; lock bit in a master pointer purge .EQU 6 ; bit for purgeable/unpurgeable resourc .EQU 5 ; bit to flag a resource handle ; Heap Zone header bkLim .EQU $0 ; last block in zone [pointer] purgePtr .EQU $4 ; roving purge placeholder [pointer] hFstFree .EQU $8 ; first free handle [pointer] zcbFree .EQU $C ; # of free bytes in zone [long] gzProc .EQU $10 ; grow zone procedure [pointer] mAllocCnt .EQU $14 ; # of master ptrs to allocate [word] flags .EQU $16 ; Flags [word] cntRel .EQU $18 ; # of allocated relocatable blocks [word] maxRel .EQU $1A ; max # of allocated rel. blocks [word] cntNRel .EQU $1C ; # of allocated non-rel. blocks [word] maxNRel .EQU $1E ; max # of allocated non-rel. blocks [word] cntEmpty .EQU $20 ; # of empty handles [word] cntHandles .EQU $22 ; total # of handles [word] minCBFree .EQU $24 ; min # of bytes free [long] purgeProc .EQU $28 ; purge warning procedure [pointer] allocPtr .EQU $30 ; roving allocator [pointer] heapData .EQU $34 ; start of heap zone data BufPtr .EQU $10C ; top of application memory [pointer] StkLowPt .EQU $110 ; Lowest stack as measured in VBL task [pointer] TheZone .EQU $118 ; current heap zone [pointer] ApplLimit .EQU $130 ; application limit [pointer] SysZone .EQU $2A6 ; system heap zone [pointer] ApplZone .EQU $2AA ; application heap zone [pointer] HeapEnd .EQU $114 ; end of heap [pointer] ;+ System Error Handler RestProc .EQU $A8C ; Resume procedure from InitDialogs [pointer] DSErrCode .EQU $AF0 ; last system error alert ID ;+ Drivers dskRfN .EQU $FFFB ; 3.5" disk reference number ; Control/Status Call Codes killCode .EQU 1 ; KillIO code drvStsCode .EQU 8 ; status call code for drive status ejectCode .EQU 7 ; control call eject code tgBuffCode .EQU 8 ; set tag buffer code ; Driver flags, (Bit definitions for DCtlFlags byte) dReadEnable .EQU 0 ; enabled for read operations dWritEnable .EQU 1 ; enabled for writing dCtlEnable .EQU 2 ; enabled for control operations dStatEnable .EQU 3 ; enabled for status operations dNeedGoodBye .EQU 4 ; needs a "goodbye kiss" dNeedTime .EQU 5 ; needs "main thread" time dNeedLock .EQU 6 ; needs to be accessed at interrupt level ; Run-Time flags, (Bit definitions for DCtlFlags+1 byte) dOpened .EQU 5 ; bit to mark driver 'Open' dRAMBased .EQU 6 ; 1=RAM-based Driver, 0=ROM-based drvrActive .EQU 7 ; bit to mark the driver active ; Drive queue element offsets dqElLnth .EQU $C ; queue element length w/header dqDrive .EQU $6 ; drive number [word] dqRefNum .EQU $8 ; driver refnum [word] dqFSID .EQU $A ; file system handling this drive [word] dqDrvSize .EQU $C ; number of blocks this drive [word] ; Device Control Entry Definition dCtlEntrySize .EQU $28 ; length of a DCE [40 bytes] dCtlDriver .EQU 0 ; driver [handle] dCtlFlags .EQU 4 ; flags [word] dCtlQueue .EQU 6 ; queue header dCtlQHead .EQU 8 ; queue first-element [pointer] dCtlQTail .EQU $C ; queue last-element [pointer] dCtlPosition .EQU $10 ; position [long] dCtlStorage .EQU $14 ; driver's private storage [handle] dCtlRefNum .EQU $18 ; refNum of this driver [word] dCtlCurTicks .EQU $1A ; counter for timing systemTask calls [long] dCtlWindow .EQU $1E ; driver's window (if any) [pointer] dCtlDelay .EQU $22 ; number of ticks between sysTask calls [word] dCtlEMask .EQU $24 ; desk accessory event mask [word] dCtlMenu .EQU $26 ; menu ID associated with driver [word] ; Driver Globals UTableBase .EQU $11C ; unit I/O table [pointer] UnitNtryCnt .EQU $1D2 ; count of entries in unit table [word] IntFlag .EQU $15F ; reduce interrupt disable time when bit 7 = 0 JFetch .EQU $8F4 ; fetch a byte routine for drivers [pointer] JStash .EQU $8F8 ; stash a byte routine for drivers [pointer] JIODone .EQU $8FC ; IODone entry location [pointer] ;+ I/O System ; File positioning modes for ioPosMode field of I/O record fsAtMark .EQU 0 ; at current position of mark fsFromStart .EQU 1 ; offset relative to beginning of file fsFromLEOF .EQU 2 ; offset relative to logical end-of-file fsFromMark .EQU 3 ; offset relative to current mark ; Permission values for ioPermssn field of I/O record fsCurPerm .EQU 0 ; whatever is currently allowed fsRdPerm .EQU 1 ; request to read only fsWrPerm .EQU 2 ; request to write only fsRdWrPerm .EQU 3 ; request to read and write ; I/O record (general fields with trap-specific ones listed below) ioQElSize .EQU $32 ; length of I/O parameter block [50 bytes] ioLink .EQU $0 ; queue link in header [pointer] ioType .EQU $4 ; type for safety check [byte] ioTrap .EQU $6 ; the trap [word] ioCmdAddr .EQU $8 ; address to dispatch to [pointer] ioCompletion .EQU $C ; completion routine [pointer] ioResult .EQU $10 ; I/O result code [word] ioFileName .EQU $12 ; file name pointer [pointer] ioVRefNum .EQU $16 ; volume refnum [word] ioDrvNum .EQU $16 ; drive number [word] ioRefNum .EQU $18 ; file reference number [word] ioFileType .EQU $1A ; specified along with FileName [byte] ; specific fields for _Read, _Write ioBuffer .EQU $20 ; data buffer [pointer] ioByteCount .EQU $24 ; requested byte count [long] ioNumDone .EQU $28 ; actual byte count completed [long] ioPosMode .EQU $2C ; initial file positioning mode/eol char [word] ioPosOffset .EQU $2E ; file position offset [long] ; specific fields for _Allocate ioReqCount .EQU $24 ; requested new size [long] ioActCount .EQU $28 ; actual byte count allocated [long] ; specific fields for _Open ioPermssn .EQU $1B ; permissions [byte] ioOwnBuf .EQU $1C ; "private" 522-byte buffer [pointer] ; specific fields for _ReName ioNewName .EQU $1C ; new name pointer [pointer] ; specific fields for _GetFileInfo, _SetFileInfo ioFQElSize .EQU $50 ; File command parameter length [80 bytes] ioFDirIndex .EQU $1C ; directory index of file [word] ioFlAttrib .EQU $1E ; in-use bit=7, lock bit=0 [byte] ioFFlType .EQU $1F ; file type [byte] ioFlUsrWds .EQU $20 ; finder info [16 bytes] ioFFlNum .EQU $30 ; file number [long] ioFlStBlk .EQU $34 ; start file block (0000 if none) [word] ioFlLgLen .EQU $36 ; logical length (EOF) [long] ioFlPyLen .EQU $3A ; physical length in bytes [long] ioFlRStBlk .EQU $3E ; resource fork's start file block [word] ioFlRLgLen .EQU $40 ; resource fork's logical length (EOF) [long] ioFlRPyLen .EQU $44 ; resource fork's physical length [long] ioFlCrDat .EQU $48 ; creation date & time [long] ioFlMdDat .EQU $4C ; last modification date & time [long] ; Specific fields for _GetEOF, _SetEOF ioLEOF .EQU $1C ; logical end-of-file [long] ; Specific fields for _SetFileType ioNewType .EQU $1C ; new type byte [byte] ; Specific fields for _GetVolInfo, _GetVolume, _SetVolume, _MountVol, _UnmountVol, ; _Eject. Note that these traps have a bigger record size. ioVQElSize .EQU $40 ; Volume command parameter length [64 bytes] ioVDrvNum .EQU $16 ; drive or volume number [word] ioVNPtr .EQU $12 ; name buffer (or zero) [pointer] ioVolIndex .EQU $1C ; volume index number [word] ioVCrDate .EQU $1E ; creation date & time [long] ioVLsBkUp .EQU $22 ; last backup date & time [long] ioVAtrb .EQU $26 ; Volume attributes [word] ioVNmFls .EQU $28 ; # files in directory [word] ioVDirSt .EQU $2A ; start block of file dir [word] ioVBlLn .EQU $2C ; length of dir in blocks [word] ioVNmAlBlks .EQU $2E ; num blks (of alloc size) this dev [word] ioVAlBlkSiz .EQU $30 ; alloc blk byte size [long] ioVClpSiz .EQU $34 ; bytes to try to allocate at a time [long] ioAlBlSt .EQU $38 ; starting block in block map [word] ioVNxtFNum .EQU $3A ; next free file number [long] ioVFrBlk .EQU $3E ; # free alloc blks for this vol [word] ; Specific fields for _Control, _Status csCode .EQU $1A ; control/status code [word] csParam .EQU $1C ; operation-defined parameters [20 bytes] ; FInfo (Finder Information) record layout fdType .EQU $0 ; type of file [long] fdCreator .EQU $4 ; file's creator [long] fdFlags .EQU $8 ; flags [word] fdLocation .EQU $A ; file's location [point] fdFldr .EQU $E ; file's window [word] ; Masks for fdFlags field of FInfo record defined above fHasBundle .EQU $0020 ; set if file has a bundle fInvisible .EQU $0040 ; set if file's icon is invisible ; File System Globals DrvQHdr .EQU $308 ; queue header of drives in system [10 bytes] DskVerify .EQU $12C ; used by 3.5 disk driver for read/verify [byte] BootDrive .EQU $210 ; drive number of boot drive [word] EjectNotify .EQU $338 ; eject notify procedure [pointer] IAZNotify .EQU $33C ; world swaps notify procedure [pointer] TagData .EQU $2FA ; sector tag info for disk drivers [14 bytes] BufTgFNum .EQU $2FC ; file number [long] BufTgFFlg .EQU $300 ; flags [word] BufTgFBkNum .EQU $302 ; logical block number [word] BufTgDate .EQU $304 ; time stamp [word] ;+ Date-Time record (for use with _Secs2Date, and _Date2Secs) dtYear .EQU $0 ; year (1904..) [word] dtMonth .EQU $2 ; month (1..12) [word] dtDay .EQU $4 ; day (1..31) [word] dtHour .EQU $6 ; hour (0..23) [word] dtMinute .EQU $8 ; minute (0..59) [word] dtSecond .EQU $A ; second (0..59) [word] dtDayOfWeek .EQU $C ; day of week, sunday..saturday (1..7) [word] ;+ Miscellaneous stuff OneOne .EQU $A02 ; constant $00010001 [long] MinusOne .EQU $A06 ; constant $FFFFFFFF [long] Lo3Bytes .EQU $31A ; constant $00FFFFFF [long] ROMBase .EQU $2AE ; ROM base address [pointer] RAMBase .EQU $2B2 ; RAM base address [pointer] SysVersion .EQU $15A ; version # of RAM-based system [word] RndSeed .EQU $156 ; random seed/number [long] ;+ Scratch Areas scratch20 .EQU $1E4 ; scratch [20 bytes] scratch8 .EQU $9FA ; scratch [8 bytes] ;+ Scrap Manager scrapSize .EQU $960 ; scrap length [long] scrapHandle .EQU $964 ; memory scrap [handle] scrapCount .EQU $968 ; validation byte [word] scrapState .EQU $96A ; scrap state [word] scrapName .EQU $96C ; pointer to scrap name [pointer] ;+ Desk Accessories ; Message Definitions (in CSCode of control call) accEvent .EQU $40 ; event message from SystemEvent accRun .EQU $41 ; run message from SystemTask accCursor .EQU $42 ; cursor message from SystemTask accMenu .EQU $43 ; menu message from SystemMenu accUndo .EQU $44 ; undo message from SystemEdit accCut .EQU $46 ; cut message from SystemEdit accCopy .EQU $47 ; copy message from SystemEdit accPaste .EQU $48 ; paste message from SystemEdit accClear .EQU $49 ; clear message from SystemEdit ;+ Segment Loader CurApRefNum .EQU $900 ; refNum of application's resFile [word] CurrentA5 .EQU $904 ; current value of A5 [pointer] CurStackBase .EQU $908 ; current stack base [pointer] CurApName .EQU $910 ; name of application [STRING[31]] LoadTrap .EQU $12D ; trap before launch? [byte] ; Queue Element Type Definitions ioQType .EQU 2 ; I/O queue element is type 2 drvQType .EQU 3 ; timer queue element is type 3 fsQType .EQU 5 ; File System VCB element 0.IF wholeSystem ; Peripheral chips and Magic Hardware addresses ; Hardware addresses and constants OvlyRAM .EQU $600000 ; low RAM address when overlay is on OvlyScreen .EQU $67A700 ; top of screen with overlay sndBufWLen .EQU $0172 ; sound/disk buffer word length ; VIA (6522) interface chip VIA .EQU $1D4 ; VIA base address [pointer] ; Offsets vBufB .EQU 0 ; BUFFER B vBufAH .EQU $200 ; buffer a (with handshake) [ Dont use! ] vDIRB .EQU $400 ; DIRECTION B vDIRA .EQU $600 ; DIRECTION A vT1C .EQU $800 ; TIMER 1 COUNTER (L.O.) vT1CH .EQU $A00 ; timer 1 counter (high order) vT1L .EQU $C00 ; TIMER 1 LATCH (L.O.) vT1LH .EQU $E00 ; timer 1 latch (high order) vT2C .EQU $1000 ; TIMER 2 LATCH (L.O.) vT2CH .EQU $1200 ; timer 2 counter (high order) vSR .EQU $1400 ; SHIFT REGISTER vACR .EQU $1600 ; AUX. CONTROL REG. vPCR .EQU $1800 ; PERIPH. CONTROL REG. vIFR .EQU $1A00 ; INT. FLAG REG. vIER .EQU $1C00 ; INT. ENABLE REG. vBufA .EQU $1E00 ; BUFFER A vBufD .EQU $1E00 ; disk head select buffer ; Buffer A: vAOut .EQU $7F ; VBufA output bits vAInit .EQU $7B ; VBufA initial values med. volume vSound .EQU $7 ; sound volume bits vSndPg2 .EQU 3 ; select sound page 2 if 0 vOverlay .EQU 4 ; overlay bit (overlay when 1) vHeadSel .EQU 5 vPage2 .EQU 6 ; select video page 2 if 0 vSCCWrReq .EQU 7 ; SCC write/request line ; Buffer B: vBOut .EQU $87 ; VBufB output bits vBInit .EQU $07 ; VBufB initial values rtcData .EQU 0 rtcClk .EQU 1 rtcEnb .EQU 2 ; enabled when 0 vSW .EQU 3 ; mouse switch (0 when down) vX2 .EQU 4 ; mouse X level vY2 .EQU 5 ; mouse Y level vH4 .EQU 6 ; horizontal sync vSndEnb .EQU 7 ; /sound enable (reset when 1) ; SCC Serial Chip Addresses SCCRd .EQU $1D8 ; SCC base read address [pointer] SCCWr .EQU $1DC ; SCC base write address [pointer] aData .EQU 6 ; offset for A channel data aCtl .EQU 2 ; offset for A channel control bData .EQU 4 ; offset for B channel data bCtl .EQU 0 ; offset for B channel control sccData .EQU 4 ; general offset for data from control sccWrite .EQU $200001 ; general offset for write from read rxBF .EQU 0 ; SCC receive buffer full txBE .EQU 2 ; SCC transmit buffer empty ; Disk Address IWM .EQU $1E0 ; IWM base address [pointer] ph0L .EQU 0 ; disk address offsets from base ph0H .EQU $200 ph1L .EQU $400 ph1H .EQU $600 ph2L .EQU $800 ph2H .EQU $A00 ph3L .EQU $C00 ph3H .EQU $E00 mtrOff .EQU $1000 mtrOn .EQU $1200 intDrive .EQU $1400 ; enable internal drive address extDrive .EQU $1600 ; enable external drive address q6L .EQU $1800 q6H .EQU $1A00 q7L .EQU $1C00 q7H .EQU $1E00 ; Interrupt secondary vectors Lvl1DT .EQU $192 ; Interrupt level 1 dispatch table [32 bytes] Lvl2DT .EQU $1B2 ; Interrupt level 2 dispatch table [32 bytes] ExtStsDT .EQU $2BE ; SCC ext/sts secondary dispatch table [16 bytes] ; Parameter Ram GetParam .EQU $1E4 ; system parameter scratch [20 bytes] SysParam .EQU $1F8 ; system parameter memory [20 bytes] ; Cursor CrsrThresh .EQU $8EC ; delta threshold for mouse scaling [word] JCrsrTask .EQU $8EE ; address of CrsrVBLTask [long] MTemp .EQU $828 ; Low-level interrupt mouse location [long] RawMouse .EQU $82C ; un-jerked mouse coordinates [long] CrsrRect .EQU $83C ; Cursor hit rectangle [8 bytes] TheCrsr .EQU $844 ; Cursor data, mask & hotspot [68 bytes] CrsrAddr .EQU $888 ; Address of data under cursor [long] CrsrSave .EQU $88C ; data under the cursor [64 bytes] CrsrVis .EQU $8CC ; Cursor visible? [byte] CrsrBusy .EQU $8CD ; Cursor locked out? [byte] CrsrNew .EQU $8CE ; Cursor changed? [byte] CrsrState .EQU $8D0 ; Cursor nesting level [word] CrsrObscure .EQU $8D2 ; Cursor obscure semaphore [byte] ; Mouse/Keyboard MBTicks .EQU $16E ; tick count @ last mouse button [long] JKybdTask .EQU $21A ; keyboard VBL task hook [pointer] KeyLast .EQU $184 ; ASCII for last valid keycode [word] KeyTime .EQU $186 ; tickcount when KEYLAST was rec'd [long] KeyRepTime .EQU $18A ; tickcount when key was last repeated [long] ; Event manager jPlayCtl .EQU 16 ; playBack call jRecordCtl .EQU 17 ; record call jcTickCount .EQU 0 ; journal code for TickCount jcGetMouse .EQU 1 ; journal code for GetMouse jcButton .EQU 2 ; journal code for Button jcGetKeys .EQU 3 ; journal code for GetKeys jcEvent .EQU 4 ; journal code for GetNextEvent(Avail) SysEvtMask .EQU $144 ; system event mask [word] SysEvtBuf .EQU $146 ; system event queue element buffer [pointer] EventQueue .EQU $14A ; event queue header [10 bytes] EvtBufCnt .EQU $154 ; max number of events in SysEvtBuf - 1 [word] ; flags in header fOnCheck .EQU 0 ; Turn On Checking fChecking .EQU 1 ; Checking on fNSelCompct .EQU 4 ; Use non-selective compact algorithm when 1. fNoRvrAlloc .EQU 5 ; Don't use rover allocation scheme when 1. fNSelPurge .EQU 6 ; Use non-selective purge algorithm when 1. fRelAtEnd .EQU 7 ; MakeBk packs rels at end of free bk when 1. ; Block Types tybkMask .EQU 3 ; Mask for block type tybkFree .EQU 0 ; Free Block tybkNRel .EQU 1 ; Non-Relocatable tybkRel .EQU 2 ; Relocatable ; Block Offsets tagBC .EQU 0 ; Tag and Byte Count field [long] handle .EQU 4 ; back pointer to master pointer [pointer] blkData .EQU 8 ; data starts here ; _InitZone argument table. startPtr .EQU 0 ; Start address for zone [pointer] limitPtr .EQU 4 ; Limit address for zone [pointer] cMoreMasters .EQU 8 ; Number of masters to allocate at time [word] pGrowZone .EQU 10 ; growZone procedure [pointer] ; Trap bits for memory manager tSysOrCurZone .EQU 10 ; bit set implies System Zone A; bit clear implies Current Zone clearBit .EQU 9 ; bit set means clear allocated memory. GZRootHnd .EQU $328 ; root handle for GrowZone [handle] GZRootPtr .EQU $32C ; root pointer for GrowZone [pointer] GZMoveHnd .EQU $330 ; moving handle for GrowZone [handle] MemTop .EQU $108 ; top of memory [pointer] MmInOK .EQU $12E ; initial memory mgr checks ok? [byte] HpChk .EQU $316 ; heap check RAM code [pointer] MaskBC .EQU $31A ; Memory Manager Byte Count Mask [long] MaskHandle .EQU $31A ; Memory Manager Handle Mask [long] MaskPtr .EQU $31A ; Memory Manager Pointer Mask [long] MinStack .EQU $31E ; min stack size used in InitApplZone [long] DefltStack .EQU $322 ; default size of stack [long] MMDefFlags .EQU $326 ; default zone flags [word] ; System Error Handler DSAlertTab .EQU $2BA ; system error alerts [pointer] DSAlertRect .EQU $3F8 ; rectangle for disk-switch alert [8 bytes] DSDrawProc .EQU $334 ; alternate syserror draw procedure [pointer] DSWndUpdate .EQU $15D ; GNE not to paintBehind DS AlertRect? [byte] WWExist .EQU $8F2 ; window manager initialized? [byte] QDExist .EQU $8F3 ; quickdraw is initialized [byte] ; Serial I/O Driver PortAUse .EQU $290 ; bit 7: 1 = not in use, 0 = in use A; bits 0-3: current use of port (see use type) A; bits 4-6: user specific PortBUse .EQU $291 ; port B use, same format as PortAUse SCCASts .EQU $2CE ; SCC read reg 0 last ext/sts rupt - A [byte] SCCBSts .EQU $2CF ; SCC read reg 0 last ext/sts rupt - B [byte] ; Serial handshake record definition shFXOn .EQU $0 ; XOn/XOff output control flags [byte] shFCTS .EQU $1 ; CTS hardware handshake flag [byte] shXOn .EQU $2 ; XOn character [byte] shXOff .EQU $3 ; XOff character [byte] shErrs .EQU $4 ; errors that cause abort [byte] shEvts .EQU $5 ; status changes that cause events [byte] shFInX .EQU $6 ; XOn/XOff input flow control flag [byte] shNull .EQU $7 ; not used [byte] ; Serial status record definition ssCumErrs .EQU $0 ; cumulative errors [byte] ssXOffSent .EQU $1 ; XOff sent as input control flag [byte] ssRdPend .EQU $2 ; read pending flag [byte] ssWrPend .EQU $3 ; write pending flag [byte] ssCTSHold .EQU $4 ; CTS flow control hold flag [byte] ssXOffHold .EQU $5 ; XOff received as output flow control [byte] ; Disk Driver ; Driver Code Header (for I/O drivers, desk accessories) drvrFlags .EQU $0 ; various flags and permissions [word] drvrDelay .EQU $2 ; # of ticks between systask calls [word] drvrEMask .EQU $4 ; event mask [word] drvrMenu .EQU $6 ; driver menu ID [word] drvrOpen .EQU $8 ; open routine offset [word] drvrPrime .EQU $A ; prime routine offset [word] drvrCtl .EQU $C ; control routine offset [word] drvrStatus .EQU $E ; status routine offset [word] drvrClose .EQU $10 ; warmstart reset routine offset [word] drvrName .EQU $12 ; length byte and name of driver [string] ; Driver Status record definition dsTrack .EQU $0 ; current track [word] dsWriteProt .EQU $2 ; bit 7=1 if volume locked [byte] dsDiskInPlace .EQU $3 ; disk in place [byte] dsInstalled .EQU $4 ; drive installed [byte] dsSides .EQU $5 ; bit 7=0 if single-sided drive [byte] dsQLink .EQU $6 ; next queue entry [pointer] dsDQDrive .EQU $C ; drive number [word] dsDQRefNum .EQU $E ; driver reference number [word] dsDQFSID .EQU $10 ; file-system identifier [word] dsTwoSideFmt .EQU $12 ; -1 if two-sided disk [byte] dsDiskErrs .EQU $14 ; error count [word] SonyVars .EQU $134 ; 3-1/2 disk driver vars [pointer] DskErr .EQU $142 ; disk routine result code [word] PWMBuf2 .EQU $312 ; PWM buffer 1 (or 2 if sound) [pointer] ; Sound Stuff SoundPtr .EQU $262 ; 4VE sound definition table [pointer] SoundBase .EQU $266 ; sound bitMap [pointer] SoundVBL .EQU $26A ; vertical retrace control element [16 bytes] SoundDCE .EQU $27A ; sound driver DCE [pointer] SoundActive .EQU $27E ; sound is active? [byte] SoundLevel .EQU $27F ; current level in buffer [byte] CurPitch .EQU $280 ; current pitch value [word] ; I/O System noQueueBit .EQU $9 ; tells I/O system not to queue the request asyncTrpBit .EQU $A ; bit in high byte of trap specifying async ; I/O Command Equates for I/O Queue Elements (match trap numbers) aRdCmd .EQU 2 ; read command aWrCmd .EQU 3 ; write command aCtlCmd .EQU 4 ; control command aStsCmd .EQU 5 ; status command ; Print variables PrintVars .EQU $944 ; print code variables [16 bytes] ScrDmpEnb .EQU $2F8 ; screen dump enabled? [byte] ScrDmpType .EQU $2F9 ; FF dumps screen, FE dumps front window [byte] ; Scrap Variables ScrapVars .EQU $960 ; scrap manager variables [32 bytes] ScrapInfo .EQU $960 ; scrap length [long] ScrapEnd .EQU $980 ; end of scrap vars ScrapTag .EQU $970 ; scrap file name [STRING[15]] ; Segment Loader LaunchFlag .EQU $902 ; from launch or chain [byte] SaveSegHandle .EQU $930 ; seg 0 handle [handle] CurJTOffset .EQU $934 ; current jump table offset [word] CurPageOption .EQU $936 ; current page 2 configuration [word] LoaderPBlock .EQU $93A ; param block for ExitToShell [10 bytes] ; Interrupt Auto-vector and Exception Definitions Line1010 .EQU $28 ; 1010 emulator trap (system routines) Line1111 .EQU $2C ; 1111 emulator trap (reserved) AutoInt1 .EQU $64 ; level 1 auto-vector AutoInt2 .EQU $68 ; level 2 auto-vector AutoInt3 .EQU $6C ; level 3 auto-vector AutoInt4 .EQU $70 ; level 4 auto-vector AutoInt5 .EQU $74 ; level 5 auto-vector AutoInt6 .EQU $78 ; level 6 auto-vector AutoInt7 .EQU $7C ; level 7 auto-vector 0.ENDC      ?O          'MNLOMPNQORPSQTRUS VT WU XV YW ZX[Y\Z][^\_]`^a_b`cadbecfdgehfigjhkilj mk!nl"om#pn$qo%rp&sq'tr(us)vt*wu+xv,yw-zx.{y/|z0}{1~|2}3~4567      !"#$%      !"#$%&'()      !"#$%&'()                                   !  "! #" $#! %$" &%# '&$ ('% )(& *)' +*( ,+) -,* .-+ /., 0/- 10. 21/ 320 431 542 653 764 875 986 :97 ;:8 <;9 =<: >=; ?< ? @> A? B@ CA DB EC FD GE HF IG JH KI J M NL OM PN QO RP SQ TR US VT WU XV YW ZX [Y \Z ][ ^\ _] ^ a b` ca db ec fd ge hf ig jh ki lj mk l o pn qo rp sq tr us vt wu xv yw zx {y |z }{ ~| } ~           !"#$%&'()*+,-./                       I      !" #!$"%#&$'%&)*(+),*-+.,/-0.1/ 20 31 42 53 64758697:8;9<:=;><?=>AB@CADBECFDGEHFIG JH KI LJ MK NLOMPNQORPSQTRUSVTWUXVYWZX[Y\Z][^\_]`^ a_!b`"ca#db$ec%fd&ge'hf(ig)jh*ki+lj,mk-nl.om/pn0qo1pstrusvtwuxvywzx{y |z }{ ~| } ~!!!      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI