Searching \ for 'Push down CALL stack and emulation thereof' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=push+down+call+stack
Search entire site for: 'Push down CALL stack and emulation thereof'.

Truncated match.
PICList Thread
'Push down CALL stack and emulation thereof'
1997\04\25@101613 by Ed Todd

picon face
I use the push down nature of the CALL stack quite a bit to optimize code
space.  For example, I have a timeout procedure, called from several
locations on different pages.  The structured programming method of doing
this would be:
       CALL    TIMEOUTPROC
       IF (FLAG1)
               GOTO    RETRY           // timeout, resend message
       IF (FLAG2)
               GOTO    JAMMING // signal jamming error recovery
       IF (FLAG3)
               GOTO    SLEEP           // no traffic, go back to sleep
Duplicating this logic gets expensive in code space.  It is even worse if
the test is made during a call:
       CALL    X
       IF (FLAG1)
               GOTO    RETRY           // timeout, resend message
       IF (FLAG2)
               GOTO    JAMMING // signal jamming error recovery
       IF (FLAG3)
               GOTO    SLEEP           // no traffic, go back to sleep
....
....
X       CALL    TIMEOUTPROC
       IF (FLAG1 || FLAG2 ||FLAG3)
               RETURN
The way I do it is to use the push down nature of the stack:
TIMEOUTPROC
       IF      (CONDX)
               GOTO    RETRY
       IF      (CONDY)
               GOTO    JAMMING
       IF      (CONDZ)
               GOTO    SLEEP
       RETURN
I have left one or two items on the stack, but that does not matter, I'm
throwing it away due to error conditions.  The next call I make puts a new
entry on the stack and throws one of the old unused values away.  It saves
a truckload of space.
This works fine on chip (16C57) and also my old favorite: PICICE.
PICMASTER is a different kettle of ballparks.  It runs fine until I break
the code, then I get repeated stack overflow message boxes every time I try
to single step.  I am using a 16C65 in this case: does that chip implement
the stack a different way when it is full?
What I want is a way to disable warnings on stack overflow, but the
emulator software does not appear to offer this capability.  The only stack
options I've found do not suppress the message boxes.  Any ideas?  Anyone
from Microchip listening and want to add it to the list?

 <spam_OUTedtoddTakeThisOuTspamsni.net>    Ed Todd

1997\04\25@103834 by tjaart

flavicon
face
Ed Todd wrote:


> This works fine on chip (16C57) and also my old favorite: PICICE.
> PICMASTER is a different kettle of ballparks.  It runs fine until I break
> the code, then I get repeated stack overflow message boxes every time I try
> to single step.  I am using a 16C65 in this case: does that chip implement
> the stack a different way when it is full?
> What I want is a way to disable warnings on stack overflow, but the
> emulator software does not appear to offer this capability.  The only stack
> options I've found do not suppress the message boxes.  Any ideas?  Anyone
> from Microchip listening and want to add it to the list?
>
>   <.....edtoddKILLspamspam@spam@sni.net>    Ed Todd

I know what you mean. (sigh) Disabling the stack overflow error checking
on MPLAB work exactly like the step-over function : it doesn't work.

According to the priority list into which we have to classify our MPLAB
requests, this is probably a nice-to-have. Just like an IDE that looks
remotely like the last time you worked on.

I overrun the stack to reset a 74. (clear pcl and pclath).

Mabe we can buy Valiums in bulk and save that way ;)

--
Friendly Regards

Tjaart van der Walt
tjaartspamKILLspamwasp.co.za
_____________________________________________________________
| Another sun-deprived R&D Engineer slaving away in a dungeon |
|             WASP International  http://wasp.co.za           |
|             GSM and GPS value-added applications            |
|  Voice : +27-(0)11-622-8686   |   Fax : +27-(0)11-622-8973  |
|_____________________________________________________________|

1997\04\25@123935 by Harold Hallikainen

picon face
On Fri, 25 Apr 1997 08:15:27 -0600 Ed Todd <.....edtoddKILLspamspam.....SNI.NET> writes:
>I use the push down nature of the CALL stack quite a bit to optimize
>code
>space.

       It sounds like you are relying on stack wrap-around, right?  It
seems dangerous to me to leave stuff on the stack since I don't really
keep track of who's calling what from where.  If there's some extra
garbage on the stack and I do a return... watch out!

{Quote hidden}

       Instead of setting flags, how about returning a unique state
number, then using a jump table.

JumpTable
       movlw   high(JumpTable)
       movwf   pclath          ; Set up high PC latch for
jump
       movfw   SystemState     ; Get state (0..3)
       andlw   0x03            ; Mask leaving 2 lsb
       addwf   pcl,1           ; Add to PC
       goto    NoError         ; State 0 - No error, so
continue
       goto    Retry           ; State 1 - Go retry
       goto    Jamming         ; State 2 - It's jammed
NoError                         ; State 3 - Here same as state 0,
no error
       sleep




Harold

1997\04\25@215434 by John Payson

