My today's project :



How it work:
PRGM2 start a timer, and lanch a Casio Basic program.
The timer check the value of 'F' variable. If it's non-null, the timer call the function corresponding to the 'F' value. It allow to use fast functions in a basic program.

This first version include functions for drawing, manage contrast, and communicate (via 3pin port).

I want to add a sprite and IsKeyDown function.
Bad point: There is a bug, the calc freeze when you quit, so you have to save your program in storage memory before launching PRGM2.

EDIT : Totoyo (an admin on planet-casio) has made a program with PRGM2:
Do you have any idea what causes the freeze when the BASIC program ends? This seems quite nifty, if I understand how it works. Is a timer like an interrupt, or something different?
I solved the freeze problem.
I used the SetQuitHandler function from SDK to stop the timer. But the basic interpretor that I launch set his own QuitHandler. So my timer was never stopped, and when another app was launched, the callback function of the timer doesn't exist anymore. So "system error" kind "interrupt"
To solve it, I don't use SetQuitHandler anymore, but stop the timer when [MENU] key is pressed. It's not perfect because it forbid to use this key in the basic programs.

But there is another bug if the basic program use Lbl/Goto.
It occurred to me that if one of us gets around to making a shell for the Prizm, this would enable us to provide extra functions to BASIC programs from our shells. Is that correct?
What syscall or address is used to start the Casio-Basic interpreter?
I don't know how to safely use a timer on Prizm.

Btw, I always wondered what exactly do shells on ti-calcs.

EDIT : @cfxm : I use syscall 0x09F5 (App_PRGM). Is there an other ?? (except 0x049A StartAnyApp)
PierrotLL wrote:
Btw, I always wondered what exactly do shells on ti-calcs.
Their main purpose is to launch programs, but many of them also provide some extra routines to programs that are run.
JosJuice wrote:
PierrotLL wrote:
Btw, I always wondered what exactly do shells on ti-calcs.
Their main purpose is to launch programs, but many of them also provide some extra routines to programs that are run.
Indeed. They can, to name a few:

1) Run programs from Archive (ROM), which the OS cannot do
2) Run programs that are larger than the OS will run
3) Provide extra routines and libraries to both ASM and BASIC programs
4) Provide extra user features for programs, like icons, descriptions, etc
5) Layer more filetypes on top of the OS, and extra file system information like folders

For example, for my own shell, Doors CS, here's a list of features:
http://dcs.cemetech.net/index.php?title=Features
@PierrotLL
Okay, I thought you made a menu and called that Basic interpreter directly.
I believe that he install a timer, then he runs the interpreter with the timer... That should explain why we get the PRGM menu after the end of the program.
I'm going to adapt this program on Prizm.
It will speed up graphics in basic, allow comunication between 2 calcs and use all the colors.

Currently, i try to use syscalls, i test it on the manager.
Purobaz wrote:
I'm going to adapt this program on Prizm.
It will speed up graphics in basic, allow comunication between 2 calcs and use all the colors.

Currently, i try to use syscalls, i test it on the manager.
Awesome, that would be very much appreciated! Good luck; please keep us posted on your progress.
If this at all interests you, I will experiment with the TMU and TPU later on. How did you get the timer to trigger an interrupt in your code? Was it a syscall, or were parts using the CPU?
PierrotLL has made this program.
This is the functions used to start and stop the timer :

Code:
void timer_start()
{
   // SetQuitHandler(timer_stop);
   SetTimer(ID_USER_TIMER1, TIMER_DELAY, timer);
}

void timer_stop()
{
   int key=0;
   KillTimer(ID_USER_TIMER1);
   PopUpWin(4);
   locate(3, 3);
   Print("PRGM2's timer");
   locate(3, 4);
   Print("has been stopped.");
   Bdisp_PutDisp_DD();
}


I just want to port it on Prizm.
I think this code will run correctly.
I've got some basics graphics functions, I can pm you for these, if you want, Puro'
Thanks, i would like a function to draw the color corresponding to the rgb value.
I also need the adress of VRAM. It is the same that for fx ?
The timer function most likely access the TPU channels 0-3, according to the SH7720-7730 docs.

Again, I will be testing them, but refer to page 573 of the sh7720/21 manual.

also:
Code:
unsigned char R,G,B;

// ... Assign ...

R >>= 3;
G >>= 2;
B >>= 3;
unsigned short rgb565 = (R << 11) | (G << 5) | B;
and
Code:
void plot(int x0, int y0, short color) {
        char* VRAM = (char*)0xA8000000;
        VRAM += 2*(y0*LCD_WIDTH_PX + x0);
        *(VRAM) = (color);
        return;
    }
Unfortunatly, i have realized i haven't enough experience to lead this projet.

This is some interesting syscalls, if somebody is able to do it, i could help him for Basic programs and experimentation.


Code:

App_PRGM() (void)(*iSysCallFuncPtr)( 0,0, 0, 0, 0x1945)
PutKey(key) (void)(*iSysCallFuncPtr)( key,key<256, 0, 0, 0x0EA9)
Alpha_GetData(VarName,Dest) (void)(*iSysCallFuncPtr)( VarName,(int)Dest, 0, 0, 0x0034)
Alpha_SetData(VarName,Src) (char)(*iSysCallFuncPtr)( VarName,(int)Src, 0, 0, 0x0035)
Alpha_ClearAll() (void)(*iSysCallFuncPtr)( 0,0, 0, 0, 0x0036)
Timer_Start(ID) (int)(*iSysCallFuncPtr)( ID,0, 0, 0, 0x08DB)
Timer_Stop(ID) (int)(*iSysCallFuncPtr)( ID,0, 0, 0, 0x08DC)
Timer_Install(ID, handler, elapse) (int)(*iSysCallFuncPtr)( ID, (int)handler, elapse, 0, 0x08D9)
Timer_Deinstall(ID) (int)(*iSysCallFuncPtr)( ID,0, 0, 0, 0x08DA)



You can download the sources here.
I just looked at this today. Awesome project. I am going to figure out how to use it this week Smile
Don't spend time, it's just a beta. The next version will be faster and easier.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement