🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

4 total messages Started by Neil MacKenzie Wed, 17 Sep 1986 06:01
ETH Modula2 Single Pass
#6730
Author: Neil MacKenzie
Date: Wed, 17 Sep 1986 06:01
9 lines
913 bytes
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
Re: ETH Modula2 Single Pass (how to access the tool-box)
#7211
Author: Hansruedi Heeb
Date: Mon, 29 Sep 1986 22:37
12 lines
850 bytes
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
Re: ETH Modula2 Single Pass (how to access the tool-box)
#7212
Author: Joel West
Date: Wed, 08 Oct 1986 03:07
24 lines
1481 bytes
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
Re: ETH Modula2 Single Pass (how to access the tool-box)
#7213
Author: bobc
Date: Thu, 09 Oct 1986 17:49
70 lines
3078 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads