Author Topic: Ascii looking intro.  (Read 4885 times)

0 Members and 1 Guest are viewing this topic.

Offline WidowMaker [retired]

  • %010101
  • Atari ST
  • ***
  • Posts: 134
  • Karma: 21
  • %010101
    • View Profile
Ascii looking intro.
« on: August 05, 2007 »
Been looking at lots of ascii demos recently during my period of dissilusionment. I have Been properly impressed with a lot of them, mind you the ones I liked the best seemed to not have dedicated ascii engines, these seem to take a small screen buffer and then later convert it into a visual display.

What I think is the appeal of these demo is that the refresh rates in the text modes has tears and glitches and gives them a nice look all of their own.

I want to make something like that with a cleaner look, I used ptc _ext by Rbraz so here is a basic routine that lets you change the resolution of the grid and the screen with no hassle.

For now it just draws random coloured blocks but the buffer could be made to display anything.

I plan you use it to draw some vector bobs and a plasma but it is here for you to use too if anybody feels like using it for anything.

Ok here is source code;

Code: [Select]
'
'                           PSEUDO ASCII CRACKTRO
'                           =====================
'
'
'
'                             WIDOW MAKER  2007
'
'
'-------------------------------------------------------------------------------

        OPTION STATIC
        OPTION EXPLICIT
       
'       SCREEN RES

        CONST   XRES = 800
        CONST   YRES = 600

'       GRID RES

        CONST   GRID = 8

        DIM SHARED AS INTEGER WXRES
        DIM SHARED AS INTEGER WYRES
       
        WXRES = XRES / GRID
        WYRES = YRES / GRID       

'       INCLUDES

        #INCLUDE "TINYPTC_EXT.BI"
        #INCLUDE "WINDOWS.BI"
       
'-------------------------------------------------------------------------------

'       VARIABLES

        DIM SHARED AS UINTEGER  BUFFER ( XRES * YRES )
        DIM SHARED AS UINTEGER WBUFFER ( WXRES * WYRES )
       
'-------------------------------------------------------------------------------   

'       SUBS

        DECLARE SUB BLIT_BUFFER()
        DECLARE SUB ERASE_GRID()
       
'-------------------------------------------------------------------------------   

'       OPEN SCREEN

        PTC_ALLOWCLOSE(0)
        PTC_SETDIALOG(0,"",0,0)   
        IF (PTC_OPEN("P0STM0RT3M",XRES,YRES)=0) THEN
            END-1
        END IF 

'-------------------------------------------------------------------------------
'       MAIN LOOP;
'-------------------------------------------------------------------------------

WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<>-32767)   
   
    ERASE_GRID()
    BLIT_BUFFER()
    PTC_UPDATE@BUFFER(0)
   
WEND
END

'-------------------------------------------------------------------------------
'   DRAWS THE SCREEN ACCORDING TO WHAT IS IN WBUFFER.
'-------------------------------------------------------------------------------

SUB BLIT_BUFFER()
    DIM AS INTEGER XX,YY,Y2,SLICE,tc
    DIM PP AS UINTEGER PTR
   
    FOR YY=0 TO WYRES-1
    FOR XX=0 TO WXRES-1
       
        FOR Y2=0 TO GRID-1
        pp=@buffer((XX*GRID)+(((YY*GRID)+Y2)*XRES))   
        SLICE = GRID
        TC=WBUFFER(XX+(YY*WXRES))
       
            asm
               
            mov eax,dword ptr[TC]
            mov ecx, [SLICE]
            mov edi, [PP]
            rep stosd
           
            end asm   
   
        NEXT
       
    NEXT
    NEXT

END SUB

'-------------------------------------------------------------------------------
'   FOR NOW JUST GENERATE RANDOM PIXELS, LATER IT WILL BE JUST DRAWN OVER.
'-------------------------------------------------------------------------------

SUB ERASE_GRID()
        DIM AS INTEGER XX,YY
        FOR YY=0 TO WYRES-1
        FOR XX=0 TO WXRES-1   
            WBUFFER(XX+(YY*WXRES))=RGB(INT(RND(1)*255),INT(RND(1)*255),INT(RND(1)*255))
        NEXT
        NEXT
END SUB


Haven't bothered with an exe as it is just a screen full of flashing coloured squares :P


Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Ascii looking intro.
« Reply #1 on: August 09, 2007 »
Widow Maker . . .
Nice work there . . . if i change grid to anything but 8 on my system why does it crash (big time!) ? I know you will be working on the buffer to generate more than just blocks but I found it fascinating anyway!!! Surely it should be able to generate any size grid? Not a criticism btw - just interested?

Drew
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline WidowMaker [retired]

  • %010101
  • Atari ST
  • ***
  • Posts: 134
  • Karma: 21
  • %010101
    • View Profile
Re: Ascii looking intro.
« Reply #2 on: August 09, 2007 »
Weird how it crashes for you DrewPee :\ Probably I have fucked up somewhere and written > than the screen buffer at some resolutions. Sorry about that.

Here is a plasma using that code;

Code: [Select]
'
'                           PSEUDO ASCII CRACKTRO
'                           =====================
'
'
'
'                             WIDOW MAKER  2007
'
'
'-------------------------------------------------------------------------------

        OPTION STATIC
        OPTION EXPLICIT
       
'       SCREEN RES

        CONST   XRES = 640
        CONST   YRES = 480

'       GRID RES

        CONST   GRID = 4

        DIM SHARED AS INTEGER WXRES
        DIM SHARED AS INTEGER WYRES
       
        WXRES = XRES / GRID
        WYRES = YRES / GRID       

