Shop OBEX P1 Docs P2 Docs Learn Events
What are those number? — Parallax Forums

What are those number?

Dan TaylorDan Taylor Posts: 207
edited 2009-05-01 16:03 in Propeller 1
I was just browsing over propeller code. Trying to understand how it works and I understand a lot. Except in the DATA section there is usually something like this:

pixdef················· word··················· 'arrow pointer
························ ·byte··· 1,5,0,4
························ ·word··· %%11110000
························· word··· %%11100000
························· word··· %%11110000
························· word··· %%10111000
························ ·word··· %%00011000

I understand all the 1 and 0 and stuff, but what about the byte line? I don't understand what those numbers are doing. Could someone help me out?
Thanks!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor

Comments

  • RaymanRayman Posts: 14,880
    edited 2009-05-01 00:04
    that line declares 4 bytes of data with the given values. Since Pixdef is made to word aligned and 4 is an even number of bytes, the word declaration after 4 byte declare is still word aligned and so no padding is needed. So, this whole data block is contiguous...
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-01 00:05
    the byte line defines 4 bytes in a row

    %means following number is binary

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-05-01 00:05
    Those numbers don't do anything by themselve. You have to read the code that uses these numbers to find out what the meaning is. The word is a 4 color mouse-pointer graphic. And as far as I remember the bytes have something to do with the positioning.

    PS: It's a %% and not a %, so it's not bits, each digit represents 2 bits given as a value between 0 and 3.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-05-01 00:14
    So those numbers are kinda like variables? Storing the numbers 1, 5, 0, and 4? How are they accessed?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-01 00:15
    that explaines why only 8 for a word didn't even notice the double %

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • RaymanRayman Posts: 14,880
    edited 2009-05-01 13:52
    Accessing them is a little tricky, but simple. You just use the BYTE command with the address of pixdef and add an offset to get the byte you want...

    E.g.: FirstByte:=BYTE[noparse][[/noparse]@pixdef+0]
    LastByte:=BYTE[noparse][[/noparse]@pixdef+3]
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-05-01 16:03
    Just a hint:

    You can use two array operators.
    FirstByte:=byte[noparse][[/noparse]@pixdef][noparse][[/noparse]0]
    LastByte:=byte[noparse][[/noparse]@pixdef]

    Maybe it's worth to test if it makes some difference in timing or not?!
Sign In or Register to comment.