As KermMartian suggested me yesterday, I propose you my last project named SPRITES Very Happy
( Available here : https://tiplanet.org/forum/archives_voir.php?id=539203 )

I've just translated the file "instructions.txt" (hope my old-school-english 's not too bad!)

First of all, the installation...Just transmit these 6 files :

    backhome.8xp
    clscreen.8xp
    palette.8xp
    print.8xp
    settings.8xp
    sprite.8xp


The SPRITES project v3.2 (for TI83PCE/TI84+CE) is composed of 6 functions, written in ASM, executables from the TI-OS :

1) SETTINGS ,situated in the beginning of your Basic program, initialises the routines, memorises the Status Bar, clears the screen in black, goes to 256-color-mode (8bpp).

If you write the string "+" just before it, that will force to stay in 16bpp mode
(useful for debugging an error in your Basic program!).

inside your program:

Code:
"+":Asm(prgmSETTINGS


or just before launching your program DEMO:

Code:
"+":prgmDEMO



2) CLSCREEN allows you to clear (part of) screen, using one of 256 colors
(see 256_colors.png).


Code:
255:Asm(prgmCLSCREEN

clears the whole screen in white.


Code:
{x,y,width,height,color,x2,y2,width2,height2,color2...:Asm(prgmCLSCREEN

Displays at least one filled rectangle starting at (x,y) position (top left corner).
You'll notice that chaining of parameters is possible.


3) PALETTE
allows you to modify/re-initialise the standard 36-color-palette
(see Palette_36colors.png)


Code:
{255,15,0,...:Asm(prgmPALETTE

changes the first colors of the palette (modifying all the palette is possible)


Code:
0:Asm(prgmPALETTE ou "":Asm(prgmPALETTE ...(well, everything but a list!)
re-initialise the standard palette.


4) SPRITE allows you to define/display a Sprite.

When defining, you'll have to mention respectively:
-its number (0 to ...),
-its width (1 to 35),
-its height (1 to 35),
-its zooming (x1 to x7),
-then pixels data...

As we need to put values higher than 9, we'll use the base 36 (values between 0 and Z ,eg A=10, B=11....Z=35)

For example:


Code:
"000,C3,5
Ans+"0123456789AB
Ans+"CDEFGHIJKLMN
Ans+"OPQRSTUVWXYZ
Asm(prgmSPRITE

define the Sprite number 0 (=000), which size will be 12x3 (=C3), and zoom x5 (=5)

IMPORTANT: : the sprites always have to be defined increasingly : 0,1,2....
Plus, when defining sprite "000", this also (re)set the Sprites Data !

76800 are available for storing sprites (I guess that will be enough)
One sprite = 2+(width*height)*zoom^2 bytes, we can store up to 62 sprites 35x35 , zoom x1 Smile

When displaying, a chaining of several sprites parameters is possible:

For example:


Code:
{0,100,200,1,0,0:Asm(prgmSPRITE

will display the sprite #0, coordinates (100,200) , also the sprite #1 , coordinates (0,0) ( =top left corner of screen) .


5) PRINT allows you to set the displaying mode (graphical position, color/background color (0 to 256), size of characters )
Also allows to display characters (text, variables,...)
Of course, the minus are availables thanks to a double [alpha] key pressing.

For setting...

Code:

{x,y:Asm(prgmPRINT
or

Code:
{x,y,color,background color:Asm(prgmPRINT
or
Code:
{x,y,color,background color,zoom-width,zoom-height:Asm(prgmPRINT


And for displaying...


Code:
"Hello world":Asm(prgmPRINT
x:Asm(prgmPRINT
L1(1:Asm(prgmPRINT
123+4567:Asm(prgmPRINT
π:Asm(prgmPRINT


If you want to "return & go to next line", just put an "i" by pressing [2nd] [.]

Code:
"Hello!iEverything's fine?":Asm(prgmPRINT

will display...

Hello!
Everything's fine?

Let's mention that PRINT will be more accurate :


Code:
π:Asm(prgmPRINT

will display 3.1415926535898 instead of usual 3.141592654

By the way, DO NOT FORGET to use the instruction DEC !
...Or else ,

Code:
 π:Asm(prgmPRINT
will display 1

Be careful to put DEC,FLOAT, MATHPRINT, CLASSIC,...Before Asm(prgmSETTINGS !
Simply because these instructions could modify the Status Bar


6) BACKHOME allows a safe return to the TI-OS :
-clear all Data, converts final screen (and goes back) to 16bpp mode, then finally restore the Status Bar


Code:
Asm(prgmBACKHOME)


If you want not to restore the Status Bar (useful for screenshots!)
just write the string "NSB" (No Status Bar)

Code:
"NSB":Asm(prgmBACKHOME



IMPORTANT, in order not to annoy your dear Calculator:

-SETTINGS must be in the beginning of your program ( 'cause it initialises things...)
-Always define sprites increasingly (from number 0...)
-obviously NEVER try to display an inexistant Sprite!
-I recommend not to display outside the screen
-no more use of display functions: Output,ClrHome,ClrDraw,Text, Line,Pxl-on,Pt-on...

Voilà! I hope that this tool will be useful for your creations.
Have lots of fun ! And good programming !

I give Thanks to Epharius, DjOmnimaga, Diolum (tip "minuscules"), DrDnar (trick "faster/fastest") and others for their advices , testings, tips and inforrmations !!

-Gérald aka grosged (june 2016)

PS: Please don't hesitate, in case of bugs , tell me, thanks Wink

I must add that despite using Asm(prgmNAME) instead of parser hooks, this lib runs very fast compared to Codex, Zapi, ZSprite, xLIB v0.1a and v0.3a, because of chained commands. What I like the most, though, is that displaying a sprite only requires 3 arguments.
Update : now version 3.3 !
A few optimisations here & there (see the 1st page of this topic for more informations)
Wow, that's actually pretty cool. Did you make that font or was it already part of TI-OS?
The font was from the Amstrad CPC computers from the 80's. I agree that it looks cool Smile (plus you can zoom it in both directions)
Sprites for BASIC (v3.31) now available thru ticalc Smile

http://www.ticalc.org/archives/files/fileinfo/470/47025.html
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement