Hello Guest it is March 28, 2024, 10:53:47 AM

Author Topic: Subroutine Library in Mach3  (Read 1272 times)

0 Members and 1 Guest are viewing this topic.

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Subroutine Library in Mach3
« on: May 29, 2022, 06:46:27 AM »
Has anyone tried to implement an external subroutine library with Mach3?

It would have to be invoked via something like m98 (-c:\dir\filename), and the actual subroutine in the library addressed by a passed variable along the lines of m98 p##1.

I believe it is theoretically possible, but I know the stack space in Mach3 is a shade limited.

Cheers
Roger

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Subroutine Library in Mach3
« Reply #1 on: May 31, 2022, 09:18:59 PM »
HIYA Roger, You can do that now with mach3. You call the sub from a remote directory with M98.

I will have to look up the details but it should be in the manual.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Subroutine Library in Mach3
« Reply #2 on: May 31, 2022, 09:52:00 PM »
Put your Sub program into the subprograms folder then Call the sub with

Sub name = testsub.tap

M98 (testsub.tap) L1

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Subroutine Library in Mach3
« Reply #3 on: May 31, 2022, 09:59:03 PM »
Oh yes, you can do that all right.

What I wanted to do was to load the whole library in with an m98 and to then call individual routines from within the library. I doubt that Mach3 can handle that.
But there is a way if the 'library' you call in starts with another call: m98 p##1, using #1 as the vector.
Devious. But I have done it a few times.
I have also implemented an array that way.

Hum - I wonder whether a sub in the called-in file can call back to the original program? I was able to do that with the stock overlay handler on a 16 bit machine, but one did have to be careful. What fun!

Cheers

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Subroutine Library in Mach3
« Reply #4 on: May 31, 2022, 10:01:05 PM »
The sub does not have to be in the subroutine folder. It can be anywhere if you call it thus:
m98 (-c:\dir\file)

Cheers
Roger