Forum
how to convert sprite to ASM? - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+--- Thread: how to convert sprite to ASM? (/showthread.php?tid=397)



how to convert sprite to ASM? - slenkar - 11-03-2011

does anyone know how to convert a sprite (in any format) to ASM defb statements?

say for example my sprite was like this:

1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1


Re: how to convert sprite to ASM? - britlion - 11-03-2011

slenkar Wrote:does anyone know how to convert a sprite (in any format) to ASM defb statements?

say for example my sprite was like this:

1,0,0,0,0,0,0,1

defb 1,0,0,0,0,0,0,1 if those are bytes.

defb %10000001, or defb 129 if those are bits.


Re: how to convert sprite to ASM? - slenkar - 11-04-2011

will defb 1,0,0,0,0,0,0,1 work in fourspriter?

if not...
it seems that this website can convert binary to numbers
<!-- m --><a class="postlink" href="http://www.unitconversion.org/numbers/binary-to-base-10-conversion.html">http://www.unitconversion.org/numbers/b ... rsion.html</a><!-- m -->

so basically I convert each line of the sprite to a number it seems?


EDIT, I used 7up to create a sprite 16x16
then i copy and pasted the numbers into the 4spriter example but my sprite was corrupted,
It resembled the original but it looked like some pixels were added and some were taken away.

the output from 7up had 4 extra numbers too......

how did you design your sprite and get it into the game?


Re: how to convert sprite to ASM? - britlion - 11-04-2011

You should be able to use binary like I said too:

defb %10000001

should be the same as

defb 129

(or for that matter defb 81h if you want to do hexadecimal Wink


Re: how to convert sprite to ASM? - slenkar - 11-04-2011

the result is coming out distorted,
(when i copy and paste numbers from 7up)
what did you use to design the sprite you used for the example?

it turns out 7up is exporting the data in the wrong order,
i cant seem to get the options to export it the right way


Re: how to convert sprite to ASM? - britlion - 11-04-2011

Actually, I borrowed gentle there from someone else; but I've used 7up to design sprites as well. You probably have the byte order wrong. Use the example as a template - put the bytes for it back into your sprite designer in binary, and you'll see the order.

I'm pretty sure you can set the byte ordering in 7up.


Re: how to convert sprite to ASM? - LCD - 11-04-2011

What byte order does Fourspriter need?
8 bytes character or 16 bit lines?
I implemented now Progressive format and vertical format (for PutChars) in BorIDE. It works, I added with it some graphics to QFJ. The most painter stuff works now, but still no saving added.


Re: how to convert sprite to ASM? - slenkar - 11-04-2011

it seems to use 4 8byte characters
that is how the data is read (after doing a few experiments)


Re: how to convert sprite to ASM? - britlion - 11-05-2011

It depends which version. There's one that uses 16 bit lines, because it uses 16 bit constructs (push and pop) to write to the screen, for example.

The one on here as "final slower version" for example, has an initialise setup of:

SUB fspInitialize (n as uByte, udgA as uByte, udgB as uByte, udgC as uByte, udgD as uByte,x as uByte,y as uByte) 'Initialize Sprite: n (sprite number 0-3);a,b,c,d (UDG number 0-20,99 means the sprite won't be printed)

That's not clear? It takes four locations in the user-definable graphics area, so clearly these should be defined as normal UDG's. You can repoint the UDG system variable to allow for initializing other graphics instead.


Re: how to convert sprite to ASM? - LCD - 11-05-2011

Okay, so I will include three encoding methods:
  • Progressive (Standard)
    Vertical (for PutChars)
    Char (for grabbing to font or Fourspriter)



Re: how to convert sprite to ASM? - slenkar - 11-05-2011

LCD Wrote:Okay, so I will include three encoding methods:
  • Progressive (Standard)
    Vertical (for PutChars)
    Char (for grabbing to font or Fourspriter)

looking forward to that Big Grin


Re: how to convert sprite to ASM? - britlion - 11-06-2011

Awesome!


Re: how to convert sprite to ASM? - slenkar - 11-07-2011

LCD Wrote:Okay, so I will include three encoding methods:
  • Progressive (Standard)
    Vertical (for PutChars)
    Char (for grabbing to font or Fourspriter)
whens it gonna be released?


Re: how to convert sprite to ASM? - LCD - 11-07-2011

slenkar Wrote:
LCD Wrote:Okay, so I will include three encoding methods:
  • Progressive (Standard)
    Vertical (for PutChars)
    Char (for grabbing to font or Fourspriter)
whens it gonna be released?
When ready... I'm working on multiple parts at the same time, but there are still some issues and unfinished parts. Anyway, It will definitly be released this year, but I cannot promise anything will work as expected.
Oh, and there are still some games which I write using it, for testing purposes.