Dude, How do you turn off the calc when locked???
jet322 wrote:
Dude, How do you turn off the calc when locked???

That's exactly what [s]AHelper[/s] gbl08ma is trying to implement.
Dude, seriously, keep going with it, and something's gonna happen! That is... 100 downloads in the first day! (Or not.) Still, good luck! I'd love a lock for my calculator. Especially one with username select, a longer password capability, etc. of the such. Something's gonna happen... something goood. Nice work! Very Happy
How do you know how many downloads it had?
easy under the download link in the archive it has #of downloads.
I did not add this to the Archives section, and I only plan on doing so when the add-in is more developed. Unless someone added it for me?
I actually don't know how many downloads there was. I was just saying that a good thing will happen like 100 downloads in the first day or not. My first upload here got like 60 downloads in the first day. The MiniGames Collection. I was just promoting you to keep it up.
Quote:
Does anyone know how to turn off the calculator using code (i.e. not using Shift+AC/ON)?


Syscall 0x1839
void PowerOff( int DisplayLogo );
Thank you, but that doesn't seem to work with PrizmSDK 0.3... the system call is not yet in it, and I don't know how to implement it... anyone wants to help? Smile
Well, seems my SH3/4 assembly learning just came in handy. I just tested this, it turns off the calculator, showing the shutdown message.


Code:
   __asm__(   
         "mov.l syscall_PowerOff, r0\n\t"
         "mov.l syscall_table_branch, r2\n\t"
         "jmp @r2\n\t"
         "mov #1, r4\n\t"
         "syscall_table_branch: .long 0x80020070\n\t"
         "syscall_PowerOff: .long 0x1839"
         );


Insert this where you want to turn off the calculator.
A big thank you! I will definitely need to put a Credits screen on my locker.
Sorry, last version was broken after turn on again. This works.


Code:
   __asm__(
         "mov.l syscall_PowerOff_ended, r4\n\t"
         "lds r4, pr\n\t"
         "mov.l syscall_PowerOff, r0\n\t"
         "mov.l syscall_table_branch, r2\n\t"
         "jmp @r2\n\t"
         "mov #1, r4\n\t"
         "syscall_table_branch: .long 0x80020070\n\t"
         "syscall_PowerOff: .long 0x00001839\n\t"
         "syscall_PowerOff_ended: .long syscall_PowerOff_ended+4\n\t"
         );
I just updated libfxcg.
Thanks everyone. Turning off works now (don't forget you need to update the screen again after the calc turns on, this can be useful for displaying different things before and after the calculator went off), but I've run into another problem. I tried to add just another normal sprite to the program, and display it.

Here's my code: http://pastebin.com/h1WvhkH4

The sprite in question is the one called hold_turn_off_msg and the code that asks for it to be drawn is at 661.

The problem is that the compiler complains:

Code:

...
/tmp/ccoTfKYs.s: Assembler messages:
/tmp/ccoTfKYs.s:1292: Error: misaligned data
/tmp/ccoTfKYs.s:1289: Error: offset to unaligned destination
...


This is just another normal sprite that I put in VRAM as I did with all the others, so I don't see what's the problem...
I initially thought this could be fixed with a quick __attribute__((aligned(4))), but that doesn't seem to be the case.

I'll need to poke at the generated code later this evening to figure it out more, but it looks like a GCC bug which is causing it to emit invalid instructions.
I have updated the download on my server to the latest version that already allows turning off (hold SHIFT and AC/ON), but still doesn't display a message with matching instructions (that's the sprite I'm trying to add...). I have updates the features list on the first post accordingly.

EDIT: Plus, note how well it handles a USB cable being plugged in when the calc is off! (and I didn't even need to write any code to specifically implement this) It turns on, but forces you to input the code before the USB selection mode popup actually displays. Smile
Not a GCC bug. It's an Ashbad bug. Line 1292 of the generated assembly corresponds to 682 of your source. That is to say, my initial thought was correct (unaligned access). There's probably an assembler directive to force alignment, but I can't be bothered to find it because a proper solution now exists.

The fix, of course, is to simply update your copy of libfxcg to the latest in git, which includes the PowerOff syscall (per my post last night when I made that change).
Great job, Programmer. I'd really like a download link for this add-in. It'll be quite useful for me to have a lock program on my CG10.
It's on the first post, as has always been.
I mean for the updated version.
  
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 2 of 4
» 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