www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - DM accept use those VGA interrupt?

reply "zhang li" <li stands.3322.org> writes:
    Set palette register (Int 10/10)

 INT 10 - VIDEO - (Jr, PS, TANDY 1000, EGA, VGA)
     AX = 1000h
     BL = palette register to set
     BH = color value to store

 Note:   on MCGA, only BX = 0712h is supported

 SeeAlso: AX=1002h,1007h

 --------
 INT 10 - VIDEO - SET BORDER COLOR REGISTER (Jr, PS, TANDY 1000, EGA, VGA)
     AX = 1001h
     BH = color value to store

 SeeAlso: AX=1008h

 --------
 INT 10 - VIDEO - SET ALL PALETTE REGISTERS (Jr, PS, TANDY 1000, EGA, VGA)
     AX = 1002h
     ES:DX -> 17-byte palette register list (see below)

 SeeAlso: AX=1000h,1009h

 Format of palette register list:
 Offset  Size    Description
  00h 16 BYTEs   values for palette registers 0-15
  10h    BYTE    value for border color register

 --------
 INT 10 - VIDEO - TOGGLE INTENSITY/BLINKING BIT (Jr, PS, TANDY 1000,
            EGA, VGA)
     AX = 1003h
     BL = 00h enable intensity
        = 01h enable blink

 --------
 INT 10 - VIDEO - GET INDIVIDUAL PALETTE REGISTER (VGA)
     AX = 1007h
     BL = palette register number

 Return: BH = palette register value

 SeeAlso: AX=1000h,1009h

 --------
 INT 10 - VIDEO - READ OVERSCAN (BORDER COLOR) REGISTER (VGA)
     AX = 1008h

 Return: BH = value

 SeeAlso: AX=1001h

 --------
 INT 10 - VIDEO - READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER (VGA)
     AX = 1009h
     ES:DX -> 17-byte buffer (see AX=1002h)

 SeeAlso: AX=1002h,1007h

 --------
 INT 10 - VIDEO - SET INDIVIDUAL DAC REGISTER (EGA, VGA/MCGA)
     AX = 1010h
     BX = register number
     CH = new value for green (0-63)
     CL = new value for blue (0-63)
     DH = new value for red (0-63)

 SeeAlso: AX=1012h,1015h

 --------
 INT 10 - VIDEO - SET BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
     AX = 1012h
     BX = starting color register
     CX = number of registers to set
     ES:DX -> table of 3*CX bytes where each 3 byte group represents one
          byte each of red, green and blue (0-63)

 SeeAlso: AX=1010h,1017h

 --------
 INT 10 - VIDEO - SELECT VIDEO DAC COLOR PAGE (VGA)
     AX = 1013h
     BL = 00h Select paging mode
         BH = 00h Select 4 blocks of 64
         BH = 01h Select 16 blocks of 16
     BL = 01h Select Page
         BH = page number (00h to 03h) or (00h to 0Fh)

 Note:   not valid in mode 13h

 SeeAlso: AX=101Ah

 --------
 INT 10 - VIDEO - READ INDIVIDUAL DAC REGISTER (EGA, VGA/MCGA)
     AX = 1015h
     BL = palette register number

 Return: DH = red value
     CH = green value
     CL = blue value

 SeeAlso: AX=1010h,1017h

 --------
 INT 10 - VIDEO - READ BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
     AX = 1017h
     BX = starting palette register
     CX = number of palette registers to read
     ES:DX -> buffer (3 * CX bytes in size) (see also AX=1012h)

 Return: CX number of red, green and blue triples in buffer

 SeeAlso: AX=1012h,1015h

 --------
 INT 10 - VIDEO - undocumented - SET PEL MASK (EGA, VGA/MCGA)
     AX = 1018h
     BL = new PEL value

 SeeAlso: AX=1019h

 --------
 INT 10 - VIDEO - undocumented - READ PEL MASK (EGA, VGA/MCGA)
     AX = 1019h

 Return: BL = value read

 SeeAlso: AX=1018h

 --------
 INT 10 - VIDEO - GET VIDEO DAC COLOR-PAGE STATE (VGA)
     AX = 101Ah

 Return: BL = paging mode
         00h four pages of 64
         01h sixteen pages of 16
     BH = current page

 SeeAlso: AX=1013h

 --------
 INT 10 - VIDEO - PERFORM GRAY-SCALE SUMMING (EGA, VGA/MCGA)
     AX = 101Bh
     BX = starting palette register
     CX = number of registers to convert

 SeeAlso: AH=12h/BL=33h
Nov 14 2002
parent reply "KarL" <someone somewhere.org> writes:
Not if you write in __ASM

If you use the int wrapper, it will work with DM + all those extenders.

The problem lies with the FS and GS registers that BIOS doesn't know
about.  You can't call BIOS without protections.


"zhang li" <li stands.3322.org> wrote in message
news:ar2423$75a$1 digitaldaemon.com...
     Set palette register (Int 10/10)

  INT 10 - VIDEO - (Jr, PS, TANDY 1000, EGA, VGA)
      AX = 1000h
      BL = palette register to set
      BH = color value to store

  Note:   on MCGA, only BX = 0712h is supported

  SeeAlso: AX=1002h,1007h

  --------
  INT 10 - VIDEO - SET BORDER COLOR REGISTER (Jr, PS, TANDY 1000, EGA, VGA)
      AX = 1001h
      BH = color value to store

  SeeAlso: AX=1008h

  --------
  INT 10 - VIDEO - SET ALL PALETTE REGISTERS (Jr, PS, TANDY 1000, EGA, VGA)
      AX = 1002h
      ES:DX -> 17-byte palette register list (see below)

  SeeAlso: AX=1000h,1009h

  Format of palette register list:
  Offset  Size    Description
   00h 16 BYTEs   values for palette registers 0-15
   10h    BYTE    value for border color register

  --------
  INT 10 - VIDEO - TOGGLE INTENSITY/BLINKING BIT (Jr, PS, TANDY 1000,
             EGA, VGA)
      AX = 1003h
      BL = 00h enable intensity
         = 01h enable blink

  --------
  INT 10 - VIDEO - GET INDIVIDUAL PALETTE REGISTER (VGA)
      AX = 1007h
      BL = palette register number

  Return: BH = palette register value

  SeeAlso: AX=1000h,1009h

  --------
  INT 10 - VIDEO - READ OVERSCAN (BORDER COLOR) REGISTER (VGA)
      AX = 1008h

  Return: BH = value

  SeeAlso: AX=1001h

  --------
  INT 10 - VIDEO - READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER (VGA)
      AX = 1009h
      ES:DX -> 17-byte buffer (see AX=1002h)

  SeeAlso: AX=1002h,1007h

  --------
  INT 10 - VIDEO - SET INDIVIDUAL DAC REGISTER (EGA, VGA/MCGA)
      AX = 1010h
      BX = register number
      CH = new value for green (0-63)
      CL = new value for blue (0-63)
      DH = new value for red (0-63)

  SeeAlso: AX=1012h,1015h

  --------
  INT 10 - VIDEO - SET BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
      AX = 1012h
      BX = starting color register
      CX = number of registers to set
      ES:DX -> table of 3*CX bytes where each 3 byte group represents one
           byte each of red, green and blue (0-63)

  SeeAlso: AX=1010h,1017h

  --------
  INT 10 - VIDEO - SELECT VIDEO DAC COLOR PAGE (VGA)
      AX = 1013h
      BL = 00h Select paging mode
          BH = 00h Select 4 blocks of 64
          BH = 01h Select 16 blocks of 16
      BL = 01h Select Page
          BH = page number (00h to 03h) or (00h to 0Fh)

  Note:   not valid in mode 13h

  SeeAlso: AX=101Ah

  --------
  INT 10 - VIDEO - READ INDIVIDUAL DAC REGISTER (EGA, VGA/MCGA)
      AX = 1015h
      BL = palette register number

  Return: DH = red value
      CH = green value
      CL = blue value

  SeeAlso: AX=1010h,1017h

  --------
  INT 10 - VIDEO - READ BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
      AX = 1017h
      BX = starting palette register
      CX = number of palette registers to read
      ES:DX -> buffer (3 * CX bytes in size) (see also AX=1012h)

  Return: CX number of red, green and blue triples in buffer

  SeeAlso: AX=1012h,1015h

  --------
  INT 10 - VIDEO - undocumented - SET PEL MASK (EGA, VGA/MCGA)
      AX = 1018h
      BL = new PEL value

  SeeAlso: AX=1019h

  --------
  INT 10 - VIDEO - undocumented - READ PEL MASK (EGA, VGA/MCGA)
      AX = 1019h

  Return: BL = value read

  SeeAlso: AX=1018h

  --------
  INT 10 - VIDEO - GET VIDEO DAC COLOR-PAGE STATE (VGA)
      AX = 101Ah

  Return: BL = paging mode
          00h four pages of 64
          01h sixteen pages of 16
      BH = current page

  SeeAlso: AX=1013h

  --------
  INT 10 - VIDEO - PERFORM GRAY-SCALE SUMMING (EGA, VGA/MCGA)
      AX = 101Bh
      BX = starting palette register
      CX = number of registers to convert

  SeeAlso: AH=12h/BL=33h
Nov 14 2002
parent reply roland <--rv ronetech.com> writes:
KarL wrote:

 Not if you write in __ASM
 
 If you use the int wrapper, it will work with DM + all those extenders.
 
 The problem lies with the FS and GS registers that BIOS doesn't know
 about.  You can't call BIOS without protections.
 
 
???? #define _INTSIZE sizeof(int) #if (_INTSIZE==4) //32 bit DOSX #define _V_INT(regs) int86_real(0x10,&regs,&regs) #define _V_INTS(regs,sregs) int86x_real(0x10,&regs,&regs,&sregs) #else //16 bit #define _V_INT(regs) int86(0x10,&regs,&regs) #define _V_INTS(regs,sregs) int86x(0x10,&regs,&regs,&sregs) #endif will do the job roland
 "zhang li" <li stands.3322.org> wrote in message
 news:ar2423$75a$1 digitaldaemon.com...
 
    Set palette register (Int 10/10)

 INT 10 - VIDEO - (Jr, PS, TANDY 1000, EGA, VGA)
     AX = 1000h
     BL = palette register to set
     BH = color value to store

 Note:   on MCGA, only BX = 0712h is supported

 SeeAlso: AX=1002h,1007h

 --------
 INT 10 - VIDEO - SET BORDER COLOR REGISTER (Jr, PS, TANDY 1000, EGA, VGA)
     AX = 1001h
     BH = color value to store

 SeeAlso: AX=1008h

 --------
 INT 10 - VIDEO - SET ALL PALETTE REGISTERS (Jr, PS, TANDY 1000, EGA, VGA)
     AX = 1002h
     ES:DX -> 17-byte palette register list (see below)

 SeeAlso: AX=1000h,1009h

 Format of palette register list:
 Offset  Size    Description
  00h 16 BYTEs   values for palette registers 0-15
  10h    BYTE    value for border color register

 --------
 INT 10 - VIDEO - TOGGLE INTENSITY/BLINKING BIT (Jr, PS, TANDY 1000,
            EGA, VGA)
     AX = 1003h
     BL = 00h enable intensity
        = 01h enable blink

 --------
 INT 10 - VIDEO - GET INDIVIDUAL PALETTE REGISTER (VGA)
     AX = 1007h
     BL = palette register number

 Return: BH = palette register value

 SeeAlso: AX=1000h,1009h

 --------
 INT 10 - VIDEO - READ OVERSCAN (BORDER COLOR) REGISTER (VGA)
     AX = 1008h

 Return: BH = value

 SeeAlso: AX=1001h

 --------
 INT 10 - VIDEO - READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER (VGA)
     AX = 1009h
     ES:DX -> 17-byte buffer (see AX=1002h)

 SeeAlso: AX=1002h,1007h

 --------
 INT 10 - VIDEO - SET INDIVIDUAL DAC REGISTER (EGA, VGA/MCGA)
     AX = 1010h
     BX = register number
     CH = new value for green (0-63)
     CL = new value for blue (0-63)
     DH = new value for red (0-63)

 SeeAlso: AX=1012h,1015h

 --------
 INT 10 - VIDEO - SET BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
     AX = 1012h
     BX = starting color register
     CX = number of registers to set
     ES:DX -> table of 3*CX bytes where each 3 byte group represents one
          byte each of red, green and blue (0-63)

 SeeAlso: AX=1010h,1017h

 --------
 INT 10 - VIDEO - SELECT VIDEO DAC COLOR PAGE (VGA)
     AX = 1013h
     BL = 00h Select paging mode
         BH = 00h Select 4 blocks of 64
         BH = 01h Select 16 blocks of 16
     BL = 01h Select Page
         BH = page number (00h to 03h) or (00h to 0Fh)

 Note:   not valid in mode 13h

 SeeAlso: AX=101Ah

 --------
 INT 10 - VIDEO - READ INDIVIDUAL DAC REGISTER (EGA, VGA/MCGA)
     AX = 1015h
     BL = palette register number

 Return: DH = red value
     CH = green value
     CL = blue value

 SeeAlso: AX=1010h,1017h

 --------
 INT 10 - VIDEO - READ BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
     AX = 1017h
     BX = starting palette register
     CX = number of palette registers to read
     ES:DX -> buffer (3 * CX bytes in size) (see also AX=1012h)

 Return: CX number of red, green and blue triples in buffer

 SeeAlso: AX=1012h,1015h

 --------
 INT 10 - VIDEO - undocumented - SET PEL MASK (EGA, VGA/MCGA)
     AX = 1018h
     BL = new PEL value

 SeeAlso: AX=1019h

 --------
 INT 10 - VIDEO - undocumented - READ PEL MASK (EGA, VGA/MCGA)
     AX = 1019h

 Return: BL = value read

 SeeAlso: AX=1018h

 --------
 INT 10 - VIDEO - GET VIDEO DAC COLOR-PAGE STATE (VGA)
     AX = 101Ah

 Return: BL = paging mode
         00h four pages of 64
         01h sixteen pages of 16
     BH = current page

 SeeAlso: AX=1013h

 --------
 INT 10 - VIDEO - PERFORM GRAY-SCALE SUMMING (EGA, VGA/MCGA)
     AX = 101Bh
     BX = starting palette register
     CX = number of registers to convert

 SeeAlso: AH=12h/BL=33h
Nov 15 2002
parent reply roland <--rv ronetech.com> writes:
roland wrote:

 
 
 #define _INTSIZE sizeof(int)
 
     #if (_INTSIZE==4)            //32 bit DOSX
 #define _V_INT(regs) int86_real(0x10,&regs,&regs)
 #define _V_INTS(regs,sregs) int86x_real(0x10,&regs,&regs,&sregs)
 
     #else                    //16 bit
 #define _V_INT(regs) int86(0x10,&regs,&regs)
 #define _V_INTS(regs,sregs) int86x(0x10,&regs,&regs,&sregs)
 
     #endif
 
 will do the job
 
 roland
 
just i have a little doubt about interrupts where you have to pass a buffer (int 10h fc 1002h for example). if it does not work like this, allocate a buffer below the 1M limit. see www.digitalmars.com/faq.html#realbuffer roland
 
 "zhang li" <li stands.3322.org> wrote in message
 news:ar2423$75a$1 digitaldaemon.com...

    Set palette register (Int 10/10)

 INT 10 - VIDEO - (Jr, PS, TANDY 1000, EGA, VGA)
     AX = 1000h
     BL = palette register to set
     BH = color value to store

 Note:   on MCGA, only BX = 0712h is supported

 SeeAlso: AX=1002h,1007h

 --------
 INT 10 - VIDEO - SET BORDER COLOR REGISTER (Jr, PS, TANDY 1000, EGA, 
 VGA)
     AX = 1001h
     BH = color value to store

 SeeAlso: AX=1008h

 --------
 INT 10 - VIDEO - SET ALL PALETTE REGISTERS (Jr, PS, TANDY 1000, EGA, 
 VGA)
     AX = 1002h
     ES:DX -> 17-byte palette register list (see below)

 SeeAlso: AX=1000h,1009h

 Format of palette register list:
 Offset  Size    Description
  00h 16 BYTEs   values for palette registers 0-15
  10h    BYTE    value for border color register

 --------
 INT 10 - VIDEO - TOGGLE INTENSITY/BLINKING BIT (Jr, PS, TANDY 1000,
            EGA, VGA)
     AX = 1003h
     BL = 00h enable intensity
        = 01h enable blink

 --------
 INT 10 - VIDEO - GET INDIVIDUAL PALETTE REGISTER (VGA)
     AX = 1007h
     BL = palette register number

 Return: BH = palette register value

 SeeAlso: AX=1000h,1009h

 --------
 INT 10 - VIDEO - READ OVERSCAN (BORDER COLOR) REGISTER (VGA)
     AX = 1008h

 Return: BH = value

 SeeAlso: AX=1001h

 --------
 INT 10 - VIDEO - READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER (VGA)
     AX = 1009h
     ES:DX -> 17-byte buffer (see AX=1002h)

 SeeAlso: AX=1002h,1007h

 --------
 INT 10 - VIDEO - SET INDIVIDUAL DAC REGISTER (EGA, VGA/MCGA)
     AX = 1010h
     BX = register number
     CH = new value for green (0-63)
     CL = new value for blue (0-63)
     DH = new value for red (0-63)

 SeeAlso: AX=1012h,1015h

 --------
 INT 10 - VIDEO - SET BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
     AX = 1012h
     BX = starting color register
     CX = number of registers to set
     ES:DX -> table of 3*CX bytes where each 3 byte group represents one
          byte each of red, green and blue (0-63)

 SeeAlso: AX=1010h,1017h

 --------
 INT 10 - VIDEO - SELECT VIDEO DAC COLOR PAGE (VGA)
     AX = 1013h
     BL = 00h Select paging mode
         BH = 00h Select 4 blocks of 64
         BH = 01h Select 16 blocks of 16
     BL = 01h Select Page
         BH = page number (00h to 03h) or (00h to 0Fh)

 Note:   not valid in mode 13h

 SeeAlso: AX=101Ah

 --------
 INT 10 - VIDEO - READ INDIVIDUAL DAC REGISTER (EGA, VGA/MCGA)
     AX = 1015h
     BL = palette register number

 Return: DH = red value
     CH = green value
     CL = blue value

 SeeAlso: AX=1010h,1017h

 --------
 INT 10 - VIDEO - READ BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
     AX = 1017h
     BX = starting palette register
     CX = number of palette registers to read
     ES:DX -> buffer (3 * CX bytes in size) (see also AX=1012h)

 Return: CX number of red, green and blue triples in buffer

 SeeAlso: AX=1012h,1015h

 --------
 INT 10 - VIDEO - undocumented - SET PEL MASK (EGA, VGA/MCGA)
     AX = 1018h
     BL = new PEL value

 SeeAlso: AX=1019h

 --------
 INT 10 - VIDEO - undocumented - READ PEL MASK (EGA, VGA/MCGA)
     AX = 1019h

 Return: BL = value read

 SeeAlso: AX=1018h

 --------
 INT 10 - VIDEO - GET VIDEO DAC COLOR-PAGE STATE (VGA)
     AX = 101Ah

 Return: BL = paging mode
         00h four pages of 64
         01h sixteen pages of 16
     BH = current page

 SeeAlso: AX=1013h

 --------
 INT 10 - VIDEO - PERFORM GRAY-SCALE SUMMING (EGA, VGA/MCGA)
     AX = 101Bh
     BX = starting palette register
     CX = number of registers to convert

 SeeAlso: AH=12h/BL=33h
