neil@fornax.uucp (Neil MacKenzie) (09/17/86)
I have a copy of the Single pass Modula-2 compiler from ETH and seems quite good. Unfortunately it came with hardly any libraries to access the toolbox etc. If any one on the net knows where I can get a hold of the libraries I would appreciate hearing from them. Thanks Neil MacKenize Simon Fraser University uw-beaver!ubc-vision!fornax!neil
heeb@ethz.UUCP (Hansruedi Heeb) (09/30/86)
You can access any tool-box tool if you know it's address. An example: FROM SYSTEM IMPORT WORD; PROCEDURE DrawChar(ch: WORD); CODE 0A883H; Hansruedi Heeb {seismo|decvax}!mcvax!cernvax!ethz!heeb -- Hansruedi Heeb {seismo|decvax}!mcvax!cernvax!ethz!heeb
joel@gould9.UUCP (Joel West) (10/08/86)
In article <384@ethz.UUCP>, heeb@ethz.UUCP (Hansruedi Heeb) writes: > You can access any tool-box tool if you know it's address. An example: > > FROM SYSTEM IMPORT WORD; > > PROCEDURE DrawChar(ch: WORD); CODE 0A883H; > > > Hansruedi Heeb > {seismo|decvax}!mcvax!cernvax!ethz!heeb Actually, this loses something in the translation, since the word here is "trap" not "address". A trap is an unimplemented 68000 instruction. This only works for stack-based calls, which are normally limited to the toolbox. For example, if MacMETH doesn't provide assembler, and doesn't provide direct access to the file manager, device manager, and memory manager, you're SOOL. -- Joel West MCI Mail: 282-8879 Western Software Technology, POB 2733, Vista, CA 92083 {cbosgd, ihnp4, pyramid, sdcsvax, ucla-cs} !gould9!joel joel%gould9.uucp@NOSC.ARPA
bobc@tikal.UUCP (10/09/86)
In article <809@gould9.UUCP> joel@gould9.UUCP (Joel West) writes: >This only works for stack-based calls, which are normally limited >to the toolbox. For example, if MacMETH doesn't provide assembler, >and doesn't provide direct access to the file manager, device >manager, and memory manager, you're SOOL. >-- > Joel West MCI Mail: 282-8879 Actually you don't need a assembler to do OS traps, but some simple rules are in order. First OS traps require some glue code to adjust things correctly for example, and the INLINE directive should be used instead of the "CODE" procedure: FROM SYSTEM IMPORT ADDRESS,INLINE,SETREG,REG,ADR,WORD; CONST A0 = 8; D0 = 0; PROCEDURE OSEventAvail (mask: WORD; VAR theEvent: EventRecord): BOOLEAN; BEGIN SETREG(8,ADR(theEvent)); SETREG(0,mask); CODE(0A030H); RETURN(VAL(INTEGER,REG(0)) = 0) END OSEventAvail; Rule #2 Don't use WITH statements with INLINE traps. Things will normally work ok if the WITH closes before the TRAP. For example the following may fail: IMPLEMENTATION MODULE FileManager; FROM SYSTEM IMPORT ADR,REG,SETREG,INLINE,WORD; FROM PascalStrings IMPORT MakePascalString; FROM MacTypes IMPORT OSErr; FROM FileTypes IMPORT OSType,ParamBlockRec; CONST OpenTrap = 0A000H; A0 = 8; D0 = 0; ... PROCEDURE FSOpen(VAR Name:ARRAY OF CHAR;vRef:INTEGER;VAR ref:INTEGER):OSErr; VAR PB:ParamBlockRec; Str:ARRAY[0..255] OF CHAR; BEGIN WITH PB DO ioCompletion := NIL; MakePascalString(Name,Str); PB.ioNamePtr := ADR(Str); PB.ioVRefNum := vRef; PB.ioVersNum := 0C; PB.ioPermssn := 0C; PB.ioMisc := NIL; SETREG(A0,ADR(PB)); INLINE(OpenTrap); ref := ioRefNum; RETURN(ioResult); END; END FSOpen; .... But if it is done like this it will work: WITH PB DO ioCompletion := NIL; ... ioMisc := NIL; END; SETREG(A0,ADR(PB)); INLINE(OpenTrap); ref := ioRefNum; RETURN(ioResult); ... Of the things in MacMETH that I want the most are: HFS Search Paths, in both the Linker and in the Loader for finding object files. But by the time that they get that done I will not need MacMETH anymore. (Hint: I am working on a MPW version of Modula-2). 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