Is there any way to get rid of the annoying border on the graph screen? Or put pixels/lines on it? If you can't do it in basic, is there an assembly hex code for it?
Date: 03 Jul 2016 15:27
Number of posts: 2
RSS: New posts
There's no way to do it from TI-BASIC only. I'm pretty sure the border is a relic of the TI-84+CSE. The calculator had barely any RAM and you could not fit an entire screen into RAM at once, so shrinking it by creating a border made it easier to work with. The TI-84+CE has 24-bit memory addressing so it has way more RAM, so this is no longer a problem.
If you want to draw something outside of the border, you're going to need Assembly. If you want it to be compatible with TI-BASIC code, there's no simple hex code for it.
To draw directly to the LCD display, you need to modify vRAM. vRAM is a location in RAM located between memory address 0D40000h and 0D65800h. If you subtract these two numbers, you get exactly 153600. Why? 320*240*2 = 153600. Each pixel on the screen is mapped to two bytes in vRAM. The two bytes represent the color code for that pixel.
This means to modify a single pixel on the LCD display, you need to first determine a 2-byte color code for that pixel, calculate where you want to put it in vRAM, then modify the vRAM at that address.
The color codes are pretty simple. On your computer, you're probably used to RGB. This is how RGB color codes on your computer relate to color codes on the calculator:
f(r,g,b) = 211⌊r÷8⌋ + 25⌊g÷4⌋ + ⌊b÷8⌋
To calculate where in RAM to write the color code, use this:
f(x,y) = 2(320y + x) + vRAM
Where vRAM = 13893632.
So basically, you need to take your color code, calculate the location in memory to modify using the equation above, then write the data.
Here's an example of doing it in Assembly:
ld de, 0 ; clear out deu ld de, $FBBF ; store pink color code in de ld hl, 2*(320*200 + 200) + vRAM ; store screen location at (200,200) ld (hl), de ; write it to the screen
That will draw a pink pixel at (200,200).
If all this sounds too complicated to you… I wrote up a hex code you can use to accomplish this. I tried to make it as compact as possible, but it's still quite long.
AsmCE84Prgm CD840302 21F905D0 3643 CD600F02 CD700F02 3E10 CD480300 EB D5 CD840302 21F905D0 3659 CD600F02 CD700F02 3EA0 CD480300 29 E5 CD840302 21F905D0 3658 CD600F02 CD700F02 E1 19 29 110000D4 19 D1 ED1F C9
Put this code in a program called "PIXEL". You can draw a pixel to the screen in your TI-BASIC code like this.
50->X 50->Y 3071->C AsmPrgm(prgmPIXEL
X is the X coordinate, Y is the Y coordinate, C is the color code.
Also, for this particular program, to convert RGB values from the computer to the equivalent, use this function instead of the one listed above:
f(r,g,b) = (211⌊r÷8⌋ + 25⌊g÷4⌋ + ⌊b÷8⌋)÷16
Note that having to load a program every time to draw a single pixel is pretty slow.
I might get around to coming up with a faster way to do this through TI-BASIC in the future.