So I've been attempting, somewhat unsuccessfully, to run TI-BASIC programs from C for some time now, getting to the point where the programs will run, but can't return successfully. I'd appreciate any guidance about what I'm doing wrong, or suggestions on how to improve it. Here's the code I'm using:
Excerpt from main.c, containing the program running stuff:
Code:
The RunPrgmBASIC() function is just the one from ICE:
Code:
Thanks in advance for your help, I don't really know what I'm doing with assembly so I'll appreciate any guidance you can give me. The current issue seems to be that the TI-BASIC program runs, but on returning, it crashes the C program.
Excerpt from main.c, containing the program running stuff:
Code:
char name[10] = " ";
size_t *asm_prgm_size = (size_t *)0x0d0118c;
size_t size_bkp = *asm_prgm_size;
name[0] = TI_PRGM_TYPE;
strcat(name, "MASTER");
strcpy(os_OP1, name);
os_PushErrorHandler();
os_ClrHomeFull();
RunPrgmBASIC();
*asm_prgm_size = size_bkp;
os_PopErrorHandler();
//just used to test if it returns correctly, which it doesn't
gfx_Begin();
gfx_FillScreen(224);
delay(100);
The RunPrgmBASIC() function is just the one from ICE:
Code:
.assume adl = 1
segment data
.def _RunPrgmBASIC
_RunPrgmBASIC:
ld iy, 0D00080h
ld hl, (0D0118Ch)
push hl
ld hl, 0
call 0020798h
set 1, (iy+8)
call 0020F00h
call 002079Ch
res 1, (iy+8)
pop hl
ld (0D0118Ch), hl
ret
Thanks in advance for your help, I don't really know what I'm doing with assembly so I'll appreciate any guidance you can give me. The current issue seems to be that the TI-BASIC program runs, but on returning, it crashes the C program.