+ Reply to Thread
Results 1 to 4 of 4

Thread: CPU Numpad

  1. #1
    Wire Amateur Kybe's Avatar
    Join Date
    Dec 2007
    Posts
    39

    Arrow

    Im Using the follow code for my calculator numpad.

    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-spacere;overflow:auto'>run:
    mov ebx,port0;
    mov port1,eax;

    cmp ebx,1
    je add1;


    cmp ebx,2
    je add2;



    cmp ebx,3
    je add3;



    cmp ebx,4
    je add4;



    cmp ebx,5
    je add5;



    cmp ebx,6
    je add6;



    cmp ebx,7
    je add7;



    cmp ebx,8
    je add8;



    cmp ebx,9
    je add9;



    cmp ebx,10
    je add10;

    jmp run;




    add1:
    mul eax,10;
    add eax,1;
    jmp run;

    add2:
    mul eax,10;
    add eax,2;
    jmp run;

    add3:
    mul eax,10;
    add eax,3;
    jmp run;

    add4:
    mul eax,10;
    add eax,4;
    jmp run;

    add5:
    mul eax,10;
    add eax,5;
    jmp run;

    add6:
    mul eax,10;
    add eax,6;
    jmp run;

    add7:
    mul eax,10;
    add eax,7;
    jmp run;

    add8:
    mul eax,10;
    add eax,8;
    jmp run;

    add9:
    mul eax,10;
    add eax,9;
    jmp run;

    add10:
    mul eax,10;
    add eax,0;
    jmp run;

    </div>

    If anyone could find bugs and how to set up that adv stuff... that would be great...

    PS My steam name is 13lackM35a
    PSS I <3 you!
    Hexakosioihexekontahexaphobia is a word.



  2. #2
    Wire Amateur Chezzestix's Avatar
    Join Date
    Jun 2007
    Location
    Dallas, TX USA
    Posts
    74

    Default

    I would love to help you out there Kybe and I understand what you code is trying to accomplish so far but what is the problem? As far as setting up "that adv stuff" I&#39;m not sure what you mean.


    ...I wish I understood me.

  3. #3
    Wire Sofaking Fatal_Exception's Avatar
    Join Date
    Oct 2007
    Location
    New Zealand
    Posts
    412

    Default

    How about:
    Code:
    run:
    mov ebx,port0;
    
    // Two comparisons do the work of ten.
    cmp ebx,1;
    jl run;********// ebx <**1 - > do nothing
    cmp ebx,10;** 
    jg run;********// ebx >**10 -> do nothing
    jl __add;******// ebx <**10 -> add ebx
    mov ebx,0;**** // ebx == 10 -> set ebx to 0 (add 0)
    jmp __add;
    
    mov port1,eax; // output after we&#39;ve done our calculation, not before
    
    __add:******** // underscores added because we can&#39;t use &#39;add&#39; for a label
    mul eax,10;
    add eax,ebx;** // simply add ebx, instead of several blocks adding constants.
    jmp run;

  4. #4
    Wire Amateur Kybe's Avatar
    Join Date
    Dec 2007
    Posts
    39

    Default

    Oh wow, that looks a lot simpler. Im typing this from inside GMod using a GMod web browser FIREBOX FTW!
    Hexakosioihexekontahexaphobia is a word.



+ Reply to Thread

Similar Threads

  1. e2 Gyropod numpad heelp!
    By Toyokunari in forum Expression 2 Discussion & Help
    Replies: 3
    Last Post: 01-27-2010, 12:47 PM
  2. Numpad input / output
    By Divran in forum Ideas & Suggestions
    Replies: 10
    Last Post: 03-03-2009, 11:17 AM
  3. E2: Get Keys / Numpad
    By MrFaul in forum Ideas & Suggestions
    Replies: 5
    Last Post: 02-04-2009, 01:40 PM
  4. Numpad Output bug
    By andy1976uk in forum Bug Reports Archive
    Replies: 7
    Last Post: 01-08-2008, 01:30 PM

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