Article View: comp.lang.modula2
Article #3520Re: Small bug in MacMETH toolbox-interface
From: Bob Campbell
Date: Tue, 18 Nov 1986 18:48
Date: Tue, 18 Nov 1986 18:48
69 lines
2763 bytes
2763 bytes
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
MOVE.B #0,8(A6)
UNLK A6
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)
BSR 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
Technical Details
Message-ID:
<556@tikal.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!sri-spam!ames!ucbcad!ucbvax!decvax!tektronix!uw-beaver!tikal!bobcReferences:
<446@daimi.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!sri-spam!ames!ucbcad!ucbvax!decvax!tektronix!uw-beaver!tikal!bobc From: bobc@tikal.UUCP (Bob Campbell) Newsgroups: comp.lang.modula2,comp.sys.mac Subject: Re: Small bug in MacMETH toolbox-interface Message-ID: <556@tikal.UUCP> Date: Tue, 18-Nov-86 13:48:26 EST Article-I.D.: tikal.556 Posted: Tue Nov 18 13:48:26 1986 Date-Received: Wed, 19-Nov-86 22:04:10 EST References: <446@daimi.UUCP> Reply-To: bobc@tikal.UUCP (Bob Campbell) Organization: Teltone Corp., Kirkland, WA Lines: 69 Keywords: MacMETH Bugs? GetItemIcon Summary: Something is not right.