[A83] Re: returning to OS in call routines


[Prev][Next][Index][Thread]

[A83] Re: returning to OS in call routines



IMHO, assembly programming was not meant for the "perfect academic
model".  Assembly languages always contain some form of "jp", and it is
always needed.  Higher level languages were designed to break away from
this (hence "goto" is frowned upon on c, and non-existent in java and
other languages).  But even in higher level languages, how do you think
if-then statements get compiled?  (warning: simplification ahead)  They
use a simple comparison followed by a jump.  No matter what you do, you
are eventually going to use the equivalent of goto.  Higher level
languages mask this, assembly cannot.

With that said, it IS usually better (read: easier, not necessarily
faster) to structure your program in such a way that code is broken up
into modular routines that are called, not jumped to.

- - Joe Pemberton


-----Original Message-----
The solution of saving the initial stack is probably frowned upon by
many because it breaks the perfect academic model, but it usually ends
up requiring less code in the end.

--
Scott Dial
scott@scottdial.com
AIM GeekMug : ICQ# 3608935

-----Original Message-----
From: assembly-83-bounce@lists.ticalc.org
[mailto:assembly-83-bounce@lists.ticalc.org] On Behalf Of Tim Wiser
Sent: Thursday, August 07, 2003 9:09 PM
To: assembly-83@lists.ticalc.org
Subject: [A83] Re: returning to OS in call routines

Ok, I'm new to this list, but I have an idea.
Instead of 'call'ing, you could 'jp' or 'jr' to the function which would
'ret' back to the OS rather than the calling function. Then 'jp' back to
the calling function if you don't have to return.  I know this isn't
practical, but it's the only way I know how.

Hope this helps,
t.wiser

------------------------------

From: "Tobias" <supermobbe@yahoo.de>
Subject: [A83] returning to OS in call routines
Date: Thu, 7 Aug 2003 22:49:36 +0200


i  write often call routines and also call routines in call routines. In
one of these routines i want to check if the "clear-button" is pressed
and if so then program should exit. And for this you usually use "ret"
but this would exit the routine?! So how to return to OS from a routine?
Impossible? Thanks


------------------------------






Follow-Ups: References: