# Omnimaga

## Calculator Community => TI Calculators => TI-BASIC => Topic started by: JosJuice on November 10, 2010, 12:51:38 pm

Title: Friendly window in Horiz mode
Post by: JosJuice on November 10, 2010, 12:51:38 pm
The window I prefer to use is the one with 0,0 in the bottom-left corner, since it saves the most space. I used to set it up like this:
Code: [Select]
:0→Xmin
:0→Ymin
:94→Xmax
:62→Ymax
However, TI-BASIC Dev suggests this instead:
Code: [Select]
:ZStandard
:84→Xmin
:72→Ymax
:ZInteger
I don't understand what ZInteger does to create the window I want and why 84 and 72 are used instead of 94 and 62. I used this method for my programs anyway.

However, I've run into a problem now. I'm making a Horiz mode program, and because of this I need the window to be a different size. I tried randomly replacing values in the code in order to get the desired 94/31, and this seems to work:
Code: [Select]
:ZStandard
:Horiz
:84→Xmin
:41→Ymax
:ZInteger
Placing the Horiz command later in the code (after ZInteger) does not create the window I want. However, changing the size of the window while Horiz is in effect makes the line between the graphscreen and homescreen flash a bit, which does not look good. Is there any way to solve this without increasing the size of the program? I have no idea of how to make this work, since I don't understand in which way ZDecimal makes every pixel be an integer.
Title: Re: Friendly window in Horiz mode
Post by: Xeda112358 on November 10, 2010, 01:03:25 pm
Do you want each pixel to be 1 unit? If so, you can do this:
Code: [Select]
0→Xmin
0→Ymin
1→dY
1→dX
(The dX is delta x where delta is the triangle thing. Same goes for dY)

If you do this in full screen mode, but then you want to have the same effect in split mode, just do the
Code: [Select]
1→dY
1→dX
thing again and you will be fine.
Title: Re: Friendly window in Horiz mode
Post by: JosJuice on November 10, 2010, 01:06:49 pm
That's what I want to do. However, your method doesn't seem to be smaller than the one I'm currently using, and wouldn't setting dY and dX in Horiz mode make the line flicker, just like the way it does with ZInteger..?
Title: Re: Friendly window in Horiz mode
Post by: Xeda112358 on November 10, 2010, 01:10:17 pm
It always flickers when you change window sizes, doesn't it? There is a flag set to mark the screen as "dirty" whenever equations are edited or window size is modified, I believe.

And it is slightly smaller that way...
Title: Re: Friendly window in Horiz mode
Post by: JosJuice on November 10, 2010, 01:13:55 pm
Changing window sizes in Full mode with AxesOff makes the flicker happen on a completely white background, which means that the screen will stay white unlike in Horiz mode, in which the line has to be redrawn.
Title: Re: Friendly window in Horiz mode
Post by: Xeda112358 on November 10, 2010, 01:14:55 pm
And you want a way to change the size without redrawing the line?
Title: Re: Friendly window in Horiz mode
Post by: JosJuice on November 10, 2010, 01:16:00 pm
Yes.
Title: Re: Friendly window in Horiz mode
Post by: Xeda112358 on November 10, 2010, 01:18:04 pm
That I am not sure can be done in BASIC. I might be able to make a hex code to "undirty" the screen, but that seems like a little much. The code would not be very large, though, if it is what I am thinking.
Code: [Select]
FDCB0380C9
Title: Re: Friendly window in Horiz mode
Post by: JosJuice on November 10, 2010, 01:27:18 pm
I would prefer to not use Asm in this program, but thanks anyway.
Title: Re: Friendly window in Horiz mode
Post by: Xeda112358 on November 10, 2010, 01:29:32 pm
Yeah, something like that isn't extreme enough for assembly, but I included it just in case. If you were making use of a library that included ExecHex or something, the opcode would be more useful, but an actual program is a bit extreme, I agree.
Title: Re: Friendly window in Horiz mode
Post by: meishe91 on November 10, 2010, 10:53:27 pm
How many times are you changing the Window settings in your program? Because if it's just once as the calculator goes into horizontal mode then I don't see any issue with it. Or are you saying for when you clear the screen each time you see the flicker and you want to get rid of that? I'm kinda confused about what you want and are doing.
Title: Re: Friendly window in Horiz mode
Post by: ztrumpet on November 10, 2010, 11:04:11 pm
Here's how to do it exactly as you want it:
Code: [Select]
:ZStandard
:84→Xmin
:20→Ymax
:ZInteger
:Horiz
Good luck. :)
Title: Re: Friendly window in Horiz mode
Post by: meishe91 on November 10, 2010, 11:32:39 pm
Here's how to do it exactly as you want it:
Code: [Select]
:ZStandard
:84→Xmin
:20→Ymax
:ZInteger
:Horiz
Good luck. :)

That doesn't make the y-axis scrollable by one at a time though. That stored negative twenty-six to Ymin and thirty-six to Ymax.
Title: Re: Friendly window in Horiz mode
Post by: ztrumpet on November 10, 2010, 11:45:23 pm
Whoops, let's try that again. ;)
Code: [Select]
:ZStandard
:0→Xmin
:1->_delta_X
:0→Ymin
:30→Ymax
:Horiz
Title: Re: Friendly window in Horiz mode
Post by: meishe91 on November 10, 2010, 11:49:30 pm
This is three bytes smaller ;)

Code: [Select]
ZStandard
84→Xmin
9→Ymax
ZInteger
0→Ymin
Horiz
Title: Re: Friendly window in Horiz mode
Post by: JosJuice on November 11, 2010, 01:52:43 am
How many times are you changing the Window settings in your program? Because if it's just once as the calculator goes into horizontal mode then I don't see any issue with it. Or are you saying for when you clear the screen each time you see the flicker and you want to get rid of that? I'm kinda confused about what you want and are doing.
Only when going into Horiz mode.
This is three bytes smaller ;)

Code: [Select]
ZStandard
84→Xmin
9→Ymax
ZInteger
0→Ymin
Horiz
Awesome! Now I just have to change the coordinates for stuff I'm drawing (shouldn't take more than a few minutes)... The window I used earlier was apparently 1 pixel off :P
Title: Re: Friendly window in Horiz mode
Post by: Deep Toaster on November 11, 2010, 05:37:00 pm
Seems like it's solved, but

However, TI-BASIC Dev suggests this instead:
Code: [Select]
:ZStandard
:84→Xmin
:72→Ymax
:ZInteger
I don't understand what ZInteger does to create the window I want and why 84 and 72 are used instead of 94 and 62. I used this method for my programs anyway.

if you're still wondering, it goes like this:
First, ZStandard sets the coordinates to [-10,10] by [-10,10] (you probably know this).
Then it sets the Xmax and Ymax, which makes the screen [84,10] by [-10,72]. This seems impossible, and if you quit the program then and try to view the graph screen, it gives you an ERR:WINDOW RANGE, as expected. But since the program doesn't display the graph screen right then, you can still play around.
Finally, it runs ZInteger. All ZInteger really does is find the center of the graph and (while keeping it the center) zoom out so that each pixel represents one unit (in other words, ΔX and ΔY each equal 1). To do this, it finds the mean of 84 and 10 (which happens to be 47) and the mean of -10 and 72 (which happens to be 31). If you keep (47,31) the center, it zooms out nicely to [0,92]x[0,62] :)
Title: Re: Friendly window in Horiz mode
Post by: jnesselr on November 11, 2010, 07:00:47 pm
oh, that's why you make it invalid.  Otherwise, you would have to store 104 to ymax.  Nice.