Xref: utzoo misc.misc:4321 comp.sys.hp:1395 comp.sys.misc:1995 Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!pasteur!ucbvax!hplabs!hp-sdd!holt From: holt@hp-sdd.HP.COM (Holt Mebane) Newsgroups: misc.misc,comp.sys.hp,comp.sys.misc Subject: Re: HP9836 BASIC -- HELP !! Message-ID: <1809@hp-sdd.HP.COM> Date: 3 Jan 89 21:05:19 GMT References: <281@vmsa.technion.ac.il> Reply-To: holt@hp-sdd.UUCP (Holt Mebane) Organization: Hewlett Packard, San Diego Lines: 44 *** SORRY TO POST, BUT COULD NOT SEND DIRECTLY *** In article <281@vmsa.technion.ac.il> ners001@vmsa.technion.ac.il writes: >******* > >Does anybody out there know what the following lines of BASIC mean? > (this is supposedly written for an HP 9836) > >SUB Out_word(@GPIB,INTEGER Xbuf(*),N) > INTEGER Odata > FOR I=1 TO N > Odata=ROTATE(Xbuf(I),8) > OUTPUT @GPIB USING "#,W";Odata > NEXT I > SUBEND > >This obviously is sending data to a GPIB device, but what would be the >equivalent in C? What does the ROTATE function do? What does the >output look like (binary word transfer or formatted ASCII)? > >Thanks for all your help, > >Benjamin Cohen >NERS001@VMSA.TECHNION.AC.IL (bitnet) The ROTATE function does a logical rotate on a 16 bit operand. If the bit position displacement argument (in this case 8) is positive, it does a rotate right; negative, left. The output specifier ("#,W") specifies that the output is word-wide, binary, no carriage-return or linefeed. So, what this program is doing is swapping bytes in a word and outputting them to GPIB. Now if GPIB is set up to be the HPIB interface, a logical question is "What is word-wide since the GPIB is inherently 8 bits wide?" Well, it will output the data in 2 bytes, MSB first. Hope this helps. Holt Mebane _________________________________________________________________________ UUCP : {hplabs|hp-pcd|hpfcla|hpda|noscvax|gould|ucsd}!hp-sdd!holt UUCP : {cbosgd|allegra|decvax|gatech|sun|tektronix}!hplabs!hp-sdd!holt ARPA : hp-sdd!holt@nosc.arpa CSNET : hp-sdd!holt@hplabs.csnet USmail: 16399 W. Bernardo Drive, San Diego CA 92127-1899 USA Phone : (619) 592-4882