|
|||||||
Video ControlWith the advent of more sophisticated video control (with 43 and 50 line support) and with yet more sophistication to come (with the rumoured 132 column support) it is instructive to examine the system routines and control records provided for the manipulation of the video screen. One thing that it is timeous to point out is that whilst some of these routines (such as VCARD) provide information that is accessible elsewhere, the use of calls to standardised routines (such as GET_VID_INFO) is encouraged by RevTI as it permits the construction of software "black boxes" which can be radically changed on the inside without changing the result returned to the calling program. VIDEOCONFIGThere is a record in the SYSTEM file which contains the setup information required when configuring the video mode. It has five multi-valued fields as follows < 1 > Video Mode - this is the numeric value used by VIDCTRL (q.v.) when resetting the video mode. < 2 > Description of the video mode < 3 > Screen width in this mode < 4 > Screen depth in this mode < 5 > Type of card mode will work with. Setting a VGA card to an EGA mode and vice versa does not work. This value records the kind of video card (as returned by VCARD (q.v.) which the video mode is designed for. VCARDCalled subroutine taking (and returning) one parameter, the kind of video card installed. Calling syntax is X = "" ; CALL VCARD(X). Types identified in Technical Bulletin 74 are, 0 - MDA, 1 - CGA, 2 - EGA, 3 - PGA, 4 - VGA, 5 - MCGA, 6 - Unknown. GET_VID_INFOThis is a function taking one parameter - the branch, returning a result of the information being asked for. The branches and returned results are as follows 1 Video mode 0 Normal text mode 1 25 line EGA Mode 2 43 line EGA mode 3 25 line VGA mode 4 43 line VGA mode 5 50 line VGA mode 6 16 line VGA mode 2 CRT Width 3 CRT Height 4 Video Card type - same as results of VCARD. 5 Unknown - always returns 0 on test machine. 6 Starting address of Video RAM, returned as a two byte number, in low byte high byte order. Normally this would return CHAR(0) : CHAR(184), in other words (0 + 256 * 184) = 47104=B800. VIDCTRLThis assembler subroutine controls the video setting of the screen and can be used to "flip" modes in real time. It takes 5 parameters, of which only the first two and the last one seem to be used. As it is an assembler routine it is difficult to be able to state with any confidence exactly what all calls do, however there seem to be three major kinds of call, with each kind taking a specific action modifier. The calling sequence is therefore 0001 VidCtrl( Action, Mode, UK1, UK2, Flag) where Action Is the action to take, having the value of the video card type for modes 0 and 2, and the video mode to change to for mode 1. Mode Is the type of operation to be performed 0 Reset video card to default settings 1 Change video mode 2 Possibly initialise card - does not seem to be required. UK Unknown Flag Result of operation. Using this routine permits the programmer to reset the screen into an alternative video mode. Note that when this is done there are several caveats to be aware of :- Changing the screen size necessitates the changing of the status line location. This is done by resetting @CRTHIGH and @CRTMAXHIGH to the appropriate size and the calling the system routine INIT.STATUS. When video modes change, the screen is left blank. A background must therefore be filled in using Video.RW. In the code that follows the default background of \B01B\ is used. If you do not use the default and you wish to construct a generic routine, you will have to extract the correct settings from the environment. As mentioned in the discussion of VIDEOCONFIG, certain video modes do not work with certain video cards. The program following makes no allowance for this, but for genericism it could be coded to check the current video card against the requested mode by examining the VIDEOCONFIG record. As we wish to return to the normal status line when leaving the temporarily chosen mode, it is necessary to capture the screen image before the new mode is invoked, and restore this image upon return. The code following represents a generic routine for calling a window from a menu and having that window appear in a non-default video mode. It may be called directly as a subroutine, or via catalyst using * to separate the arguments. The arguments are the window name and the mode to use. The mode can be the number or the text equivalent. 0001 Subroutine Call_Window(Window, Mode) 0002 Declare Subroutine VidCtrl, Catalyst, Video.Rw 0003 Declare Function Guar_Assign, Get_Vid_Info 0004 Mode = Guar_Assign(Mode) 0005 If Index(Window, "*", 1) Then 0006 Mode = Window[-1, "B*"] 0007 Window = Window[1,"*"] 0008 End 0009 VidCard = "" ; Call VCard(VidCard) 0010 ModeNums = "0,1,2,3,4,5,6" 0011 Names = "TEXT,EGA25,EGA43,VGA25,VGA45,VGA50,VGA16" 0012 ModeHigh = "25,25,43,25,45,50,16" 0013 GoSub Save 0014 Locate Mode In ModeNums Using "," Setting Pos 0015 Then 0016 DoIt = 1 0017 End Else 0018 Locate Mode In Names Using "," Setting Pos Then 0019 DoIt = 1 0020 End 0021 End 0022 If DoIt Then 0023 GoSub SetUp 0024 Catalyst("W", Window) 0025 GoSub Restore 0026 End 0027 Return 0028 0029 SetUp: 0030 Flag = "" ; VidCtrl(VidCard, 0, "", "", Flag) 0031 Flag = "" 0032 VidCtrl(Field(ModeNums,",",Pos), 1, "", "", Flag) 0033 @CrtMaxHigh = Field(ModeHigh, ",", Pos) 0034 @CrtHigh = @CrtMaxHigh 0035 Video.RW(0,0,(@CrtWide-1),(@CrtHigh-1),"C",\B01B\) 0036 Call Init.Status 0037 Return 0038 0039 Save: 0040 SaveMode = Get_Vid_Info(1) 0041 SaveHigh = @CrtHigh 0042 SaveMaxHigh = @CrtMaxHigh 0043 Video.RW(0,0,@CrtWide-1,@CrtMaxHigh-1,"R",Image) 0044 Return 0045 0046 Restore: 0047 Flag = "" ; VidCtrl(VidCard, 0, "", "", Flag) 0048 Flag = "" ; VidCtrl(SaveMode, 1, "", "", Flag) 0049 @CrtMaxHigh = SaveMaxHigh 0050 @CrtHigh = SaveHigh 0051 Call Init.Status 0052 Video.RW(0,0,@CrtWide-1,@CrtMaxHigh-1,"W", Image) 0053 Return (Volume 4, Issue 3, Pages 8-10) |
|||||||
| |||||||