Omnimaga
Calculator Community => TI Calculators => ASM => Topic started by: TiAddict on June 27, 2011, 04:57:01 pm
-
in this situation, is assembly faster? or same speed?
TI-BASIC
2->kTheta
or
Assembly
B_CALL OP1Set2
B_CALL StoTheta
RET
if ASM's faster, that means TI BASIC games/program will be faster if i use some ASM prgm to store and add/sub/multiply/divide the floating point variables?(A~Z and kTheta)?
-
Asm will usually be faster, but keep in mind that bcalls tend to suck compared to handwritten routines.
Also, remember that it takes asm time to load as well. if you have tons of tiny programs, you will end up possibly slower, and take up more space.
Can't give you an exact answer on your particular one, just a little advice :P
-
Asm should be a bit faster, as basic is interpreted. But basic should be a lot smaller in a large program.
-
willrandship,That makes sense :D but if i use 1 ASM prgm to do many storing and addition, i should use it right? and handwritten routines? How fast are they?
Ben_g, alright thanks :)
-
well, maybe. A handwritten routine that is well optimized (and there are people here very good at that :P ) would definitely be faster. And it would probably be worth it, especially for larger calculations.
You won't ever be going over 32768, right? I think that's the 84's bit limit for integers without some complications
-
Oh i see.
and no, so i should use HL to do the math?
-
that should be fine, I think. very optimized as compared to bcalls, but you might have some trouble getting it back without using the stotheta bcall.
-
Oh i see.
and no, so i should use HL to do the math?
Yep, that'll probably make it a couple thousand times faster. Literally.
-
lol, so after i do all the math, store HL to the OP1, and then use StoTheta?
Oh i see.
and no, so i should use HL to do the math?
Yep, that'll probably make it a couple thousand times faster. Literally.
-
lol, so after i do all the math, store HL to the OP1, and then use StoTheta?
That would work, or if you want to make it even faster and don't care about using up a couple more bytes, do it yourself with _CreateReal.
-
so creating Real Variable is faster than storing?
-
Well, that's what StoTheta does. It finds the theta var if it exists, deletes it if it's there, creates a new one, and loads OP1 into it. The reason there's a bcall for that is to save you code, but bcalls are always going to be a bit slower than hard-coding everything.
-
so just make sure you delete it if necessary, by hand. That way the program doesn't have to check.
-
oh cool i get it. :D thanks!
-
I think I should just point out that bcalls aren't as slow as what people think. Yes, if you are using bcall(_multAbyE) inside a djnz loop, then you are wasting some time. But the time wasted is relative.
The whole bcall process takes about 1000 t-states. In 6.5MHz mode, that's .00015 sec. If you do 100 bcalls, that's only .01 sec.
In this case, since you are making a basic library, there's no reason why you shouldn't use bcalls. The bcalls aren't slow compared to basic. However, floating point numbers vs. HL makes a big difference. If you don't need decimals, then HL is definitely the way to go.
-
ah thanks! and wow i never new how fast bcall process were! :o
-
That's actually pretty slow compared to raw ASM. Keep in mind that even the slow 6MHz chip in the TI's are screaming along at 6 million cycles a second.