CGA136.BAS 4/6

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

NEXT
FOR yv = 0 TO r
xv = SQR(r ^ 2 - yv ^ 2)
PixSet x + xv, y + yv, c
PixSet x - xv, y - yv, c
PixSet x + xv, y - yv, c
PixSet x - xv, y + yv, c
NEXT
END SUB

SUB Pget (x1, y1, x2, Y2, v())

IF x1 > x2 THEN SWAP x1, x2: SWAP y1, Y2
'REDIM v((x2 - x1) * (y2 - y1) + 4)
v(1) = x2 - x1: v(2) = Y2 - y1: P = 3

FOR y = y1 TO Y2
FOR x = x1 TO x2
v(P) = PixColr(x, y)
P = P + 1
NEXT
NEXT
END SUB

FUNCTION PixColr (x, y)
'
' Returns the color of the pixel at the specified coordinates
'
' To find the two colors that were blended to create the color, use
' c1 = PixColr (x,y) \ 16
' c2 = PixColr (x,y) and 15
'
IF ModeNum = 136 THEN
PixColr = PEEK(((2 * x + (y * 160)) AND &HFFFE) + 1)
ELSE
PIXELADDR = ((x + (y * 160)) AND &HFFFE) + 1
NIBBLE = (x + (y * 160)) MOD 2
IF NIBBLE = 0 THEN PixColr = (PEEK(PIXELADDR) AND &HF0) \ 16
IF NIBBLE = 1 THEN PixColr = PEEK(PIXELADDR) AND &HF
END IF
END FUNCTION

SUB PixSet (x, y, Colr)
'
' Plots a point at x,y in Colr color.
'
' Colr is calculated by:  color1 * 16 + color2
' this will give you a blending of the two colors
'
IF ModeNum = 136 THEN
POKE ((2 * x + (y * 160)) AND &HFFFE) + 1, Colr
ELSE
PIXELADDR = ((x + (y * 160)) AND &HFFFE) + 1
NIBBLE = (x + (y * 160)) MOD 2
+ Colr * &H10
&HF0) + Colr
END IF
END SUB

SUB Pline (mx1, my1, mx2, my2, MColr)
'
' Not tested, may not work...
'
x1 = mx1: y1 = my1: x2 = mx2: Y2 = my2: Colr = MColr

IF ABS(x2 - x1) > ABS(Y2 - y1) THEN         'x is major
IF x1 > x2 THEN SWAP x1, x2: SWAP y1, Y2
IF x2 - x1 = 0 THEN ys! = 0 ELSE ys! = (Y2 - y1) / (x2 - x1)
FOR l = 0 TO (x2 - x1)
PixSet x1 + l, y1 + M!, Colr: M! = M! + ys!
NEXT
ELSE                                       'y is major
IF y1 > Y2 THEN SWAP y1, Y2: SWAP x1, x2
IF Y2 - y1 = 0 THEN xs! = 0 ELSE xs! = (x2 - x1) / (Y2 - y1)
FOR l = 0 TO (Y2 - y1)
PixSet x1 + M!, y1 + l, Colr: M! = M! + xs!
NEXT
END IF
END SUB

'>>> Continued on page 5

* Call PTS!  * As a math atheist, I should be excused from this.- Calvin

--- TMail v1.31.3
* Origin: Programmer's Tech Shop - Toledo, Ohio (1:234/56)
```

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