Oxygen Basic

Programming => Example Code => Topic started by: Peter on August 29, 2011, 02:57:59 AM

Title: Factorial
Post by: Peter on August 29, 2011, 02:57:59 AM
Deleted
Title: Re: Factorial
Post by: Charles Pegge on August 29, 2011, 09:47:59 AM
Thanks Peter.

I wonder if anyone would like to do some code for division. :)

Charles
Title: Re: Factorial
Post by: jcfuller on August 29, 2011, 10:12:55 AM
You might find some useful information here.
http://www.ray.masmcode.com/

James
Title: Re: Factorial
Post by: Charles Pegge on August 29, 2011, 12:40:04 PM

dec ecx affects the sign flag for jl exit

This is a conditional loop (defined between the brackets).

(
 dec ecx
 jl exit       < here
 sub byte [edi],48
 inc edi
 repeat
)

The Finish procedure is not required here. It is used in thinBasic to explicitly invoke the terminate macro. It is only needed when the compiled code is required to be persistent, like a DLL, so that thinBasic can call its procedures. Finish() is like FreeLibrary().

If terminate does not appear in the code then the compiler will automatically add it at the end.


Charles