Video Stuff in PowerBASIC

 BBS: Inland Empire Archive
Date: 01-27-93 (19:05)             Number: 354
From: SCOTT WUNSCH                 Refer#: NONE
  To: JOHN GALLAS                   Recvd: NO  
Subj: Video Stuff in PowerBASIC      Conf: (2) Quik_Bas
Salutations, John!

  On 24 Jan 93, John Gallas entered the following ASCII
codes for the express viewing pleasure of Scott Wunsch...

 SW>> end sub
 JG>
 SW>> Sub Getvideoinfo
 SW>> a$=space$(64)            'Initialize string with spaces
 SW>> reg %ax, &h1b00
 SW>> reg %bx,0
 SW>> reg %es,strseg(a$)
 SW>> reg %di,strptr(a$)
 JG>
 JG> Scott, it got cut off right here!  Can you re-post that sub?

  Hmm... let's see... there it is!  Continuing from where you lost it:

Sub Getvideoinfo
a$=space$(64)            'Initialize string with spaces
reg %ax, &h1b00
reg %bx,0
reg %es,strseg(a$)
reg %di,strptr(a$)
call interrupt &h10
print hex$(cvi(mid$(a$,1,2))),"Offset static functionality table"
print hex$(cvi(mid$(a$,3,2))),"Segment"
print asc(mid$(a$,5,1)),"Video mode"
print cvi(mid$(a$,6,2)),"Current mode Columns"
print hex$(cvi(mid$(a$,8,2))),"Length current mode videobuffer"
print hex$(cvi(mid$(a$,10,2))),"Start address videobuffer"
print asc(mid$(a$,30,1)),"Active page"
print hex$(cvi(mid$(a$,31,2))),"Crt controller address"
print asc(mid$(a$,35,1)),"Current mode rows"
print cvi(mid$(a$,36,2)),"Characterheight"
print cvi(mid$(a$,40,2)),"Current mode number of colors"
print asc(mid$(a$,42,1)),"Current mode number of pages"
print (asc(mid$(a$,50,1))+1)*64,"Total amount of available videomemory"
end sub

FUNCTION BlankScreen%             'This turns screen refresh OFF on EGA/VGA
reg %ax, (&h12*256)+1             'Besides screen blanking,
this has the effect
reg %BX, &h36                     'of SPEEDING UP YOUR APPLICATION.
call interrupt &h10               'If the function returns
a 0, the blanking is
BlankScreen%= reg(%ax) and &h12   'not supported by your videocard.
END FUNCTION

FUNCTION ScreenOn%                'Restores screen refresh
reg %ax, &h12*256                 'If the function =0, not supported!
reg %BX, &h36
call interrupt &h10
ScreenOn% = reg(%ax) and &h12
END FUNCTION

FUNCTION AddressOff%               'Makes it impossible to write to the screen
reg %ax, &h12*256+1               'All other functions, as imput, retained.
reg %BX, &h32                     'usefull for security apps.
call interrupt &h10               'If the function =0, not supported!
AdressOff% = reg(%ax) and &h12
END FUNCTION

FUNCTION AddressOn%                'Restores screenwrite
reg %ax, &h12*256                 'If the function =0, not supported!
reg %BX, &h32
call interrupt &h10
AdressOn% = reg(%ax) and &h12
END FUNCTION



Sub setvideomode(mode%)         'This gives access to videomodes not
                              'supported by powerbasic. You can not
reg %ax,mode%                   'use powerbasic print and graphics commands.
call interrupt &h10
end sub

Sub Superimposemode(mode%)       'This superimposes new screens over the old
                              'ones! Screen modes should be LINE/COLOR
                              'compatible. (same number of lines and number
                              'of colors returns compatible bitmap)
reg %ax,mode% xor 128            'setting bit 7 prevents clearing in EGA/VGA
                              'Standard modes.
call interrupt &h10              'It even works with pageswitching!
end sub

'THIS ONE IS VERY HARDWARE SPECIFIC
'ONLY MODE &H5E PARADISE SVGA!
'DO NOT USE ON OTHER CARDS!!!!!!!!!
'
Sub SwitchBank(Bank%)     'HARDWARE programmed bankswitching on paradise SVGA
OUT &H3CE, &H0F           'gives up to (1-64kb) meg of
extra mem in 64 kb banks
at
OUT &H3CF, &H05           'a000-afff!!!!!
OUT &H3CE, &H09
OUT &H3CF, Bank%*16          ' a bank=4kb,
                       ' in pb3.0 should be 64k, max stringlength
OUT &H3CE, &H0F
OUT &H3CF, &H00
END SUB
                                               /\   LLAP...
                                             > \ cott \\'unsch <
                                              \/

... Keep your grubby little hands off my tagline; I stole it first!

---
 * Origin: Regina, Sask, Canada, Earth, Sol System, Milky Way (1:140/23.1701)
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