Shop OBEX P1 Docs P2 Docs Learn Events
Could someone please look over my code? — Parallax Forums

Could someone please look over my code?

SONIC the HedgehogSONIC the Hedgehog Posts: 321
edited 2012-02-08 07:01 in Propeller 1
So I haven't really gotten into propeller assembly enough to use it for this simple......program you could say.
So I've been making a graphics demo. I used the AiGeneric driver that Oldbitcollecter used in the lightcycle demo as a starting point. And I'd like a professional opinion as to why or why not my code would work so I may improve upon it, thanks!
' ' File: Sonic on prop graphic demo
CON 
            clkmode =xtal1 +pl16x
** * * * *xinfreq** =5_000_000
** * * * *UpdateTime = 24_000_000
VAR
byte CogLaunch[1000]

OBJ*
*text * : *"aigeneric_driver_g"

PUB CogLauncher
cognew(VidDatBuf1, @CogLaunch[0])
cognew(VidDatBuf2, @CogLaunch[500])

PUB DisplayBuffer
Repeat
** waitcnt(clkfreq/UpdateTime + cnt)
** text.UpdateScreen

PUB VidDatBuf1
*text.pokechar(6,4,21,"#")
**text.pokechar(7,4,21,"#")
** text.pokechar(8,3,21,"#")
**text.pokechar(8,4,21,"#")
**text.pokechar(8,5,21,"#")
**text.pokechar(9,3,21,"#")
**text.pokechar(9,4,21,"#")
**text.pokechar(9,5,21,"#")
**text.pokechar(10,3,21,"#")
**text.pokechar(10,4,21,"#") *
**text.pokechar(10,5,21,"#")
**text.pokechar(11,3,21,"#")
**text.pokechar(11,4,21,"#")
**text.pokechar(11,5,21,"#")
**text.pokechar(11,6,21,"#")
**text.pokechar(12,2,21,"#")
**text.pokechar(12,3,21,"#")
**text.pokechar(12,4,21,"#")
**text.pokechar(12,5,21,"#")
**text.pokechar(12,6,21,"#")
**text.pokechar(12,7,21,"#")
**text.pokechar(13,2,21,"#")
**text.pokechar(13,3,21,"#")
**text.pokechar(13,4,21,"#")
**text.pokechar(13,5,21,"#")
**text.pokechar(13,6,21,"#")
** text.pokechar(13,7,21,"#")
**text.pokechar(14,2,21,"#")
**text.pokechar(14,3,21,"#")
**text.pokechar(14,4,21,"#")
**text.pokechar(14,5,21,"#")
**text.pokechar(14,6,21,"#")
**text.pokechar(14,7,21,"#")
**text.pokechar(15,2,21,"#")
**text.pokechar(15,3,21,"#")
**text.pokechar(15,4,21,"#")
*text.pokechar(15,5,6,"#") ' ' sonics ear left
**text.pokechar(15,6,6,"#") ' ' sonics ear left
**text.pokechar(15,7,6,"#") ' ' sonics ear left
**text.pokechar(16,2,21,"#")
**text.pokechar(16,3,21,"#")
**text.pokechar(16,4,6,"#") ' ' sonics ear left
**text.pokechar(16,5,6,"#") ' ' sonics ear left
**text.pokechar(16,6,6,"#") ' ' sonics ear left
**text.pokechar(16,7,6,"#") ' ' sonics ear left
** text.pokechar(17,2,21,"#")
**text.pokechar(17,3,21,"#")
**text.pokechar(17,4,21,"#")
**text.pokechar(17,5,7,"#")*
text.pokechar(17,6,6,"#") ' ' sonics ear left
**text.pokechar(17,7,6,"#") ' ' sonics ear left
*text.pokechar(18,2,21,"#")
**text.pokechar(18,3,21,"#")
**text.pokechar(18,4,21,"#")
*text.pokechar(18,5,21,"#")*
*text.pokechar(18,6,21,"#")*
*text.pokechar(18,7,6,"#") ' ' sonics ear left
*text.pokechar(19,3,21,"#")
**text.pokechar(19,4,21,"#")
*text.pokechar(19,5,21,"#")*
*text.pokechar(19,6,21,"#")*
*text.pokechar(19,7,21,"#")*
*text.pokechar(20,4,21,"#")
*text.pokechar(20,5,21,"#")*
*text.pokechar(20,6,21,"#")*
*text.pokechar(20,7,21,"#")

