[net.lang.mod2] M2 for the Amiga

XBR2D96D@DDATHD21.BITNET (Knobi der Rechnerschrat) (08/05/86)

Hallo,

I've posted this a few day ago, but it seems it had problems to get through
the net. So I decided to post it again together with msome more problems AND
solutions.
-----------------------------------------------------------------------------
We've just obtained the TDI M2 compiler for the Commodore AMIGA. Together
with the documentation came some papers concerning known problems in
release "1.01A". This papers seem to be incomplete or at least ambigious, so
I've got some questions:

1.) There have been some postings of fixes for TDI on this list in the
    past. I've missed most of them. Could someone resend them to me
    <XBR2D96D@DDATHD21> ?

2.) The files AMIGAX.sym, CIAHardware.sym and  CustomHardware are corrupted.
    Do we need them and if yes, how can we obtain them. Simply recompile
    the DEF's will cause severe problems I suppose.

3.) This papers say that TDI is available via COMPUSERVE 75026,1331.
    If I try to access them via VAX-PSI and DATEX-P (German PSN)
    I reach a Username/Password prompt. I don't know both and I suppose
    that I'm not supposed to use the COMPUSERVE ID this way. Can someone
    tell me how to use it?

4.) TDI announced a fix diskette in it's documentation. Is this diskette
    already available ? Our local dealer hasn't got it jet.

5.) we (I) are especially interested in the RealInOut and LongInOut modules
    announced with the diskette. Are they available on the net?

6.) playing with the Amiga tools I discovered that the CreatePort and
    DeletePort routines from PortUtils had both horrible bugs. I've corrected
    both routines according to the new ROM-Kernel Manual Part 2/App. F. The
    fix is enclosed with this message.

7.) The SerialDevice.Def file misses some of the SerFlags (e.g. 7Wire). The
    SerStatus bits also didn't look like Bits for a SerialDevice (PaperOut ???)

Regards
Martin Knoblauch

TH-Darmstadt
Dept. Physical Chemistry 1
Petersenstrasse 20
D-6100 Darmstadt
West-Germany

BITNET: <XBR2D96D@DDATHD21>

--------------New PortUtils.MOD------------------------------------------------
IMPLEMENTATION MODULE PortUtils;

(** ------------------------------------------------------------------

                 Commodore Amiga port utilities module

     (c) Copyright 1985, 1986 TDI Software, Inc.  All Rights Reserved

    ------------------------------------------------------------------ **)


(* VERSION FOR COMMODORE AMIGA

     Original Author : Paul Curtis, TDI Software, Inc.  16-Dec-85

     Version         : 0.00a  16-Dec-85  Paul Curtis, TDI.
                         Original

                       0.00b  03-Aug-86  Martin Knoblauch, TH-Darmstadt.
                         Corrected according to ROM-Kernel Man. 2
  *)


(*$S-*)(*$T-*)


FROM SYSTEM IMPORT TSIZE, BYTE, ADR, ADDRESS;
FROM Lists IMPORT NewList;
FROM Nodes IMPORT NTMsgPort;
FROM Ports IMPORT MsgPortPtr, MsgPort, MsgType, AddPort, RemPort;
FROM Memory IMPORT AllocMem, FreeMem, MemPublic, MemClear, MemReqSet;
FROM Tasks IMPORT FindTask, MyTask, AllocSignal, FreeSignal, AnySignal,
  NoSignals, SIGNAL;


PROCEDURE CreatePort(VAR name: ARRAY OF CHAR; pri: INTEGER): MsgPortPtr;
  (* create a message port. *)
VAR
  mp: MsgPortPtr;
  signal: SIGNAL;
BEGIN
  signal := AllocSignal(AnySignal);
  IF signal = NoSignals THEN
    RETURN MsgPortPtr(0);
  END;
  mp := AllocMem(TSIZE(MsgPort),MemReqSet{MemPublic, MemClear});
  IF ADDRESS(mp) = 0 THEN
    FreeSignal(signal);
    RETURN MsgPortPtr(0);
  END;
  WITH mp DO
    WITH mpNode DO
      lnPri := BYTE(pri);
      IF name[0] = 0C THEN
        lnName := ADDRESS(0);
      ELSE
        lnName := ADR(name);
      END;
      lnType := BYTE(NTMsgPort);
    END;
    mpFlags := BYTE(PASignal); (* made more symbolic than BYTE(0) *)
    mpSigBit := BYTE(signal);
    mpSigTask := FindTask(MyTask);
  END;
  IF name[0] # 0C THEN
    AddPort(mp);
  ELSE                             (* added ELSE to IF *)
    NewList(ADR(mp.mpMsgList));
  END;
  RETURN mp;
END CreatePort;


PROCEDURE DeletePort(port: MsgPortPtr);
  (* delete a message port *)
BEGIN
  WITH port DO
    WITH mpNode DO
      IF lnName # ADDRESS(0) THEN (* "=" changed into "#" !!! *)
        RemPort(port);
      END;
      lnType := BYTE(0FFH); (* unknown to Exec *)
      mpMsgList.lhHead := NIL;
    END;
    FreeSignal(SIGNAL(mpSigBit));
  END;
  FreeMem(port,TSIZE(MsgPort));
END DeletePort;


(*$P-*)


END PortUtils.