+ Reply to Thread
Results 1 to 6 of 6

Thread: Mov Strings?

  1. #1
    Wire Amateur LeonBlade's Avatar
    Join Date
    Apr 2009
    Location
    Blossvale, NY
    Posts
    77

    Exclamation Mov Strings?

    Heylo,

    I'm working on a little something in the GPU.
    Basically I'm having port3 input a number either 0 or 1 for the ON or OFF status.

    I want to be able to cmp port3,1 and if it's 1 then I write ON on the screen with the color GREEN and if not then write OFF on the screen with the color RED.

    I was thinking just use mov #onoffstr,"ON" but that doesn't work right...
    And I also need to figure out how to change color too...

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

  2. #2
    Wire Sofaking Bobsymalone's Avatar
    Join Date
    Jul 2008
    Posts
    770

    Default Re: Mov Strings?

    Quote Originally Posted by LeonBlade View Post
    Heylo,

    I'm working on a little something in the GPU.
    Basically I'm having port3 input a number either 0 or 1 for the ON or OFF status.

    I want to be able to cmp port3,1 and if it's 1 then I write ON on the screen with the color GREEN and if not then write OFF on the screen with the color RED.

    I was thinking just use mov #onoffstr,"ON" but that doesn't work right...
    And I also need to figure out how to change color too...

    Thanks,
    LeonBlade
    Admittedly I'd have to check the comments in the lua to be completely sure of the order of arguments in some of the opcodes, but you probably know those and this will give you the basic idea despite any mistakes:
    Code:
    dcolor white
    cmp port3,1
    ce _on
    cne _off    // I don't think you have to use cmp twice, it stores the result I think.
    dexit
    
    _on:
    dwrite pos,on
    ret
    
    _off:
    dwrite pos,off
    ret
    
    color white,255,255,255
    vec2f pos,255,255
    string on,'on'
    string off,'off'
    The alternative would be to write ASCII values for the new string over the old one, but it seems overcomplicated for a simple on/off. You have to do it if you want to dynamically display data in strings.
    EDIT: Come to think of it, you could use mcopy to overwrite the old string, but again it seems a bit complicated for on/off.
    Last edited by Bobsymalone; 05-31-2009 at 08:55 PM. Reason: Forgot to set colour in code

  3. #3
    Wire Amateur LeonBlade's Avatar
    Join Date
    Apr 2009
    Location
    Blossvale, NY
    Posts
    77

    Default Re: Mov Strings?

    Cool man, thanks a lot works just fine!
    I didn't know about ce and cne.

    What is the difference between ce and je and etc?
    Code:
    if (powerLevel > 9000) {
         print "IT'S OVER 9000!!!11";
    }
    Code:
    mov #status,1337

  4. #4
    Wire Sofaking Bobsymalone's Avatar
    Join Date
    Jul 2008
    Posts
    770

    Default Re: Mov Strings?

    Quote Originally Posted by LeonBlade View Post
    Cool man, thanks a lot works just fine!
    I didn't know about ce and cne.

    What is the difference between ce and je and etc?
    If you jump, you can't ret I don't think. You can jump to a set label but not go back to the point in the code where you jumped.
    With call, you can.

    Something along those lines.

  5. #5
    Wire Sofaking Hitman271's Avatar
    Join Date
    Feb 2008
    Location
    Why? You looking for somebody?
    Posts
    731

    Default Re: Mov Strings?

    call - non-conditional call
    ce - call if equal
    cne - call if not equal
    cl - call if less than
    cle - call if less or equal
    cg - call if greater than
    cge - call if greater than or equal

    jmp - non-conditional jump
    For the jump ones, just replace the c with a j lol
    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

  6. #6
    Wire Amateur A.K.A.Steve's Avatar
    Join Date
    May 2009
    Posts
    38

    Default Re: Mov Strings?

    Lol, wish I knew about those conditional calls before, I've had to play with my code so that it would work with jumps lol

+ Reply to Thread

Similar Threads

  1. Using Strings to call arrays
    By Bean in forum Installation and Malfunctions Support
    Replies: 1
    Last Post: 04-22-2009, 12:34 PM
  2. Inputting/Outputting strings in CPU
    By Boltshot in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 0
    Last Post: 04-12-2009, 09:32 AM
  3. Strings
    By kklouzal in forum Wiremod Addons & Coding
    Replies: 3
    Last Post: 07-23-2008, 03:55 AM
  4. strings in the ex gate
    By nanotech fur in forum Installation and Malfunctions Support
    Replies: 5
    Last Post: 10-19-2007, 12:28 AM

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