PUB VidDatBuf2
*text.pokechar(21,4,21,"#")
*text.pokechar(21,5,21,"#")*
*text.pokechar(21,6,21,"#")*
*text.pokechar(21,7,21,"#")
*text.pokechar(22,5,21,"#")*
*text.pokechar(22,6,21,"#")*
*text.pokechar(22,7,21,"#")
*text.pokechar(23,5,21,"#")*
*text.pokechar(23,6,21,"#")*
*text.pokechar(23,7,21,"#")
*text.pokechar(24,6,21,"#")*
*text.pokechar(24,7,21,"#")
text.pokechar(25,5,21,"#") *' ' sonic's right ear
*text.pokechar(25,6,21,"#") ' ' sonic's right ear
*text.pokechar(25,7,21,"#") ' ' sonic's right ear
text.pokechar(26,4,21,"#") *' ' sonic's right ear
*text.pokechar(26,5,21,"#")*' ' sonic's right ear
*text.pokechar(26,6,21,"#")*' ' sonic's right ear
*text.pokechar(26,7,21,"#")*' ' sonic's right ear
*text.pokechar(20,8,21,"#")
*text.pokechar(21,8,21,"#")*
*text.pokechar(22,8,21,"#")*
*text.pokechar(23,8,21,"#")
*text.pokechar(24,8,21,"#")*
*text.pokechar(25,8,21,"#")
*text.pokechar(26,8,21,"#")
text.pokechar(20,9,21,"#")
*text.pokechar(21,9,21,"#")*
*text.pokechar(22,9,21,"#")*
*text.pokechar(23,9,21,"#")
*text.pokechar(24,9,21,"#")*
*text.pokechar(25,9,21,"#")
*text.pokechar(26,9,21,"#")

