Path: ns-mx!uunet!math.fu-berlin.de!NewsServ!behrenss From: behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens) Newsgroups: comp.sys.apple2 Subject: Re: TML Pascal II... Message-ID: <1992Mar6.102346.5879@Informatik.TU-Muenchen.DE> Date: 6 Mar 92 10:23:46 GMT References: <1992Mar3.021749.11353@nuscc.nus.sg> Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem) Organization: Technische Universitaet Muenchen, Germany Lines: 34 Hi, to the power of shoould be pretty simple to write. Let's see. long int power (int x, int y) { long int foo; foo = x; if(y==0) return(foo); while(--y) foo *= x; return foo; } In Pascal: FUNCTION power(integer x,y) : longint; VAR foo: integer; BEGIN foo := x; if(y <> 0) BEGIN y := pred (y); WHILE(y) DO BEGIN y := pred (y); foo := foo * x; END; END; power := foo; END; Transferring it to ASM for a speedy lib function is left up as an exercise :) I'm online right now and not fluent enough with ASM :) Soenke