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

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Harry Potter
Veteran
Posts: 111
Joined: Sat Feb 21, 2009 8:19 am
Location: New York, U.S.

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

Post 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?
Joseph Rose, a.k.a. Harry Potter
Creating magic in the computer community...or at least striving to! :(
angros47
Veteran
Posts: 79
Joined: Mon Sep 08, 2008 12:52 pm
Contact:

Post 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)
Harry Potter
Veteran
Posts: 111
Joined: Sat Feb 21, 2009 8:19 am
Location: New York, U.S.

Post by Harry Potter »

Thank you.
Joseph Rose, a.k.a. Harry Potter
Creating magic in the computer community...or at least striving to! :(
Post Reply