Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!ames!ucbcad!ucbvax!decvax!tektronix!uw-beaver!tikal!bobc From: bobc@tikal.UUCP (Bob Campbell) Newsgroups: comp.sys.mac Subject: Re: Small bug in MacMETH toolbox-interface Message-ID: <560@tikal.UUCP> Date: Tue, 18-Nov-86 17:48:53 EST Article-I.D.: tikal.560 Posted: Tue Nov 18 17:48:53 1986 Date-Received: Thu, 20-Nov-86 08:23:29 EST References: <446@daimi.UUCP> Reply-To: bobc@tikal.UUCP (Bob Campbell) Organization: Teltone Corp., Kirkland, WA Lines: 70 In article <446@daimi.UUCP> jnp@daimi.UUCP (J|rgen N|rgaard) writes: >Small bug in MacMETH 2.0 Toolbox interface: >the result parameter is a "VAR IconItem:Byte", due to modulas >way of handling BYTEs this is wrong. Pascal and modula use >exactly the opposite BYTEs of a WORD when accessing just one >BYTE. .... >One solution could be: (in interface module of course) > VAR dirty : RECORD > b1,b2:BYTE > END; >.......... > GetIconItem(parameter1,parameter2, dirty.b1); PROCEDURE GetItemIcon(theMenu:MenuHandle;item:INTEGER;VAR icon:CHAR); Either the definition is wrong (and I believe that it is correct as per Inside Mac but I have not checked), or there are serious problems. Neither the Mac nor MacMETH should assume that when a BYTE size variable is passed that the address of the real byte is the address passed + 1, this just does not make since to me. I do know that value parameters are passed differently as MacMETH uses MOVE.B xxx,-(A7) and the normal Mac routines used MOVE.W xxx,-(A7). The MacMETH code is something like follows: PROCEDURE Example(VAR b:BYTE); BEGIN b := 0C; END Example; VAR x:BYTE; BEGIN Example(x); END ... example LINK A6,#0 ; Link A6 MOVEA.L 8(A6),A3 ; Get the address of b MOVE.B #0,(A3) ; Store 0 into b UNLK A6 ; Unlink MOVEA.L (A7)+,A3 ; I believe that it uses A3 most of the time LEA 4(A7),A7 ; Pop Parameter JMP (A3) ; Return PEA x,-(A7) ; Push Address of x BSR Example ; Call Example OR for a trap routine PROCEDURE Examp(VAR b:BYTE); CODE 0A9FFH; VAR x:BYTE; BEGIN Examp(x); END ... PEA x,-(A7) DC.W A9FF At this point you have passed the address of the exact byte that you want it to work with. If it messes with something else then there are big problems, I don't beleive that either MacMETH or the MacIntosh ROMs would do this (unless there is a bug). I would like to here what the final resolution of this problem is, (and may do some experments at home to find out). Bob Campbell Teltone Corporation 18520 - 66th AVE NE P.O. Box 657 Seattle, WA 98155 Kirkland, WA 98033 {amc,dataio,fluke,hplsla,sunup,uw-beaver}!tikal!bobc