🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.msdos.programmer
Article #10

[Q] PC VGA Attribute Controller

#10
From: Thomas Jensen
Date: Thu, 14 Dec 1995 09:43
38 lines
2051 bytes
Goal:
  The following code is supposed to switch a standard VGA
  display on my PC (running DOS, but that shouldn't matter)
  between blinking text and light background colors.

Problem:
  Reading the contents of attribute controller (ATC)
  register 10h doesn't seem to work. Line graphics mode
  always gets turned off.

Question:
  Can you tell me what changes I have to make to make the ATC read work?

C-Code:

  void blink (int on) {
  /* 0 -> allow light background attributes  */
  /* 1 -> make text blink instead            */

    unsigned char reg10;

    reg10 = inportb (0x3da);         /* set ATC to index mode */
    outportb (0x3c0, 0x10|32);       /* select mode control register */
    reg10 = inportb (0x3c1);         /* read current status (!) */
    if (on) reg10 = reg10 | 8;       /* set bit 3 (blink on) */
    else asm {and reg10, 11110111b}; /* clear bit 3 (blink off) */
    outportb (0x3c0, 0x10|32);       /* reg select */
    outportb (0x3c0, reg10|32);      /* write changes */
  }

When I set the register contents manually, it works fine, so
I believe that the write operation poses no problem.

Please reply by e-mail, too. Any help would be most appreciated!
Thanks!
--
 Thomas Jensen <fi136@fim.uni-erlangen.de> 2B |! 2B  W.S.
 Sign my guest book at <<http://home.pages.de/~Murphy/>>!
Technical Details
Message-ID: <4aorkp$i1j@rznews.rrze.uni-erlangen.de>
Path: arc1-ca.pugleaf.net!rznews.rrze.uni-erlangen.de!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!rznews.rrze.uni-erlangen.de!news
From: Thomas Jensen <tsjensen@cip.informatik.uni-erlangen.de>
Newsgroups: comp.msdos.programmer,comp.os.msdos.programmer,comp.programming,comp.lang.asm.x86,comp.lang.c,comp.lang.pascal.borland
Subject: [Q] PC VGA Attribute Controller
Date: 14 Dec 1995 09:43:53 GMT
Organization: CSD, Univ. Erlangen-Nuernberg
Message-ID: <4aorkp$i1j@rznews.rrze.uni-erlangen.de>
NNTP-Posting-Host: faui06o.informatik.uni-erlangen.de
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-User: tsjensen
X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.01 9000/715)
To: tsjensen
X-URL: news:comp.lang.asm.x86