Shop OBEX P1 Docs P2 Docs Learn Events
Need a DEC method — Parallax Forums

Need a DEC method

NewzedNewzed Posts: 2,503
edited 2007-09-29 17:12 in Propeller 1
For Mike Green:

Mike, I am trying to write a program with an ADC for VGA display.· My VGA object is:

VGA_1280x1024_Tile_Driver_With_Cursor

The methods I have will write a string or a character but not a decimal number.· Do you have time to write a method for me that will let me display decimals?

Thanks

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.

That is why they call it the present.

Don't have VGA?
Newzed@aol.com
·

Comments

  • mynet43mynet43 Posts: 644
    edited 2007-09-29 17:12
    Sid,

    You could try this:

    PUB dec(value) | i
    
    '' Print a decimal number
    
      if value < 0
        -value
        out("-")
    
      i := 1_000_000_000
    
      repeat 10
        if value => i
          out(value/i + "0")
          value //= i
          result~~
        elseif result or i == 1
          out("0")
        i /= 10
    
    



    Jim
Sign In or Register to comment.