Author Topic: Undocumented BASIC tricks (TI89 series)  (Read 11742 times)

0 Members and 1 Guest are viewing this topic.

Offline mdjenkins86

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 235
  • Rating: +0/-0
    • View Profile
Undocumented BASIC tricks (TI89 series)
« on: July 18, 2006, 12:54:00 pm »
For the ti-89 BASIC
Don't know if this belongs...delete if not.
Try to Program with out using

c1-->
CODE
ec1Stopc2
ec2

Stop is Evil
Use Return and Break

-------------------------------------------------------

Like I said before to test for HW2, HW3

c1
-->
CODE
ec1if getConfg()[22]>2000000: Text "Titanium"c2
ec2

----------------------------------------------------------
To measure time on HW2 or HW3

c1
-->
CODE
ec1StartTmr()->trm
.....//code
.....//code
getTime()->trm2
Disp "Elapsed Time", timeCnv(trm2-trm)[1] & " Days",timeCnv(trm2-trm)[2] &" Hours", timeCnv(rtrm2-trm)[3] & " Minutes",timeCnv(trm2-trm)[4] & "Seconds"c2
ec2

---------------------------------------------------------------

in 89 Basic you can load strings on top of cells in list and matricies.  This is useful for event programming:

c1
-->
CODE
ec1"This code is in a list"->fl[1]//assumes fl exist as a list var
Text fl[1]c2
ec2

This way you can trim your programs down by storing all dialog into list and matricies.
-----------------------------------------------------------------

to convert getkey() directly to characters

c1
-->
CODE
ec1while a=a
char(getkey())
endwhilec2
ec2

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Undocumented BASIC tricks (TI89 series)
« Reply #1 on: July 19, 2006, 02:26:00 am »
sound cool, we should start another basic optimising/tricks thread for 68k ^^

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
Undocumented BASIC tricks (TI89 series)
« Reply #2 on: July 19, 2006, 11:34:00 am »
I think it would be better to seperate the two so others will not get confused XDsmiley.gif, not saying people would >.>

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Undocumented BASIC tricks (TI89 series)
« Reply #3 on: July 19, 2006, 11:43:00 am »
yeha I'll split both I think  

Offline mdjenkins86

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 235
  • Rating: +0/-0
    • View Profile
Undocumented BASIC tricks (TI89 series)
« Reply #4 on: July 25, 2006, 04:04:00 am »
to make a magnifing program in basic with flib:
this program also saves the product
Warning this program is very slow, so it is best used for game development, in game execution, except for maybe a pic of 4x4 lol

c1-->
CODE
ec1magnify(picstr,mag)


// this program is for magnifing small pics only not bigger than 40x40
// anything bigger than 40x40 wont fit on the screen when magnified

flib("clrscr","rclscr:"&picstr)
flib("picsize:"&picstr)
fl[1]->w
fl[2]->h
fl*mag->savep
mag->mag2

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Undocumented BASIC tricks (TI89 series)
« Reply #5 on: July 25, 2006, 04:10:00 am »
what does magnifing do?

Offline mdjenkins86

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 235
  • Rating: +0/-0
    • View Profile
Undocumented BASIC tricks (TI89 series)
« Reply #6 on: July 25, 2006, 04:36:00 am »
Well, it takes picture 'picstr' and zoom magnifies the picture by a factor of 'mag'.  First the program finds out the hight and width of a picture in pixels.  Then the program scans each pixel to see it is turned on or not.  if so the program draws a rectangle and fills it in black.  If not it draws a rectangle and fills in in white.  the program scans down and across, respectively and updates the progress at the bottom of the screen in real time.  You can also see the image being rendered in real time as well.  after the image is rendered.  The output is saved into a picture file called zp.