Hey guys,

Some months ago I decided to start a project that many Basic coders from the French community at http://tout82.forumactif.org/ had asked for, that is, an extended Basic lib, kinda like xLIB or Celtic, but for TI-82 stats and such (TI-76 and 83). So I had another idea : why not making it compatible with the 8x+ line too ?

So how to use it : the main idea is that you put arguments in the list named WLIB and you call the Basic program USEWLIB with in Ans the number of the function to call.

I present it here and now but it's not nearly done. For now it can only do a few things, that is :

  • Scroll the screen up or down (not the buffer, uses port $10). {column to display at the top of the screen}→LWLIB : 0 : prgmUSEWLIB
  • Scroll the buffer left. {nb of pixels to scroll}→LWLIB : 1 : prgmUSEWLIB
  • Scroll the buffer right. {nb of pixels to scroll}→LWLIB : 2 : prgmUSEWLIB
  • Check if a program exists on-calc. {nb of Str that holds the program's name}→LWLIB : 3 : prgmUSEWLIB
  • Create a program, and erase the one of the same name that already exists. {nb of Str that holds the program's name, size in bytes}→LWLIB : 4 : prgmUSEWLIB
  • Turn a pixel on. {X, Y}→LWLIB : 5 : prgmUSEWLIB
  • Turn a pixel off. {X, Y}→LWLIB : 6 : prgmUSEWLIB
  • Toggle the state of a pixel. {X, Y}→LWLIB : 7 : prgmUSEWLIB
  • Load sprites in WLib's slots. {nb of Str that holds sprite data, nb of sprites}→LWLIB : 8 : prgmUSEWLIB
  • Load a tilemap in WLib's tilemap slot. {nb of Str that holds tilemap data, size in characters (width * height), offset to load from in characters}→LWLIB : 9 : prgmUSEWLIB
  • Display the loaded tilemap using the loaded sprites. 10 : prgmUSEWLIB
  • Display the buffer to the screen. 11 : prgmUSEWLIB
  • Invert the buffer's pixels. 12 : prgmUSEWLIB

And all of this in 763 bytes. Happy Christmas ! Razz

Now, some explanations :

  • Sprites must be stored in hex format, similar to Axe's or ASM's format.
  • Same for tilemaps, so each tilemap can use at most 16 different tiles (0 to F).
  • A slot is something relative to WLib's system. Don't bother about it for now.
  • If you want to load several sprites with a single function call, you'll need to pack them into one Str.
  • Idem for tilemaps.

Why it works with all calcs is because prgmUSEWLIB contains a single Basic line that launches WLIB the correct way, with either Asm() or Send(9) depending on the platform. So send the right version of USEWLIB and WLIB to your calc, and every program using them will work on every calc ! Very Happy

Download WLib (readme is in French, although it doesn't contain much information).

If you want to give it a try and/or see how it works, you can see the example program A.8xp Wink

Share comments Smile
i would be curious about two things:

1) why do we have Pixel On, Off, and Invert commands? does the 82Stats not have such functionality?

2) what speed decrease (or increase) do we get out of using this library over other libraries, in the 8x models?

As a super small library, this seems to be a nice project for closing the gap between calculators nicely. well done, Matref!
1) WLib's work with the buffer, Basic's work with the screen.
2) Definitely a speed decrease due to how you call a program instead of a Basic function, but it's the only way you can have compatibility.
matrefeytontias wrote:
1) WLib's work with the buffer, Basic's work with the screen.
2) Definitely a speed decrease due to how you call a program instead of a Basic function, but it's the only way you can have compatibility.
Thanks for answering those questions; I was thinking of both of those. What made you decide to work with the gbuf rather than directly with the LCD? I'd be curious to see and help optimize that fastcopy routine if you want. Have you done a quantitative comparison between your tilemapper and xLIB/Celtic to see how much overhead Asm() is giving you? Keep in mind that the larger your ASM program comes, the higher the constant-time overhead that Asm() will introduce, due to the _InsMem call and the code-copy. Finally, are you keeping the arguments to your library similar to xLIB to make it easy to transition, or does the Asm() call format and use of variables and Ans and strings make that prohibitive?
I chose buffering over direct LCD because for me it was easier and faster not to deal with screen delays so often, and also because I was a bit worry about the speed of TI-Basic making things non-clear on-screen.

An Asm()/Send(9) call is nearly 0.2 seconds, which is really slow. I didn't do any comparison with xLIB or Celtic because WLib is not intended and either case will never be faster.

Seeing that the user passes arguments through strings and lists, the less arguments are required, the better.

And it's not time for optimisation yet. First have everything working, then optimize.
Nice Matref! I'll try it!

Here is a basic translation of the readme (not to imply that you needed me to translate it, but all the french was looking at me and I had to translate it Razz):

WLib demo
by matrefeytontias
To use WLIB, send USEWLIB.8xp and WLIB.8xp to your calculator if it is a 73, 83+ or 84+, or USEWLIB.83p and WLIB.83p located in the "83p" folder if it is a 76, 82 Stats or 83.
BASIC programs use the same function whatever the calculator. You can verify this with A.8xp located in the "examples" folder, try to send it to any of the above-mentioned calculators along with the correct version of WLib.

The 83p version is twice as big as it is in hex ​​form, that is normal; it will be corrected in the final version.

The current commands are described here: http://tout82.forumactif.org/t62-wlib
So yeah, it's been a while since I last worked on it, but yesterday I decided to give it a go and now the tilemapping function is fully done !

How it works is : you can load a tilemap up to 255*255 (that won't even fit in RAM Razz) and only display a part of it, thus allowing tile scrolling !

No binaries yet (because not ready), but here's a screenshot to give you patience Razz

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