Author Topic: Character vs token? (and other questions)  (Read 4101 times)

0 Members and 1 Guest are viewing this topic.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Character vs token? (and other questions)
« on: February 23, 2011, 08:48:59 pm »
The character 'f' (lowercase F) is designated the number '102' (66 in hexadecimal) by the calculator (and therefore, by ASCII), but according to the table of tokens located at tibasicdev, the token 'Normal' is also represented by '66'.

How does the calculator distinguish between the two?
« Last Edit: February 24, 2011, 11:18:31 am by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Character vs token?
« Reply #1 on: February 23, 2011, 08:51:59 pm »
The lowercase letters are 2 byte tokens:

BB66 = f
66 = Normal

Check out the xml's included with Merth's Tokens (maybe you can get them other places, idk)
« Last Edit: February 23, 2011, 08:52:26 pm by squidgetx »

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Character vs token?
« Reply #2 on: February 23, 2011, 08:55:52 pm »
Ahh... Okay, I think I've got it now.  Thanks.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Character vs token?
« Reply #3 on: February 23, 2011, 10:23:44 pm »
Ahh... Okay, I think I've got it now.  Thanks.
But that only applies to tokens.  f still is 0x66, and is that when displaying characters with an asm routine like getC.  Tokens are strange in that manner.  Maybe I should update that page.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Character vs token?
« Reply #4 on: February 23, 2011, 10:35:49 pm »
The difference between tokens and ASCII is that when the calc reads "Normal" the calc displays the ASCII letters for 'N' 'o' 'r' 'm' 'a' 'l'
In certain situations, the calc reads data as tokens and in other situations it reads it as ASCII.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Character vs token? (and other questions)
« Reply #5 on: February 24, 2011, 11:21:44 am »
I don't really want to start a new topic, so I'll periodically ask a few questions here:

The type of variable is indicated by a single byte - for example, a program would have a byte set to 05 whereas an appvar is set to 06 (I think?).

Does anybody know where I can get a complete table of all the types?  (So I can find out what kind of variable 03 indicates, for example).
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Character vs token? (and other questions)
« Reply #6 on: February 24, 2011, 11:26:09 am »
Yes, I happen to know a few (I have made a bunch) and actually 06 is a Protected Program and an Appvar is 15h. I included a chart in my BatLib readmes as well as their compatibilities with each other:
Code: [Select]
00=Real            00h
01=List            01h
02=Matrix          02h
03=EQU             03h
04=String          04h
05=Program         05h
06=ProtProg        06h
07=Picture         07h
08=GDB             08h
09=Unknown         09h
10=Unknown Equ     0Ah
11=New EQU         0Bh
12=Complex         0Ch
13=Complex List    0Dh
14=Undefined       0Eh
15=Window          0Fh
16=ZSto            10h
17=Table Range     11h
18=LCD             12h
19=BackUp          13h
20=App             14h
21=Appvar          15h
22=TempProg        16h
23=Group           17h
EDIT:Added hex equivalents :D

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Character vs token? (and other questions)
« Reply #7 on: February 24, 2011, 11:39:07 am »
Ahh, cool, thanks!
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Character vs token? (and other questions)
« Reply #8 on: February 24, 2011, 11:45:33 am »
As a note, if you are going to be playing around by switching variable types, some types are not compatible. For example, you can change that 05 you were talking about to a 15 to make it an appvar, but you should not change that to a 00, for example.