Author Topic: nib{} question  (Read 4093 times)

0 Members and 1 Guest are viewing this topic.

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
nib{} question
« on: March 28, 2011, 08:16:02 pm »
Hi, I'm trying to use the nib{} command in a sprite display routine, and I'm getting some funky looking graphics out of it...but not the ones I want.

Basically, Pic0V and Pic0S each point to a bunch of 4x4 sprites. Naturally, each sprite is 2 bytes, so to use the Pt-on() (etc...) commands I have to convert it to 8x8. Well, for this program I'll always be displaying one sprite from Pic0V and one from Pic0S side by side, so I thought "why not just make a routine to generate an 8x8 sprite that has both 4x4's next to each other (with the rest filled by 0's of course).

So I tried to write that routine, but it's not working...and I realized that I may be using the nib{} command wrong. So I guess my real question is this:

if {L1} = $8F, would nib{L1*2} = 8 or 15? Basically, which half of the byte is read first? The lower half or the upper half?
There's something about Tuesday...


Pushpins 'n' stuff...


Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: nib{} question
« Reply #1 on: March 28, 2011, 09:00:28 pm »
It appears to be 15.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: nib{} question
« Reply #2 on: March 28, 2011, 09:35:36 pm »
If you downgrade to axe .4.8 or lower, it will read the opposite way. Unfortunately, the nibble writing commands will be flipped. This is something I like to continuously complain about as it prevents me from upgrading from .4.8

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: nib{} question
« Reply #3 on: March 29, 2011, 02:57:07 am »
Wait...reading is little-endian but writing is big-endian?
« Last Edit: March 29, 2011, 02:57:51 am by ZippyDee »
There's something about Tuesday...


Pushpins 'n' stuff...


Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: nib{} question
« Reply #4 on: March 29, 2011, 03:16:00 am »
For big-endian nibble reading:

Code: [Select]
Lbl NIB
Return nib{xor 1}
« Last Edit: March 29, 2011, 03:17:10 am by Runer112 »

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: nib{} question
« Reply #5 on: March 29, 2011, 03:25:02 am »
Wow...Damn.......So...Simple...

Thank you. You're a genius...
There's something about Tuesday...


Pushpins 'n' stuff...


Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: nib{} question
« Reply #6 on: March 29, 2011, 10:07:08 am »
Thank you, I was asking the same question. :D

The solution is so simple.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.