Join us on Discord!
You can help CodeWalrus stay online by donating here.

Sprites v3, a new ASM lib to enhance TI-84 Plus CE BASIC games [tutorial]

Started by Dream of Omnimaga, May 16, 2016, 12:42:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

unregistered

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 :



Perhaps the bug comes from later in your program, while displaying ...?
Could you please send me your .8xp program (by PM thru TiPlanet), thanks ;)

Dream of Omnimaga

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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

unregistered

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 ;)

Dream of Omnimaga

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:


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:



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,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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
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

unregistered

I have the blue fish :) (never saw green squares)



I'll search more about this "44 sprites cap bug" ;)

Adriweb

I'll try on CEmu, my 83PCE and 84+CE (5.1.5 everywhere)...
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dream of Omnimaga

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
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

unregistered

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 ..?

Adriweb

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...?
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dream of Omnimaga

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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Adriweb

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.
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dream of Omnimaga

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:



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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

unregistered

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

Adriweb

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.
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dream of Omnimaga

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=
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Powered by EzPortal