+ Reply to Thread
Page 10 of 10 FirstFirst ... 8910
Results 91 to 99 of 99

Thread: GPU: Basic Tutorial by LeonBlade

  1. #91
    Wirererer Venompapa's Avatar
    Join Date
    Feb 2008
    Location
    Slovakia
    Posts
    179

    Default Re: GPU: Basic Tutorial by LeonBlade

    Quote Originally Posted by Black Phoenix View Post
    Some numbers cannot be represented by floating point number.
    But how you draw number like this in your video?

  2. #92
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default Re: GPU: Basic Tutorial by LeonBlade

    Here's code to that:
    Code:
    //Draw background
    mov #regWidth, 776;
    mov #regHeight,512;
    mov KS,63488
    dcvxpipe 1;
    dcolor c1; drect p1,p2;
    
    //Draw name
    mov #textpos.x,48; mov #textpos.y,48;
    dcolor c2; dsetsize 32; dwrite textpos,text1;
    
    //jmp Draw.Help;
    jmp Draw.Profiler;
      
    //----------------------------------------------------
    Draw.Help:
      mov #textpos.y,96;
      dsetsize 24; dwrite textpos,text3;
    dexit;
    
    //----------------------------------------------------
    Draw.Profiler:
    
      mov #CurSector,KS:#CDD_CurrentSector;
      mov #CurTrack,KS:#CDD_CurrentTrack;
      mov #CurCommand,KS:#CDD_Command; add #CurCommand,Command.Start; mov EAX,#CurCommand; mov #CurCommand,#EAX;
      mov #CurNotify,KS:#CDD_Notify; add #CurNotify,Notify.Start; mov EAX,#CurNotify; mov #CurNotify,#EAX;
      mov #CurDataState,KS:#CDD_Data; add #CurDataState,DataState.Start; mov EAX,#CurDataState; mov #CurDataState,#EAX;
      mov #CurBytesDone,KS:#CDD_BytesDone;
      mov #CurBytesTotal,KS:#CDD_TotalBytes;
      mov #CurSectorDone,#CurBytesDone; div #CurSectorDone,512;
      mov #CurSectorsTotal,#CurBytesTotal; div #CurSectorsTotal,512;
      mov #CurErrorCode,KS:#CDD_ErrorCode;
      mov #CurTimeout,KS:#CDD_Timeout;
      mov #CurDensity,KS:#CDD_Density;
      mov #CurTracks,KS:#CDD_DiskTracks;
    //  mov #CurFirstTrack,KS:#CDD_DiskFirstTrack;
      mov #CurCapacity,KS:#CDD_Capacity; div #CurCapacity,1024;
      mov #CurAngle,KS:#CDD_Angle; mul #CurAngle,100; fint #CurAngle; div #CurAngle,100;
      mov #CurVelocity,KS:#CDD_Vel; mul #CurVelocity,100; fint #CurVelocity; div #CurVelocity,100;
      mov #CurTargetVelocity,KS:#CDD_TVel;
    
      //Draw states
      mov #textpos.y,96;
      dsetsize 24; dwritefmt textpos,text2;
    
      //Draw disk
      mov #regCircleQuality,16; dcircle p3,88;
      mov EAX,#CurAngle;
      drotatescale eax,1; dmove p3; dshade 0.5;
      mov #regCircleQuality,8; dcircle 0,86;
      
      mov eax,#CurVelocity; sub eax,#CurTargetVelocity;
      add eax,1.57;
      drotatescale eax,1; dshade 0.5;
      mov #regCircleQuality,3; dcircle 0,32;
    dexit;
    
    //----------------------------------------------------
    string text1,'CDC Hardware Profiler';
    
    text2:
      db 'Sector: %i%tTrack:  %i',10,10;
      db 'Command:     %s',10;
      db 'Notify flag: %s',10;
      db 'Data state:  %s',10;
      db 'Bytes done:  %i of %i',10;
      db 'Sectors done:%i of %i',10;
      db 'Error code:  %i',10;
      db 'Timeout:     %i',10,10;
      db 'Disk stats:',10;
      db 'Density:     %i ipb',10;
      db 'Track count: %i',10;
      db 'Capacity:    %i KB',10;
      db 'Raw angle:   %f rad',10;
      db 'Velocity:    %f rad/s',0;
      
    alloc CurSector;
    alloc CurTrack;
    alloc CurCommand;
    alloc CurNotify;
    alloc CurDataState;
    alloc CurBytesDone;
    alloc CurBytesTotal;
    alloc CurSectorDone;
    alloc CurSectorsTotal;
    alloc CurErrorCode;
    alloc CurTimeout;
    alloc CurDensity;
    alloc CurTracks;
    //alloc CurFirstTrack;
    alloc CurCapacity;
    alloc CurAngle;
    alloc CurVelocity;
    alloc CurTargetVelocity;
    
    define CDD_Command,0;
    define CDD_Notify,1;
    define CDD_Data,2;
    define CDD_ErrorCode,3;
    define CDD_OpMode,4;
    define CDD_BlockStart,5;
    define CDD_BlockEnd,6;
    define CDD_BufferStart,7;
    define CDD_BufferEnd,8;
    define CDD_MotorMode,9;
    define CDD_CurrentSector,16;
    define CDD_CurrentTrack,17;
    define CDD_TotalBytes,18;
    define CDD_BytesDone,19;
    define CDD_BytesDonePercent,20;
    define CDD_DiskSectors,24;
    define CDD_DiskTracks,25;
    define CDD_DiskFirstTrack,26;
    define CDD_Capacity,27;
    define CDD_Density,28;
    define CDD_Angle,29;
    define CDD_Vel,30;
    define CDD_TVel,31;
    define CDD_Timeout,21;
    
    string Command0,'IDLE';
    string Command1,'IDLE_NOSPIN';
    string Command2,'IDLE_FASTSPIN';
    string Command3,'WRITE';
    string Command4,'READ';
    string Command5,'TEST';
    string Command6,'SCAN';
    string Command7,'ERASE';
    string Command8,'INITIALIZE';
    Command.Start:
      db Command0,Command1,Command2,Command3,Command4;
      db Command5,Command6,Command7,Command8;
    Command.End:
    
    string Notify0,'READY/OK';
    string Notify1,'NEW_DISK';
    string Notify2,'NO_DISK';
    string Notify3,'INIT';
    string Notify4,'BUSY';
    string Notify5,'DISK ERROR';
    string Notify6,'EJECTED';
    Notify.Start:
      db Notify0,Notify1,Notify2,Notify3,Notify4,Notify5,Notify6;
    Notify.End:
    
    string DataState0,'NO DATA';
    string DataState1,'PARTIAL DATA';
    string DataState2,'DATA PRESENT';
    DataState.Start:
      db DataState0,DataState1,DataState2;
    DataState.End:
    
    text3:
      db '(C) 2009 Black Phoenix',10,
      db 'NUM7 to perform READ',10;
      db 'NUM9 to perform WRITE',10;
      db 'NUM8 to compare dest & src',10,10;
      db 'Attach requested size to P0',10;
      db 'Result of comparsion is out',10;
      db 'to P7',10,10;
      db 'Press NUM5 to perform TEST',10;
      db '(result into P7, full disk)',0;
    
    vec2f textpos;
    
    color c1,64,64,64;
    color c2,255,255,255;
    
    vec2f p1,32,32;
    vec2f p2,746,488;
    vec2f p3,630,380;
    Or more exactly, this is what you're interested in:
    Code:
      mov #CurAngle,KS:#CDD_Angle; mul #CurAngle,100; fint #CurAngle; div #CurAngle,100;
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  3. #93
    Wirererer Venompapa's Avatar
    Join Date
    Feb 2008
    Location
    Slovakia
    Posts
    179

    Default Re: GPU: Basic Tutorial by LeonBlade

    Thanks you Phoenix. This code is helped a lot.

  4. #94
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default Re: GPU: Basic Tutorial by LeonBlade

    Quote Originally Posted by Venompapa View Post
    Thanks you Phoenix. This code is helped a lot.
    Do you think I should post source to all of my neat GPU programs? Well, only code, and a screenshot, nothing more (maybe a video).
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  5. #95
    Wirererer Venompapa's Avatar
    Join Date
    Feb 2008
    Location
    Slovakia
    Posts
    179

    Default Re: GPU: Basic Tutorial by LeonBlade

    Quote Originally Posted by Black Phoenix View Post
    Do you think I should post source to all of my neat GPU programs? Well, only code, and a screenshot, nothing more (maybe a video).
    I do not think this but i can now learning from this gpu code.

  6. #96
    Wire Amateur xThaWolfx's Avatar
    Join Date
    Sep 2009
    Location
    The Netherlands
    Posts
    41

    Default Re: GPU: Basic Tutorial by LeonBlade

    how do i make a circle that goes lower the faster you go..
    i got this, but the circle isnt moving:

    mov eax,port0;
    mov ebx,port1;
    dcolor white;
    _cookie_:
    dcircle KM,20;
    dsetsize 54;
    dwritef S,eax;
    jg _cookie_;
    dexit;

    color white,255,255,255;

    vec2f S,200,256;

    vec2f KM,400,ebx;
    also, the ebx is rounded speed multiplied by 6.4, cuz the max speed of a jeep is about 80km/h.
    and is there a maximum of 4 inputs?
    because the only things i can find for moving to a port is aex abx acx and adx D:
    Last edited by xThaWolfx; 11-15-2009 at 09:20 AM.

  7. #97
    Wire Noob goz3rr's Avatar
    Join Date
    Aug 2008
    Posts
    15

    Default Re: GPU: Basic Tutorial by LeonBlade

    Quote Originally Posted by xThaWolfx View Post
    how do i make a circle that goes lower the faster you go..
    i got this, but the circle isnt moving:
    Code:
    mov eax,port0;
    mov ebx,port1;
    dcolor white;
    _cookie_:
    dcircle KM,20;
    dsetsize 54;
    dwritef S,eax;
    jg _cookie_;
    dexit;
    
    color white,255,255,255;
    
    vec2f S,200,256;
    
    vec2f KM,400,ebx;
    also, the ebx is rounded speed multiplied by 6.4, cuz the max speed of a jeep is about 80km/h.
    and is there a maximum of 4 inputs?
    because the only things i can find for moving to a port is aex abx acx and adx D:
    Code:
    mov eax,port0;
    mov ebx,port1;
    dcolor white;
    
    _cookie_:
    add #KM.y,ebx;
    dcircle KM,20;
    dsetsize 54;
    dwritef S,eax;
    jump _cookie_;
    
    dexit;
    
    color white,255,255,255;
    
    vec2f S,200,256;
    
    vec2f KM,400,50;
    You used JG which means Jump if Greater
    You didnt have any comparision so it wouldnt do anything ;P
    I've also made the KM Y value update everytime with "add", The circle starts at a value of 50, And then adds ebx.

  8. #98
    Wire Noob Danman's Avatar
    Join Date
    Mar 2010
    Posts
    4

    Default Re: GPU: Basic Tutorial by LeonBlade

    I am in your debt LeonBlade.

  9. #99
    Alopex Lagopus DanKing's Avatar
    Join Date
    Aug 2009
    Location
    Bergen, Norway
    Posts
    632

    Default Re: GPU: Basic Tutorial by LeonBlade

    Quote Originally Posted by goz3rr View Post
    Code:
    mov eax,port0;
    mov ebx,port1;
    dcolor white;
    
    _cookie_:
    add #KM.y,ebx;
    dcircle KM,20;
    dsetsize 54;
    dwritef S,eax;
    jump _cookie_;
    
    dexit;
    
    color white,255,255,255;
    
    vec2f S,200,256;
    
    vec2f KM,400,50;
    You used JG which means Jump if Greater
    You didnt have any comparision so it wouldnt do anything ;P
    I've also made the KM Y value update everytime with "add", The circle starts at a value of 50, And then adds ebx.
    Might be a little late to say this, but inf loop alert?
    At the _cookie_ part, you keep running that without ending it.

+ Reply to Thread
Page 10 of 10 FirstFirst ... 8910

LinkBacks (?)


Similar Threads

  1. Need help with basic if's
    By Echo51 in forum Expression 2 Discussion & Help
    Replies: 3
    Last Post: 02-27-2009, 04:36 PM
  2. Need Some Not-So-Basic Help
    By DarthRogue in forum Installation and Malfunctions Support
    Replies: 4
    Last Post: 08-05-2008, 05:08 AM
  3. basic if then statements
    By FuzzMaster in forum Installation and Malfunctions Support
    Replies: 3
    Last Post: 03-08-2008, 09:08 PM
  4. Putting a video tutorial in the gmod tutorial list
    By Def the world in forum Installation and Malfunctions Support
    Replies: 1
    Last Post: 08-21-2007, 10:04 PM

Tags for this Thread

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