Author Topic: Turn off Calc and Exit Program in Axe?  (Read 8613 times)

0 Members and 1 Guest are viewing this topic.

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Turn off Calc and Exit Program in Axe?
« on: August 28, 2012, 06:40:25 pm »
Well, been playing around with Axe for a month or so, and was wondering if there's a way to turn off the calculator and exit the program? Is there some sort of axiom or asm technique to do that?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8206
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Turn off Calc and Exit Program in Axe?
« Reply #1 on: August 28, 2012, 06:58:48 pm »
:Asm(FDCB1696)
:Return


The first line tells the calculator to power off when the program exits, and the second line exits the program. (If you are in a subroutine when you run this, you should use Returnr instead of Return.)

Spoiler For Spoiler:
The first line actually tells the OS that the batteries are too low to run... Seems to work anyway :P
« Last Edit: October 07, 2012, 09:16:41 pm by Deep Thought »




Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: Turn off Calc and Exit Program in Axe?
« Reply #2 on: August 28, 2012, 07:02:33 pm »
Brilliant! Thanks, really appreciate it!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8206
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Turn off Calc and Exit Program in Axe?
« Reply #3 on: August 28, 2012, 07:10:35 pm »
Edited my post (Runer112 pointed some stuff out over IRC).




Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Turn off Calc and Exit Program in Axe?
« Reply #4 on: August 30, 2012, 09:22:17 am »
:Asm(FDCB1696)
:Return


The first line tells the calculator to power off when the program exits, and the second line exits the program. (If you are in a subroutine when you run this, you should use Returnr instead of Return.)

Spoiler For Spoiler:
The first line actually tells the OS that the batteries are very low... Seems to work anyway :P
It doesn't work with zStart when the program is set on startup D:
(however, it works when launched from homescreen :))
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Xaychru04

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +0/-0
    • View Profile
    • Xaychru04's blog
Re: Turn off Calc and Exit Program in Axe?
« Reply #5 on: October 07, 2012, 03:55:01 pm »
Wow, we can do a lot of things including pure assembly in an axe program !
I wanted to do a screen saver one month ago with axe but I didn't know how to launch it automaticly...
Anyway, I don't think it's possible to tell the OS to launch the program automaticly ^^

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Turn off Calc and Exit Program in Axe?
« Reply #6 on: October 07, 2012, 04:38:22 pm »
* shmibs is curious about this as well.
what would one have to do to make a program that automatically launches after a given amount of time, regardless of whether or not there is any user input? would modifying the os to add in a bit of code executed during interrupts work?

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1591
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Turn off Calc and Exit Program in Axe?
« Reply #7 on: October 07, 2012, 09:07:36 pm »
This sounds like a job for OFFSCRPT.

OFFSCRPT.8xv (appVar) gets copied to $8001 every time the calculator turns off. This catches both 2ND + ON as well as APD. So instead of going to APD, it can just display your screen saver.

Here's what your OFFSCRPT would look like:
Code: [Select]
.org $8001
bit 4, (iy + 8)
ret z ;this was a purposeful turn off


;do whatever you want, here's an example if you want to run an axe program

ld hl, axeName
rst 20h
bcall(_executePrgm)



;when you are done, you have two options

ret ;this will turn the calculator off

bcall(_jForceCMDNoChar) ;this will turn the calculator on

axeName:
.db protProgObj, "AXEPROG", 0


I realize this isn't exactly an axe answer, but, this is what must be done.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Xaychru04

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +0/-0
    • View Profile
    • Xaychru04's blog
Re: Turn off Calc and Exit Program in Axe?
« Reply #8 on: October 08, 2012, 01:20:17 pm »
I found a French tutorial that explains how to program in hexadecimal (I'm french), but it seems pretty difficult O.o
@thepinguin77: I've never used assembly but I'll try as soon as I can access to an emulator :)

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Turn off Calc and Exit Program in Axe?
« Reply #9 on: October 08, 2012, 01:27:51 pm »
@Xaychru04 ah ... that's mine ;D As far as I know, I wrote the only French hex tutorial (well, I never found another one, and you can believe that I searched).
« Last Edit: October 08, 2012, 01:28:49 pm by Matrefeytontias »

Offline Xaychru04

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +0/-0
    • View Profile
    • Xaychru04's blog
Re: Turn off Calc and Exit Program in Axe?
« Reply #10 on: October 08, 2012, 04:45:20 pm »
Yes, it was yours, and it's an excellent tutorial !
I will test programming in hexadecimal on an emulator too because I don't know if an error can just clear the RAM like Axe ( xD ) or can corrupt the memorry etc...

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Turn off Calc and Exit Program in Axe?
« Reply #11 on: October 09, 2012, 01:43:35 am »
Thanks :)

And yeah, you'd better program on an emulator, even if there is only a small chance of doing something else than a RAM clear (but there's still a chance ;) ).

Offline bored_student

  • LV3 Member (Next: 100)
  • ***
  • Posts: 44
  • Rating: +3/-0
    • View Profile
Re: Turn off Calc and Exit Program in Axe?
« Reply #12 on: November 21, 2012, 10:58:18 am »
Quote
OFFSCRPT.8xv (appVar) gets copied to $8001 every time the calculator turns off. This catches both 2ND + ON as well as APD. So instead of going to APD, it can just display your screen saver.

My OFFSCRPT always crashs the calc. The code is copied to $8001 and executed. But every times it reaches bcall(_jForceCMDNoChar) the calculator simply doesn't react anymore


I leaved the
bit   4, (iy + 8 )
out because this way the bit is set always and my code is never executed
« Last Edit: November 22, 2012, 03:10:07 am by bored_student »
Sorry for my bad English, I'm German.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Turn off Calc and Exit Program in Axe?
« Reply #13 on: November 27, 2012, 10:04:49 am »
Up,

thepenguin77, are you sure that your code will work assuming that the OS disables the LCD before calling OFFSCRPT ?

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1591
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Turn off Calc and Exit Program in Axe?
« Reply #14 on: November 27, 2012, 12:41:35 pm »
Quote
OFFSCRPT.8xv (appVar) gets copied to $8001 every time the calculator turns off. This catches both 2ND + ON as well as APD. So instead of going to APD, it can just display your screen saver.

My OFFSCRPT always crashs the calc. The code is copied to $8001 and executed. But every times it reaches bcall(_jForceCMDNoChar) the calculator simply doesn't react anymore


I leaved the
bit   4, (iy + 8 )
out because this way the bit is set always and my code is never executed

The OS does not disable the LCD before calling OFFSCRPT.

Quote
OFFSCRPT.8xv (appVar) gets copied to $8001 every time the calculator turns off. This catches both 2ND + ON as well as APD. So instead of going to APD, it can just display your screen saver.

My OFFSCRPT always crashs the calc. The code is copied to $8001 and executed. But every times it reaches bcall(_jForceCMDNoChar) the calculator simply doesn't react anymore


I leaved the
bit   4, (iy + 8 )
out because this way the bit is set always and my code is never executed

Post the code, that's the only way I can tell what's wrong with it. Also, bit 4, (iy + 8) is the APD flag. I do RET Z because the code you're looking at was for a screensaver, and you wouldn't want a screen saver to run if you were turning the calculator off on purpose.
« Last Edit: November 27, 2012, 12:43:00 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112