picon face
On Fri, 25 Apr 1997 08:15:27 -0600 Ed Todd <EraseMEedtoddspam_OUTspamTakeThisOuTSNI.NET> writes:
|>I use the push down nature of the CALL stack quite a bit to optimize
|>code
|>space.

|        It sounds like you are relying on stack wrap-around, right?  It
|seems dangerous to me to leave stuff on the stack since I don't really
|keep track of who's calling what from where.  If there's some extra
|garbage on the stack and I do a return... watch out!

I don't think he's relying on the stack wraparound behavior.  I think what
he's doing is figuring that if a condition arises where he wants to forget
whatever he was doing [literally] and go do something else, that it's eas-
iest to simply never return from the earlier calls.  For example, suppose
that he's writing a simple input parser and an escape character is supposed
to always exit whatever the system is doing and return to the main command
loop.

The only way to do so while "returning" properly is to have every single
place his character input routine is called check whether it should exit.
This is certainly not impossible to code, though it is rather a pain.  In
such situations if the command loop is run at the top level (i.e. *IT* is
never going to have to do a "return" itself) it's convenient to just jump
back to the command loop from the character-input routine.  Some procedure
calls will be left on the stack, but since nothing is going to try to
"return" to them that won't be a problem.

Attachment converted: wonderland:WINMAIL.DAT (????/----) (0000E91A)

1997\04\25@234954 by Sarunas Cepulis

flavicon
face
Tjaart van der Walt wrote:
{Quote hidden}

About Tifanny==== is hoooost,,,,, PIC
& some nice portssssssssssssssssssssss,
& some ALU & some....Tifany's...
Oh-Yeah Big nice Emu (wish you).

1997\04\26@030820 by taking

flavicon
face
>         It sounds like you are relying on stack wrap-around, right?  It
> seems dangerous to me to leave stuff on the stack since I don't really
> keep track of who's calling what from where.  If there's some extra
> garbage on the stack and I do a return... watch out!

 Ah, but if you're doing extra returns, does it really matter if the
"garbage" is something you left there or not?

1997\04\26@122419 by Ed Todd

picon face
I am not relying on wrap around.  I am just throwing the stack away, just
as John Payson says.  Another example:

SendMessage:
       //      code to send a radio message
GetAck:
       // code to receive a new radio message or an ACK to a transmission
       Call CheckTimeout       // this call appears in several locations in thi
s large
code block
       ........                        // more code
       Call CheckTimeout
       ........                        // more code
       Call CheckTimeout
       ........                        // more code
       Call CheckTimeout
       ........                        // more code



CheckTimeout:
       // do we need an ACK to a message?  If so, did we time out?
       If ((need ACK to message) && (elapsed time > X))
               goto Retry              // resend message
       if (jamming signal && jam timeout)
               goto ProcessJam // respond to jamming attempt
       if ((do not need ACK) && (elapsed time > Y)
               goto SleepAgain         // no traffic, go to sleep procedure
       return

Each of the gone to locations is at call level 0: there are no outstanding
returns to be executed.
I don't want tests on exit conditions to the timeout procedure after each
call, I don't have the space.  After all, I have got a 10 channel digital
radio network 'slave' device implemented on a 16C57.

What I want is an emulator that emulates the chip.....  A 16C65 does not
melt down when stack overflow occurs, whereas the emulator might as well.
Fortunately, my 16C65 unit (a loop control unit) has space for me to
include a file containing exit condition tests after every call, so I am
not hurt by this rather severe limitation.  So I'm just nagging.

1997\04\28@203457 by Dieter Macke

flavicon
face
Hi John,

i receive many mails with a WINMAIL.DAT but dont't know what do do with it. I
unpacked it with uudecode but what's next?

JP> begin 600 WINMAIL.DAT
...
JP> `
JP> end

cu Dieter

1997\04\29@011832 by John Payson

picon face
>>
i receive many mails with a WINMAIL.DAT but dont't know what do do with it. I
unpacked it with uudecode but what's next?
<<

I dunno... wait for me to get Pegasus mailer running on my machine so you
won't have those useless attachments to deal with?

MS-Exchange has an annoying habit of tacking those blasted WINMAIL.DAT
files if I do any editing on quoted text (including adding quoting-char-
acters to the start of each line).  If I don't touch any paragraph of
quoted text it seems to refrain from putting in that useless file.

Hopefully with Pegasus all those problems will be gone.


Attachment converted: wonderland:WINMAIL.DAT (????/----) (0000ECC3)

1997\04\29@161501 by Mike Smith

flavicon
face
>
> I dunno... wait for me to get Pegasus mailer running on my machine so you
> won't have those useless attachments to deal with?
>
> MS-Exchange has an annoying habit of tacking those blasted WINMAIL.DAT
> files if I do any editing on quoted text (including adding quoting-char-
> acters to the start of each line).  If I don't touch any paragraph of
> quoted text it seems to refrain from putting in that useless file.
>
> Hopefully with Pegasus all those problems will be gone.
>
Or you could use MS Internet Mail, the one that comes free with IE 3.nn.
Its a lot nicer to use than Exchange, even does proper quoting

Mike Smith
(KILLspammikesmith_OZKILLspamspamrelaymail.net)

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...