CGA136.BAS 5/6

 BBS: Inland Empire Archive
Date: 06-14-93 (11:54)             Number: 398
From: PETER BARNEY                 Refer#: NONE
  To: GERALD RICHTER                Recvd: NO  
Subj: CGA136.BAS 5/6                 Conf: (2) Quik_Bas
'>>> Start of page 5.

SUB Pput (x1, y1, v(), M)
IF M = 1 THEN M = 0 ELSE M = 256
x2 = x1 + v(1): Y2 = y1 + v(2): P = 3
FOR y = y1 TO Y2
    FOR x = x1 TO x2
        IF v(P) <> M THEN PixSet x, y, v(P)
        P = P + 1
    NEXT
NEXT
END SUB

SUB SaveScreen (f$)
BSAVE f$, 0, &H3F1E
END SUB

FUNCTION Sequence (PickCol)
'
' This was designed for the 136-color mode
'
' places colors in Sequence order.  Used by this program to make a nifty
' color arrangement, not very usable in your programs.
'
SELECT CASE PickCol + 1
        CASE 1: Colr = 0
        CASE 2: Colr = 8
        CASE 3: Colr = 1
        CASE 4: Colr = 9
        CASE 5: Colr = 3
        CASE 6: Colr = 11
        CASE 7: Colr = 2
        CASE 8: Colr = 10
        CASE 9: Colr = 6
        CASE 10: Colr = 14
        CASE 11: Colr = 4
        CASE 12: Colr = 12
        CASE 13: Colr = 5
        CASE 14: Colr = 13
        CASE 15: Colr = 7
        CASE 16: Colr = 15
        CASE ELSE
END SELECT
Sequence = Colr
END FUNCTION

SUB Setup

'Color/Graphics Adapter Definitions
MODEREG = &H3D8:  COLORREG = &H3D9        'control registers
MODESAVE = &H465: COLORSAVE = &H466       'BIOS saves the regs
' here
CRTREG = &H3D4:   CRTDATA = &H3D5         '6845 CRT controller
' regs

'set up Color/Graphics Adapter for 160- by 100-block graphics
DEF SEG = 0: SMode = 0
POKE MODESAVE, SMode: OUT MODEREG, SMode
POKE COLORSAVE, 0:   OUT COLORREG, 0

'Load new parameters into 6845 CRT controller
RESTORE
FOR REGISTER = 0 TO 11
        READ REGDATA
        OUT CRTREG, REGISTER: OUT CRTDATA, REGDATA
NEXT

'set mode for 80 column color enable
HIRES = 1: GRAPH = 2: BW = 4      'Mode register bits
VIDEO = 8: G640 = 16: BLINK = 32  'Mode register bits
SMode = HIRES + VIDEO
POKE MODESAVE, SMode: OUT MODEREG, SMode
DEF SEG = &HB800
END SUB

FUNCTION Spectral (PickCol)
'
'converts ordered color numbers to a Spectrum --19 of 25 used
'
' This will give you the number of the color on the spectrum
' Example:
'   x=Spectral(10)
' will give you the 10th color of the Spectrum

'>>> Continued on page 6

 * Call PTS!  * Nudge, nudge, wink, wink, say no more, say no more!

--- TMail v1.31.3
 * Origin: Programmer's Tech Shop - Toledo, Ohio (1:234/56)
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