Author Topic: xLIB 84C Edition  (Read 51100 times)

0 Members and 2 Guests are viewing this topic.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
xLIB 84C Edition
« on: June 18, 2013, 08:01:27 pm »
Hi All,

As you may have seen, there has been a small amount of interest in bringing an ASM lib with some graphics features to the TI-84+CSE (84C for short).

I have been toying with a few small ideas that i may end up implementing in a preliminary version for BASIC programmers.

There are some pretty serious speed and memory limitations on the 84C which mean that fast paced BASIC+ASM lib games arent likely if the entire screen is utilised per frame. That being said, if there are a handful of sprites on screen at any time, this should be ok.

Just a note, there will be a radical difference between the way this lib and earlier versions of xLIB (for the 83+ etc) work.

Some of the proposed features:

32 internal but user accessible 16-bit variables (functions will take references to these variables instead of TIOS variables)
Graphics mode will be 160x120 (half res)
128x64, 256 colour (standard palette) custom PIC's (likely stored in appvars) ~8192 bytes+header. Enough to store 128, 8x8 tiles/sprites.
Ability to 'load' 2 custom PIC's into temp RAM for faster access
Ability to store 2 copies of the LCD into temp RAM (kind of like a temp storePIC)
8x8 fullscreen tilemapping (160x120 = 19x13 tiles)
256 colour (standard palette) sprites (not sure on max size yet)
Capability to 'chain' keypresses and update user variables if necessary (can test up to 16 keypresses with 1 command)
On calc PIC/tile/sprite editor
*Possibly* an on calc map editor
Line/shape drawing
Colour text routines
Archived program execution
And possibly more, but that for now.

One of the BIG traps that older versions of xLIB fell into was people requesting odd or specific features that would only be used *very* rarely, if at all. These considerably slowed the entire lib down for almost no benefit. This is something that i would really like to avoid with this incarnation.

Anyway ive been testing a few small things, but screenshots are difficult to make without a fully functioning emulator. But anyway here is a small tilemap test:



Simple sprite tests, with transparency as well:



Scrolling is not ideal speed wise. Though there are options to speed things up (interlacing etc). The most probable method for games will be to scroll screen-by-screen if that makes sense.

Just wondering if anyone has any ideas/thoughts?
« Last Edit: June 19, 2013, 08:11:57 am by tr1p1ea »
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #1 on: June 18, 2013, 08:46:31 pm »
I'm really glad that xLIB is happening. I have some suggestions, though:

Tilemapping: I think it should not be limited to full screen, else we will not be able to draw HUD's and some people might want to make their games fit a smaller screen are in order to save speed. Even SNES games like Star Fox did it, after all. :P

What would be nice about tilemapping would be if data could be read from appvars, kinda, and preferably use a format similar to Axe, because matrices are ridiculously large and strings are a major PITA to use for collision detection.


Sprites: 8x8 I guess, but in the future it would be nice if any screen resolution is supported, for people who want quality over speed or vice-versa. I mean 320x240, 160x240 and 160x120. You could maybe include 16x16 support eventually, for people who want their code to be smaller and faster.


Resolution: I think you should allow people to enable interlacing or not (via an extra argument?). People who absolutely want 160x240 resolution can then just use two set of tiles then display the tilemap twice, with one copy offset by 1 pixel vertically. (although such graphics might be hard to draw :P).

