home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / dos / intcall / intcall.bas < prev    next >
Encoding:
BASIC Source File  |  1987-05-10  |  2.6 KB  |  57 lines

  1. 'This program does a call to BIOS to find the current video mode, char/line,
  2. 'and video page as a test for the INTCALL machine language subroutine.
  3.  
  4. 'Info is passed to INTCALL as integers giving Int #, Location of register
  5. 'data for the interrupt, and location to put returned register data,
  6. 'in that order.
  7.  
  8. 'The register data is passed to/from the interrupt in integer arrays (as
  9. 'integers) in the following order:
  10. 'ax,bx,cx,dx,si,di,ds,es as elements 1 thru 8 of an integer array. The
  11. 'location passed is the pointer to element 1 of the array.
  12.  
  13. Wherein%=0:Whereout%=0                      'Save a place for variables
  14. Inter%=&H10                                 'General video BIOS int
  15. Option base 1:Dim Inar%(8), Outar%(8)       'Dimension integer arrays (1-8)
  16. Print "Find current Video mode; do Int 10h with AH=0Fh. Returns AL=width in chars,"
  17. Print "AL=Video mode, and BH=Video page number."
  18. Print "Register passed are:"
  19. For x%=1 to 8                               'Read data statement
  20.     Read R$,A$                               'Read register and value
  21.     xx=val("&H"+A$)                          'Convert to hex
  22.     Gosub Convert                            'Convert unsigned to signed
  23.     Inar%(x%)=xx%                            'Enter in array
  24. Next x%                                     'Do all registers
  25.  
  26. Wherein%=varptr(Inar%(1)):Whereout%=varptr(Outar%(1)) 'Get array pointers
  27. call Intcall(Inter%,Wherein%,Whereout%)     'Do call, pass interrupt number,
  28.                                           'passed array and returned array locations
  29.  
  30. Print "Returned registers are:              'Print returned register values
  31. Restore                                     'Restore data pointer
  32. For x%=1 to 8                               'Read returned data
  33.     Read R$,A$                               'Read register; A$ is dummy var
  34.     xx%=Outar%(x%)                           'Get returned value
  35.     gosub Printit                            'Print register and value
  36. next x%                                     'Do all registers
  37.  
  38. 'Now print the meaning of the returned data.
  39. Mode%=Outar%(1) and &HFF                    'Get mode
  40. Char%=Outar%(1)/256                         'Get chars/line
  41. Page%=Outar%(2)/256                         'Get video page
  42. print"Video mode is";Mode%                  'Print answers
  43. print"There are";Char%;"Chars/line"
  44. print"Video page is";Page%
  45. end
  46.  
  47. 'Subroutine for converting unsigned to signed number and print reg & value.
  48. Convert:
  49. if xx>&H7FFF then xx=-(65536-xx)
  50. xx%=int(xx):gosub Printit:return
  51.  
  52. Printit: print R$;"=";right$("0000"+hex$(xx%),4):return
  53.  
  54. 'Register data goes here.
  55. Data AX,0F00,BX,2222,CX,3333,DX,4444,SI,5555,DI,6666,DS,7777,ES,8888
  56.  
  57.