Comments

  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-07 18:36
    Oh and please disregard the stars, I'm not sure how they got there, I promise my code was clean!
  • BrowserBrowser Posts: 84
    edited 2012-02-07 19:00
    Oh and please disregard the stars, I'm not sure how they got there, I promise my code was clean!
    phil wil speek for me heer:
    I looked at your edit screen, and the asterisks are present there. So it's not the forum software that put them there. Which IDE are you using and how did you do the cut-and-paste to the forum?

    -Phil

    -browz
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-07 19:09
    Well you could say that I love to program and learn for/about spin, so not even not having a keyboard will stop me! I used the Microsoft onscreen keyboard for basic functions, but I type the actual code on an app for my iPad called notes. I needed to indent to make the repeat work, so I did that, and there were one, two and sometimes three spaces. After that I highlighted everything, hit the copy, and then pasted it inbetween the code brackets.
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-07 19:12
    ' ' File: Sonic on prop graphic demo
    CON*
    ** * * * *clkmode =xtal1 +pl16x
    ** * * * *xinfreq** =5_000_000
    ** * * * *UpdateTime = 24_000_000
    VAR
    byte CogLaunch[1000]

    OBJ*
    *text * : *"aigeneric_driver_g"

    PUB CogLauncher
    cognew(VidDatBuf1, @CogLaunch[0])
    cognew(VidDatBuf2, @CogLaunch[500])

    PUB DisplayBuffer
    Repeat
    ** waitcnt(clkfreq/UpdateTime + cnt)
    ** text.UpdateScreen

    PUB VidDatBuf1
    *text.pokechar(6,4,21,"#")
    **text.pokechar(7,4,21,"#")
    ** text.pokechar(8,3,21,"#")
    **text.pokechar(8,4,21,"#")
    **text.pokechar(8,5,21,"#")
    **text.pokechar(9,3,21,"#")
    **text.pokechar(9,4,21,"#")
    **text.pokechar(9,5,21,"#")
    **text.pokechar(10,3,21,"#")
    **text.pokechar(10,4,21,"#") *
    **text.pokechar(10,5,21,"#")
    **text.pokechar(11,3,21,"#")
    **text.pokechar(11,4,21,"#")
    **text.pokechar(11,5,21,"#")
    **text.pokechar(11,6,21,"#")
    **text.pokechar(12,2,21,"#")
    **text.pokechar(12,3,21,"#")
    **text.pokechar(12,4,21,"#")
    **text.pokechar(12,5,21,"#")
    **text.pokechar(12,6,21,"#")
    **text.pokechar(12,7,21,"#")
    **text.pokechar(13,2,21,"#")
    **text.pokechar(13,3,21,"#")
    **text.pokechar(13,4,21,"#")
    **text.pokechar(13,5,21,"#")
    **text.pokechar(13,6,21,"#")
    ** text.pokechar(13,7,21,"#")
    **text.pokechar(14,2,21,"#")
    **text.pokechar(14,3,21,"#")
    **text.pokechar(14,4,21,"#")
    **text.pokechar(14,5,21,"#")
    **text.pokechar(14,6,21,"#")
    **text.pokechar(14,7,21,"#")
    **text.pokechar(15,2,21,"#")
    **text.pokechar(15,3,21,"#")
    **text.pokechar(15,4,21,"#")
    *text.pokechar(15,5,6,"#") ' ' sonics ear left
    **text.pokechar(15,6,6,"#") ' ' sonics ear left
    **text.pokechar(15,7,6,"#") ' ' sonics ear left
    **text.pokechar(16,2,21,"#")
    **text.pokechar(16,3,21,"#")
    **text.pokechar(16,4,6,"#") ' ' sonics ear left
    **text.pokechar(16,5,6,"#") ' ' sonics ear left
    **text.pokechar(16,6,6,"#") ' ' sonics ear left
    **text.pokechar(16,7,6,"#") ' ' sonics ear left
    ** text.pokechar(17,2,21,"#")
    **text.pokechar(17,3,21,"#")
    **text.pokechar(17,4,21,"#")
    **text.pokechar(17,5,7,"#")*
    text.pokechar(17,6,6,"#") ' ' sonics ear left
    **text.pokechar(17,7,6,"#") ' ' sonics ear left
    *text.pokechar(18,2,21,"#")
    **text.pokechar(18,3,21,"#")
    **text.pokechar(18,4,21,"#")
    *text.pokechar(18,5,21,"#")*
    *text.pokechar(18,6,21,"#")*
    *text.pokechar(18,7,6,"#") ' ' sonics ear left
    *text.pokechar(19,3,21,"#")
    **text.pokechar(19,4,21,"#")
    *text.pokechar(19,5,21,"#")*
    *text.pokechar(19,6,21,"#")*
    *text.pokechar(19,7,21,"#")*
    *text.pokechar(20,4,21,"#")
    *text.pokechar(20,5,21,"#")*
    *text.pokechar(20,6,21,"#")*
    *text.pokechar(20,7,21,"#")

    PUB VidDatBuf2
    *text.pokechar(21,4,21,"#")
    *text.pokechar(21,5,21,"#")*
    *text.pokechar(21,6,21,"#")*
    *text.pokechar(21,7,21,"#")
    *text.pokechar(22,5,21,"#")*
    *text.pokechar(22,6,21,"#")*
    *text.pokechar(22,7,21,"#")
    *text.pokechar(23,5,21,"#")*
    *text.pokechar(23,6,21,"#")*
    *text.pokechar(23,7,21,"#")
    *text.pokechar(24,6,21,"#")*
    *text.pokechar(24,7,21,"#")
    text.pokechar(25,5,21,"#") *' ' sonic's right ear
    *text.pokechar(25,6,21,"#") ' ' sonic's right ear
    *text.pokechar(25,7,21,"#") ' ' sonic's right ear
    text.pokechar(26,4,21,"#") *' ' sonic's right ear
    *text.pokechar(26,5,21,"#")*' ' sonic's right ear
    *text.pokechar(26,6,21,"#")*' ' sonic's right ear
    *text.pokechar(26,7,21,"#")*' ' sonic's right ear
    *text.pokechar(20,8,21,"#")
    *text.pokechar(21,8,21,"#")*
    *text.pokechar(22,8,21,"#")*
    *text.pokechar(23,8,21,"#")
    *text.pokechar(24,8,21,"#")*
    *text.pokechar(25,8,21,"#")
    *text.pokechar(26,8,21,"#")
    text.pokechar(20,9,21,"#")
    *text.pokechar(21,9,21,"#")*
    *text.pokechar(22,9,21,"#")*
    *text.pokechar(23,9,21,"#")
    *text.pokechar(24,9,21,"#")*
    *text.pokechar(25,9,21,"#")
    *text.pokechar(26,9,21,"#")
    And I put it here outside of the code block and still see asterisks.....
    But in order to get it on my computer I email it to myself, then copy and paste it again into the spin tool. Maybe it has something to do with the format of the font.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-07 20:41
    You're going between formatted text and unformatted text. Your notes app is acting like multi-level lists. When you copy/paste to E-mail you get RTF. When you paste here, it converts it to a text representation of your list which isn't what you want.

    PlainText editor.
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-08 07:01
    Ah I see. Thanks a bunch, I will look into that.
Sign In or Register to comment.