+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: Gpu HandBook

  1. #1
    Wire Sofaking
    Hitman271 has a spectacular aura about Hitman271 has a spectacular aura about Hitman271's Avatar
    Join Date
    Feb 2008
    Location
    Why? You looking for somebody?
    Posts
    705

    Default Gpu HandBook

    Why, Hello World!

    I have created a large repository of gpu coding, opcodes, and basic know-how. I have also commented on all parts and have tested the code.

    I got the inspiration from having to go into my many programs just to remember a certain memory location, mnemonic, etc.

    This code can also be quick loaded and viewed!

    Due to the comments being justified to wiremod.com, there is a txt version for download that will keep everything where it should.

    Feel free to use, re-distribute, comment, etc. on this code

    Code:
    // 	Compiled/Commented by Hitman271
    
    dentrypoint 0,_EntryHere		// Dentrypoint makes the gpu start reading code at _EntryHere
    	mov #deg2rad,3.141592		// Degrees to radians
    	div #deg2rad,180
    
    	timer #GpuSpawn				// Timer sets GpuSpawn to the current curtime of the server, this is done here 
    								//so that I know the exact time this gpu was spawned
    dexit
    
    ///// FIELD /////
    _EntryHere:
    	dcvxpipe 2						//Co-ords in gpu have to be from 0..1 to be displayed now
    	dclrscr BackGround_Color		//Clear the screen to this color
    	dsetsize 24						//Set font size to 24
    	dsetwidth 0.001					//Set line widths to 0.001 i.e. - (dline pos,pos2)
    	dcolor Test_Color				//Set the color for things drawn to this color
    
    	jmp Cursors						//I skip the code below as it is only for reference
    
    ///// FIELD /////
    CircleStuff:
    	mov eax,#deg2rad
    	mul eax,360			// I want 2*pi
    
    	mov #65478,0		//Start of circle
    	mov #65477,eax		//end of circle, at 2*pi
    	
    						//Any circle drawn now will be from 0-2pi, or 0-360 degrees
    						//Go learn trig if you haven't by now
    						
    						//Also, by default the end of circles is already at 2*pi
    						//Setting the circle end to pi would make a semi-circle
    
    ///// FIELD /////
    2dRenders:
    	drectwh MidPos,Dim			//Draw a rectangle with top-left point at MidPos and dimensions of Dim( or 0.1, 0.1 )
    
    	dcircle MidPos,#TestRadius	//Draw a circle with a Center of MidPos and a radius of TestRadius
    
    	dline MidPos,TextPos		//Draw a line from MidPos to TextPos
    	
    	dorectwh Point1,Point3		//This draws an outlined rectangle
    								//This rectangle has nothing inside but is just 4 lines
    
    	dvxpoly TestPoly,3			//Draw a polygon
    								//In the code, TestPoly is a label
    								//The compiler is pointed to TestPoly and reads 3 points
    								//These points are plotted and line drawn between them
    								//Dcolor applies to this aswell
    
    ///// FIELD /////
    3dRenders:
    	//Haha, no
    
    ///// FIELD /////
    Pixelation:
    	mov #65533,0		//This sets hardware clear to 0
    						//With no clearing, everything drawn stays on-screen
    						//So a box drawn will appear to "smudge" if moved every frame
    						//This is how Pamento was created
    
    	dcolor UnitColor	//This color is just 1,1,1
    	dshade 255			//Dshade multiplies the dcolor color (UnitColor) by 255
    						//So now the color is 255, 255, 255
    
    ///// FIELD /////
    Cursors:
    	mov #65503,1			//With this on, whenever you have your cursor on the gpu an arrow will be drawn on the cursor
    
    	mov #Cursor.X,#65505	//The X componet of the cursor
    	mov #Cursor.Y,#65504	//The Y componet of the cursor
    
    	vmov TextPos,Cursor		//The Text is moved to the cursor so you can move the text around
    
    	jmp RealCode			//Skip again
    
    ///// FIELD /////
    Strings:
    	mov #StringHere,CoderWho		//Under TestString, this is defined
    	mov #FloatHere,#deg2rad			//Under TestString, this is defined
    	mov #IntegerHere,#GpuSpawn		//Under TestString, this is defined
    	
    	dwritefmt TextPos,TestString	//TestString is a formatted string, so we tell the compiler this
    	
    									//Formatted strings have a % parameter in them
    									//Along with variable directly under them that point to other variables
    									
    									//Parameters are
    									// %f - floats
    									// %s - strings
    									// %i - integers, or rounded floats
    									// %t - tab (not in code), should be same as tab key?
    
    ///// FIELD /////
    Vectors:
    	vmov RegisterVector,F1			//Setting it equal to
    	vsub RegisterVector,F2			//Substracts the vectors
    
    	vlen eax,RegisterVector			//Eax = 2 ^ 0.5		//Gets vector magnitude
    
    	vnorm RegisterVector,RegisterVector	//First vector is set to the normalized vector of the second
    										//Here, I just set a vector to its normalized self
    
    	vmul RegisterVector,2			//Vector multiplied by scalar
    
    	mov #RegisterVector.x,0			//The x's and y's of vectors have certain stack locations and can be treated like this
    	mov #RegisterVector.y,0
    
    	vmov RegisterVector,F2
    	xchg #RegisterVector.x,#RegisterVector.y	//Exchanges the first parameter with the second ( x,y = y,x )
    	neg #RegisterVector.y	//This is now perpendicular to F2, Negates the parameter
    
    ///// FIELD /////
    RealCode:
    	timer #Uptime
    	sub #Uptime,#GpuSpawn		//TimeNow - TimeSpawned
    	
    	mul #Uptime,10				//This is done to get to 1 decimal precision
    	fint #Uptime
    	div #Uptime,10
    
    	mov #String1,CoderWho
    
    	dwritefmt TextPos,TExt
    dexit
    
    ///// FIELD /////
    		//GPU: VARIABLES, DATA, AND ALL-AROUND TOM-FOOLERY
    ///// FIELD /////
    color BackGround_Color, 51, 54, 77
    color Test_Color, 103, 126, 43
    color UnitColor, 1, 1, 1
    
    float deg2rad
    float TestRadius, 0.1
    float GpuSpawn
    
    vec2f TextPos, 0.05, 0.4
    vec2f Dim, 0.1, 0.1
    vec2f MidPos, 0.5, 0.5
    vec2f Cursor
    
    vec2f F1, 0, 0
    vec2f F2, 1, 1
    vec2f RegisterVector
    
    string CoderWho, 'Compiled by Hitman271'
    string TExt, 'You can move me around!',10,'Look in my code for handbook!'10' Gpu Uptime: %f seconds'10,10'%s'
    	float Uptime
    	alloc String1
    
    string TestString, 'String 1: %s '10' Float 1: %f '10' Integer 1: %i'
    	alloc StringHere
    	alloc FloatHere
    	alloc IntegerHere
    	
    //The 10 is ascii for "new line", or equivalent to enter key	
    
    TestPoly:	//sides=3 ,All consecutive points
    	vec2f Point1, 0.5, 0.1
    	vec2f Point2, 0.1, 0.9
    	vec2f Point3, 0.9, 0.9
    
    Attached Files
    Quote Originally Posted by Anticept View Post
    This is not some place where you can toss your dick around and expect people to suck it.
    Community Gpu Thread. Post Yours!

    Bouncy Ball

  2. #2
    Inactive grandpapolly is on a distinguished road grandpapolly's Avatar
    Join Date
    Aug 2008
    Posts
    284

    Default Re: Gpu HandBook

    Wow, this is really handy! It's like a GPU Mini Cheat Sheet! Thank you so much.

    Have my babies.

  3. #3
    Wire Sofaking
    Hitman271 has a spectacular aura about Hitman271 has a spectacular aura about Hitman271's Avatar
    Join Date
    Feb 2008
    Location
    Why? You looking for somebody?
    Posts
    705

    Default Re: Gpu HandBook

    I already eated thems OM NOM NOM NOM
    Quote Originally Posted by Anticept View Post
    This is not some place where you can toss your dick around and expect people to suck it.
    Community Gpu Thread. Post Yours!

    Bouncy Ball

  4. #4
    Wire Sofaking
    Hitman271 has a spectacular aura about Hitman271 has a spectacular aura about Hitman271's Avatar
    Join Date
    Feb 2008
    Location
    Why? You looking for somebody?
    Posts
    705

    Default Re: Gpu HandBook

    bump

    (bump is too short :O )
    Quote Originally Posted by Anticept View Post
    This is not some place where you can toss your dick around and expect people to suck it.
    Community Gpu Thread. Post Yours!

    Bouncy Ball

  5. #5
    That furred thing
    Black Phoenix has a spectacular aura about Black Phoenix has a spectacular aura about Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,273

    Default Re: Gpu HandBook

    Makes sense to bump thread in a forum with only 5 threads
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5


  6. #6
    Wire Sofaking
    Hitman271 has a spectacular aura about Hitman271 has a spectacular aura about Hitman271's Avatar
    Join Date
    Feb 2008
    Location
    Why? You looking for somebody?
    Posts
    705

    Default Re: Gpu HandBook

    lol, the real question is to how many people even know about this sub-forum
    Quote Originally Posted by Anticept View Post
    This is not some place where you can toss your dick around and expect people to suck it.
    Community Gpu Thread. Post Yours!

    Bouncy Ball

  7. #7
    Spucatum Tauri Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    4,702

    Default Re: Gpu HandBook

    I think this needs to be stickied.
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

  8. #8
    Lurker LeonBlade is on a distinguished road LeonBlade's Avatar
    Join Date
    Apr 2009
    Location
    Blossvale, NY
    Posts
    78

    Default Re: Gpu HandBook

    Yeah, well I think my post should be sticked too, then again, it's supposed to be in this sub-forum and no body has corrected me.

    Lol.
    Code:
    if (powerLevel > 9000) {
         print "IT'S OVER 9000!!!11";
    }
    
    Code:
    mov #status,1337
    

  9. #9
    Wire Noob SuperMarioKarter is on a distinguished road SuperMarioKarter's Avatar
    Join Date
    Feb 2009
    Posts
    28

    Default Re: Gpu HandBook

    I know this sounds dumb, but I'm having trouble adding inputs to the GPU. I know how to wire up the data port and such, but how do you represent it in the code?

  10. #10
    Wire Sofaking
    Hitman271 has a spectacular aura about Hitman271 has a spectacular aura about Hitman271's Avatar
    Join Date
    Feb 2008
    Location
    Why? You looking for somebody?
    Posts
    705

    Default Re: Gpu HandBook

    Quote Originally Posted by SuperMarioKarter View Post
    I know this sounds dumb, but I'm having trouble adding inputs to the GPU. I know how to wire up the data port and such, but how do you represent it in the code?
    Let's say you wired 1337 to port0 of the data port.
    Code:
    //Do this in the code to read it
    
    in eax,0
    //EAX is now port0
    
    Quote Originally Posted by Anticept View Post
    This is not some place where you can toss your dick around and expect people to suck it.
    Community Gpu Thread. Post Yours!

    Bouncy Ball

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots