[misc.misc] HP9836 BASIC -- HELP !!

ners001@vmsa.technion.ac.il (01/02/89)

*******

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)

scowles@lll-lcc.llnl.gov (Sid Cowles) (01/03/89)

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?
>
>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
>
>             ...  What does the ROTATE function do?   What does the
>output look like (binary word transfer or formatted ASCII)?

benjamin,
the rotate function is described as:
"this function returns an integer which equals the value obtained by
shifting the 16-bit binary representation of the argument by the
number of bit positions specified.  the shift is performed with
wrap-around."
i'd guess that the io-path, @gpib, was assigned with format off
since the output statement is using a 2 byte word ("W") format with
no end-of-line sequence.
i hope this helps.
sid
=======================================================================
s cowles                         att:  +1 415 423 0929
lawrence livermore national lab  uucp: {backbone}!lll-lcc!scowles
environmental sciences division  internet:  scowles@lll-lcc.llnl.gov
p. o. box 5507
L-524
livermore, california  94550

holt@hp-sdd.HP.COM (Holt Mebane) (01/04/89)

*** 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