Nov 15 2002
next sibling parent reply "zhang li" <li stands.3322.org> writes:
 just i have a little doubt about interrupts where you have to pass a
 buffer (int 10h fc 1002h for example).
 if it does not work like this, allocate a buffer below the 1M limit.
 see

 www.digitalmars.com/faq.html#realbuffer

 roland
At DOS video memory is map to a 64 kb frame on 0xb000:0. dosX can directly read/write video memory address? I need address map of dosX. Thanks li
Nov 15 2002
parent roland <--rv ronetech.com> writes:
zhang li wrote:

just i have a little doubt about interrupts where you have to pass a
buffer (int 10h fc 1002h for example).
if it does not work like this, allocate a buffer below the 1M limit.
see

www.digitalmars.com/faq.html#realbuffer

roland
At DOS video memory is map to a 64 kb frame on 0xb000:0. dosX can directly read/write video memory address?
yes
 I need address map of dosX.
 
see http://www.digitalmars.com/faq.html#vram regards roland
Nov 15 2002
prev sibling parent reply "zhang li" <li stands.3322.org> writes:
 just i have a little doubt about interrupts where you have to pass a
 buffer (int 10h fc 1002h for example).
 if it does not work like this, allocate a buffer below the 1M limit.
 see

 www.digitalmars.com/faq.html#realbuffer

 roland
In this example, maybe don't need allocate memory, use this idea maybe pass. #define PUSHALL \ asm { \ push ax; \ push bx; \ push cx; \ push dx; \ push es; \ push ds; \ push si; \ push di; \ push bp; \ } #define POPALL \ asm { \ pop bp; \ pop di; \ pop si; \ pop ds; \ pop es; \ pop dx; \ pop cx; \ pop bx; \ pop ax; \ } copyRegs( int ss, int sp ) { char far *s = ; memcpy( MK_FP(ss,sp), regSet ); } main() { PUSHALL copyRegs( _SS, _SP ); POPALL asm int 0x10; PUSHALL keepRegs( _SS, _SP ); POPALL } li
Nov 15 2002
parent "zhang li" <li stands.3322.org> writes:
A warn about use BP register.
C/C++ often access stack by BP register.
so do not change it.

instead of a "asm pushf" and "asm popf" to keep running flags register.

li.


"zhang li" <li stands.3322.org> 写入消息新闻
:ar2rmb$1064$1 digitaldaemon.com...
 just i have a little doubt about interrupts where you have to pass a
 buffer (int 10h fc 1002h for example).
 if it does not work like this, allocate a buffer below the 1M limit.
 see

 www.digitalmars.com/faq.html#realbuffer

 roland
In this example, maybe don't need allocate memory, use this idea maybe
pass.
 #define PUSHALL \
   asm { \
    push ax; \
    push bx; \
    push cx; \
    push dx; \
    push es; \
    push ds; \
    push si; \
    push di; \
    push bp; \
   }


 #define POPALL \
   asm { \
    pop bp; \
    pop di; \
    pop si; \
    pop ds; \
    pop es; \
    pop dx; \
    pop cx; \
    pop bx; \
    pop ax; \
   }

 copyRegs( int ss, int sp )
 {
     char far *s = ;
     memcpy( MK_FP(ss,sp), regSet );
 }

 main()
 {
 PUSHALL
 copyRegs( _SS, _SP );
 POPALL
 asm int 0x10;
 PUSHALL
 keepRegs( _SS, _SP );
 POPALL
 }

 li
Nov 16 2002