??? 09/23/05 20:01 Modified: 09/23/05 20:02 Read: times |
#101468 - RET to a different address |
Hi to all.
I do 8051 programming as a hobby (for home automation projects) and I have a situation with a possible solution that I have never tried before, and wanted to run it by you more experienced programmers for any caveats that I might not be thinking of. I am calling a routine that fetches a character from a serial input buffer. In the called routine, I want to test if the character is a carriage return. If it isn't, I simply want to return to the calling program. If however it is a carriage return, I want to immediately go to a fixed location in the calling program. What I was thinking of doing was this in the called routine: - get the character - test for a carriage return - if not a carriage return, then simply RET - if it is a carriage return, POP two bytes off the stack to adjust the stack pointer for the non use of RET, and then JMP to the fixed location at the end of the calling routine instead. This is not an interrupt routine (ie: not a RETI). Is doing this ok or can something unforseen happen? Thanks again! |
Topic | Author | Date |
RET to a different address | 01/01/70 00:00 | |
here is how pseudocode | 01/01/70 00:00 | |
RET to a different address | 01/01/70 00:00 | |
no flaw, but 1.000.000 gotchas | 01/01/70 00:00 | |
That's what I wanted to know | 01/01/70 00:00 | |
Yes | 01/01/70 00:00 | |
"clever" | 01/01/70 00:00 | |
OT: my wife | 01/01/70 00:00 | |
no flaw, but seriously not recommended | 01/01/70 00:00 | |
experience | 01/01/70 00:00 | |
reload SP | 01/01/70 00:00 | |
restoring stack | 01/01/70 00:00 | |
Recognisable string![]() | 01/01/70 00:00 | |
named return value | 01/01/70 00:00 | |
Bad Practice | 01/01/70 00:00 | |
Well phrased | 01/01/70 00:00 | |
What I am doing with it | 01/01/70 00:00 | |
try...catch | 01/01/70 00:00 | |
setjmp / longjmp | 01/01/70 00:00 | |
when to try ... catch | 01/01/70 00:00 | |
the borderline | 01/01/70 00:00 | |
Promises | 01/01/70 00:00 | |
who cares if an exceptiom is "acceptable | 01/01/70 00:00 | |
Parsing input data | 01/01/70 00:00 |