Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:36 01 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM Edit - GOSUB without line numbers

Author Message
larny
Guru

Joined: 31/10/2011
Location: Australia
Posts: 346
Posted: 06:44pm 18 Mar 2016
Copy link to clipboard 
Print this post

I recently installed the latest firmware in my Maximite & the latest version of MM Edit.

I like not having to use line numbers, but I cannot find out how to insert labels for GOTO & GOSUB.

I searched in the MMedit.pdf & the MMedit Help but all I could find (of course it may be staring me in the face) was the following.

"With MM Edit you can convert code that has line numbers to code with labels"

I was able to convert the code I had written with line numbers to code with labels, but now I want to add another sub routine. I cannot see how to insert a label for the GOSUB.

It is easy to do it for PIC programmes in the Microchip MPLAB IDE using assembly code, but I can't see how to do it in MMEdit.

Any assistance will be appreciated.
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 07:30pm 18 Mar 2016
Copy link to clipboard 
Print this post

Gosub test1

Somewhere else you have

Test1:

Followed by

Return
Cliff
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:35pm 18 Mar 2016
Copy link to clipboard 
Print this post

Best way forward is to use defined subroutines and functions.
Using labels for subroutines is not preferred.
Try to code without the use of GOTO, only when it will be more clear what the code is doing. Not jump around!

[code]
SayHello
PRINT "5 squared = " SquareIt(5)

SUB SayHello
PRINT 'Hello from MySubroutine'
END SUB

FUNCTION SquareIt(value)
SquareIt = value * value
END FUNCTION
[/code]

Edited by MicroBlocks 2016-03-20
Microblocks. Build with logic.
 
larny
Guru

Joined: 31/10/2011
Location: Australia
Posts: 346
Posted: 05:32pm 19 Mar 2016
Copy link to clipboard 
Print this post

  centrex said   Gosub test1

Somewhere else you have

Test1:

Followed by

Return


Thanks Cliff,
So it is essentially that same as assembly in MPLAB.
 
larny
Guru

Joined: 31/10/2011
Location: Australia
Posts: 346
Posted: 05:34pm 19 Mar 2016
Copy link to clipboard 
Print this post

  MicroBlocks said   Best way forward is to use defined subroutines and functions.
Using labels for subroutines is not preferred.
Try to code without the use of GOTO, only when it will be more clear what the code is doing. Not jump around!

[code]
SayHello
PRINT "5 squared = " SquareIt(5)

SUB SayHello
PRINT 'Hello from MySubroutine'
END SUB

FUNCTION SquareIt(value)
SquareIt = value * value
END FUNCTION
[/code]


Thanks for that info, I'll try it.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025