CodeWalrus

Development => Calculators => Calculator News, Coding, Help & Talk => Topic started by: Dream of Omnimaga on May 16, 2016, 12:42:15 AM

Title: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: Dream of Omnimaga on May 16, 2016, 12:42:15 AM
TI-83 Premium CE and TI-84 Plus CE BASIC programmers who wants to use sprites in their games via the help of ASM and C libraries dedicated to enhance their favorite language are waiting for the arrival of Doors CE 9, which will include xLIBCE and Celtic 2, both of which have advanced sprite support along with many other features. However, did you know that even though Doors CE 9 is not released yet, it is already possible to program in hybrid TI-BASIC on your color screen calculator?

For a very long while, CE Textlib, by DrDnar, was the only choice available for those who wanted something else than monochrome home-screen text and slow DRAW command graphics. Featuring rectangles with the ability to chain commands for much faster execution speed, it was later discovered that CE Textlib rectangle command could be exploited to circumvent the multiples of 12x20 pixels limit to display rectangles as small as 4x4 and was fast enough to display sprites:
(http://img.codewalr.us/walrush1.png) (http://img.codewalr.us/newchars.png)


But now there is a second ASM library available, called Sprites! As the name suggests, this one is dedicated to displaying sprites and it was made by grosged from TI-Planet. It supports custom palettes and can display sprites of any size up to 35x35 pixels:
(http://img.codewalr.us/spritelib.gif)
The library comes with 6 different sub-programs, three of which are optional, but still can be handy. How the lib works is as follows:

1) First of all, you must define a color palette with the PALETTE program. A palette can contain 36 colors at once but you don't have to define all 36 everytime. You can define the first three, for example (it's recommended to place the colors you plan to change the most often at the beginning)
{color0, color1, color2:Asm(prgmPALETTE
The color IDs go from 0 to 255 and this library uses the same colors as xLIBC. (Click here to see the chart.) (http://dcs.cemetech.net/index.php/DCSE:BasicLibs:DrawShape#Color_Values) If you use Asm(prgmPALETTE with something else than a list, then a default color palette (https://i.imgur.com/13bMjj0.jpg) will be defined instead. Using the "":Asm(prgmPALETTE syntax will display the current palette on the screen.


2) Then you must define sprites with SPRITE. Here are the limitations:
-ID: Starts at zero
-Height: From 1 to 35
-Width: From 1 to 35
-Zoom: From 1 to 3
-Each pixel color: From 0 to 9 and A to Z.
Sprites are stored as numbers and letters, with the ID and size in the header, all inside a string, like this:
"0C310123456789AB
Ans+"CDEFGHIJKLMN
Ans+"OPQRSTUVWXYZ
Asm(prgmSPRITE

In this code, you basically create or overwrite sprite 0 and it's 12x3 pixels (Note the 0 C3 at the start. The width, height and pixels are in base-35, meaning from 0 to 9 and from A to Z). You can store up to 10 35x35 sprites at a time if they are not zoomed in. Note that zoomed sprites take more space than non-zoomed sprites, so basically a 8x8 sprite with a 2x zoom will take the same amount of memory as a 16x16 sprite and with a 3x zoom it will take the same as a 24x24 sprite.


3) Draw the sprites with SPRITE. You can draw multiple sprites at once in one command (it is unknown how many can be drawn at once, but CE Textlib took lists of up to 255 elements at a time). You can use the entire screen, but be careful to not draw outside the screen!
{0,100,200,1,0,0:Asm(prgmSPRITE
This code draws Sprite 0 at (100,200) on the screen and Sprite 1 at (0,0). You must always re-define the palette before defining any sprite, according to the author!

As you can see in the screenshot above, the only reason why the trees are being drawn gradually is because I decided to only draw 10 at a time. It's up to you to judge if you need higher speed or a smaller file size in such situation.

The other program is optional (CLRSCREEN fills the entire screen with one of the palette colors of your choice and you can choose to redraw the status bar or disable the busy indicator). For example, {5:Asm(prgmCLRSCREEN will erase the screen with color #5, but preserve the run indicator and status bar, while 5:Asm(prgmCLRSCREEN will erase the entire screen with color #5, including the status bar, and will disable the run indicator.


In conclusion, there will soon be three different ASM libraries available for TI-84 Plus CE BASIC programmers to enhance their games with sprites, some of which are smaller, others larger and some has features that the others lack. You can even use CE Textlib and Sprites v3 together, such as if you want colored home screen text and erasing the busy indicator, but still be able to use high-quality sprites at the same time. This new Sprite lib addition will give you even more choice! As always, though, backup your progress often if you start programming, in case you do mistakes and freeze your calculator!


Download Sprites v3: https://tiplanet.org/forum/archives_voir.php?id=539203
Source: https://tiplanet.org/forum/viewtopic.php?f=12&t=18391
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 16, 2016, 03:16:59 PM
Thanks a lot for the add, DJ Omnimaga   ;D

The AFFSPR routine can display up to 85 sprites at a time
and , yes, we must launch DEFPAL in the beginning (just 1 time) before DEFSPR and AFFSPR because DEFPAL not only (re)defines the palette but also does several initialisations & relocates the AFFSPR routine to the 1Kb memory-area "Cursor Image Ram" ($e30800) in order to run a bit faster ;)

Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 16, 2016, 07:47:54 PM
Hi grosged and welcome here. 85 sprites seems very good for me. That would definitively be more than enough for a custom font routine (I wanted to make one in CE Textlib too but the fonts would be too big).

Something that would be cool for future versions is the ability to define if we want a sprite to show up at its original size, twice larger (each pixel would be 2x2), three times larger, etc. Many people prefer using 8x8 sprites to save space and be able to port monochrome games easier, but at 320x240 resolution it's harder, so scaled sprite support (even if we can't change them on the fly) would be nice. Maybe the syntax could be 0 C32, for example? (0 being sprite #0, C being 12 pixels width, 3 being 3 pixels height and 2 being 200% zoom).
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 18, 2016, 07:57:33 AM
When you suggested a zoom possibility a few days ago, I thought  I'd have to modify AFFSPR (which would slow it down)
I had not your nice idea to include zoom within the sprite definition :thumbsup:

I went back to the source of DEFSPR and included the parameter "zoom" : x1, x2 or x3  ;D
I realised that a zoom greater than 3 would slow the display routine (AFFSPR) down.
This zoom parameter will appear in version 2.1  ;)

Here is a small test program  plus its screenshot:

(http://i.imgur.com/4U2buvE.png)        (http://i.imgur.com/y2uhrPd.png)

3 "undefined" (because no data!) sprites 35x35 , respectively defined using  zoom x1, x2 et x3
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 18, 2016, 04:36:18 PM
Woah great job :O. I don't mind a bit of slowdowj, considering there is chaining support. I can now save RAM and time doing pixel art yet still fill the entire screen. :)
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 18, 2016, 06:39:14 PM
Thanks  ;)

I've just typed my very first "true" sprite... Here are screenshots demonstrating  zoom x1, x2 & x3 :

(http://i.imgur.com/zkhjB2R.png) (http://i.imgur.com/WWSfOBG.png) (http://i.imgur.com/t5h4CEe.png)
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 18, 2016, 06:54:46 PM
Nice. Also I should check if SourceCoder lets us convert images to hex.
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: alexgt on May 19, 2016, 11:36:36 AM
Nice! Looks good grosged ;)
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 19, 2016, 12:06:24 PM
Thanks, alexgt ;)

I've optimised again the display routine (a little bit faster).
Moreover, I also make the "run indicator" (yellow bubble) disappear, now.
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 19, 2016, 12:36:16 PM
Is there an option to make the run indicator appear and disappear? That could be handy if someone prefers keeping it, but I am fine if it doesn't have one.

One option that would be nice, though, is if EFFECR redrew the gray status bar at the top of the screen when you do "String":Asm(prgmEFFECR.
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 19, 2016, 12:44:59 PM
If I well understand, there would be 2 manners:
-either clear partially the screen ( leaving the "gray status bar" & "run indicator" fines)
-or clear the whole screen, and deactivate the "run indicator"

Is this what you mean?
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Ivoah on May 19, 2016, 12:51:34 PM
Quote from: DJ Omnimaga on May 18, 2016, 06:54:46 PM
Nice. Also I should check if SourceCoder lets us convert images to hex.
I thought the sprites were base-35, not base-16 (hex)
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 19, 2016, 01:06:05 PM
Actually, the sprites Data are values between "0" and "Z"
Which means 36 different possible values ...base 36 ;)
If you want,  you can decide to use the 16 first colors only ;)

(I can't access to IRC...sorry)
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 19, 2016, 01:18:39 PM
Quote from: grosged on May 19, 2016, 12:44:59 PM
If I well understand, there would be 2 manners:
-either clear partially the screen ( leaving the "gray status bar" & "run indicator" fines)
-or clear the whole screen, and deactivate the "run indicator"

Is this what you mean?
Neither of those, actually. What I mean is doing like Doors CSE 8.0's real(0,1,0,1) command. I think redrawing the status bar is a TI-OS routine or BCall but I could be wrong. Basically, when we exit our games then we would have the ability to redraw the gray bar if we want to (with is currently impossible with CE Textlib and Sprites v2).

Quote from: Ivoah on May 19, 2016, 12:51:34 PM
Quote from: DJ Omnimaga on May 18, 2016, 06:54:46 PM
Nice. Also I should check if SourceCoder lets us convert images to hex.
I thought the sprites were base-35, not base-16 (hex)
Yeah it's base-35 for Sprite v2 and base-16 for SourceCoder, but most of the time I only use about 4 colors per tile so it's not a problem for me. I just don't remember if SourceCoder can convert images to hex or if it can only do the opposite.
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 19, 2016, 02:08:33 PM
I've just modified EFFECR   ;D
now, when you type :

{0:Asm(prgmEFFECR

(http://i.imgur.com/8VfvsRH.png)

It will clear/fill the screen, using the color 0,  BUT leaving the Status Bar & Run Indicator safe ;)


Of course, it's always possible to clear the whole screen & put Run Indicator off by omitting the {  :

0:Asm(prgmEFFECR
(http://i.imgur.com/5Tqr7p5.png)
(nota bene:  the bubble in the corner comes back only when the Basic Program is over)
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 19, 2016, 02:14:21 PM
I fixed your post, since it looks like you clicked Quote instead of modify by accident :P

Also glad to see this added. :) Is the latest version on TI-Planet, by the way?
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 19, 2016, 02:16:59 PM
Oh thanks ;)

The version 2.1 is not uploaded yet
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 19, 2016, 03:32:28 PM
Ah ok, I'll check later :)

Some ideas I have in mind with this lib are direct ports of some of my old games. The main issue is screen size, but the 3x zoom of this lib pretty much fixes the entire problem. The other issue would be how I store map data in some of them, but I can probably switch to a different format since the calc has 150 KB of RAM. Of course I have another project and am busy, though, so I don't know when I would be able to start a new project using this lib (especially a brand new game) :P
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 20, 2016, 08:45:14 PM
As it's late (have to go to bed!)
I just write this little message:
"I've just posted SPRITES version 3 on TI-Planet :) "
https://tiplanet.org/forum/viewtopic.php?f=12&t=18433
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: MateoConLechuga on May 21, 2016, 06:35:41 AM
Nice work grosged! :D Do you have any plans to integrate the seven segment display program into the basic library as well? Also, a graphics converter sounds like it could be quite useful :)
Title: Re: Sprites v2, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 21, 2016, 07:24:40 AM
Quote from: grosged on May 20, 2016, 08:45:14 PM
As it's late (have to go to bed!)
I just write this little message:
"I've just posted SPRITES version 3 on TI-Planet :) "
https://tiplanet.org/forum/viewtopic.php?f=12&t=18433
Cool, I'll check it out. :) I'll also update this topic to say Sprite v3. :P


EDIT: My only gripe about the zoomed sprites @grosged is that a 8x8 sprite with a 3x zoom takes 9 times more space than without zoom, so basically, we can only use 21 8x8 sprites at a time if we use 3x zoom. Would there be a way in the future to store all sprites at original zoom, but display them 3x larger later, even if it means slower speed? Because I think that would be more efficient, especially for porting certain TI-83+ games like Metroid II and Reuben Quest.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on May 21, 2016, 07:08:25 PM
@MateoConLechuga, Thanks !

@DJ Omnimaga, perhaps I'll go back to the zoom possibilities later, ...
For now, I've been working on a new option to display boxes, available through CLSCREEN :

{x,y,width,height,color:Asm(prgmCLSCREEN

Here's a screenshot of random boxes :

(http://i.imgur.com/siFAvu9.png)

8)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 21, 2016, 08:42:12 PM
Does that use Mateo C rectangle routine and does it support chaining? That is quite cool :3=
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: Dudeman313 on May 21, 2016, 09:09:58 PM
That should be a screensaver. Could that be implemented to automatically run after, say, 1 minute of inactivity?
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 22, 2016, 05:29:55 AM
Only via ASM hooks I think. And then your calculator would not turn off automatically, resulting into even more battery drainage than if you manually turned if off (unless the screensaver turned the calc off automatically after a while)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 22, 2016, 01:28:33 PM
Quote from: DJ Omnimaga on May 21, 2016, 08:42:12 PM
Does that use Mateo C rectangle routine and does it support chaining? That is quite cool :3=

No, it doesn't use any Mateo's routine. I write all the routines by myself, and yes, I intend to make it support chaining ;)
(I'm also workin' on a zooomed sprite display routine...)

I forgot to mention that CLSCREEN won't be able to use colors from palette, but colors amongst 256 :)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 22, 2016, 02:31:35 PM
Oh I see about ClrScreen, that's fine. :P

How large is the lib so far by the way, with and without CLRSCREEN?
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on May 22, 2016, 02:39:32 PM
Here's the size of the lib :

With CLSCREEN, 969 bytes
Without CLSCREEN, 700 bytes

Let's not forget that the size will soon change as I'm writing the zoomed display routine ;)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 22, 2016, 02:41:04 PM
Cool, maybe this could be the first CE sprite lib that is under or around 1 KB :P (I think smaller ASM programs launches faster with the Asm() command because of the time it takes to be copied in safe Ram)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on May 22, 2016, 02:55:34 PM
I think the same : that's why , for now, the source of function SPRITE is just one line:

   jp      $e308b5

:)

I'm still thinking about the eventual zoomed display routine...If I choose to add it, it would be located in function SPRITE....then , no more "one line prg" ... This may slow down
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 22, 2016, 04:19:14 PM
I am fine with that unless it takes like an extra 0.2 seconds (which I doubt)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 23, 2016, 07:43:18 AM
@grosged I found three major problems in Sprites v3:

-Custom palette creation doesn't work. Any list will give ERR:INVALID DIMENSION, even if I try the example program (MARIO.8xp) provided in the zip file. I can only get Sprites v3 to work with the default palette (0:Asm(prgmPALETTE).

-After using the program, if I quit the home screen then come back to it, garbage appears in it. Can this cause stability issues?

-Once we run out of sprite memory, there is no way to erase or overwrite existing sprites. I can't find any command to do that and simply trying to store a sprite in the same slot as an old sprite will not work (the original copy will remain intact). If erasing 1 sprite is impossible then maybe there should be a command to clear the entire sprite memory?


(http://img.codewalr.us/spritesv3test.gif)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on May 23, 2016, 02:29:46 PM
I modified a lot these days...maybe I chose the wrong file when creating the archive
Anyway, Custom Palette is ok in the very last version :
Please upload Sprites v3.1    ( https://tiplanet.org/forum/archives_voir.php?id=549179 )
Inside, you 'll find MARIO.8XP and SQUASH.8XP for testing ;)

Concerning the garbages , don't worry : it's not dangerous, just a little bit of sprites Data
(as the memory area PixelShadow is used)

In fact you can't rewrite over an existing sprite but you can reset all by using PALETTE
When you define a sprite, the program just stores sprites one after the other , and doesn't care of its number (which is just a way for you not to get lost)
Thus when defining sprites the program will associate pointer1 to 1st sprite, pointer2 to 2nd sprite...
the sprite number you put when defining allows you remember which pointer will be used
That's the reason why you have to define sprite 0,1 ,2 ...increasingly

Hope it'll be ok for you :)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 23, 2016, 04:05:28 PM
Oh I see now. I noticed that defining sprites in the wrong order caused a crash, so I figured I should define them in the right order and it worked, but it might be good to specify that in the readme. Also it would be a good idea to make the readme.txt compatible with Windows Notepad since that's what most people use :P . You might also want to explain how to erase all sprite data with PALETTE for those who don't read the forums.

As for the garbage stuff thanks for the info. I guess I can always tell people to quit with CLEAR and have a ClrHome at the end of my program so people aren't too scared.

EDIT: @grosged it seems like you uploaded the wrong version of the program, because it's dated from May 20th and I still get the INVALID DIM error :( EDIT: New version works now thanks :)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 23, 2016, 07:16:58 PM
Update:

This is a demonstration of changing the color palette. The speed is slow because I have to store many large sprites each time, but with 8x8 sprite data it shouldn't be too bad:

(http://img.codewalr.us/friday13paletteswap.gif)

0:Asm(prgmCLSCREEN

For(Z,1,7

If Z=1 or Z=7:{0,33,32,0,40,1,7,32,8,9,34,74
If Z=2 or Z=6:{0,97,96,0,80,2,7,96,9,10,99,148
If Z=3 or Z=5:{0,161,160,0,120,3,7,160,10,18,165,181
If Z=4:{0,226,224,0,152,4,7,224,11,19,231,255
Asm(prgmPALETTE
"0ZY133333333333333333333333333333AAAAAA3333333333333333333333333AAAAAAAAAA3333333333333333333333AAAAAAAAAAAAA33333333333333333333AAAAAAAAAAA1111333333333333333333AAAAAAAAA1111111133333333333333333AAAAAAAA1111111111333333333333333AAAAAAAA11111111117733333333333333AAAAAAA111111111777773333333333333AAAAAAA111111177777777333333333333AAAAAA1111111777777777733333333333AAAAAA1111111777777774443333333333AAAAAA1111111777777744444333333333AAAAAA1111117777777444444433333333AAAAAA1111117777777444444443333333AAAAAA11111177777774444444993333333AAAAA11111177777744444449999333333AAAAAA1111177777744444449999933333AAAAAA11111177777444444499999933333AAAAA11111177777744444499999953333AAAAAA11111777777444444999999553333AAAAA11111777777444444999999555333AAAAAA11111777774444449999995555333AAAAA111117777774444499999955555333AAAAA11111777774444449999955555533AAAAA111111777774444499999955555533AAAAA111117777744444499999555555533AAAAA1111177777444449999995555555BBBBAAA11BB177777444449BBBBB555BBBB3BB33A111BB377777444449BB33BB55BB333BB33311BBBBB7774444499BB33BB35BB333BB333311BB333774444499BBBBB333BBBB3BB333111BB333374444499BBBB3333BB333BB333111BB333334444499BB3BB333BB33BBBB333333BBB3333333333BB33BB33BB33
Asm(prgmSPRITE
"1ZY1AAA33333333333333333333333333333333AAAAAAA3333333333333333333333333333AAAAAAAAAA333333333333333333333333311111AAAAAAA33333333333333333333333111111111AAAAA33333333333333333333311111111111AAAA333333333333333333337777777111111AAAA333333333333333333777777777711111AAA333333333333333337777777777777111AAA3333333333333333744444447777777111AA3333333333333334444444444447777111AA3333333333333344444444444444777111AA3333333333333444999999944444477711AA3333333333339999999999999444477711AA3333333333399999999999999944477711AA3333333333999995555555999994447711A3333333333999555555555559999444771AA3333333339555555555555555999444711AA3333333355555555555555555599447711A3333333355555555555555555559944771AA3333333555555555555555555559944771A3333333555555555555555555555994471AA3333335555555555555555555555994771A3333335555555555555555555555594471A33333355555555555555555555555994711A3333355555555555555555555555594471A3333355555555555555555555555599471A33333B5555BBBB55555555555555559471A33333BB55BB33BB555555555555BB594771A3333BB35BB33333555555555555335947BBBBB3B333BB3BBB33555555555BBB3394BB333333333BB33BB333555555555BB33347BBBB333333BB33BB335555555555BB33947133BB333333BBBB333333333333BBBB333BBBBB33
Asm(prgmSPRITE
"2271BBBBBBBBBB33BB
Asm(prgmSPRITE
"3Y61BB333B33B3B33B3BB333B3B3B333BB333BB3B3B3B3B3B3B33B3B3B33B3B333B3B3B3BB33B3B3B3B3B33B3B3B333BB333BB33B3B333B3B3B3B3B33B3B3B3333B333B333B3B333B3B3B3B3B33B3B3B3333B333B333B3B3333B33BBB3B33BB33B33BB3333B333B3
Asm(prgmSPRITE
"4I61BB33B3BB3BB33B333BB33B33B33B3B3BB3B3BB3B33BB3B3B3B33B3B333B3B33B3B3B333BB333B3B33B3B3B333BBB3B33BB3B3B33B3B3
Asm(prgmSPRITE
"5ZT32223333333332333332323333233233333323333333233323333323233332332333333233332233332233223232333222323333232233233323232323233223333233223323223332333232323232333233332332323222233323332323232323332333323323232332333233323322332232233333323232332233333333333333333333333333333333333333333333333333333333333322333322333333223332222233333333222223333223333322232222222222222222222233322333332222322333223222222333322333223333322223333222333333223333223332233333332233322223333332233332233322333333322332222222333322333322333223333333223333332223333223333223332223333332233333332233332233332222222233333322333333222333322333322222222333333223332222233333223333223333223333332233222233333332233332233332233333333333333333333333333322333333333333333333333333333333333333333333333332233333333333233332222222223333333323233333333332333332323232333333333232332233223222333323232323333333332233232323333233333323323233333333323332323233332333332323232333333333233323232333323333323232323333333332333322323333323332222222223333
Asm(prgmSPRITE
"6Y723B33B333B33B33BB333BB33BB33B33B33B3B3B3B3B33B3B3B3B33B3B3B33B33B3B3B3B3B3B3B33B3B3B3B33B3B3B33B33B3B3B3B3BBB3B33B3B3B3B33BB33BB3B33B3B3B3B3B3B33B3B3B3B3B33B3B3B33B33B3B3B3B3B3B33B3B3B3B3B33B3B3B33B33B3B3BBB3B3B3B333B33B3B33BB33BB33B33B33B
Asm(prgmSPRITE
"7Z723B3BB33B333B333B3B33B33B333B3B3B33BBB3B33B333B3B33B3B3B3B3B33B33B3B3B3BB3B33B333B3B33B3B3B3B3B33B33B3B3B33B3BB3B333BBB33B3B3BBB3B33B33B3B3B33B3B333B33B3B33BBB3B3B3B33B33B3B33B3B3B333B33B3B33BBB3B3B3B33B33B3B33B3B3BB3B333B3B33B3B3B3B3BB3B333B33B3
Asm(prgmSPRITE
{0,123,2,1,157,2,2,196,29,3,132,38,4,167,38,5,105,71,6,91,187,7,160,187:Asm(prgmSPRITE
0getKey
If Z=4
Then
Repeat getKey
End
End
End
For(Z,0,400:End
0:Asm(prgmCLSCREEN



Sprite display is nearly instant.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: alexgt on May 23, 2016, 07:19:23 PM
That looks good DJ!
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 23, 2016, 07:32:36 PM
Thanks. Here is another example with only 2 sprites (although zoomed in):

(http://img.codewalr.us/friday13paletteswap2.gif)

EDIT: Question @grosged : How do we store a sprite past Sprite #35? I noticed the string only has 1 space for the sprite number (from 0 to 9 and from A to Z), but what if we get past Z?


Also a feature suggestion I have would be a command to change the home screen text colors (foreground and background). I think you need to enable text colors beforehand but if you had that feature then I wouldn't have to use CE Textlib anymore for the text color. :P
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on May 24, 2016, 06:52:42 AM
Good job !
I answer to your questions:
-It's slow because PALETTE is not optimised. Plus , as PALETTE reset all, you have to define again your sprites each time you modify the palette (I'm thinking of resolving that)
-when defining, the program doesn't care of number of sprite : it'll keep on storing in next place(beside the last stored sprite), whatever number you put. I must admit that 1 character only is not enough to let you remember which sprite you defined...(in v2, with no zoom parameter, that was 2 characters)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 24, 2016, 07:21:38 AM
Thanks. :D

I actually didn't mind the speed since what I did was kinda overkill (eg the It RPG Is logo is very large. The speed drop is due to storing such large strings into Ans. With just small 8x8 sprites the speed would be even faster).

And I see. I didn't know it didn't take the number into account, so I guess that's good for me if I can add more sprites after it :P.

Also yeah a command to change Output() and Text() background and text colors would be nice, since right now on the home screen we are stuck with only black text on white background lol. But it's up to you :)


I also found a bug: The {color:Asm(prgmCLSCREEN syntax doesn't work at all. It still won't redraw the status bar.

DispGraph
0:Asm(prgmCLSCREEN

For(Z,1,7

If Z=1 or Z=7:{0,33,32,0,40,1,7,32,8,9,34,74
If Z=2 or Z=6:{0,97,96,0,80,2,7,96,9,10,99,148
If Z=3 or Z=5:{0,161,160,0,120,3,7,160,10,18,165,181
If Z=4:{0,226,224,0,152,4,7,224,11,19,231,255
Asm(prgmPALETTE
"0ZY133333333333333333333333333333AAAAAA3333333333333333333333333AAAAAAAAAA3333333333333333333333AAAAAAAAAAAAA33333333333333333333AAAAAAAAAAA1111333333333333333333AAAAAAAAA1111111133333333333333333AAAAAAAA1111111111333333333333333AAAAAAAA11111111117733333333333333AAAAAAA111111111777773333333333333AAAAAAA111111177777777333333333333AAAAAA1111111777777777733333333333AAAAAA1111111777777774443333333333AAAAAA1111111777777744444333333333AAAAAA1111117777777444444433333333AAAAAA1111117777777444444443333333AAAAAA11111177777774444444993333333AAAAA11111177777744444449999333333AAAAAA1111177777744444449999933333AAAAAA11111177777444444499999933333AAAAA11111177777744444499999953333AAAAAA11111777777444444999999553333AAAAA11111777777444444999999555333AAAAAA11111777774444449999995555333AAAAA111117777774444499999955555333AAAAA11111777774444449999955555533AAAAA111111777774444499999955555533AAAAA111117777744444499999555555533AAAAA1111177777444449999995555555BBBBAAA11BB177777444449BBBBB555BBBB3BB33A111BB377777444449BB33BB55BB333BB33311BBBBB7774444499BB33BB35BB333BB333311BB333774444499BBBBB333BBBB3BB333111BB333374444499BBBB3333BB333BB333111BB333334444499BB3BB333BB33BBBB333333BBB3333333333BB33BB33BB33
Asm(prgmSPRITE
"1ZY1AAA33333333333333333333333333333333AAAAAAA3333333333333333333333333333AAAAAAAAAA333333333333333333333333311111AAAAAAA33333333333333333333333111111111AAAAA33333333333333333333311111111111AAAA333333333333333333337777777111111AAAA333333333333333333777777777711111AAA333333333333333337777777777777111AAA3333333333333333744444447777777111AA3333333333333334444444444447777111AA3333333333333344444444444444777111AA3333333333333444999999944444477711AA3333333333339999999999999444477711AA3333333333399999999999999944477711AA3333333333999995555555999994447711A3333333333999555555555559999444771AA3333333339555555555555555999444711AA3333333355555555555555555599447711A3333333355555555555555555559944771AA3333333555555555555555555559944771A3333333555555555555555555555994471AA3333335555555555555555555555994771A3333335555555555555555555555594471A33333355555555555555555555555994711A3333355555555555555555555555594471A3333355555555555555555555555599471A33333B5555BBBB55555555555555559471A33333BB55BB33BB555555555555BB594771A3333BB35BB33333555555555555335947BBBBB3B333BB3BBB33555555555BBB3394BB333333333BB33BB333555555555BB33347BBBB333333BB33BB335555555555BB33947133BB333333BBBB333333333333BBBB333BBBBB33
Asm(prgmSPRITE
"2271BBBBBBBBBB33BB
Asm(prgmSPRITE
"3Y61BB333B33B3B33B3BB333B3B3B333BB333BB3B3B3B3B3B3B33B3B3B33B3B333B3B3B3BB33B3B3B3B3B33B3B3B333BB333BB33B3B333B3B3B3B3B33B3B3B3333B333B333B3B333B3B3B3B3B33B3B3B3333B333B333B3B3333B33BBB3B33BB33B33BB3333B333B3
Asm(prgmSPRITE
"4I61BB33B3BB3BB33B333BB33B33B33B3B3BB3B3BB3B33BB3B3B3B33B3B333B3B33B3B3B333BB333B3B33B3B3B333BBB3B33BB3B3B33B3B3
Asm(prgmSPRITE
"5ZT32223333333332333332323333233233333323333333233323333323233332332333333233332233332233223232333222323333232233233323232323233223333233223323223332333232323232333233332332323222233323332323232323332333323323232332333233323322332232233333323232332233333333333333333333333333333333333333333333333333333333333322333322333333223332222233333333222223333223333322232222222222222222222233322333332222322333223222222333322333223333322223333222333333223333223332233333332233322223333332233332233322333333322332222222333322333322333223333333223333332223333223333223332223333332233333332233332233332222222233333322333333222333322333322222222333333223332222233333223333223333223333332233222233333332233332233332233333333333333333333333333322333333333333333333333333333333333333333333333332233333333333233332222222223333333323233333333332333332323232333333333232332233223222333323232323333333332233232323333233333323323233333333323332323233332333332323232333333333233323232333323333323232323333333332333322323333323332222222223333
Asm(prgmSPRITE
"6Y723B33B333B33B33BB333BB33BB33B33B33B3B3B3B3B33B3B3B3B33B3B3B33B33B3B3B3B3B3B3B33B3B3B3B33B3B3B33B33B3B3B3B3BBB3B33B3B3B3B33BB33BB3B33B3B3B3B3B3B33B3B3B3B3B33B3B3B33B33B3B3B3B3B3B33B3B3B3B3B33B3B3B33B33B3B3BBB3B3B3B333B33B3B33BB33BB33B33B33B
Asm(prgmSPRITE
"7Z723B3BB33B333B333B3B33B33B333B3B3B33BBB3B33B333B3B33B3B3B3B3B33B33B3B3B3BB3B33B333B3B33B3B3B3B3B33B33B3B3B33B3BB3B333BBB33B3B3BBB3B33B33B3B3B33B3B333B33B3B33BBB3B3B3B33B33B3B33B3B3B333B33B3B33BBB3B3B3B33B33B3B33B3B3BB3B333B3B33B3B3B3B3BB3B333B33B3
Asm(prgmSPRITE
{0,123,2,1,157,2,2,196,29,3,132,38,4,167,38,5,105,71,6,91,187,7,159,187:Asm(prgmSPRITE
0getKey
If Z=4
Then
Repeat getKey
End
End
End
For(Z,0,400:End
0:Asm(prgmCLSCREEN

{58,18,204,204,255
Asm(prgmCLSCREEN
For(Z,0,8
{59+Z,19+Z,202-2Z,202-2Z,24+Z
Asm(prgmCLSCREEN
End
{68,28,184,184,255
Asm(prgmCLSCREEN
TextColor(12)
Text(0,43,"DUE TO JASON VOORHEES
Text(12,43,"REGENERATIVE POWERS,
Text(24,43,"AUTHORITIES FROZE HIM
Text(36,43,"AND BURIED HIM UNDER
Text(48,43,"ICE IN ALASKA. BUT 30
Text(60,43,"YEARS LATER HE MELTED
Text(72,43,"THEN REVIVED AS A
Text(84,43,"WALRUS.
Text(105,43,"OTHER WALRUSES MUST
Text(117,43,"DEFEAT HIM AND HAVE
Text(129,43,"CHOSEN YOU TO DO SO!
Text(141,43,"GO ON AND BEAT JASON!
0getKey
Repeat getKey
End
{255:Asm(prgmCLSCREEN
ClrHome


(https://img.ourl.ca/recording.gif)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 25, 2016, 06:39:51 PM
Question:

If what you say on IRC about the 8 bpp mode gets implemented, then will you implement a text routine or a way to map sprites of our choice to specific characters? Because if 8 bits mode is used then this pretty much makes Text() and Output() unuseable, meaning we would have no text in games using your lib.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: unregistered on May 26, 2016, 04:11:40 PM
Yes, I'm working on v3.3 which is now in 8bpp mode (faster rendering)
For example,  a 35*35 zoomed 300% sprite doesn't need 22052 bytes but...  half (11027 bytes only ) !
And instead of 24,4 Kb , 75 Kb are available for storing sprites !
Of course, I'm gonna implement a text routine ;)

For now, I created...
SETTINGS : initialisation (to be put in very beginning of the program) Meanwhile clear screen (256 colors) , go into 8bpp
SPRITE : define/display sprite(s) (possible to chain parameters)
CLSCREEN: clear/display boxes on screen (256 colors, chaining possible)
PALETTE: reset/modify the palette of 36 colors
BACKHOME: convert the 8bpp screen into 16bpp mode, restore staus bar & run indicator (to be put on last line of program , for a neat back to TI-OS ;) )
PRINT : display text, values (to be written)



Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 26, 2016, 04:29:27 PM
Ah I see. Yeah the issue right now is in 8 bpp mode the Output()/Text() text will be too big. 

I tried making my own font routine with Sprites v3 by creating custom font sprites, but I couldn't figure out how to convert a string into a list efficiently in pure BASIC (speed-wise). I might try again later with rectangles, though.


Of course that might be a bit complicated to implement, though, so if you had an actual font/text routine in the planning stages then perhaps you could use that? Of course you would probably need to create custom fonts or find a public domain font, though.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on May 28, 2016, 02:32:50 PM
at last, I finally finished writing the display function PRINT !
I decided to use the Amstrad CPC 8x8 font ...so I typed hundreds of binary codes ...ouch !! headache !! haha

(http://i.imgur.com/KpK1GNq.png)

Here's how to send parameters to the function :
{x,y:Asm(prgmPRINT
or
{x,y,ink,background:Asm(prgmPRINT
or
{x,y,ink,background,width zoom , height zoom:Asm(prgmPRINT


And now, to display values or strings :

123456:Asm(prgmPRINT
or
"ABCDEF":Asm(prgmPRINT
or
123+789/154:Asm(prgmPRINT

When you omit to send parameters, what you intend to display will be put exactly where you displayed just before.

For example:

1234:Asm(prgmPRINT:"AB":Asm(prgmPRINT

will display "AB34"



Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 28, 2016, 08:14:14 PM
Wow, it supports separate zooms? O.O Nice. Also are . , : = ! ? -  character supported? :)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on May 29, 2016, 06:49:11 AM
sure ! :)

(http://i.imgur.com/uS0PWI8.png) (http://i.imgur.com/cjBbouF.png) (http://i.imgur.com/OPTwL6R.png) (http://i.imgur.com/XtBWOMd.png) (http://i.imgur.com/4GWMvNn.png)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: aetios on May 29, 2016, 07:22:33 AM
Darn that looks so epic. Makes me want a CE just to try haha.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 29, 2016, 02:19:28 PM
Some characters could be used as pseudo 3D sprites :3=
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 29, 2016, 11:50:27 PM
On a side note: Even though you now have your own font routine, you should warn users in the readme to not use Output() after setting sprites, because Output() will corrupt the sprite data. I assume it's the same for any display command that modifies the RAM in which the sprites are stored.


Also, can the text routine display both strings (eg "HELLO WORLD") and variable content (eg L1(21))?
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on May 30, 2016, 04:12:46 PM
Yes,  8bpp mode will make you use only the custom font/routine display, and Output/ClrHome/ClrDraw/Disp ...will have to be forgotten (otherwise it could corrupt)

And yes, we can display variable contents:

22/3:Asm(prgmPRINT
rand:Asm(prgmPRINT
L1(1:Asm(prgmPRINT
π:Asm(prgmPRINT
Ans:Asm(prgmPRINT

Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on May 30, 2016, 04:17:14 PM
Ah ok, I'm fine with it personally, now that there is an easy way to use custom text. I would have made my own font routine in Basic using the lib but that would have been quite slow :P

Also nice to see we can use variables :)


Also, the fact we can zoom width and height separately means we could use stretched text to mimic Atari 2600 games :P
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 01, 2016, 09:30:18 PM
Sprites v3.2 available  ;)

https://tiplanet.org/forum/archives_voir.php?id=539203
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 01, 2016, 09:46:22 PM
OMG it's out! O.O

I'll definitively give it a try in a few minutes. :) I can't wait to try the new features and update my game (and of course check if there are new bugs to report :P)

Also I see it's now open source. :) There is a problem with the zip file, though:

!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\palette.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\clscreen.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\sprite.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\print.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\backhome.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Sources...\settings.asm
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Docs...\Palette_36colors.png
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Docs...\256_colors.png
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Docs...\Instructions.txt
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Demos...\DEMO.8Xp
!   The system cannot find the path specified.
!   C:\Users\DJOmnimaga\Desktop\Sprites_v3.2\Sprites_v3.2.zip: Cannot create Sprites v3.2\Demos...\SQUASH.8Xp
!   The system cannot find the path specified.


Renaming the Demo..., Sources... and Docs... folder to Demo, Sources and Docs fixed the problem.


EDIT: It seems you got the order of the default palette wrong. You put yellow first, but yellow should come between cyan and white. :P


Suggestion @grosged :

-Make BACKHOME so that if you use "+":Asm(prgmBACKHOME it only erases the sprite data without switching back to 16bpp.
-Maybe merge BACKHOME with SETTINGS to reduce the amount of sub-programs.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 02, 2016, 10:03:26 AM
Okay, thank you for testing :)

I'm modifying the folders name ;)
I'm gonna change the order of colors (had a doubt!)
And merging SETTINGS/BACKHOME is a good idea :)

EDIT: when using SourceCoder, black color is coded 3, right ?
So, what color should be represented by 0 ?

Re-EDIT : I've just thought of an easier way to erase automatically  sprites data, that would happen when defining sprites :

Just when the routine meets "000,... as header ! ;)

Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 02, 2016, 03:51:55 PM
From what I could gather, SourceCoder colors are the following:

0=Nothing
1=Blue (10 in pure BASIC and CE Textlib)
2=Red (11)
3=Black (12)
4=Magenta (13)
5=Green (14)
6=Orange (15)
7=Brown (16)
8=Navy Blue (17)
9=Cyan (18)
A=Yellow (19)
B=White (20)
C=Light Gray (21)
D=Medium Gray (22)
E=Gray (23)
F=Dark Gray (24)
G=Transparent (or Teal in CE Textlib if you use color code 25)

Basically, for some reasons 0 doesn't seem to have any color assigned to it. That's unless I am wrong, but that's what I noticed  when converting sprites.

And yeah maybe you could make sprites data overwrite the sprite behind when it meets the header, but wouldn't it cause empty gaps to be left behind if the former sprite was larger?


Also I am curious about if it would be easy to allow people to setup text settings and display the text in one single PRINT command? That would require storing the string into Str1 or  something, though, unless you used the "150,232,255,224,2,HELLO WORLD":Asm(prgmPRINT syntax (which would draw HELLO WORLD at 150,232 coordinates, with color 255 and background color 224 and 2x zoom. Or would that be much slower to process?


The other idea I had for text would be to assign one character or token as a line break. For example, If you draw text at 10,20, once the routine encounters the asterisk * character in the string, it would draw the rest at 10,28 instead, and 10,36 if another * is encountered and so on.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 02, 2016, 09:16:54 PM
Sprites v3.2 updated (palette ok now, folders too)
I've been trying to improve again, this afternoon...but it seems I can't go further....have to pause or writing something else, another project  9_9
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 02, 2016, 09:51:08 PM
It's fine. Sprites is already excellent already. I can't wait to make elaborate games with it :3=
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 04, 2016, 05:29:07 PM
On a side note, I might update my tutorial in the first post into an English version of the readme. I wonder if it could be included with future zip files @grosged since there are probably a bunvh of people who would like to download this lib, but cannot speak French?
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 04, 2016, 09:27:03 PM
After Kerm suggested me, today I made a post on cemetech :
https://www.cemetech.net/forum/viewtopic.php?t=12841&start=0&postdays=0&postorder=asc&highlight=
where I translated in english the file instructions.txt ;)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 04, 2016, 10:17:47 PM
Cool thanks a lot. :D

You should upload to Cemetech and ticalc archives for more visibility. I hope this library becomes popular among BASIC programmers in the future. :)

I hope to have time next week to make a game with this library :3=
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 06, 2016, 11:19:56 PM
Hi @grosged , I have some bad news:

I found a fatal bug in version 3.2 of Sprites: Basically, Sprite #0 no longer works and if it is less than 7x3 pixels large at 4x zoom, then Sprite #1 will not work either. Instead, 4x4 green squares will show up.

This is my code:

Asm(prgmSETTINGS
0:Asm(prgmCLSCREEN
{20,25,255,148,224,227,0,12,4,34,231
Asm(prgmPALETTE

"000,73,4100111010111211111111
Asm(prgmSPRITE
"001,75,410011101011121111111110111111001110
Asm(prgmSPRITE
"002,75,450000004555000444455544440004000000
Asm(prgmSPRITE
"003,75,400606006006006066466060060060060600
Asm(prgmSPRITE
"004,C5,7000099990000099988889999988877778888877700007777700000000000
Asm(prgmSPRITE
"005,88,40330330012212210112112103333333332323333323233333333333330330330
Asm(prgmSPRITE
"006,55,70000000000000000000000000
Asm(prgmSPRITE
"007,88,4A33A33AA1221221A1121121A333333333232333332323333333333333A33A33A
Asm(prgmSPRITE


With the code above, Sprite #0 is a green square but Sprite #1 and higher works fine. If I make Sprite #0 smaller, however, Sprite #1 will not work anymore.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 07, 2016, 07:08:28 AM
hmmm, thanks, DJ... ???...annoying bug !..I'm going back to the source ;)

EDIT:

that's odd, I typed the beginning of your program,then  I have no bug  9_9

Just after defining sprites #0 & 1, I displayed them and saw no green square :

(http://i.imgur.com/8TNeP78.png)

Perhaps the bug comes from later in your program, while displaying ...?
Could you please send me your .8xp program (by PM thru TiPlanet), thanks ;)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 07, 2016, 04:15:20 PM
Strange. I checked my code many times when I encountered that bug and couldn't figure out how to get rid of it. I was drawing the sprites one by one in a loop:

For(Z,0,7
{Z,Z,Z:Asm(prgmSPRITE
Pause
End


And I tried after a full memory clear to make sure that my calculator was stable.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 07, 2016, 06:49:04 PM
Sprites now updated to version 3.3 :D

(downloadable here : https://tiplanet.org/forum/archives_voir.php?id=539203 )

Hope this version will get rid off the bug you met, DJ Omnimaga ;)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 07, 2016, 07:22:50 PM
I'll try it out and edit my post as I test :)


v3.2 was already awesome, but bug fixes, even if the bugs aren't that bad, don't hurt. :)


EDIT: Sorry @grosged but all bugs are still present:

(https://img.ourl.ca/bugstillhere.gif)
Notice the green square instead of blue fishes. Here's my source code:


Asm(prgmSETTINGS
0:Asm(prgmCLSCREEN
{20,25,255,148,224,227,0,12,4,34,231,129
Asm(prgmPALETTE
1→dim(ʟWALRS
{129,224,227,231,129,224→L₁
For(Z,7,39
randInt(0,1→L₁(Z
End
"001,75,410011101011121111111110111111001110
Asm(prgmSPRITE
"002,75,450000004555000444455544440004000000
Asm(prgmSPRITE
"003,75,400606006006006066466060060060060600
Asm(prgmSPRITE
"004,C5,7000099990000099988889999988877778888877700007777700000000000
Asm(prgmSPRITE
"005,88,40330330012212210112112103333333332323333323233333333333330330330
Asm(prgmSPRITE
"006,55,70000000000000000000000000
Asm(prgmSPRITE
"007,88,3A33A33AA1221221A1121121A333333333232333332323333333333333A33A33A
Asm(prgmSPRITE
"668,Y5,4BBB666BBB6666BBBBBB6BBB66666BBBBBB44466644464446664446444666664446665556665556555666555655565556555555AAAAAAAAA6AAA666AAA6AAA66666AAA6662226662226666222222622266666222666
Asm(prgmSPRITE
"669,Y5,46666BBB666BBB6BBBBBB6BBB6666666BBB44464446664446444666644466666664446666555666555655555565555556666555AAA6AAA666AAA6666AAA6AAA666AAA66662226666222666622222262226662226222
Asm(prgmSPRITE
"616,75,4BBB6BBB46664665666555A666A662226222
Asm(prgmSPRITE
{0,0,320,80,0,0,77,320,8,16,0,78,320,1,0,0,85,320,8,25,0,86,320,1,16,0,93,320,8,29,0,94,320,1,25,0,101,320,8,14,0,102,320,1,29,0,109,320,61,231,0,110,320,1,14,0,170,320,71,5,2,41,316,4,129
Asm(prgmCLSCREEN
{6,146,111,7,2,17,8,138,17,9,290,17
Asm(prgmSPRITE
For(A,0,288,24
{10+A,168,1,4,16,18+A,170,4,1,231,26+A,169,4,4,14
Asm(prgmCLSCREEN
End
{89,52,14,0,1,2
Asm(prgmPRINT
"A GAME OF WALRUSES
Asm(prgmPRINT
{12,179,0,5
Asm(prgmPRINT
"PC a\nd Atari 2600 game by JWinslow23
Asm(prgmPRINT
{20,199
Asm(prgmPRINT
"TI-84 Plus CE remake by DJ Omnimaga
Asm(prgmPRINT
{48,219
Asm(prgmPRINT
"(C)2016, https://codewalr.us
Asm(prgmPRINT
{114,146,0,231
Asm(prgmPRINT
"Highscore:
Asm(prgmPRINT
{202,146
Asm(prgmPRINT
ʟWALRS(1
Asm(prgmPRINT
0getKey
Repeat Z
getKey→Z
End
If Z=45:Then
Asm(prgmBACKHOME
ClrHome
DelVar L₁Return
End
While 1
1→A
0→B
0→I
288→C
288→D
1→E
100→R
120→O
0→P
288→F
0→G
1→M
{0,0,320,220,20,0,220,320,20,0
Asm(prgmCLSCREEN
{146,222,255,0
Asm(prgmPRINT
0
Asm(prgmPRINT
While B<190 and Z≠45 and (O≠C or (B+20<R or B+10>R
While B<190 and O≤300 and (O≠C or (B+20<R or B+10>R
{5,F,G,5,D,I,3,12A,96,3,12A+80,96,3,12A+160,96,3,12A+240,96,4,C,B,M,O,R
Asm(prgmSPRITE
C→D
B→I
O→F
R→G
A+1→A
If A>13:1→A
getKey→Z
If Z=21:⁻40→E
E+10+10(E=⁻10→E
C-24(Z=24)+24(Z=26→C
If C<0:0→C
If C>288:288→C
If E>30:30→E
B+E→B
If B<0:0→B
O+24→O
R+20(M=2)((R<B)-(R>B→R
If Z=45:200→B
End
If (B+20≥R and B+10≤R) and O=C and not(M:Then
P+10→P:300→O
End
If O>288:Then
0→O
P+1→P
{146,222
Asm(prgmPRINT
P
Asm(prgmPRINT
20randInt(0,9→R
not(randInt(0,3))+(150<randInt(P,200→M
End
End
If Z≠45:Then
If B>189:189→B
For(Z,1,2
For(M,1,4
{33,12,1,6,27,L₁(M+1),33,5,1,5,27,L₁(M),33,4,1,1,27,L₁(M),33,4,A,52,6,L₁(M+1),33,4,A+13,52,6,L₁(M+1),33,B+L₁(M+4Z+2),C+L₁(M+4Z+18),39,1,L₁(M+2
"Asm(prgmTEXTLIB
End
End
{17,L₁(M),16,12
"Asm(prgmTEXTLIB

{126,40,0,129
Asm(prgmPRINT
"Game Over
Asm(prgmPRINT
If P>ʟWALRS(1:Then
{112,60
Asm(prgmPRINT
"NEW HIGHSCORE
Asm(prgmPRINT
P→ʟWALRS(1
End
0getKey
Repeat getKey
End
Else
Asm(prgmBACKHOME
ClrHome
DelVar L₁Return
End
End


Could it be a compatibility issue with CEmu? Maybe @Adriweb or @MateoConLechuga might be able to help.


And the 44 sprites cap bug is still intact. Here's what happens if I try to display more than 44 sprites in one command:

(https://img.ourl.ca/bugstillhere2.gif)

Source:

Asm(prgmSETTINGS
0:Asm(prgmCLSCREEN
{189,155,123,222,125,192,50,181,74,41,33,65
Asm(prgmPALETTE
"000,73,4100111010111211111111
Asm(prgmSPRITE
"001,88,30000002100000021000000210000002100000021000000212222222111111111
Asm(prgmSPRITE
"002,88,33333333433333334333333343333333433333334333333345555555566666666
Asm(prgmSPRITE
"003,88,37777777978888889788888899999999977797777888978888889788899999999
Asm(prgmSPRITE
"004,88,3AAAAAAAAABBBBBBAABBBBBBAABBBBBBAABBBBABAABBBBBBAABBBBBBAAAAAAAAA
Asm(prgmSPRITE
"005,88,3A33A33AA1221221A1121121A333333333232333332323333333333333A33A33A
Asm(prgmSPRITE

500→M
{3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,2,2,2,2,2,3,3,3,2,2,2,2,2,2,2,3,2,2,2,2,2,2,3,3,3,3,3,3,1,1,1,3,1,1,1,1,1,3,3,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,3,3,3,3,3,3,1,3,1,3,1,1,1,1,1,3,3,3,1,1,1,1,1,1,1,3,1,3,3,3,3,3,3,3,3,3,3,3,1,3,1,3,1,1,1,1,1,3,3,3,1,1,1,1,1,1,1,3,1,2,2,2,2,2,3,3,3,3,3,3,1,3,1,3,3,3,1,3,1,2,2,3,3,3,1,1,1,3,3,3,1,1,1,1,1,1,3,3,3,3,3,3,1,3,1,3,2,2,1,3,1,1,1,2,2,3,1,1,1,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,1,3,1,2,1,1,1,3,3,3,1,1,1,3,1,1,1,3,2,2,2,2,2,2,2,1,3,3,3,3,3,3,1,3,1,1,1,3,3,3,3,3,3,3,1,3,1,1,1,3,1,1,1,1,1,1,1,1,3,3,3,3,3,3,1,3,3,3,3,3,2,2,2,2,2,2,1,3,1,1,1,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,1,2,2,2,2,2,1,1,1,1,1,1,1,3,1,1,1,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,3,1,3,1,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,1,1,1,2,1,1,1,2,1,3,1,1,1,1,1,1,3,3,3,3,3,3,2,2,2,2,2,3,3,3,3,3,3,3,1,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,1,2,2,2,2,2,2,3,3,3,1,1,1,3,3,3,2,2,2,2,2,2,3,3,3,3,3,3,1,3,3,3,1,1,1,1,1,1,1,2,2,2,1,1,1,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,1,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3,1,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3,1,3,3,3,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,1,1,1,1,1,1,1,3,3,3,3,3,3,1,3,3,3,1,1,1,1,1,1,3,2,2,2,2,2,2,2,3,1,1,1,1,1,1,1,3,3,3,3,3,3,1,3,3,3,1,1,1,1,1,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,3,3,3,3,3,3,1,3,3,3,1,1,1,1,1,1,3,1,1,3,1,3,1,1,2,1,1,1,1,1,1,1,3,3,3,3,3,3,1,3,3,3,1,1,1,1,1,1,3,1,1,3,1,3,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3→L₁
While 1
{L₁(M),16,12,L₁(M+1),40,12,L₁(M+2),64,12,L₁(M+3),88,12,L₁(M+4),112,12,L₁(M+5),136,12,L₁(M+6),160,12,L₁(M+7),184,12,L₁(M+8),208,12,L₁(M+9),232,12,L₁(M+10),256,12,L₁(M+11),280,12,L₁(M+32),16,36,L₁(M+33),40,36,L₁(M+34),64,36,L₁(M+35),88,36,L₁(M+36),112,36,L₁(M+37),136,36,L₁(M+38),160,36,L₁(M+39),184,36,L₁(M+40),208,36,L₁(M+41),232,36,L₁(M+42),256,36,L₁(M+43),280,36,L₁(M+64),16,60,L₁(M+65),40,60,L₁(M+66),64,60,L₁(M+67),88,60,L₁(M+68),112,60,L₁(M+69),136,60,L₁(M+70),160,60,L₁(M+71),184,60,L₁(M+72),208,60,L₁(M+73),232,60,L₁(M+74),256,60,L₁(M+75),280,60,L₁(M+96),16,84,L₁(M+97),40,84,L₁(M+98),64,84,L₁(M+99),88,84,L₁(M+100),112,84,L₁(M+101),136,84,L₁(M+102),160,84,L₁(M+103),184,84,L₁(M+104),208,84,L₁(M+105),232,84,L₁(M+106),256,84,L₁(M+107),280,84,L₁(M+128),16,108,L₁(M+129),40,108,L₁(M+130),64,108,L₁(M+131),88,108,L₁(M+132),112,108,5,136,108,L₁(M+134),160,108,L₁(M+135),184,108,L₁(M+136),208,108,L₁(M+137),232,108,L₁(M+138),256,108,L₁(M+139),280,108,L₁(M+160),16,132,L₁(M+161),40,132,L₁(M+162),64,132,L₁(M+163),88,132,L₁(M+164),112,132,L₁(M+165),136,132,L₁(M+166),160,132,L₁(M+167),184,132,L₁(M+168),208,132,L₁(M+169),232,132,L₁(M+170),256,132,L₁(M+171),280,132,L₁(M+192),16,156,L₁(M+193),40,156,L₁(M+194),64,156,L₁(M+195),88,156,L₁(M+196),112,156,L₁(M+197),136,156,L₁(M+198),160,156,L₁(M+199),184,156,L₁(M+200),208,156,L₁(M+201),232,156,L₁(M+202),256,156,L₁(M+203),280,156,L₁(M+224),16,180,L₁(M+225),40,180,L₁(M+226),64,180,L₁(M+227),88,180,L₁(M+228),112,180,L₁(M+229),136,180,L₁(M+230),160,180,L₁(M+231),184,180,L₁(M+232),208,180,L₁(M+233),232,180,L₁(M+234),256,180,L₁(M+235),280,180
Asm(prgmSPRITE
getKey→Z
⁻(Z=24)+(Z=26→C
⁻(Z=25)+(Z=34→D
If L₁(M+133+C+32D)≠1
Then
0→C
0→D
End
M+C+32D→M
End
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 07, 2016, 07:57:01 PM
I have the blue fish :) (never saw green squares)

(http://i.imgur.com/XZI7ayO.png)

I'll search more about this "44 sprites cap bug" ;)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Adriweb on June 07, 2016, 08:13:38 PM
I'll try on CEmu, my 83PCE and 84+CE (5.1.5 everywhere)...
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 07, 2016, 08:23:24 PM
What OS do you use Grosged? I have OS 5.1.5?


I'm thinking it's a bug specific to the TI-84 Plus CE, not the TI-83 Premium CE
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 07, 2016, 08:37:59 PM
I use a TI-83 Premium CE, OS 5.1.5.0019.

And about the "44 sprites cap bug", maybe the TI-OS fault
I displayed about 55 times at coordinates (1,1) the sprite #1, and coord. (9,9) for the last sprite: it works!
So I think it may be a length of Basic List too long (for TI-OS !) which could make trouble ..?
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Adriweb on June 07, 2016, 08:41:21 PM
Tested on 83PCE, 84+CE, CEmu, all 5.1.5, and I don't have the fish, just a little square.

Do we have the same files...?
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 07, 2016, 08:44:32 PM
TI-BASIC lists can be 999 elements maximum. I suspect it might be an ASM limitation or something? I know that CE Textlib doesn't accept lists larger than 255 elements. If Sprites v3.3 had such limitation, then this means the max amount of sprites it could display is 85 (255/3 arguments per sprites == 85 sprites).

I'll try again with 84 or 85 sprites.


Could this be an hardware revision issue? Note that for accurate tests, a RAM clear should be performed beforehand.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Adriweb on June 07, 2016, 08:47:49 PM
Bug report: I believe (though I'm not sure) that the PRINT program doesn't handle lowercase letters well?

Also, DJ, yeah I tested with a ram clear first.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 07, 2016, 08:55:09 PM
Hm I have no issues with lowercase letters, but make sure that your editor doesn't replace lowercase letters with tokens like SourceCoder and TokenIDE does (eg P a u s e becomes the Pause command)


Also bingo! I found the issue with the tilemap bug above:

(https://img.ourl.ca/255argumentscap.png)

In order words, Sprites (or maybe the Asm() command?) accepts a maximum of 255 elements. Past 255 it loops back to 0 and acts as if those 255 arguments weren't there.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 07, 2016, 09:02:05 PM
Yes , the asm routine accepts up to 255 elements ;)
(more would be useful?)
and concerning minuscules, make sure you re not using tokens (which are not welcome!)

I found a bug : the caracter ^ gives a space
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Adriweb on June 07, 2016, 09:03:33 PM
Yeah, I used TI-Connect CE (and had to fix a few things from the code box above, like the little L for the lists), so it probably recognized some tokens instead of lowercase letters.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 07, 2016, 09:28:18 PM
Quote from: grosged on June 07, 2016, 09:02:05 PM
Yes , the asm routine accepts up to 255 elements ;)
(more would be useful?)
and concerning minuscules, make sure you re not using tokens (which are not welcome!)

I found a bug : the caracter ^ gives a space
More would be welcome, but not necessary. If I only use two Asm() commands to display a full map, the speed is better than with three Asm() commands. And if I want to do it with just one command, I just have to use 10x8, 11x7 or 9x9 maps. The Reign of Legends 3 used 10x8 maps and my First Fantasy II demo used 8x6 maps (I'll probably try to use odd numbers instead of even, so I can have my character sprite centered at any time :)

Thanks a lot for the work on this library so far, by the way :3=
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 08, 2016, 02:56:29 PM
Perhaps I found why there was a bug !
In this program, when you start to define sprites, you ommit sprite #0 !
Please don't forget that we must start from 0, because meanwhile this allows the routine to (re)set sprites :)

Asm(prgmSETTINGS
0:Asm(prgmCLSCREEN
{20,25,255,148,224,227,0,12,4,34,231,129
Asm(prgmPALETTE
1→dim(ʟWALRS
{129,224,227,231,129,224→L₁
For(Z,7,39
randInt(0,1→L₁(Z
End
"001,75,410011101011121111111110111111001110
Asm(prgmSPRITE
"002,75,450000004555000444455544440004000000
Asm(prgmSPRITE
"003,75,400606006006006066466060060060060600
Asm(prgmSPRITE
"004,C5,7000099990000099988889999988877778888877700007777700000000000
Asm(prgmSPRITE
"005,88,40330330012212210112112103333333332323333323233333333333330330330
Asm(prgmSPRITE
"006,55,70000000000000000000000000
Asm(prgmSPRITE
"007,88,3A33A33AA1221221A1121121A333333333232333332323333333333333A33A33A
Asm(prgmSPRITE
"668,Y5,4BBB666BBB6666BBBBBB6BBB66666BBBBBB44466644464446664446444666664446665556665556555666555655565556555555AAAAAAAAA6AAA666AAA6AAA66666AAA6662226662226666222222622266666222666
Asm(prgmSPRITE
"669,Y5,46666BBB666BBB6BBBBBB6BBB6666666BBB44464446664446444666644466666664446666555666555655555565555556666555AAA6AAA666AAA6666AAA6AAA666AAA66662226666222666622222262226662226222
Asm(prgmSPRITE
"616,75,4BBB6BBB46664665666555A666A662226222
Asm(prgmSPRITE
{0,0,320,80,0,0,77,320,8,16,0,78,320,1,0,0,85,320,8,25,0,86,320,1,16,0,93,320,8,29,0,94,320,1,25,0,101,320,8,14,0,102,320,1,29,0,109,320,61,231,0,110,320,1,14,0,170,320,71,5,2,41,316,4,129
Asm(prgmCLSCREEN
{6,146,111,7,2,17,8,138,17,9,290,17
Asm(prgmSPRITE
For(A,0,288,24
{10+A,168,1,4,16,18+A,170,4,1,231,26+A,169,4,4,14
Asm(prgmCLSCREEN
End
{89,52,14,0,1,2
Asm(prgmPRINT
"A GAME OF WALRUSES
Asm(prgmPRINT
{12,179,0,5
Asm(prgmPRINT
"PC a\nd Atari 2600 game by JWinslow23
Asm(prgmPRINT
{20,199
Asm(prgmPRINT
"TI-84 Plus CE remake by DJ Omnimaga
Asm(prgmPRINT
{48,219
Asm(prgmPRINT
"(C)2016, https://codewalr.us
Asm(prgmPRINT
{114,146,0,231
Asm(prgmPRINT
"Highscore:
Asm(prgmPRINT
{202,146
Asm(prgmPRINT
ʟWALRS(1
Asm(prgmPRINT
0getKey
Repeat Z
getKey→Z
End
If Z=45:Then
Asm(prgmBACKHOME
ClrHome
DelVar L₁Return
End
While 1
1→A
0→B
0→I
288→C
288→D
1→E
100→R
120→O
0→P
288→F
0→G
1→M
{0,0,320,220,20,0,220,320,20,0
Asm(prgmCLSCREEN
{146,222,255,0
Asm(prgmPRINT
0
Asm(prgmPRINT
While B<190 and Z≠45 and (O≠C or (B+20<R or B+10>R
While B<190 and O≤300 and (O≠C or (B+20<R or B+10>R
{5,F,G,5,D,I,3,12A,96,3,12A+80,96,3,12A+160,96,3,12A+240,96,4,C,B,M,O,R
Asm(prgmSPRITE
C→D
B→I
O→F
R→G
A+1→A
If A>13:1→A
getKey→Z
If Z=21:⁻40→E
E+10+10(E=⁻10→E
C-24(Z=24)+24(Z=26→C
If C<0:0→C
If C>288:288→C
If E>30:30→E
B+E→B
If B<0:0→B
O+24→O
R+20(M=2)((R<B)-(R>B→R
If Z=45:200→B
End
If (B+20≥R and B+10≤R) and O=C and not(M:Then
P+10→P:300→O
End
If O>288:Then
0→O
P+1→P
{146,222
Asm(prgmPRINT
P
Asm(prgmPRINT
20randInt(0,9→R
not(randInt(0,3))+(150<randInt(P,200→M
End
End
If Z≠45:Then
If B>189:189→B
For(Z,1,2
For(M,1,4
{33,12,1,6,27,L₁(M+1),33,5,1,5,27,L₁(M),33,4,1,1,27,L₁(M),33,4,A,52,6,L₁(M+1),33,4,A+13,52,6,L₁(M+1),33,B+L₁(M+4Z+2),C+L₁(M+4Z+18),39,1,L₁(M+2
"Asm(prgmTEXTLIB
End
End
{17,L₁(M),16,12
"Asm(prgmTEXTLIB

{126,40,0,129
Asm(prgmPRINT
"Game Over
Asm(prgmPRINT
If P>ʟWALRS(1:Then
{112,60
Asm(prgmPRINT
"NEW HIGHSCORE
Asm(prgmPRINT
P→ʟWALRS(1
End
0getKey
Repeat getKey
End
Else
Asm(prgmBACKHOME
ClrHome
DelVar L₁Return
End
End
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 08, 2016, 09:08:43 PM
Yeah, as replied in the other topic it seems that definiting sprite 0 properly did not fix it.

That said, I did not know that defining Sprite 0 erased all other sprites, because I was sure that the 000 thing was just as reference. It's good to know, because I thought the only way to reset sprites was to use the following code:

"NSB":Asm(prgmBACKHOME
Asm(prgmSETTINGS



On a side note, I did a screenshot of the text linebreak in action :D

(https://img.ourl.ca/txt.gif)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 12, 2016, 08:56:33 PM
Sprites v3.31 available ! ( https://tiplanet.org/forum/archives_voir.php?id=539203 )

! NEW !.. "getKey":Asm(prgmPALETTE

Allows you to know if 1 or more "arrow" keys  are pressed, then store result into theta variable

(down)=1 , (left)=2 , (right) =4 , (up) = 8

Also allows you to know if 1 or more of the keys (2nd) =1 , (mode) = 4 , (del) = 8 are pressed,
then store result into Ans.

It's possible to read several keys together !

EG : when (up) and (left) are pressed, theta will contains value 8+2 = 10 :)

Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 12, 2016, 10:02:07 PM
Very nice addition. I will give it a try in my game to see if the game runs fast enough with that new feature. Otherwise I will probably use it in future games that don't require much speed. Thanks a lot :)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 14, 2016, 07:08:28 AM
So I tried Sprites v3.31 and it doesn't look like "getKey":Asm(prgmPALETTE does anything at all. I tried it in GalagACE but keys wouldn't respond at all. Not that I plan to use it in that game since it would slow it down but I thought I would let you know.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on June 14, 2016, 02:38:41 PM
 9_9 Oh, please forget v3.31 : this sort of getkey added to PALETTE was rather slow  :-[ (in fact, you had to put the token of getKey, perhaps it was not ok for you because of that ;) )
I just downgraded to v3.3  :P
To be fast, we could add this "getkeyS" function but as another new ASM program (yes , one more!)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 14, 2016, 02:52:33 PM
That could work, but what about merging some existing programs? For example BACKHOME with SETTINGS? That would still leave us at 6.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 16, 2016, 06:52:01 PM
By the way, would adding Sprite/rectangle clipping support cause too many slowdowns?

Also I think in some scenarios where graphics are simple, it's better to use sprites than rectangles, because a rectangle uses 5 list arguments, while a sprite uses 3, so if you display 20 objects, then this means you need to use a list of 100 elements, versus 60, causing extra slowdowns. So from now on if I need to display small rectangles of fixed size, I'll just use a sprite lol.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on September 08, 2016, 01:27:31 AM
So I had an idea @grosged , regarding the issue with scaled sprite data storage: Why not store the zoom value with the sprite data and zoom to that value when the sprite is called? This would allow you to keep the sprite command at three arguments, but still greatly reduce the size of scaled sprite data. For example, right now a 35x35 sprite zoomed at 700% takes 60025 bytes of safe RAM, while with my idea it would take 1225. My initial idea was to have the user specify the zoom during sprite display, but I felt it would make the lists too long with 4 arguments. With my new idea the user would still not be able to choose a different zoom after the sprite was stored and sprite display would be slower, but it would take much less space while still sticking to three arguments for sprite calling. Of course the sprite data would be 1 byte larger due to the zoom being stored side by side, but it's better than for example 49 times larger .

With Pokéwalrus, for example, I would be able to store all my 150 sprites into the safe RAM at once, while right now I can only store about 16 at a time.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on September 11, 2016, 08:50:37 PM
You know , I feel my project sprites like finished, now (after many many improvements/versions)
Moreover, I always tried to keep speed before anything else : writing another version including zoom during display would unfortunately get it slow.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on September 11, 2016, 10:35:09 PM
Ah I see. That's true it would get slow actually. Perhaps too much to allow scrolling tilemaps.

On a side note I should try storing map data inside 8xi images and use pxl-test. I would have a few tiles at a time but I wonder if it would be faster than using lists. I would be able to use maps larger than 31*32 pixels too and they would take no RAM. It probably depends if Sprite uses the graph screen, though.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on September 16, 2016, 03:15:20 AM
A little advice for exporting sprites: Do not use color #22 (L) unless you are 100% sure that it's never placed right to the left of a pixel that use colors from 1 to 6. This is because TokenIDE converts L1 through L6 into the List tokens of the same names and omits the backslash in your code (and TokenIDE doesn't save backslashes, even in the txt file *pokes @merthsoft or someone else to fix on Github*) to prevent that. Not using color L next to 1 through 6 will speed up sprite conversion considerably.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: RomanChrome on June 03, 2017, 03:38:00 PM
Hi,
I really like this program, and it's honestly really helpful for creating things. I've written a program for Windows which allows you to quickly create sprites for for this. It can be downloaded here: http://bit.ly/TISpriteEditorPage (http://bit.ly/TISpriteEditorPage).
On another topic, I do wish that there was a way in this program to do something like pxl-check and see if a pixel is on or not, but I can see that might be hard to add.
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games
Post by: Dream of Omnimaga on June 04, 2017, 03:09:48 AM
Heya @RomanChrome and welcome here. I agree with you about this library. When I still programmed stuff, it was very handy for advanced graphics in my basic games and due to chained command support it allowed my games or demos to run at very decent speed. Pxl-check would be an interesting addition for sure (I think it's possible)
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: unregistered on December 01, 2017, 08:35:05 AM
Sprites for BASIC (v3.3) now available thru ticalc  :)

http://www.ticalc.org/archives/files/fileinfo/470/47025.html
Title: Re: Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]
Post by: RomanChrome on December 12, 2017, 04:52:03 AM
Hey there! A few months back, I replied here with a sprite editor I made. Well, I'm back with a brand new rewrite of the program. It has tons of new features that I'm excited to use. Here's just a few ones that work right now:
* Custom pallette.
* Sprite editor that will edit any size of sprites.
* Layout editor that will allow for any sized sprite as well as on the fly scaling.
* Super easy one-click export to export the layout, the sprites, and everything you need to the calculator. It'll calculate the scaling of sprites and work it all out for you.
Now for my favorite features....
* Importing of a normal photo file as a sprite or as a full screen image. This will run everything at the native resolution and respect your pallette choices. It's awesome.
Here's a quick teaser image: (https://i.imgur.com/lKaTDEHr.jpg)
I'll finish it up and put the link here soon.