BBS: Inland Empire Archive
Date: 07-23-92 (22:04)             Number: 119
From: STEVE HALKO                  Refer#: NONE
  To: DOUGLAS LUSHER                Recvd: NO  
Subj: Functions                      Conf: (2) Quik_Bas
DL> Thanks 10^6. That's exactly what I was needing. Gotta wonder
DL> why these weren't included in QB itself. BTW, where did you
DL> get the variable names for the DEF SEG and VIEW PRINT parameters?

  Glad I could help.  I got the variable names by writing a short QB
  program and running it through CODEVIEW.  For example, for VIEW PRINT,
  here's the QB code:


  and here's the CODEVIEW version:

  1:      DEFINT A-Z
  2:      VIEW PRINT 2 TO 3
  4051:0030 B80200         MOV       AX,0002
  4051:0033 50             PUSH      AX
  4051:0034 B80300         MOV       AX,0003
  4051:0037 50             PUSH      AX
  4051:0038 9A1E065540     CALL      B$VWPT (4055:061E)

  You can see where the arguments to the VIEW PRINT statement are first
  pushed onto the stack, and then QB calls the internal routine to do
  the dirty work - in this case it's called B$VWPT.  I single step into
  the call to B$VWPT, and look around until I find where those stack
  parameters are called into use, and see what symbolic name has been
  assigned to them:

  4055:061E 55             PUSH      BP
  4055:061F 8BEC           MOV       BP,SP
  4055:0621 F606300402     TEST      Byte Ptr [b$IOFLAG (0430)],02
  4055:0626 7539           JNZ       B$VWPT+43 (0661)
  4055:0628 8A264301       MOV       AH,Byte Ptr [b$KEY_SW (0143)]
   [Deleted about 16 lines of code]
  4055:064E 8AD0           MOV       DL,AL
  4055:0650 2AD4           SUB       DL,AH
  4055:0652 881E7C03       MOV       Byte Ptr [b$WDOTOP (037C)],BL
  4055:0656 88167D03       MOV       Byte Ptr [b$WDOBOT (037D)],DL
             There's the rascals! ----------------'

  In the stuff I deleted, the VIEW PRINT parameters were shuffled around
  a bit, and eventually ended up in the BL and DL registers.  And from
  there, you can see that they are saved in memory locations having the
  symbolic names b$WDOTOP and b$WDOBOT.

  Piece o' cake - and actually quite educational to plow thru QB's
  internals like this.

 * SLMR 2.1a * Two wrongs don't make a right, but 3 lefts do.

--- DB B1073/002487
 * Origin: Gulf Coast BBS -QuickSHARE #2- (904)563-2547 HST/V.32bis (1:365/12)
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