Text mode screen 0 revisited.... - relsoft - 08-11-2003
Joe, you're right, things like plasmas could be done.
The challenge is to make a graphical textmode screen 0 effect.
rules:
1. No call absolute
2. No external files
3. Call interrupt is okay to use.
Here's and example:
Plasma and floormapper. ;*)
Code: 'I am crazy!!!
'Plasma anf Floormapper in TextMode!!!
'Relsoft 2003
DECLARE SUB BlobsTxt (Intensity%)
DECLARE SUB DrawBlob (bx%, by%)
DECLARE SUB Mode7Text (sx%, sy%, sz%, horz%)
DEFINT A-Z
RANDOMIZE TIMER
CLS
SCREEN 0
WIDTH 80, 50
CONST PI = 3.14151693#
CONST FALSE = 0, TRUE = NOT FALSE
DIM SHARED Lsin1%(-1024 TO 1024)
DIM SHARED Lsin2%(-1024 TO 1024)
DIM SHARED Lsin3%(-1024 TO 1024)
DIM SHARED Lsin!(-10 TO 370)
DIM SHARED Lcos!(-10 TO 370)
FOR i% = -1024 TO 1024
Lsin1%(i%) = SIN(i% / (16)) * 16
Lsin2%(i%) = SIN(i% / (32)) * 64
Lsin3%(i%) = SIN(i% / (32)) * 8
NEXT i%
j! = 255 / 360 * 2
k! = 255 / 360 * 8
l! = 255 / 360 * 4
FOR i% = 0 TO 255
m% = INT(a!)
n% = INT(b!)
o% = INT(c!)
r% = 63 * ABS(SIN(m% * PI / 180))
g% = 63 * ABS(SIN(n% * PI / 180))
b% = 63 * ABS(SIN(o% * PI / 180))
a! = a! + j!
b! = b! + k!
c! = c! + l!
OUT &H3C8, i%
OUT &H3C9, r%
OUT &H3C9, g%
OUT &H3C9, b%
NEXT
Dir% = 1
DEF SEG = &HB800
DO
counter& = (counter& + Dir%)
IF counter& > 600 THEN Dir% = -Dir%
IF counter& < -600 THEN Dir% = -Dir%
offset% = 0
FOR y% = 1 TO 50
FOR x% = 1 TO 80
c% = Lsin3%(x%) + Lsin1%(x% + counter&) + Lsin2%(y% + counter&)
c% = c% + Lsin3%(c%) + Lsin1%(c% + counter&) + Lsin2%(counter& - y% + x%)
POKE offset%, 177 + (c% AND 1)
POKE offset% + 1, c% AND 15
offset% = offset% + 2
NEXT x%
NEXT y%
LOOP UNTIL INKEY$ <> ""
CLS
horz% = 10
sx% = 30
sy% = 30
sz% = 40
Mode7Text sx%, sy%, sz%, horz%
END
SUB Mode7Text (sx%, sy%, sz%, horz%)
'256*126 = 32256
'((256*126)+4)\2 =16130
'256*8 =2048
'32256\2=16128
FOR i% = 0 TO 359
RA! = i% * (3.141593 / 180)
Lcos!(i%) = COS(RA!)
Lsin!(i%) = SIN(RA!)
NEXT i%
FOR i% = -1024 TO 1024
Lsin1%(i%) = SIN(i% / (16)) * 32
Lsin2%(i%) = SIN(i% / (32)) * 16
Lsin3%(i%) = SIN(i% / (32)) * 32
NEXT i%
j! = 255 / 360 * 8
k! = 255 / 360 * 8
l! = 255 / 360 * 16
FOR i% = 0 TO 255
m% = INT(a!)
n% = INT(b!)
o% = INT(c!)
r% = 63 * ABS(SIN(m% * PI / 180))
g% = 63 * ABS(SIN(n% * PI / 180))
b% = 63 * ABS(SIN(o% * PI / 180))
a! = a! + j!
b! = b! + k!
c! = c! + l!
OUT &H3C8, i%
OUT &H3C9, r%
OUT &H3C9, g%
OUT &H3C9, b%
NEXT
SpaceZ! = sz%
ScaleY! = sy%
ScaleX! = sx%
Horizon% = horz%
countdir% = 1
counter% = 50
t# = TIMER
DO
F& = (F& + 1) AND &H7FFFFFFF
counter% = (counter% + countdir%)
IF counter% < 2 THEN
countdir% = -countdir%
ELSEIF counter% > 700 THEN
countdir% = -countdir%
END IF
pd% = (pd% + 1) AND 1023
ci% = (ci% + 1) AND (3)
px% = SIN(ci% / counter%) * 4
py% = COS(ci% / counter%) * 8
Angle = (Angle + 1) MOD 359
xv! = Lcos!(Angle)
yv! = Lsin!(Angle)
offset% = (80 * 4)
FOR ya% = 4 TO 50
Distance! = (SpaceZ! * ScaleY!) / (ya% + Horizon%)
HorizScale! = (Distance! / ScaleX!)
LineDX! = (-yv! * HorizScale!)
LineDy! = (xv! * HorizScale!)
SpaceX! = ((Distance! * xv!)) - (40 * LineDX!)
SpaceY! = ((Distance! * yv!)) - (25 * LineDy!)
ldx& = LineDX! * 1024
ldy& = LineDy! * 1024
sx& = SpaceX! * 1024
sy& = SpaceY! * 1024
pxysin% = Lsin3%(px% + py%)
FOR xa% = 1 TO 80
xx% = sx& \ 1024' + (pd%)
yy% = sy& \ 1024' + (pd%)
c% = Lsin1%(xx% + px%) + Lsin2%(yy% + py%) + pxysin%
c% = Lsin2%(xx% - counter%) + Lsin3%(Lsin1%(yy% - counter%) - Lsin3%(xx% - counter% - c%))
POKE offset%, 177 + (c% AND 1)
POKE offset% + 1, c% AND 15
offset% = offset% + 2
sx& = sx& + ldx&
sy& = sy& + ldy&
NEXT xa%
NEXT ya%
LOOP UNTIL INKEY$ <> ""
END SUB
Text mode screen 0 revisited.... - oracle - 08-11-2003
Okay, you win your own challenge. Next, please :rotfl:
Text mode screen 0 revisited.... - toonski84 - 08-11-2003
well, till i come up with something better, my text-fire from the 9-liner:
Code: 1 IF i = 0 THEN WIDTH 80, 50 ELSE OUT &H3C8, 0
2 FOR i = 0 TO 18
3 IF i = 18 THEN WAIT &H3DA, 8 ELSE IF i MOD 3 = 0 THEN OUT &H3C9, (i \ 3) * 10 ELSE OUT &H3C9, 0
4 NEXT i
5 IF x% = 0 THEN DEF SEG = &HB800 ELSE CLS
6 FOR x% = 7999 TO 5080 STEP -2
7 IF x% > 7840 THEN POKE x%, CINT(RND) * 80 ELSE POKE x%, ((PEEK(x% + 160) + PEEK(x% + 162) + PEEK(x% + 158) + PEEK(x% + 320) * 1.5) / 5)
8 NEXT
9 IF INKEY$ = "" THEN GOTO 1
Text mode screen 0 revisited.... - relsoft - 08-11-2003
C'mon!!! No judging. And you get to host stuff from this at QBnz.
No loosers just winners!!!!
Text mode screen 0 revisited.... - relsoft - 08-11-2003
Joe, sorry leah won't load. ;*(
Sent you the final version of the "project"
Will release tomorrow barring problems. ;*)
Text mode screen 0 revisited.... - toonski84 - 08-11-2003
hey rel, i couldnt help but notice your palette routines on your text file. (how'd ya do that?)
and would anyone want to help make an rgb table generator for text characters?
you have 16 foreground colors, ega, 8 backgorund (ega) and 5 dithered characters 32, 176, 177, 178, 219.
Text mode screen 0 revisited.... - relsoft - 08-11-2003
Don't understand. I just played with the pallete until it looked good. ;*)
What do you mean?
Text mode screen 0 revisited.... - toonski84 - 08-11-2003
you OUT to the pallette 255 times... there's only 16 colors ega in text mode, only 5 of them changeable on a vga monitor. how are you doing the colors?
Text mode screen 0 revisited.... - na_th_an - 08-11-2003
There are 64 colours in Screen 0, the issue is that you only see 16. You select which 16 colours in the 64 colours range you wanna see using PALETTE. You change DACs using OUT:
http://faq.qbasicnews.com/?blast=DacRegistersInScreenNine
(toonski: 5??)
---
Now I'll take this oportunity to show you my textmode engine http://usuarios.lycos.es/firstqbasicforum/stuff/nadya.html
(please run at FULLSCREEN!!! -> DOS has to be fullscreen _before_ running this)
This game of mine has been called "the thread killer". I've posted this in this forum three times waiting for some feedback but it killed the thread the three times :o
Text mode screen 0 revisited.... - toonski84 - 08-11-2003
in my experience i've only been able to use the DAC registers with the first 5 colors in screen zero. The color palette goes up to 31, but 16-31 is simple 0-15 blinking.
Could I have an example/demo of how you get the other 64?
edit: btw, the rgb textmode table is finished *maniacal laughter* It takes too long to generate, so i'll just write it to a text file...
|