Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!dayton!viper!john From: john@viper.Lynx.MN.ORG (John Stanley) Newsgroups: comp.sys.atari.st Subject: Re: problems with rnd# from assembler Message-ID: <1021@viper.Lynx.MN.ORG> Date: Tue, 19-May-87 15:51:27 EDT Article-I.D.: viper.1021 Posted: Tue May 19 15:51:27 1987 Date-Received: Sat, 23-May-87 04:13:50 EDT References: <2088@pbhya.UUCP> Reply-To: john@viper.UUCP (John Stanley) Organization: DynaSoft Systems Lines: 29 Keywords: midi/rnd# In article <2088@pbhya.UUCP> gdr@pbhya.UUCP (Guy Ridley) writes: > >Does anyone have some good documentation on calling trap #17 (the random >number generator) from assembler? Acc'd to what I have the rnd# generator >is reseeded when the machine is turned on, and calling trap #17 puts a >random number in D0. However, what I seem to be getting (based on what >note comes out of my synthesizer, to which the contents of D0 are sent via >MIDI) is a lot of decimal "40"'s. This is completely mystifying, and the >Assempro documentation doesn't say much more that "ST Internals" does. >Can anyone send me a small sample of such a call that works? > No, no, no... It's xbios subfunction 17, NOT trap 17.. (God knows what's on trap 17...) Try: move.w #17,-(sp) trap #14 addq.l #2,sp * random number now in D0 I haven't tried it, but I also haven't heard about anyone else having problems with it, so it "should" work. (Note: The random number returned is only 24 bits long so you'll only get from zero to 16777215 ($00ffffff)...) --- John Stanley (john@viper.UUCP) Software Consultant - DynaSoft Systems UUCP: ...{amdahl,ihnp4,rutgers}!{meccts,dayton}!viper!john