Page 6 of 6
Posted: Wed May 17, 2006 2:12 pm
by blueb
Dioxin wrote:
I'm only able to speculate as I don't actually own PureBASIC...
Paul... Dioxin.... Assembler... hmmmm! Sounds a lot like Paul Dixion on the PowerBASIC forum.
Paul, this is the best $60 I ever spent. Great compiler, great forum with lots of sample code... simply the best!
--blueb
Posted: Wed May 17, 2006 2:19 pm
by rsts
blueb wrote:
snip.
Paul, this is the best $60 I ever spent. Great compiler, great forum with lots of sample code... simply the best!
--blueb
ditto.
cheers
Posted: Wed May 17, 2006 2:47 pm
by blueznl
are you simply allowed to jump out of loops with a goto, will it not screw up anything internally in pb?
Posted: Wed May 17, 2006 3:01 pm
by thefool
It shouldnt screw up anything.
(if fred increases eg AX every loop or whatever to count, it will hopefully be reset before next loop.)
Posted: Wed May 17, 2006 5:45 pm
by dioxin
Blueb,
that'll be my evil twin brother. We try not to talk about him, he's nothing but trouble.
$60? It now says this on the ordering page:
PureBasic Price
Country Cost per copy
All US$ 99
blueznl,
if a compiler is written properly there should never be a problem jumping OUT of a structure provided you remain in the same procedure.
Jumping into structures or into/out of procedures is a different matter.
Paul.
Posted: Wed May 17, 2006 5:57 pm
by rsts
Hmm - must have raised the price with V4.
Still the best bargain around - especially with a lifetime license.
Get in now before the V5 price increase
cheers,
Posted: Wed May 17, 2006 7:25 pm
by SFSxOI
Maybe v5 will have 'Procedure' replaced by GOTO ?
My original question wasn't intended to spark such a debate but i'm glad it did now. This whole conversation has gotten me really interested in exploring the most usable and flexable way of streamlining code as much as possible in a 'modular non-linear' fashion (i use 'modular' for lack of a better word right now) instead of a linear fashion.
Posted: Wed May 17, 2006 10:47 pm
by thefool
If you want modulear non linear code, go OOP

(in purebasic if you want to. or praise fred to build some basic class support in. Perhaps he will listen one day

)
Or use goto's a lot.
You can also use gosub and return as a simple procedure. I guess it has slightly less memory overhead and is a little faster... (for optimizer freaks.. but perhaps im not right.)
procedures got some other advantages but if you REALLY are an optimizing freak i would wonder if using GOTO's or gosub/return would work...
perhaps someone can test it?
goto example:
Code: Select all
;jump the code over.!
Goto main
;********************************
;"function" one.. using goto and RET
ShowAbout:
MessageRequester("About!","This little example is programmed by me!")
RET ;RET will now jump back to the address last stored in the stack!
;********************************
;********************************
;"function" two. using gosub
PrintThing:
PrintN("Now im in my gosub!")
Return ;Return.
;********************************
main:
;main code:
OpenConsole()
;Calling function one and returning..
PrintN("Going to show about using goto's and gosubs.")
PUSH l_back ;Pushing the address of the label back into the stack.
Goto showabout
back:
PrintN("Now im back!")
Input()
PrintN("Running into my second function!")
Gosub printthing ;Perhaps this is just pushing a hidden label to the stack like above code?
PrintN("back!")
Input()
edit: just thought i would say this; The use of using RET to jump to code positions can annoy some disassemblers. wich is good

I've even made examples where they wouldnt find the code and so on. Also, the crackers don't know the place to jump sometimes

How? Because you can push like you want to. You can push anywhere, just as long as you don't change the stack. You can use it in an if loop.
if serial="blah"
push ?goodlocation
else
push ?badlocation
endif
;perhaps do something. jump somewhere, then perform a RET!
Posted: Thu May 18, 2006 7:25 am
by akee
If you need to GO to a SUB, then make sure you return...

Posted: Thu May 18, 2006 3:31 pm
by SFSxOI
An example, pretty please
thefool wrote:
I've even made examples where they wouldnt find the code and so on.