Page 1 of 1

Calling function by reference for QB4.5/VBDOS 1.0?

Posted: Mon Nov 07, 2011 10:02 am
by Harry Potter
I want to experiment with AI in BASIC and might want to create self-editing code. I want to provide code to handle each neuron. The problem is that I need to be able to "attach" a function to each neuron such that the code runs when the neuron is "fired." In an OOPS, I can simply refer to the function by name or address. However, AFAIK, the best I can do with the aforementioned BASICs is a series of SELECT CASEs. Is there a way around this?

Posted: Tue Nov 08, 2011 5:58 pm
by angros47
In FreeBasic, you can do that by using a function pointer.

In QB, you'll have to use CALL ABSOLUTE... but your function needs to be written in assembly (qb itself doesn't allow function pointers)

Posted: Thu Nov 10, 2011 9:20 am
by Harry Potter
Thank you.