Grayscale Lib for TI83 Basic
Moderator: MaxCoderz Staff
Grayscale Lib for TI83 Basic
Could someone make a grayscale lib for ti 83 plus basic? I know its possible but whos willing to do it.? Like what you could do is have.. 4 different shades and then the coordinates like example :
2:24:10:Asm(GrayLib
2 = shade of gray
24 = x axis
10 = y axis
Edit kv83:Please... don't use CAPS LOCK in titles (or posts)
2:24:10:Asm(GrayLib
2 = shade of gray
24 = x axis
10 = y axis
Edit kv83:Please... don't use CAPS LOCK in titles (or posts)
Actually, making basic grayscale isn't only as simple as running an ASM(prgmGSENABLE prgm at the beginning of the game. You have to run the interrupt (if anyone have a proper word for BASIC interrupt plz tell me) after every lines of code.
Also NEVER use the Asm( command in a walking loop because it's very slow. Use Omnicalc or dissasemble (or hack) xLIB and run the hex code from the ExecAsm( command in Omnicalc. This should be faster.
There is a guide to BASIC grayscale here:
http://www.ticalc.org/archives/files/fi ... 35823.html
Also NEVER use the Asm( command in a walking loop because it's very slow. Use Omnicalc or dissasemble (or hack) xLIB and run the hex code from the ExecAsm( command in Omnicalc. This should be faster.
There is a guide to BASIC grayscale here:
http://www.ticalc.org/archives/files/fi ... 35823.html
Just a thought: I saw the PI background program by Benryves at ticalc.org (http://www.ticalc.org/archives/files/fi ... 27493.html) and noticed that you can do anything with your calc during it's runtime. I was wondering if a multitaksing-based gray lib like the pi background would be possible? For example, you load your two map layer with xLIB and store them in two pictures (like in Reuben Quest), you display the first map layer, and you run Asm(prgmGSENABLE. That way, the second layer would be displayed as a full screen sprite like in RQ using the XOR logic very quickly during runtime. Then when you want to disable the grayscale you just run Asm(prgmGSDSABLE. Basically this would do almost the same thing than using Omnicalc, but this would decrease the game size dramatically. The interupt frequency would be stored in X so if you want speed but less quality you choose a lower value and if you want high quality but don't need speed much you choose a higher, and of course the grayscale would still be 3 level only. I was wondering if we could use the multitasking idea by Benryves to make that kind of library?
- dysfunction
- Calc Master
- Posts: 1454
- Joined: Wed 22 Dec, 2004 3:07 am
- Location: Through the Aura
- Jim e
- Calc King
- Posts: 2457
- Joined: Sun 26 Dec, 2004 5:27 am
- Location: SXIOPO = Infinite lives for both players
- Contact:
As plausible as it sounds, at some point tios well hit an im 1 or a DI or some thing else of that nature. Not impossible, but not worth the effort put into it really. Besides every basic coder should learn asm eventually, lets not give them any reason to stay with basic.
But with that aside, increasing the interrupt frequency doesn't really improve the image, It's been a misconception that the faster you display your layers the better the grey scale. The 83(+) lcd only updates a frame at a certain rate, try going faster or slower than that and you'll get visible noise due to the images being out of sync. In gpp it's seen as the shifting pixels, and in rigview, prior to being tuned,you'll see a diagonal line of bytes being darker or lighter than they should. The key is trying to sync it just right, and that's hard with the normal interrupt timers.
But with that aside, increasing the interrupt frequency doesn't really improve the image, It's been a misconception that the faster you display your layers the better the grey scale. The 83(+) lcd only updates a frame at a certain rate, try going faster or slower than that and you'll get visible noise due to the images being out of sync. In gpp it's seen as the shifting pixels, and in rigview, prior to being tuned,you'll see a diagonal line of bytes being darker or lighter than they should. The key is trying to sync it just right, and that's hard with the normal interrupt timers.
Ok thx. It was just a thought because my BASIC game update the display 25 times a second on my TI-83+ SE (50 times during splash screens), making quite decent 3-level grayscale, but I have to shift the pixel with Omnicalc Sprite( command after every code of line so it was just a thought for shrinking the program size down .
- dysfunction
- Calc Master
- Posts: 1454
- Joined: Wed 22 Dec, 2004 3:07 am
- Location: Through the Aura
The least difficult course, however, would be to simply modify Ben's library. Cut out the part at the beginning where it prompts the user to input the interrupt value, and instead have the program get that value from X. For your actual pics, just replace the default pi pic data with your own exported from istudio or calcgs, then recompile the program.
"You're very clever, young man, but it's turtles all the way down!"
ZGreyLib Compatibility
Hello everybody! Although this is my first post at the Maxcoderz forum, I'm quite experience in assembly and would like to say that I have some intriguing news about "revolutionary greyscale graphics": I have written a greyscale library demo! Before you read, I would also like to apologize in advance for the length of this post, since it is gargantuan...
I originally thought of this last Thursday, February 17 during school, wrote it after I came home, and sent off a demo to Kévin that evening. With that, he gave me a link to this thread, which meant that I wasn't the first to think of this After reading this, I tweaked the library to sort of fit Kévin's specifications. Here are some important pieces from the readme:
* Kévin's RPGs will have to use the archive, meaning slower map loading
* A GarbageCollect will mess up the picture pointers, and set interrupt mode 1
* You cannot delete/edit/unarchive the picture while the library is installed
* xLIB still uses appBackUpScreen, so the library must be uninstalled first before using it
* Omnicalc might sometime store data to the interrupt code (256 bytes @$9900 and ??? bytes @$9A9A), thus crashing the calculator
The advantages? Well, I'm glad you asked. If we can get rid of these problems, this library will allow:
* Omnicalc sprite() quality 3-level greyscale or better
* Reduced program size (because there aren't as many sprite() commands)
* Faster program execution (because there aren't as many sprite() commands)
* And best of all, higher-quality greyscale graphics than Omnicalc on an 83+
This is where I currently stand. Now I ask, what other possible method(s) are there to fix xLIB and Omnicalc compatability? Is there another mysterious 768 byte RAM buffer somewhere? Or will this greyscale library be just another dream?
@Kévin: The reason why this didn't work in an emulator is because VTI and FlashDebugger don't emulate interrupts properly, which means that you can't take screenshots I'm not positive about TiLEm though...
@Everybody else: I don't know of an easy way to distribute this library, seeing that I don't have a webpage to post a link to, and that I don't want to release it to ticalc.org yet... Btw, you guys can also catch me at the Detached Solutions forum, if need be
I originally thought of this last Thursday, February 17 during school, wrote it after I came home, and sent off a demo to Kévin that evening. With that, he gave me a link to this thread, which meant that I wasn't the first to think of this After reading this, I tweaked the library to sort of fit Kévin's specifications. Here are some important pieces from the readme:
The first version I sent to him was extremely buggy because _FindSym in an interrupt isn't safe. It seems that the BASIC interpreter/parser doesn't update the VAT or something to that nature, so if I couldn't look up the picture variable every interrupt, I had to look for a fixed, untouched location where I could copy the picture to, since RAM data (i.e. the picture variable) is relocatable. Boy, that was a long sentence . Anyway, since appBackUpScreen had the interrupt code and plotSScreen was taken (duh), I immediately thought of the last 768 byte buffer, saveSScreen. The second version, which uses saveSScreen, works, but I then discovered some discouraging news: Omnicalc's "equates.inc" has Sprite_DATA equated to saveSScreen. And sure enough, when I tested sprite(), the image was messed up. Darn ... The solution I proposed to Kévin was to make the picture non-relocatable by archiving it. This new method works with near-identical quality to the saveSScreen version, but there are some glaring problems:Pieces of the ZGreyLib Readme wrote:The syntax of ZGreyLib is as follows:
{#1,#2,#3:Asm(prgmZGREYLIB
#1 - Action code. The currently supported codes are install (1) and uninstall (0)
#2 - Picture #. For those who have used ZPIC, follow the same convention, mainly 1 = Pic1, 2 = Pic2; 10 = Pic0.
#3 - Interrupt Frequency. If you divide the # of times an interrupt triggers by this #, you get the number of times the images are XORed per second. Example: ~100Hz/4 is ~25Hz.
...This program takes advantage of the hardware interrupts built in the z80 microprocessor... Every time a counter reaches zero, the interrupt routine will XOR a buffer that holds the 2nd greyscale layer with the current screen, and reset the counter to the user-specified frequency before jumping to the system interrupt code. By XORing the two images many times per second, it gives the illusion of grey...
* Kévin's RPGs will have to use the archive, meaning slower map loading
* A GarbageCollect will mess up the picture pointers, and set interrupt mode 1
* You cannot delete/edit/unarchive the picture while the library is installed
* xLIB still uses appBackUpScreen, so the library must be uninstalled first before using it
* Omnicalc might sometime store data to the interrupt code (256 bytes @$9900 and ??? bytes @$9A9A), thus crashing the calculator
The advantages? Well, I'm glad you asked. If we can get rid of these problems, this library will allow:
* Omnicalc sprite() quality 3-level greyscale or better
* Reduced program size (because there aren't as many sprite() commands)
* Faster program execution (because there aren't as many sprite() commands)
* And best of all, higher-quality greyscale graphics than Omnicalc on an 83+
This is where I currently stand. Now I ask, what other possible method(s) are there to fix xLIB and Omnicalc compatability? Is there another mysterious 768 byte RAM buffer somewhere? Or will this greyscale library be just another dream?
@Kévin: The reason why this didn't work in an emulator is because VTI and FlashDebugger don't emulate interrupts properly, which means that you can't take screenshots I'm not positive about TiLEm though...
@Everybody else: I don't know of an easy way to distribute this library, seeing that I don't have a webpage to post a link to, and that I don't want to release it to ticalc.org yet... Btw, you guys can also catch me at the Detached Solutions forum, if need be
"If SOURCE is outlawed, only outlaws will have SOURCE."
Sounds cool.
You could always write your own interrupt-safe _findsym It wouldn't be that hard to walk the Allocation Table for normal variables until you find the appropriate picture variable. If you did this, you would also be able to handle cases when the pic variable is archived during execution (if that is something you want to do). And of course, you wouldn't have to worry about finding a safe 768 byte buffer.
One small thing: pictures do not take up the full 768 bytes. You only need 63*12, or 756 bytes
You could always write your own interrupt-safe _findsym It wouldn't be that hard to walk the Allocation Table for normal variables until you find the appropriate picture variable. If you did this, you would also be able to handle cases when the pic variable is archived during execution (if that is something you want to do). And of course, you wouldn't have to worry about finding a safe 768 byte buffer.
One small thing: pictures do not take up the full 768 bytes. You only need 63*12, or 756 bytes
Hmmm, never thought of that. However, I see a problem with looking it up every interrupt. What if the interpreter was moving the picture and an interrupt was triggered at, say, the 123 byte of the picture. That would then lead to those crashes/messed up pictures/etc I experienced in my first version...
Oh, and I'm aware a picture takes $02F4 bytes. Thanks anyway.
Oh, and I'm aware a picture takes $02F4 bytes. Thanks anyway.
"If SOURCE is outlawed, only outlaws will have SOURCE."