BBS: Inland Empire Archive Date: 06-14-93 (11:54) Number: 394 From: PETER BARNEY Refer#: NONE To: GERALD RICHTER Recvd: NO Subj: CGA136.BAS 1/6 Conf: (2) Quik_Bas
GR>Is there a way to run a CGA card in 16-color mode? 4-
GR>colors is kinda tiring!
>and does the code work with qb 4.00? If you've got some, send some. Thanx.
The following messages are some code that I was working on a couple years ago
when I had a cga monitor. Included are a 16-color mode and a 136-color mode.
This should get you started in the right direction.
'________O_/________________________| SNIP |______________________\_O_______
' O \ | HERE | / O
'This file created by PostIt! v6.0.
'>>> Start of page 1.
DECLARE SUB Moire ()
DECLARE SUB Demo ()
DECLARE SUB GPrint (A$, x%, y%, Colr%, Size%)
DECLARE SUB Mode (M%, BG%)
DECLARE SUB PCircle (x%, y%, r%, c%)
DECLARE FUNCTION PixColr% (x%, y%)
DECLARE SUB PixSet (x%, y%, Colr%)
DECLARE SUB SaveScreen (f$)
DECLARE FUNCTION Sequence% (PickCol%)
DECLARE SUB Setup ()
DECLARE FUNCTION Spectral% (PickCol%)
DECLARE SUB TextDemo ()
DIM SHARED ModeNum
SCREEN 0
'=================== Main Code ===================
Begin:
Setup ' this creates the screen modes (do this only once)
Mode 136, 0 ' or Mode 136 , Color
' This is where you would add your code.
Demo
TextDemo
Done:
SOUND 1160, 2
SLEEP
WHILE INKEY$ = "": WEND
SCREEN 0, 0
END
'================= End Main Code =================
'
'
'initial data for 6845 chip (80 x 100 pixels)
'
DATA 113: 'register 0 horizontal total
DATA 80: 'register 1 horizontal displayed
DATA 90: 'register 2 horizontal sync position
DATA 10: 'register 3 horizontal sync width
DATA 127: 'register 4 vertical total
DATA 6: 'register 5 vertical adjust
DATA 100: 'register 6 vertical displayed
DATA 112: 'register 7 vertical sync position
DATA 2: 'register 8 interlace mode (non-interlaced)
DATA 1: 'register 9 maximum scan line address
DATA 32: 'register 10 cursor start (32 makes cursor
' invisible)
DATA 0: 'register 11 cursor end
DEFINT A-Z
SUB Demo
'draw screen (136 color demo)
' You MUST use this command to set up the screen properly.
' (note that the number may be changed, however)
Mode 136, 0
' draw Spectral circle
FOR r = 0 TO 19
PCircle 60, 60, r, Spectral(r)
NEXT
'this one shows how to blend the two colors
FOR x = 0 TO 31
FOR y = 0 TO 63
c1 = Sequence(x \ 2 MOD 16)
c2 = Sequence(y \ 4 MOD 16)
Colr = c1 * 16 + c2 ' this blends
' color 1 with color 2
PixSet x, y, Colr
NEXT
'>>> Continued on page 2
* Call PTS! * If a tree fell on a deaf forester, would he make a sound?
--- TMail v1.31.3
* Origin: Programmer's Tech Shop - Toledo, Ohio (1:234/56)

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