Author Topic: Prizm C Q&A thread  (Read 7527 times)

0 Members and 2 Guests are viewing this topic.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Prizm C Q&A thread
« on: August 31, 2011, 12:40:40 am »
I am totally overwhelmed with the prizm mini SDK documentation. Right now all I need to know is: How do I draw pixels, both directly to the screen and to a back buffer, and how do I read keypresses?
« Last Edit: August 31, 2011, 12:44:36 am by t0xic_kitt3n »

Offline SimonLothar

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 129
  • Rating: +35/-1
    • View Profile
Re: Prizm C Q&A thread
« Reply #1 on: August 31, 2011, 08:44:49 am »
You could use the following syscalls:

write a pixel to VRAM:
0x0263
void Bdisp_SetPoint_VRAM( int x, int y, unsigned short color );

directly draw a pixel:
0x026B
void Bdisp_SetPoint_DD( int x, int y, unsigned short color );

read the keyboard (blocking):
0x0EAB
int GetKey( int*key );

read the keyboard (non-blocking):
0x12BF 
int GetKeyWait_OS(int*column, int*row, int type_of_waiting, int timeout_period, int menu, unsigned short*keycode );

These are only examples for a start.

It is possible to read the keyboard-registers directly, to gain speed, if necessary.
Or you can write to VRAM by simple memory-write-operations.
I recommend the use of syscalls as much as possible.
Especially there are some drawing-syscalls, which save a lot of source code and coding time.


I'll be back.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Prizm C Q&A thread
« Reply #2 on: August 31, 2011, 11:23:59 am »
How fast are they? An inline function would be better, I could make one if i knew the addresses.

Ashbad

  • Guest
Re: Prizm C Q&A thread
« Reply #3 on: August 31, 2011, 01:11:08 pm »
How fast are they? An inline function would be better, I could make one if i knew the addresses.

Well, for graphics drawing, I've been doing it all either inline with just managing pixels with simple memory management within VRAM, or wrote some application specific (mostly size-constant and sprite offset address-constant) graphics routines instead of using the graphics syscalls.

For GetKey routines, I use this routine by Kerm:

Code: [Select]
int PRGM_GetKey(){
unsigned char buffer[12];
PRGM_GetKey_OS( buffer );
return ( buffer[1] & 0x0F ) * 10 + ( ( buffer[2] & 0xF0 ) >> 4 );
}

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: Prizm C Q&A thread
« Reply #4 on: August 31, 2011, 02:05:41 pm »
Is that one considerably faster or is it like BASIC getkey speed? The other day Eiyeron was trying various getkey routines and kept reporting that anything he was trying was as slow as BASIC. Maybe I missed something, though.

Also it is in the wrong forum section. Technically people aren't even supposed to be able to post in here, but there is a permission issue on the forums it seems. X.x
« Last Edit: August 31, 2011, 02:06:25 pm by DJ_O »

Ashbad

  • Guest
Re: Prizm C Q&A thread
« Reply #5 on: August 31, 2011, 02:12:07 pm »
It actually works very well -- I'd compare it to the GetKey routine Axe has.

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: Prizm C Q&A thread
« Reply #6 on: August 31, 2011, 02:13:06 pm »
Ok that's good then. I was a bit worried X.x

Ashbad

  • Guest
Re: Prizm C Q&A thread
« Reply #7 on: September 01, 2011, 12:49:17 pm »
Ok that's good then. I was a bit worried X.x

on a side note, it does sometimes act weird for reasons I'm not sure about (sometimes it will not register a keypress), but I only noticed that problem once; it should be good.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Prizm C Q&A thread
« Reply #8 on: September 05, 2011, 01:59:51 am »
So what address is the VRAM located at? (Is it memory mapped?) I'd like to make a screen buffer and copy stuff to the VRAM. Also, what does blocking and non blocking mean?

Ashbad

  • Guest
Re: Prizm C Q&A thread
« Reply #9 on: September 05, 2011, 08:54:35 am »
Blocking means it waits for a key, non blocking means it checks for any currently pressed keys and returns which one is pressed.

VRAM is situated at the address 0xA8000000, but I suggest using something like this to make sure you will always use VRAM if the address changes in OS versions:

Code: [Select]
#define D_VRAM GetVRAMAddress();
GetVRAMAddress() I believe is in either system.h, or one of the display headers.

Another thing, VRAM is *very* large; larger than the amount of memory you're allowed to allocate.  So, you're rather forced to have just one buffer at this moment.
« Last Edit: September 05, 2011, 08:56:17 am by Ashbad »

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Prizm C Q&A thread
« Reply #10 on: September 05, 2011, 02:05:32 pm »
Thanks, though it would be faster to create a pointer that has the address rather than calling the function every time the address is needed. I guess the large space needed is one of the downsides of having a 16 bit color screen :P 384*216*2 bytes = 165888 bytes. Is there a way to stop the screen from updating while graphics are drawn to the VRAM to eliminate flicker? (Come to think of it, that is actually a lot more efficient than using a screen buffer.)

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Prizm C Q&A thread
« Reply #11 on: September 05, 2011, 02:10:55 pm »
Thanks, though it would be faster to create a pointer that has the address rather than calling the function every time the address is needed. I guess the large space needed is one of the downsides of having a 16 bit color screen :P 384*216*2 bytes = 165888 bytes. Is there a way to stop the screen from updating while graphics are drawn to the VRAM to eliminate flicker? (Come to think of it, that is actually a lot more efficient than using a screen buffer.)
The VRAM is not connected directly to the screen, there is an OS function to transfer to the screen (like on the TI-83+, except the LCD controller doesn't suck)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Prizm C Q&A thread
« Reply #12 on: September 05, 2011, 02:42:16 pm »
Oh, so the screen on the Prizm is more similar to the 8x calcs rather than the Nspire? What LCD controller does it use?

Offline SimonLothar

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 129
  • Rating: +35/-1
    • View Profile
Re: Prizm C Q&A thread
« Reply #13 on: September 05, 2011, 04:11:31 pm »
What LCD controller does it use?
Obviously a customized one, but similar to some renesas LCD controllers:
http://ourl.ca/8207/232704
Some additional information is gathered in
fx_calculators_SuperH_based_10.chm
I'll be back.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: Prizm C Q&A thread
« Reply #14 on: November 02, 2011, 05:30:21 pm »
Why don't we have access to screen border?