Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 UW 5/3/83; site uw-june
Path: utzoo!linus!philabs!cmcl2!seismo!lll-crg!dual!qantel!hplabs!tektronix!uw-beaver!uw-june!jamie
From: jamie@uw-june (James Painter)
Newsgroups: net.micro.mac
Subject: Re: more comments (fixes) to Modula-2 compiler
Message-ID: <148@uw-june>
Date: Sat, 10-Aug-85 00:44:36 EDT
Article-I.D.: uw-june.148
Posted: Sat Aug 10 00:44:36 1985
Date-Received: Sun, 18-Aug-85 21:39:46 EDT
References: <105@ssc-vax.UUCP> <145@uw-june>
Organization: U of Washington Computer Science
Lines: 42


Whoops!  I got interrupted.  Let's try again.

I've found that interfacing to the ROM from the PD Modula-2 compiler is
not quite as simple as Keith suggested.  His example fails to correctly
pass the duration parameter to the ROM SysBeep procedure.

It IS possible if you are willing to do a little hand assembly.


For example, here is the SoundDriver code fixed up.  At the last
iteration the duration is ~ 2 seconds as it should be.


MODULE SoundDriver;

FROM SYSTEM IMPORT CODE;

PROCEDURE SysBeep(duration:INTEGER); (*$P-*)
BEGIN
  CODE ( 4E56H ); CODE( 0000H );   (* LINK A6,#0     *)
  CODE ( 3F2EH ); CODE( 0008H );   (* MOVE.W 8(A6),-(SP)  ; Push duration *)
  CODE (0A9C8H );                  (* Trap to ROM SysBeep *)
  CODE ( 4E5EH );                  (* UNLINK A6 *)
  CODE ( 4E75H );                  (* RETURN *)
END SysBeep;  (*$P+*)

VAR i:INTEGER;
BEGIN
  FOR i := 5 TO 100 BY 5 DO SysBeep(i); END;
END SoundDriver.



If there is an easier way I'd like to know about it.



--Jamie Painter

ARPA:     jamie@uw-june.ARPA
UUCP:     {ihnp4,decvax,tektronix}!uw-beaver!uw-june!jamie