Oxygen Basic

Programming => Example Code => Topic started by: Peter on March 24, 2011, 04:13:19 AM

Title: Gradient
Post by: Peter on March 24, 2011, 04:13:19 AM
Deleted
Title: Re: Gradient
Post by: Charles Pegge on March 24, 2011, 08:32:07 AM
Hi Peter,

Your gradient test works fine.

I am also very keen to keep the Oxygen core as simple as possible. I have managed to reduce its size by throwing out a few redundant constructs and improving efficiency in recent releases. I think most of the problems you have encountered are to do with compound logical tests and also indirection. Those lines of logic actually require a lot of inference and encoding.

If you can isolate any constructs that do not behave as expected, I will always be happy to investigate. :)

Charles
Title: Re: Gradient
Post by: Charles Pegge on March 24, 2011, 03:39:48 PM
How about this Peter:


Implementing Functions in Assembler
Code: [Select]



  long a=1,b=2,c=3,d=4

  jmp fwd over

  fun: 'procedure without signature
  '================================
  mov eax,[esp+4]
  add eax,[esp+8]
  add eax,[esp+12]
  ret 12
  '
  over:

  d=call fun a,b,c,d 'UNCHECKED

  print d




  declare function fun(byval a as long, byval b as long, byval c as long) as long

  jmp fwd over

  fun#long#long#long: 'procedure with signature
  '============================================
  mov eax,[esp+4]
  add eax,[esp+8]
  add eax,[esp+12]
  ret 12
  '
  over:


  d=fun a,b,c 'CHECKED

  print d

  declare function fun(byval a as long, byval b as long, byval c as long) as long

  jmp fwd over

  fun#long#long#long: 'procedure with signature
  '============================================
  (
  '
  'DEFINE LOCAL VARIABLES
  '
  def aa [esp+4]
  def bb [esp+8]
  def cc [esp+12]
  '
  mov eax,aa
  add eax,bb
  add eax,cc
  ret 12
  )
  over:


  d=fun a,b,c 'CHECKED

  print d



Charles