Path: utzoo!utgpu!watserv1!watmath!att!pacbell.com!ucsd!sdd.hp.com!hp-pcd!hpcvra.cv.hp.com!rnews!hpcvbbs!akcs.falco From: akcs.falco@hpcvbbs.UUCP (Andrey Dolgachev) Newsgroups: comp.sys.handhelds Subject: Re: Using CLEAR in progs (Was: Re: new puzzle, new blinky) Keywords: 48sx, CLEAR, programs Message-ID: <27a06d1f:1696.3comp.sys.handhelds;1@hpcvbbs.UUCP> Date: 25 Jan 91 17:40:04 GMT References: <1991Jan10.172803.2262@DRD.Com> <56027@eerie.acsu.Buffalo.EDU> Lines: 17 I also agree with the opinion that a program shouldn't clear the stack. Considereing that it take virtually no effort to save the stack, it seems senseless not to. A simple way to save the state of the calculator is to simply store the flags, put the contents of the stack into a list, save the list and flags as local vars, execute your program with all the clears, flag changings, etc. you want, and then simply recall the flags and the stack. Another thing I like about this is that if you have a program which you are still debugging, and it happens to take which you what you had on the stack previously as an argument accidently, it wouldn't be a problem. Anyways, here's the open and close I use on my programs. \<< RCLF DEPTH \->LIST \-> flags stacklist *YOUR PROGRAM* flags STOF stacklist LIST\-> DROP \>> It's simple and it works, and more importantly, you won't lose anything accidently. Hmm, come to think of it, it would be better to store the flags and stack in global variables, so an interrupt wouldn't matter. ---Falco