'       INCLUDES

        #INCLUDE "TINYPTC_EXT.BI"
        #INCLUDE "WINDOWS.BI"
       
'-------------------------------------------------------------------------------

'       VARIABLES

        DIM SHARED AS UINTEGER  BUFFER ( XRES * YRES )
        DIM SHARED AS UINTEGER WBUFFER ( WXRES * WYRES )
        dim shared as double fuckfuck(xres)
        DIM SHARED AS UINTEGER COL_PAL(10000)
        DIM SHARED AS DOUBLE GADD,GADD2
'-------------------------------------------------------------------------------   

'       SUBS

        DECLARE SUB BLIT_BUFFER()
        DECLARE SUB ERASE_GRID()
        DECLARE SUB PRECALC()
        DECLARE SUB PLASMA()
       
       
'-------------------------------------------------------------------------------   

'       OPEN SCREEN

        PTC_ALLOWCLOSE(0)
        PTC_SETDIALOG(0,"",0,0)   
        IF (PTC_OPEN("P0STM0RT3M",XRES,YRES)=0) THEN
            END-1
        END IF 
        PRECALC()
       
'-------------------------------------------------------------------------------
'       MAIN LOOP;
'-------------------------------------------------------------------------------

WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<>-32767)   
    GADD=GADD-1.5
    GADD2=GADD2-1.4
'    ERASE_GRID()
    PLASMA()
    BLIT_BUFFER()
    PTC_UPDATE@BUFFER(0)
   
WEND
END


SUB PLASMA()
   
    DIM AS INTEGER YY,XX,VALL,QQ,RR
    dim as double ll,mm
   
    for xx=0 to xres
        fuckfuck(xx)=171+50*sin((GADD+xx)/39)
    next

    FOR YY=0 TO WYRES-1
   
       
        QQ = 599 * SIN (( GADD2 + YY) /69) 
        rr = 599 * SIN (( GADD  - YY) /87) 
       
        mm=171+50*sin((GADD+yy)/237)
        FOR XX=0 TO WXRES-1
            VALL = 5000+(2499*cos((gadd2-YY+QQ)/fuckfuck(xx))+2499*SIN((gadd-YY+rr)/mm))
           
            WBUFFER(XX+(YY*WXRES))=COL_PAL(VALL)
        NEXT
    NEXT
   
END SUB

SUB PRECALC()
    DIM X AS INTEGER
    DIM AS DOUBLE RR,GG,BB
    RR=125
    GG=125
    BB=125
    FOR X=0 TO 10000

        rr=125+124*sin(X/1813)
        gg=125+124*sin((X+1000)/1813)
        bb=125+124*sin((X+2000)/1813)

        COL_PAL(X) = RGB( INT(RR),INT(GG),INT(BB) )
       
    NEXT
   
END SUB

'-------------------------------------------------------------------------------
'   DRAWS THE SCREEN ACCORDING TO WHAT IS IN WBUFFER.
'-------------------------------------------------------------------------------

SUB BLIT_BUFFER()
    DIM AS INTEGER XX,YY,Y2,SLICE,tc
    DIM PP AS UINTEGER PTR
   
    FOR YY=0 TO WYRES-1
    FOR XX=0 TO WXRES-1
       
        FOR Y2=0 TO GRID-1
        pp=@buffer((XX*GRID)+(((YY*GRID)+Y2)*XRES))   
        SLICE = GRID
        TC=WBUFFER(XX+(YY*WXRES))
       
            asm
               
            mov eax,dword ptr[TC]
            mov ecx, [SLICE]
            mov edi, [PP]
            rep stosd
           
            end asm   
   
        NEXT
       
    NEXT
    NEXT

END SUB

'-------------------------------------------------------------------------------
'   FOR NOW JUST GENERATE RANDOM PIXELS, LATER IT WILL BE JUST DRAWN OVER.
'-------------------------------------------------------------------------------

SUB ERASE_GRID()
        DIM AS INTEGER XX,YY
        FOR YY=0 TO WYRES-1
        FOR XX=0 TO WXRES-1   
            WBUFFER(XX+(YY*WXRES))=RGB(INT(RND(1)*255),INT(RND(1)*255),INT(RND(1)*255))
        NEXT
        NEXT
END SUB

Exe attached.... :P


Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Ascii looking intro.
« Reply #3 on: August 10, 2007 »
Widow Maker,
You were right . . . i changed the For yy=0 to WYRES-1 to For yy=0 to WYRES-8 and did the same with the xx variable - then changed the grid value to 16 and it worked fine - it was trying to draw the 'blocks' outside the screen array.
The Plasma effect is wicked - smooth as anything - again if you change the grid value you get some fantastic results . . . try changing it to 32 . . . looks fantastic.
Thanks for sharing the code Widow Maker, appreciate it very much!

Drew
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Ascii looking intro.
« Reply #4 on: August 10, 2007 »
...
Haven't bothered with an exe as it is just a screen full of flashing coloured squares :P

 :(
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17426
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: Ascii looking intro.
« Reply #5 on: August 10, 2007 »
He added an exe of the effect in one of the posts above with a Plasma effect Benny :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Ascii looking intro.
« Reply #6 on: August 10, 2007 »
Ja. But not with the ASCII looking fx :-(
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17426
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: Ascii looking intro.
« Reply #7 on: August 10, 2007 »
It's just a load of squares mate.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Ascii looking intro.
« Reply #8 on: August 11, 2007 »
@Shocky:
Ok. I was just curious you know  :whisper:
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17426
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: Ascii looking intro.
« Reply #9 on: August 11, 2007 »
I'll make an exe later when I go to my other computer :)
Shockwave ^ Codigos
Challenge Trophies Won: