Author Topic: Goto Label using ASM  (Read 6086 times)

0 Members and 1 Guest are viewing this topic.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Goto Label using ASM
« on: February 25, 2011, 09:16:37 pm »
If I run a Ti-Basic program and there's an asm( line to run an ASM program, how can I tell the asm program to goto a label inside of the Ti-Basic program?  I'm wondering if there's a B_CALL or something to find the label and continue running the program from that location

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Goto Label using ASM
« Reply #1 on: February 25, 2011, 10:06:35 pm »
Oooh, that's a cool idea.  I don't know of a way, but I'm sure there is a way to do this. :D

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Goto Label using ASM
« Reply #2 on: February 25, 2011, 10:16:28 pm »
I know there is no bcall explicity made for doing this. But with a little bit ptr hacking it's probably doable. (Essentially change a few numbers so the program returns to the new label instead of where it's supposed to.)
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Goto Label using ASM
« Reply #3 on: February 25, 2011, 10:56:42 pm »
You would have to change some variables.  Essentially check from the basic_start and basic_end (There's also one for basic_pc or something like that) for your label, and set basic_pc to it.

EDIT: That should work, if it doesn't, don't say I didn't warn you.  btw, I'm warning you now. ;-) Not that I think it'll do anything bad.
« Last Edit: February 25, 2011, 10:57:17 pm by graphmastur »

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: Goto Label using ASM
« Reply #4 on: February 26, 2011, 12:30:52 am »
Sounds like it could be kind of hard to calculate as each instruction has varying size from only one byte to several hundred or even thousand bytes. You could have the subroutine count the number of carriage returns to find where to jump to.
Code: [Select]
:15->A      //number of instructions to jump
:asm(JUMP   //count 15 carriage returns, then change the BASIC pointer to that address. 
:blah       //14 lines of blah
:if B=4     //destination

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Goto Label using ASM
« Reply #5 on: February 26, 2011, 01:09:20 am »
Actually, I forgot about searching tokens. 

The calculator has three specific variables for Ti-Basic programs running: where the program starts, where it ends and where it is currently running.  I'll just search through the list of tokens in the program from beginning to end.