Oxygen Basic

Programming => Problems & Solutions => Topic started by: Peter on May 07, 2014, 10:33:46 AM

Title: Loop Misunderstanding
Post by: Peter on May 07, 2014, 10:33:46 AM
Deleted
Title: Re: Loop Misunderstanding
Post by: Charles Pegge on May 07, 2014, 12:46:03 PM
Hi Peter,

I found a bug which prevented loop working with labels beginning a..e !

Try this one:

http://oxygenbasic.org/o2zips/Oxygen.zip
Title: Re: Loop Misunderstanding
Post by: Charles Pegge on May 08, 2014, 01:25:23 AM
Peter,

The poor chap does not sleep well, he can't lie on his back anyway, and his talons get tangled in the duvet!

Microcode instructions, like loop, are somewhat deprecated. They take longer to execute than the individual instructions.

Intel has produced one of their mighty tome on the subject of optimisation:

http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-optimization-manual.pdf

loops in this format will actually use less instructions than your loop construct, and are not restricted to short loops:

y=20
c=0
do
  dec y
  jl exit

  inc c
end do
print c


the basic loop translates to:

(
._do
  dec [ebp - :)]
  jl exit
  ...
  jmp long _do
._exit_do
)