This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 22 Sep 2003 01:36:22 pm    Post subject:

I'd like to clear the screen in which you write with _Puts.
Maybe you've already made the experience : you display something on the screen, and then, you quit the program after having called the routine _clrlcdfull.
Now, the screen is white, and there is just a "Done".

But if you push [TRACE], and then, [CLEAR], the screen isn't white any more, and all that you displayed in your asm program is here again :-/

The problem is that when I quit a program that I made, (I've cleared the screen with B_CALL(_clrlcdfull)), when I don't push [CLEAR] and when I do a few calculations (about 4-5, so that the "Done" disappears), my calculator crash, and I have to remove the batteries for quite a long time.


So do you think how to clear this screen properly (I don't care about how to clear the graphbuffer, I can do it ;) ? Do I have to use the rom call _homeup ? any other rom call ? If so, which one ?

Please help me, it is not a difficult thing to do, is it ? ;-)
Back to top
sgm


Calc Guru


Joined: 04 Sep 2003
Posts: 1265

Posted: 22 Sep 2003 03:00:32 pm    Post subject:

The problem is TextShadow, probably. _ClrScrnFull
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 23 Sep 2003 12:14:08 am    Post subject:

Oh yes, that's how it's named : Textshadow
Isn't it the buffer where all is stored when we turn off the calculator ?

If it is, you're probably right.
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 23 Sep 2003 05:40:59 pm    Post subject:

well, it is actually the buffer the text is stored to... period. not just when we turn off Smile but, if you want changes to the buffer to be reflected on the screen, then you would have to write an interrupt, but we wont get into that here Smile
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 25 Sep 2003 01:43:28 pm    Post subject:

GRRRRR...
It still doesn't work and I don't know what to do Sad This is exactly how I exit my program :


Code:
   B_CALL(_homeup)
   B_CALL(_grbufclr)
   B_CALL(_clrlcdfull)
   xor   a
   ld   (curcol), a
   ld   hl, text
   B_CALL(_puts)
   B_CALL(_RunIndicOn)
   B_CALL(_getkey)
   B_CALL(_ClrscrnFull)
   B_CALL(_ClrTxtShd)
   B_CALL(_homeup)
   ld   SP,(saveSP)
   ret


After having launched it, I write some stuff on the home screen :
97
45+7
10.1
4
9
And the screen turns off. I think by pressing keys like Clear, 2nd, Alpha, arrows or something like that, I arrive on the homescreen but I just have 9bytes memory ! So I have to reset the calc, of course.
However, when, after having launched the program, I first press "Trace", and then clear (to return on the homescreen, not to clear the "Done" message), and just these 2 keys, I can do all the calculations I want without crashing my TI-83+...

Disconcerting, isn't it ?
Please help me, I'd really like to make a program after which you can do all you want without crashing your calc :-/
Back to top
sgm


Calc Guru


Joined: 04 Sep 2003
Posts: 1265

Posted: 25 Sep 2003 02:46:32 pm    Post subject:

Tyraniek wrote:
GRRRRR...
It still doesn't work and I don't know what to do Sad This is exactly how I exit my program :


Code:
   B_CALL(_homeup)
   B_CALL(_grbufclr)
   B_CALL(_clrlcdfull)
   xor   a
   ld   (curcol), a
   ld   hl, text
   B_CALL(_puts)
   B_CALL(_RunIndicOn)
   B_CALL(_getkey)
   B_CALL(_ClrscrnFull)
   B_CALL(_ClrTxtShd)
   B_CALL(_homeup)
   ld   SP,(saveSP)
   ret

Talk about not taking any chances Wink


What's the value of (saveSP)? And why are you storing to SP to exit your program when you just need a "ret"?
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 26 Sep 2003 08:56:52 am    Post subject:

I've already talked about it in another post
The way I quit the program is good. I've stored the value of SP at the beggining of the program in StoreSP.
Then, I put it in SP again so that a single ret quits the program.

It's in 83pa28d. I quote :
Quote:
Finally, the stack pointer can be used to terminate the program like C's exit().
You know from the last section that RET is like a POP PC. Since RET is used to end a program, you can infer that the TI-OS uses CALL $9D95 to execute a program. If the value of SP was saved at the start of the program, it could be later restored and followed with RET to stop the program:

;Start of program
LD (save_SP),SP
.
.
.
;Somewhere within the program
LD SP,(save_SP)
RET
This could be useful if, say, you had to exit from deep within the program and you're unable to remove all the stack pushes, such as from within a subroutine.



Maybe I could resolve my problem by doing something with "RES AppTextSave,(IY + AppFlags)"
I quote :
Quote:
You'll probably want to stop _PutS and _PutC from writing to text shadow. This is done with

RES AppTextSave,(IY + AppFlags)
This instruction — the details of which you don't need to know now — will, as an added bonus, free up text shadow for variable storage. You will then have to clear it when you exit, or you'll see junk on the screen. Anyone who's ever played ZTetris knows what I'm talking about.


What do you think of that ?
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 26 Sep 2003 09:24:37 am    Post subject:

It works !!! You can try this program :


Code:
; Après avoir lancé ce programme, on peut
; faire autant d'opérations que l'on veut
; sans devoir d'abord appuyer sur clear
; ou sur Trace, et ça ne buggera pas !

#include "ASM.inc"

.org   9d95h
   RES   AppTextSave,(IY + AppFlags)
   B_CALL(_clrlcdfull)
   B_CALL(_homeup)
   ld   hl, texte
   B_CALL(_Puts)
   B_CALL(_GetKey)
   B_CALL(_ClrscrnFull)
   B_CALL(_homeup)
   set   AppTextSave,(IY + AppFlags)
   ret

texte:   .db   "Salut ! Ceci est"
   .db   "un texte plutot "
   .db   "long qui vise en"
   .db   "fait a remplir l"
   .db   "ecran ! Super,  "
   .db   "non ? A bientot "
   .db   "sur mon site !  "
.end
END


(sorry for the french version)
Back to top
sgm


Calc Guru


Joined: 04 Sep 2003
Posts: 1265

Posted: 26 Sep 2003 01:39:58 pm    Post subject:

Tyraniek wrote:
It's in 83pa28d. I quote :
Quote:

Finally, the stack pointer can be used to terminate the program like C's exit().
You know from the last section that RET is like a POP PC. Since RET is used to end a program, you can infer that the TI-OS uses CALL $9D95 to execute a program. If the value of SP was saved at the start of the program, it could be later restored and followed with RET to stop the program:

;Start of program
LD (save_SP),SP
.
.
.
;Somewhere within the program
LD SP,(save_SP)
RET
This could be useful if, say, you had to exit from deep within the program and you're unable to remove all the stack pushes, such as from within a subroutine.

Don't quote my own a guide at me, or I might not make any new versions of it Razz . And you're only supposed to use the SP trick when you have to exit from within a subroutine. Using in the main module is just silly and means your program doesn't take care of the stack properly.
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 27 Sep 2003 12:05:34 am    Post subject:

Yes, but it is the case, of course ! It wouldn't work correctly if I didn't use this way !
(I didn't know that you were the author of the better tutorials for TI-83+ !)
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement