Omnimaga
Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: Runer112 on March 28, 2011, 12:29:41 am
-
For the past week or so, I worked on an Axiom that includes a lot of commands for interfacing with the LCD driver. I think I've finished adding just about everything I wanted to and hopefully it has no bugs, so I'll release it. Here are its features:
- Turn the LCD on or off ? This one's cool
- Get the on/off status of the LCD
- Set the contrast (I just realized as I'm writing this that Axe could already do this, but this command is safer)
- Get the contrast set by the OS (useful for setting the screen contrast back to normal) ? Pretty useful
- Set the screen's z-address (internally shifts the rows of the screen up/down) ? This one's really cool
- Apply screen flipping effects (on newer calculators with compatible drivers)
- Read and write individual bytes/words to and from LCD memory
- Copy a stream of bytes to or from LCD memory
That's a lot of information to throw at you about what it can do. To give you some ideas of how you could use some of these commands, here would be some useful applications of this Axiom:
- Turn the screen off for a teacher key or to save power in a waiting state
- Make contrast effects based around the active (OS-defined) contrast value and then return the contrast to the proper value when done
- Use z-addressing to apply an earthquake effect without having to worry about shifting the buffer image (or make crazy tunnel games (http://ourl.ca/9322/177233))
Anyway, without further ado I will attach a zip file containing the LCDKit Axiom, its source code (sorry if it's tabbed oddly, I designed it in wabbitcode), a readme, and a command list. The Axiom appvar is fairly small for a library with 31 routines, weighing in at 651 bytes. Note that Axe will NOT add the whole thing to your program, only the routines that you actually use, so don't worry about any unnecessary code bloating.
Changelog- 1.0.1 (Mar 28 2011): Fixed a bug that slipped by, breaking the ?imag() commands
- 1.0.0 (Mar 28 2011): Initial release
MAKE SURE YOU DOWNLOAD THE LATEST VERSION, CURRENTLY: LCDKit_1.0.1.zip
-
This is awesome! Writing directly to the buffer is something I was definitely looking for a few days ago!
-
Oh wow, that's epic. Nice job Runer112. :D
-
Fixed a bug I hadn't noticed due to changing a shared routine without realizing it would break a routine that used it. Writing bytes/words directly to the LCD should now work.
EDIT: Just noticed a dumb mistake in commands.txt. Oh well, it's only a naming mistake and isn't too important. It'll make it into the next release, which will probably be soon due to another unexpected bug.
-
Awesome, the first real Axiom I've seen! :)
On a related note, I remember you were asking somewhere if the 32 routines was a technical limitation: kind of. I have 160/256 unique subroutine identifiers reserved for axioms which leaves me 96 built in subroutines (I am currently using 52). I decided to split it up such that there would be 5 Axioms maximum with 32 routines for each one. I could change it to 4 Axioms with 40 routines per Axiom, I'm not sure what a good mix would be. What are your thoughts?
-
Hmm... if RAM limits you to only assigning 256 subroutines, then I guess the current limit is okay.
-
Wow, this looks great! Nice job, Runer! ;D
-
Looks useful!
Also, Quigibo, what's the chance of having a header in each axiom, that specifies the number of subs used, and allows you to have it based on the number of routines, not the number of axioms?
-
I can't send it to my calc; my computer says it's an invalid file type.
Nevermind. I was being illiterate. :(
How do I flip the LCD?
What's z addressing?
-
To flip the LCD:
R►Pr() Turns horizontal and vertical flipping off; only works on newer calculators
P►Rx() Turns horizontal flipping on and vertical flipping off; only works on newer calculators
P►Ry() Turns horizontal flipping off and vertical flipping on; only works on newer calculators
R►Pθ() Turns horizontal and vertical flipping on (rotate screen 180 degrees); only works on newer calculators
LCD flipping is only supported on fairly new calculators. Older calculators' LCD drivers did not have this flipping feature.
Z-addressing changes how LCD RAM is mapped to the screen. The z-address can be a number from 0 to 63, and is normally set to 0. This means that normally, row 0 of a buffer image would be displayed at row 0 on the screen. However, the output on the screen can be shifted vertically by changing the z-address. The value of the z-address determines which row in the buffer image would be displayed at row 0 on the screen. For instance, if you set a z-address value of 8, the screen would effectively be shifted up 8 pixels because row 8 of the buffer image would be mapped to row 0 of the screen. Rows 8-63 would be shifted up 8 pixels and rows 0-7 would appear at the bottom of the screen, having wrapped around from the top. Z-addressing could be used for something like an earthquake effect by changing the z-address between 1 and 63, which would shift the screen 1 pixel up and 1 pixel down, respectively.
To set the z-address (this token is found under VARS > Statistics... > TEST):
→z Sets the z-address
-
z isn't under EQ, it's under TEST. Just saying.... ¯\(O.o)/¯
-
So it is.../me slaps head
-
It's giving me a BAD SYMBOL error! Should I send the z to its room?
-
It works fine for me. Is the Axiom on your calculator, and does your program contain #Axiom(LCDKIT)?
-
Yes, and yes. Does your Axiom support z+1->z anyway?
So I just use P►Ry() and the screen flips upside down?
-
Unfortunately there's no way to read the current z-address setting, so no. You might want to keep track of the z-address in your own variable.
-
Yeah, I'm doing that now. :P