Real(10 command to copy archived programs to RAM, which would be nice since the calc has smaller RAM.

Anyway this looks promising. By the way, have you tried TilEm and SourceCoder emulators? They can run ASM programs, although they can't setup the 160x240 res mode IIRC. Just capture with Camstudio then edit the screenshot in VirtualDub to crop the second half of the screen, then stretch it up to 320px and export as GIF. Else I could maybe do the screenshot for you (although that could take a while)

Good luck!

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #2 on: June 18, 2013, 09:08:20 pm »
Tilemapping most likely wont be limited to fullscreen only to allow space for HUD's etc.

The data will not be stored in matrices as they are too slow! Id say they will be stored in appvars as well. Im not sure what the largest size map should be ... 64x64 (4096 bytes)?

Sprites will have the ability to be any size up to 64x64 i think. But the way they are stored in the PIC files will be in 8x8 chunks.

By interlacing are you referring to only drawing every 2nd line (and having black in between)? Im not sure if this would be one of those features that not many people would use since lots of detail is lost on screen. But it would be good for speed.

Copying programs from archive to RAM will be included.

I havent come across an 84C version of TilEm yet, but i have used jsTIfied. The issue with screenies is that xLIB uses the 'non-active' portion of GRAM as a buffer so it needs 160x240 mode to be emulated in order to construct proper screenshots (cropping and resizing wont give proper screenshots).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: xLIB 84C Edition
« Reply #3 on: June 19, 2013, 12:01:39 am »
This looks great Tr1p. As the original xLIB was a huge asset to programmers, I'm sure this will be the same.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #4 on: June 19, 2013, 12:24:26 am »
Tilemapping most likely wont be limited to fullscreen only to allow space for HUD's etc.

The data will not be stored in matrices as they are too slow! Id say they will be stored in appvars as well. Im not sure what the largest size map should be ... 64x64 (4096 bytes)?

Sprites will have the ability to be any size up to 64x64 i think. But the way they are stored in the PIC files will be in 8x8 chunks.

By interlacing are you referring to only drawing every 2nd line (and having black in between)? Im not sure if this would be one of those features that not many people would use since lots of detail is lost on screen. But it would be good for speed.

Copying programs from archive to RAM will be included.

I havent come across an 84C version of TilEm yet, but i have used jsTIfied. The issue with screenies is that xLIB uses the 'non-active' portion of GRAM as a buffer so it needs 160x240 mode to be emulated in order to construct proper screenshots (cropping and resizing wont give proper screenshots).
Ah ok, I didn't realize matrices were slow. They seemed faster than strings to me (at least for collision detection). But appvars would be better as it would be smaller.

Sprites that are 64x64 seems fine to me. Else I guess 32x32 or 16x32 would be fine as well. Most large sprites will most likely be enemy data for RPGs and bosses for other games.

For the emulator, as I said, you could just use a video capture program then edit the screenshot resolution afterward, cropping the non-active portion of the GRAM out. This is what I did with my older screenshots to fake the 160x240 mode:


As for interlacing, see image below for what I mean (basically you don't even need to implement 160x240 mode, as long as you implement scanlines):
« Last Edit: June 19, 2013, 12:25:21 am by DJ Omnimaga »

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #5 on: June 19, 2013, 01:53:15 am »
Cool, though i think ill add the scanline option after the majority of the graphics routines have been written - to ensure consistency.

Also i forgot to mention that sprites will have an optional transparent colour index as well!
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #6 on: June 19, 2013, 02:18:38 am »
I like the transparent color idea. By the way, how will palettes be stored? Will each sprite have their own palette or will it be one palette at once for the sprite sheet?

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #7 on: June 19, 2013, 02:20:58 am »
There is a standard 256 colour 'xLIB Palette' that graphics need to use. This is not required to be included with the sprites/PIC's themselves.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #8 on: June 19, 2013, 02:54:42 am »
Ah ok I see now. I guess in that case too it shouldn't take too much memory. I worried that each sprite had its own palette, so that would have been quite large >.<

Will line/rectangle routines be forced to 120 px height btw or will they be able to use the full res?
« Last Edit: June 19, 2013, 02:57:36 am by DJ Omnimaga »

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: xLIB 84C Edition
« Reply #9 on: June 19, 2013, 03:35:51 am »
Good luck with this! :D


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #10 on: June 19, 2013, 04:04:47 am »
On a side note tr1p1ea, since xLIB is starting to get old, a lot of younger TI-Z80 programmers are probably unaware of what the original version was, here. So as a suggestion, I would change the topic title to xLIB 84C - fast ASM lib for BASIC programmers or something like that, to attract more people. :P

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: xLIB 84C Edition
« Reply #11 on: June 19, 2013, 04:39:34 am »
That looks quite nice feature wise ! I hope you'll get a good speed once it's finished. :D
* Streetwalker wants a CSE

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: xLIB 84C Edition
« Reply #12 on: June 19, 2013, 05:06:11 am »
Well, it seems that 3rd party app development is off to a better start than TI's app development! We already have two released apps (BrandonW's Linky beta and my MicrOS), and now a third in development. I suspect that performance issues will push even more BASIC coders to adopt assembly augmentation.

Also, I'd like to suggest possibly using the ExecLib command as your hook for BASIC functions, for it might be faster. Based on what I'm seeing in the USB8X source, you specify using ExecLib by putting the byte sequence 96 E2 00 01 at 40A0 in your app. Then, put a short pointer to a header continuation, which then contains the bytes 01 00 02 00 followed by a pointer to your ExecLib handler. These two extra headers can be sequential. Why TI didn't just make this part of a new app header field I can't image, but maybe BrandonW can.
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #13 on: June 19, 2013, 05:12:05 am »
Ive thought about OpenLib/ExecLib, but i thought there were issues with using it? Ill check it out :).

(Also thanks for the APP info :)).
« Last Edit: June 19, 2013, 05:12:50 am by tr1p1ea »
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: xLIB 84C Edition
« Reply #14 on: June 19, 2013, 06:27:22 am »
On a side note tr1p1ea, since xLIB is starting to get old, a lot of younger TI-Z80 programmers are probably unaware of what the original version was, here. So as a suggestion, I would change the topic title to xLIB 84C - fast ASM lib for BASIC programmers or something like that, to attract more people. :P
Wasn't it that you have to put stuff in ans and then call Asm(prmXLIB ?

And nice thingy, the xlib for the cse!
i /really/ should get one...........

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!