'=========================================================================== ' Subject: PB FIRE VERSION 6 Date: 08-13-98 (00:55) ' Author: Thomas Ludwig Code: PB ' Origin: lycium@hotmail.com Packet: GRAPHICS.ABC '=========================================================================== '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 'PBFiRE ver 6 '------------ 'This prog is Public Domain, but if u use it, 'credit me. 'Thomas Ludwig 'lycium@hotmail.com 'I'm looking for people to join my one-man 'demogroup BlackBox, so if you're interested 'please mail me, and I'll get back to you 'within 4 days '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= cls:randomize timer dim dynamic img(32320) as byte dim dynamic div5(255*5) as integer for x% = 0 to 255*5 div5(x%) = cint((x%/5)-2) next x% print "PBFiRE 6" print "--------" print print "Here's the latest (as of 8/7/98) version of" print "PBFiRE. This version has LOADZA assembler," print "and in case you haven't noticed, is *FAST*" print print "Punch the beige plastic" do:loop until inkey$ <> "" ! mov ax, 19 ;Set screen 13 in ASM ! int 16 FOR p% = 1 TO 127 OUT &H3C8, p% OUT &H3C9, 0 OUT &H3C9, 0 OUT &H3C9, p% / 2 NEXT p% FOR p% = 127 TO 255 OUT &H3C8, p% OUT &H3C9, p% / 2 OUT &H3C9, p% / 2 OUT &H3C9, 63 NEXT p% 'OUT &H3D4, 9 'This tweaks the screen 'OUT &H3D5, 3 'to 320x100 resolution. def seg = &Ha7d0 screenseg% = &Ha7d0 imgseg% = varseg(img(0)) div5seg = varseg(div5(0)) 'Bottom line for 320x200 = 31680, def seg &ha7d0 'Bottom line for 320x100 = 31680, def seg &ha000 Start! = timer DO ! mov cx,31680 ;Preclac for px% = 0 to 319 place% = px% ! mov ax,place% ! add ax,cx ! mov place%,ax if int(rnd*2) = 1 then img(place%) = 255 else img(place%) = 0 next px% ! mov pm%,8000 ;Start at 0,0 (25*320 = 8000) 'wait &h3da, 8 'Wait for vertical retrace, kills flicker and locks FPS 'at monitor refresh rate. Begin: ! mov ax,pm% ;Move pixel mem location to AX ! mov dx,320 ;Speedup for 320! ! inc ax ;Increment it per pixel ! sub ax,dx ;Subtract 320 from AX ! mov above%,ax ;Move result to above% ! add ax,dx ;Not done yet - add 320 to AX ! mov pm%,ax ;Move result to above% 'p% = img(pm%) 'Grab first value from virtual screen ! mov es,imgseg% ! mov di,ax ! mov al,es:[di] ! mov pixel%,al p% = pixel% ! mov dx,above% ;Move above% to DX - faster ! cmp p%,1 ;Compare p% to 1 ! jl Skip ;If it's less, Skip the pixel 'The next line is the "core" of the routine. It blurs the pixel 'by averaging the colours of the surrounding pixels. p% = div5(p%+img(pm%+1)+img(pm%-1)+img(pm%+320)+img(above%)) ! cmp p%,1 ;Compare p% to 1 ! jl Skip ;If it's less, Skip the pixel ! mov es,imgseg% ;Set mem segmet to img(0) location ! mov di,dx ;Set mem offset to above% (stored in DX) ! mov cl,p% ;Set colour to CL ! mov es:[di],cl ;Write to mem 'The following lines of code are basicly an assembler replacement of ' poke (above%),p%. MUCH more complex!!! ! mov es,screenseg% ;Move screen segment to ES ' ! stosb ;Write AL do DI at seg ES, and inc DI reg. ! mov es:[di],cl ;Write CL to DI @ ES Skip: ! cmp dx,31680 ;Are we at the bottom? ! je DoneFrame ;If so, the frame's done! ! jmp Begin ;Otherwise, carry on! DoneFrame: ! mov ax,f& ;Move frame counter var to AX ! inc ax ;Incr AX ! mov f&,ax ;Move back to f& ! in al,96 ;Get input from port 96 ! cmp al,1 ;Is it 1? ! je Done ;If so, exit the loop! loop Done: Finish! = timer ! mov ax,3 ;Return to text mode ! int &h10 screen 0 width 80 color 4 print "PBFiRE v6" color 8 print "---------" print color 7 print f&;"frames for";Finish!-Start!;"seconds." print "Did";f&/(Finish!-Start!);"frames per second." print color 8 print "Lycium '98" color 9 print "lycium@hotmail.com" color 7 system '=-=-=-=-=-=-=-=-=-=-=-=-=-= 'Credits!!! '----------- Matt Gulden (Folter) - For getting me started with PB!! Thankx man, u rule! mattg@thrillhaus.com, page www.THRILLHAUS.com (rocks!) Danny Beardsley - For helpin me out with all kindza stuff dsb@cyberdude.com, page www.dnai.com/~beards ABC archives - For being the best QBasic source ever! (And publishing this code) All the other people who made fire routines (Matt esp.), I learned from each one! You, for downloading this file, thus keeping basic alive!