320x200x16???? on cga 1/2

 BBS: Inland Empire Archive
Date: 08-02-92 (11:56)             Number: 185
From: MATT PRITCHARD @ 930/21      Refer#: NONE
  To: JIM CALES                     Recvd: NO  
Subj: 320x200x16???? on cga 1/2      Conf: (1) 80xxx

IZ> There's always the trick of changing palettes every time the monitor's IZ>moves to a new line. A friend of mine used this trick to get a 320x200x16 IZ>mode with a CGA adapter. JC>This information on the multi color CGA stuff is getting my curiosity JC>going. Could you elaborate on this process or perhaps provide a small JC>snippet of code? Thanks. Jim No, actually the CGA is capable of 160x100x16 colors directly.. a Graphics mode that IBM should have included in their BIOS (they did have it the PCjr)... Here is some code in BASIC for setting it. Credit goes to the Origional author, Lawrence McCaplin Since the code just sets registers, plots points, etc, and lets you use another undocumented graphics mdoe, I think people shouldn't be too mad about it... Also, on my ATI VGA-Wonder XL, I have to run a Batch file to set up the VGA card so it can properly emulate this mode... ============================ CGA-16.BAS ========================== DEFINT A-Z DECLARE SUB ScreenMode160 (Mode%) DECLARE SUB ClearScreen (Mode%, DrawColor%, NoClear%) DECLARE SUB ExitMode () DECLARE SUB DrawDot (x%, y%, DrawColor%) DECLARE SUB DrawLine (x1%, y1%, x2%, y2%, DrawColor%) DECLARE SUB GetInput () DECLARE SUB Pause () RANDOMIZE TIMER ' SuperCGA version 1.0 ' Color Graphics Adapter Enhancement Routines ' Tesseract Productions ' ' BEGIN (main) SCREEN 0, 0, 0: WIDTH 80 PRINT "Super CGA" PRINT "Version 1.0" PRINT "Tesseract Productions" PRINT "Programmed by Lawrence McAlpin" PRINT "" PRINT "Demonstration program on the 160x100 128-color capabilities of the CGA" PRINT "monitor. Tested on an AT&T PC 6300 with built- in AT&T CGA and a" PRINT "Verxion 386 with BOCA SuperVGA." PRINT PRINT "WARNING! This program may not work properly on emulated CGA sreen" PRINT "modes (i.e., it may not work right on EGA, VGA, MCGA, or XGA cards.)" PRINT "The author assumes no liability for any damag that may result from" PRINT "the use of this program. If you try this program out you are" PRINT "responsible for anything that may occur." PRINT PRINT "128 Color CGA Demonstration Program" PRINT PRINT "Hit '+' or '-' to change the 'background'" PRINT "Hit 'L' or 'l' to draw random dots and lines" PRINT "Hit 'M' or 'm' to change between box and fuzzy modes" PRINT "Hit 'Q' or 'q' to quit" PRINT "PRESS ANY KEY TO CONTINUE" Pause ScreenMode160 1 ClearScreen 1, 0, 0 DrawLine 0, 1, 79, 1, 3 DrawLine 0, 1, 0, 79, 3 DrawLine 3, 1, 40, 80, 4 ' demonstrate the first 128 colors FOR counter = 0 TO 79 DrawDot counter, 15, counter NEXT counter FOR counter = 80 TO 127 DrawDot counter - 80, 20, counter NEXT counter GetInput ' Pause ' there are two types of screen 'modes' ' they are box and fuzz, ScreenMode160 and ClearScreen take the mode ' parameter for box as zero, and fuzz for anything else ' fuzz mode smooths the box-graphics so they don't look AS boxy as they ' really are ClearScreen 1, 0, 0 ' this returns you to the regular 320x200 CGA 4-color mode ' if you neglect to ExitMode then you will find your screen display ' acting extremely strangely as the registers won't be restored to ' something normal ExitMode ' END (main) END SUB DrawDot (x, y, DrawColor) ' check for out of bounds errors IF DrawColor < 0 OR DrawColor > 255 THEN EXIT SUB IF x < 0 OR x > 79 THEN EXIT SUB IF y < 0 OR y > 99 THEN EXIT SUB a = ((2 * x + (y * 160)) AND &HFFFE) + 1 n = PEEK(a) POKE a, (n AND &HF0) OR DrawColor END SUB DEFINT A-Z SUB DrawLine (x1, y1, x2, y2, DrawColor) IF ABS(x1 - x2) > ABS(y1 - y2) THEN IF x1 > x2 THEN SWAP x1, x2 SWAP y1, y2 END IF dx = (x2 - x1) dy = (y2 - y1) IF dx <> 0 THEN b! = dy / dx ELSE b! = 0 END IF m! = y1 - x1 * b! FOR x = x1 TO x2 IF b! <> 0 THEN y = INT(m! + x * b!) + .5 ELSE y = y1 >>> Continued to next message === * SLMR 2.1a * hAS ANYONE SEEN MY cAPSLOCK KEY? --- InterPCB 1.50 # Origin: CENTRAL BBS -Texas' BEST BBS! 214-393-7090 HST 3+GIGs (8:930/21) * Origin: Gateway System to/from RBBS-NET (RBBS-PC 1:10/8)
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