Bit shift & rotate 2/2

 BBS: Inland Empire Archive
Date: 05-10-92 (13:11)             Number: 140
From: MATT PRITCHARD @ 930/21      Refer#: NONE
  To: RICHARD VANNOY                Recvd: NO  
Subj: Bit shift & rotate    2/2      Conf: (2) Quik_Bas
>>> Continued from previous message
to get a Integer (16 bit) value back from your AssemblySUB
routine and into the variable X, all you have to do is put
the desired value in the AX register before you RETurn.
That's it.

If AssemblySub& is a Long Integer Function, you put the
high 16 bits of your return value into DX, and the low 16
bits into AX.

You are returing something other than in Integer or Long Integer, you put
your value in memory somewhere, and return a "Reference" to
it. i.e. the address where the value is store at, just like
above in the "Pass by reference" discussion.

---------------------------------------------------------------

There is another way to return a value from assembly:
Change the value of a variable that has been passed by
reference.

lets say:

DECLARE SUB ZEROIT (x%)

     x% = 12345
     CALL ZEROIT(x%)
     IF x% = 0 THEN PRINT "IT worked"

Your routine ZEROIT gets passed the address of where x% is
stored. Knowing where it is, it can change the contents of
x% to anything it likes.

--------------------------------------------------------------

There is a lot to interfacing QuickBASIC to assembly.  This
is just a start, but if you or anyone else has more
questions, this is the place to voice them.

Best 'o luck.

-Matt Pritchard

===
 * SLMR 2.1a * Corporations Often Lie to Their Employees

--- InterPCB 1.50
 # Origin: CENTRAL BBS -Texas' BEST BBS! 214-393-7090 HST  3+GIGs (8:930/21)
 * Origin: Gateway System to/from RBBS-NET (RBBS-PC 1:10/8)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET