Is it possible to Execute TI BASIC from a string? Such that:
execute(":Disp Str1")
would Print out Str1?
Asked
Active
Viewed 109 times
2 Answers
2
It could be done with a small Asm(
program that takes a string (from Ans
), turns it into a BASIC program, and executes it. For example:
.nolist
#include "ti83plus.inc"
.list
.org userMem-2
.db $BB,$6D
ld hl,SavesScreen
ld (hl),tTheta
inc hl
ld (hl),0
inc hl
push hl
bcall(_AnsName)
rst rFindSym
ex de,hl
ld c,(hl)
inc hl
ld b,(hl)
dec hl
inc bc
inc bc
pop de
ldir
ld hl,SavesScreen
ld a,6
bcall(_ExecuteNewPrgm)
; no ret because _ExecuteNewPrgm does not return
This is not ideal,
- No safety in case
Ans
did not contain a string (could be added). - A program named θ should not exist, because it will be overwritten. If
prgmθ
already exists and is archived, then it does not work at all. (could be improved) prgmθ
is not deleted afterwards. (not sure how to do this)- When
prgmθ
is done, it quits to the Homescreen, it does not return to the calling program. (not sure how to do this)
Aside from that, it does work, for example:
:"TESTING->Str1
:":Disp Str1
:Asm(prgmRUNSTR
Looks like this afterwards:
You can create the assembly program by typing this into a normal program:
AsmPrgmBB6D21
EC86365B2336
0023E5EF524B
D7EB4E23462B
0303D1EDB021
EC863E06EF3C
4C
It can be made smaller with AsmComp(
.

harold
- 61,398
- 6
- 86
- 164
0
Unfortunately, no, not like this- expr and eval only work on expressions.

iPhoenix
- 719
- 7
- 20
-
This is what I was hoping I didn't have to do, but I've heard that you can execute Assembly from the TI BASIC Program, Is this true? – Scraps Jul 14 '20 at 22:40
-
1Yes, it is! Asm(prgmMYASMPGM – iPhoenix Jul 14 '20 at 22:41
-
Thank you so much! – Scraps Jul 14 '20 at 22:45