Simple BC+31 program - help needed 
Author Message
 Simple BC+31 program - help needed

This is my program (borland c++31), but it doesn't work prop.-why???:

#pragma inline
#include <dos.h>
#include <stdio.h>
struct VideoRegs
 { unsigned HiText    :1;
   unsigned GrMode    :1;
   unsigned ColorMode :1;
   unsigned ScrShow   :1;
   unsigned HiGraph   :1;
   unsigned Blink     :1;
   unsigned Reserved  :2;
   unsigned Reg3x9    :8;
 };

struct SModeInfo
 { char far *  StatFuncTable;
   char       Mode;
   int        Cols;      //Count of text columns on screen-offset 5 ???
   int        RegLen;
   int        RegStart;
   int        CurPos[8];
   int        CurType;
   char       Page;
   int        CRTCPort;
   struct VideoRegs  VRegs;
   char       Rows;
   int        FontLines;
   char       DispMain;
   char       DispAlt;
   int        Colors;
   int        Pages;
   char       ScanLines;
   char       PriBlk;
   char       SecBlk;
   char       Reserved1[4];
   char       VideoMemAvail;
   char       Reserved2[15];
 };

int main (void)
{ struct SModeInfo Buffer;
  char B[100];
  unsigned int BSeg, BOff;
  char Col=80, Row=25;
  int FLin=8;

  BSeg=FP_SEG(&B);
  BOff=FP_OFF(&B);

  asm { Push ES
        Mov DI, BOff
        XOr BX, BX
        Mov AX, BSeg
        Mov ES, AX
        Mov AX, 1B00h
        Int 10h
        Cmp AL, 1Bh
        JNE NoTest
        Mov AL, ES:[DI+05h]
        Mov Col, AL
        Mov AL, ES:[DI+22h]
        Mov Row, AL
        Mov AX, ES:[DI+23h]
        Mov FLin, AX
      }
  NoTest:
  asm { pop ES
      }

  memcpy(&Buffer,B,sizeof(Buffer));//Copying data from buffer b to struct.buffer
//Why doesn'n appear columns count in Buffer and in B ????????????????????

  printf("\nScreen in mode (ROW/COL) %uX%u, %u lines per character.\n", Row, Col, FLin);
  return(0);

Quote:
}

please help me.
WBR
Vik

---
        <  +  >              |      Viktor Remennick

Singature. V1.10 Lite        |



Mon, 16 Mar 1998 03:00:00 GMT  
 Simple BC+31 program - help needed


Quote:
>> int main (void)
>> { struct SModeInfo Buffer;
>>   char B[100];
>>   unsigned int BSeg, BOff;
>>   char Col=80, Row=25;
>>   int FLin=8;

>>   BSeg=FP_SEG(&B);
>>   BOff=FP_OFF(&B);

                 ^

Try

   BSeg=FP_SEG(B);
   BOff=FP_OFF(B);

or

   BSeg=FP_SEG(&B[0]);
   BOff=FP_OFF(&B[0]);

John Sargent



Wed, 18 Mar 1998 03:00:00 GMT  
 Simple BC+31 program - help needed
Hello !
The program output is currect on my machine (borland 3.1 -DOS),
I don't think I understood you'r question,any way here how
B lookes like after memcpy:
   char far *  StatFuncTable = C000:4826;
   char       Mode = 3;
   int        Cols 80;
   int        RegLen = 4096;
   int        RegStart = 0;
   int        CurPos[8] = 6144,0,0,0,0,0,0,0;
   int        CurType = 3342;
   char       Page =0 ;
   int        CRTCPort = 980;
   struct VideoRegs  VRegs = 1,0,0,1,0,1,0,48;
   char       Rows = 25;
   int        FontLines = 16;
   char       DispMain = 8;
   char       DispAlt = 0;
   int        Colors = 16;
   int        Pages =520 ;
   char       ScanLines = 0;
   char       PriBlk = 0;
   char       SecBlk = 49;
   char       Reserved1[4]=0,0,0,3;
   char       VideoMemAvail=0;
   char       Reserved2[15]=0,0,0,0,0,0,0,0,0,0,0,0,0,73,113;

p.s:why do you need the #pragma inline for ?



Sat, 21 Mar 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. (Q) File lock check (bc++31)

2. BC++31 calling MS V5.1 Fortran DLL's

3. Need some help in writing a simple C program

4. Need some help in writing a simple C program

5. Need Help on simple ISAM like program

6. need help in extremely simple c program

7. need help debugging simple c program

8. Need some help with tweeking a simple program

9. Help on a simple calculator program which needs Trigo, Arithmethic, log functions..[Apologies for repeat mail]

10. Need help with simple C Program

11. !Need help with simple C program

12. Need Help with a SIMPLE mouse control program in C.

 

 
Powered by phpBB® Forum Software