tifreak8x wrote:
Nope, I have found a way to use While loops to completely replace Lbl Goto stuff, but still get the same effect while maintaining speed. It is pretty nifty. Smile


Quick question, though.

When a program's making its rounds, does the size of an If-block matter if it's not included?

Like is there any difference in speed between these:


Code:
(other code)
If A=25
Then
Goto ZX
End
(other code)



Code:
(other code)
If A=25
Then
Do this
Do that
Do the other thing
End
(other code)



Code:
(other code)
If A=25
Then:Do this:Do that:Do the other thing:End
(other code)


And is there a difference between having an if-block and not having one, even if it's only one or two lines?

rthprog wrote:
thanks Kerm =D


Code:
:13:Asm(prgmCodex
:27-->R
:9-->L
:iPart(length(Str0)/R)+1-->Z
:sub(Str0+"                                                      ",1,RZ)-->Str1
:1-->B
:(Z>L)(L-Z)+Z-->C
:For(N,1,C
:Text(7N-6,4,sub(Str1,RN-R+1,R
:End
:While 1
:B-->D
:0:Repeat(Ans:getKey:End:
:(Ans=34)-(Ans=25)+B-->B
:(B=0)-(B=Z+1)+B-->B
:If B<>D and Z<>C
:Then
:For( N,1,7
:(B=D-1)+2
:Asm(prgmCodex
:End
:Text((B=D-1)+(7L-6)(B<>D-1),4,sub(Str1,RB-R+1,R
:End
:End


I just made some minor modifications that fix some bugs (namely the stray pixels when scrolling up) and save some space =D I'm wondering if it would be advantageous to let the user scroll, and update lines once no buttons are being pressed...making scrolling much smoother and a bit faster....

In addition, perhaps storing the image of the lines and overlaying a secondary image which is removed when scrolling would allow such things as sprites, menus, etc...


Well, as for overlaying a secondary image, the only way I know of to do that is to use the home/graph screens for different things. Is there another way to do this sort of thing, perhaps with ASSEMBLY SORCERY?
This is utterly, completely wrong, for two reasons:
Code:
(other code)
If A=25
Then
Goto ZX
End
(other code)
It should be
Code:
(other code)
If A=25:Goto ZX
(other code)


And no, it's only a marginal speed decrease while it searches for the End.
KermMartian wrote:
This is utterly, completely wrong, for two reasons:
Code:
(other code)
If A=25
Then
Goto ZX
End
(other code)
It should be
Code:
(other code)
If A=25:Goto ZX
(other code)


And no, it's only a marginal speed decrease while it searches for the End.


Well, I know that, but I was more talking about the difference between one line of code and twenty within a block. How much memory do "then" and "end" use?
Aeromax wrote:
KermMartian wrote:
This is utterly, completely wrong, for two reasons:
Code:
(other code)
If A=25
Then
Goto ZX
End
(other code)
It should be
Code:
(other code)
If A=25:Goto ZX
(other code)


And no, it's only a marginal speed decrease while it searches for the End.


Well, I know that, but I was more talking about the difference between one line of code and twenty within a block. How much memory do "then" and "end" use?


One byte each, but there's no situation where you can choose between using Then/End and omitting them, so it's irrelevant to discuss the speed penalty (which is minimal).
Here's a quick little multi. line displayer code I made:


Code:

:ClrDraw
:AxesOff
:1→I
:While length(Str1)≥27I
:Text(6I-6,0,sub(Str1,27I+1,27I
:I+1→I
:End
[/list]
Reapex wrote:
Here's a quick little multi. line displayer code I made:


Code:

:ClrDraw
:AxesOff
:1→I
:While length(Str1)≥27I
:Text(6I-6,0,sub(Str1,27I+1,27I
:I+1→I
:End
[/list]


This code will not show anything if the string is shorter than 27 characters... which then again I guess is fairly irrelevant since you specified that its a multi line displayer...

however, it WILL crash if the string is too long

how about


Code:

:ClrDraw
:AxesOff
:iPart(length(Str1)/27 -1) +1
:(Ans>9)(9-Ans) + Ans --> I
:For(N,1,I
:Text(7N-7,0,sub(Str1+"                                ",27N+1,27N
:End
Aeromax wrote:

Well, as for overlaying a secondary image, the only way I know of to do that is to use the home/graph screens for different things. Is there another way to do this sort of thing, perhaps with ASSEMBLY SORCERY?


uhm... you can do it quite easily in BASIC, (though it is quite a bit nicer using Codex's "Quick ClearScreen" function...)
it basically would work like this

:draw screen/all lines
:While 1
:Store Pic0
:Display Overlay
:GetKey loop thing
:ClearDraw: Recall Pic0
:Scroll using Codex
:Display the new line
:End

In the "Overlay" you could add visual items such as toolbars, menus, clocks, etc... (and you could embed them into the getkey loop so that they are regularly updated)

Fairly pointless, but it was kinda cool to play around with when I was still working on Darkfire IDE....
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement