Author Topic: 4x4 sprites  (Read 3599 times)

0 Members and 1 Guest are viewing this topic.

Offline Camdenmil

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +4/-0
    • View Profile
4x4 sprites
« on: September 02, 2011, 06:17:30 pm »
I'm making a game that uses 4x4 sprites. Does anyone have a fast way for drawing 4x4 sprites? Right now I'm using nib{ to copy to the buffers.
It is bad luck to be superstitious.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: 4x4 sprites
« Reply #1 on: September 03, 2011, 06:29:20 pm »
Just treat it like an 8x8 sprite. That's the fastest way because nib{ is basically a combination of 8-bit storing and masking anyway.




Offline Camdenmil

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +4/-0
    • View Profile
Re: 4x4 sprites
« Reply #2 on: September 03, 2011, 09:17:49 pm »
So I just draw it the same way as an 8x8 tilemap except with twice as many pt- commands.
It is bad luck to be superstitious.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: 4x4 sprites
« Reply #3 on: September 03, 2011, 09:57:33 pm »
If you are drawing a tilemap, it actually might be better to do something clever by adding values and only storing once to each byte, that way you are using 768 byte store commands instead of twice as many nibble storing commands.  You could do something like:

A*256 + B -> {L6+L}

where A is the nibble of the first sprite, B is the nibble of the second sprite, and L is your offset.  Does that make kinda sense?

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: 4x4 sprites
« Reply #4 on: September 03, 2011, 10:14:36 pm »
If anyone wants to make an Axiom, Xeda, Runer, and I made a couple of ASM routines.  
http://ourl.ca/10793

Builderboy's idea is probably the best solution for pure Axe, though.
« Last Edit: September 03, 2011, 10:14:53 pm by ralphdspam »
ld a, 0
ld a, a

Offline Camdenmil

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +4/-0
    • View Profile
Re: 4x4 sprites
« Reply #5 on: September 04, 2011, 03:31:41 pm »
If you are drawing a tilemap, it actually might be better to do something clever by adding values and only storing once to each byte, that way you are using 768 byte store commands instead of twice as many nibble storing commands.  You could do something like:

A*256 + B -> {L6+L}

where A is the nibble of the first sprite, B is the nibble of the second sprite, and L is your offset.  Does that make kinda sense?
I thought about that way but I couldn't figure out how because I forgot about multiplying to shift. Don't you multiply by 16 to shift it 4 bits though?
It is bad luck to be superstitious.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: 4x4 sprites
« Reply #6 on: September 04, 2011, 04:19:12 pm »
Oh right, I was thinking bytes, but yeah multiply by 16 would do it :)