| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: passing user types t |
TH> I get the following error..
TH> ..relating to indavid variable types.
TH> | Error 481: Parameter mismatch |
TH> ======== here's the test program
TH> DECLARE FUNCTION HexOut(Dbyte) AS STRING
TH> UNION bw
TH> b1 AS BYTE
TH> b2 AS BYTE
TH> b3 AS BYTE
TH> b4 AS BYTE
TH> END UNION
TH> UNION Dbyte
TH> B AS bw 'so I can look at individual bytes
TH> Dd AS DWORD 'this is the numeric
TH> Ds AS STRING * 4 'this will be the string representation
TH> END UNION
th>......
KK>This is known as the SCOPE of a variable.
[...]
Thank you, Kurt, for a well articulated explanation and solution. You
are an asset to this echo.
--- Maximus/2 3.01
---------------
** A related thread FOLLOWS this message.
FIDO MESSAGE AREA==> TOPIC: 214 POWER BASIC Ref: E1W50883 Date: 01/27/97
From: KURT KUZBA Time: 05:14am
\/To: TIM HUTZLER (Read 3 times)
Subj: R: Re: passing user types t
TH> You are an asset to this echo.
th>.....
OoH!! A compliment! I seldom see any ET's around here. :)
'_|_|_| SVGA_XTB.BAS
'_|_|_| A demo of line drawing and palette manipulation in
'_|_|_| VESA mode 101h, 640x480x256 for Power Basic 3.1.
'_|_|_| Includes putpixel() and Bline() SUBs.
'_|_|_| No warrantee or guarantee is given or implied.
'_|_|_| Released PUBLIC DOMAIN by Kurt Kuzba. (1/26/97)
DECLARE SUB Bline (x%, y%, x2%, y2%, c%)
DECLARE SUB putpixel (x%, y%, c%)
DECLARE SUB vesamode (mode&)
TYPE PaletteData: r AS INTEGER: g AS INTEGER: b AS INTEGER: END TYPE
RANDOMIZE TIMER: DIM pal(0 TO 256) AS PaletteData
r% = 63: rd% = 2: g% = 63: gd% = 3: b% = 63: bd% = 4
SCREEN 12: vesamode &H101
x% = 1: x1% = 1: y% = 1: y1% = 1: c% = 0
yd% = 2: yd1% = 2: xd% = 2: xd1% = 2
DO: c% = (c% MOD 255) + 1
IF (r% > 61) OR (r% < 2) THEN rd% = -rd%
IF (g% > 60) OR (g% < 3) THEN gd% = -gd%
IF (b% > 59) OR (b% < 4) THEN bd% = -bd%
r% = r% + rd%: g% = g% + gd%: b% = b% + bd%
pal(0).r = r%: pal(0).g = g%: pal(0).b = b%
FOR t% = 255 TO 1 STEP -1
pal(t%) = pal(t% - 1): OUT &H3C8, t%
OUT &H3C9, pal(t%).r: OUT &H3C9, pal(t%).g
OUT &H3C9, pal(t%).b: NEXT
IF (x% 478) THEN xd% = RND * 3 + 3
IF x% > 478 THEN xd% = -xd%
IF (y% 638) THEN yd% = RND * 3 + 3
IF y% > 638 THEN yd% = -yd%
IF (x1% 478) THEN xd1% = RND * 3 + 3
IF x1% > 478 THEN xd1% = -xd1%
IF (y1% 638) THEN yd1% = RND * 3 + 3
IF y1% > 638 THEN yd1% = -yd1%
x% = x% + xd%: x1% = x1% + xd1%: y% = y% + yd%: y1% = y1% + yd1%
'_|_|_| Horizontal Retrace seems ok to prevent Chromablizzards
'_|_|_| with a 486sx25. Slower systems may need vertical retrace.
WAIT &H3DA, 1: WAIT &H3DA, 1, 1: Bline (y%), (x%), (y1%), (x1%), c%
LOOP WHILE INKEY$ = "": SCREEN 0: SYSTEM
SUB Bline (x%, y%, x2%, y2%, c%)
'_|_|_| Bresenham Line Drawing Algorithm
'_|_|_| Adapted from BRESNHAM.C in Bob Stout's SNIPPETS.
i% = 0: steep% = 0: e% = 0
IF (x2% - x%) > 0 THEN sx% = 1: ELSE sx% = -1
dx% = ABS(x2% - x%)
IF (y2% - y%) > 0 THEN sy% = 1: ELSE sy% = -1
dy% = ABS(y2% - y%)
IF (dy% > dx%) THEN
steep% = 1: SWAP x%, y%: SWAP dx%, dy%: SWAP sx%, sy%
END IF: e% = 2 * dy% - dx%: ex% = dx% * 2: ey% = dy% * 2
FOR i% = 0 TO dx% - 1
IF steep% = 1 THEN putpixel y%, x%, c%: ELSE putpixel x%, y%, c%
WHILE e% >= 0: y% = y% + sy%: e% = e% - ex%: WEND
x% = x% + sx%: e% = e% + ey%
NEXT: putpixel x2%, y2%, c%
END SUB
SUB putpixel (x%, y%, c%)
STATIC a&
px& = x%: py& = y%: c& = c%
IF (x% 639) OR (y% 479) THEN EXIT SUB
po& = py& * 640 + px&: pa& = po& \ 65536: po& = po& AND 65535
IF a& pa& THEN
'_|_|_| If not in the proper frame
'_|_|_| of memory for the putpixel,
'_|_|_| switch to the right frame.
a& = pa&
! mov ax, &H4F05
! mov bx, &H0000
! mov dx, pa&
! int &H10
END IF
'_|_|_| store the color data in
'_|_|_| the video memory
! mov ax, &HA000
! mov di, po&
! mov es, ax
! mov ax, c&
! stosb
END SUB
SUB vesamode (mode&)
'_|_|_| mode& should be &H101 to access
'_|_|_| the 640x480x256 VESA video mode
m% = INT(mode&)
!mov ax, &H4F02
!mov bx, m%
!int &H10
END SUB
'_|_|_| end SVGA_XTB.BAS
---
> ] * Origin: Madman BBS * Chico, California * 916-893-8079 * (1:119/88)* Origin: Toast House * (314) 994-0312 * (1:100/560) |
|
| SOURCE: echomail via exec-pc | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.