What is the best way to run an assembly program as a subroutine in C?
Also: What is the best way to run a BASIC program?

I mean, where do I put the code? And what code to I use?

This is the code I have currently.

Code:

   ld hl,-64
   add hl,sp
   push hl
   pop de
   ld sp,hl
   push de
   ex hl,de
   ld hl,.stub
   ld bc,64
   ldir
   ld hl,(ti.asm_prgm_size)
   ld de,userMem
   call ti.DelMem
   call ti.ChkFindSym  ; name is already in OP1
   ld hl,(hl)
   push de
   push hl
   call ti.InsertMem
   pop bc
   ld (ti.asm_prgm_size),bc
   pop hl
   ld de,ti.userMem
   ldir
   ld hl,.name
   call ti.Mov9ToOP1
   ld hl,.name
   call ti.PushOP1
   jp ti.userMem
.name:
   db 6,"BOSSHELL"
.stub:
   ld hl,(ti.asm_prgm_size)
   ld de,ti.userMem
   call ti.DelMem
   call ti.PopOP1
   call ti.ChkFindSym
   ld hl,(hl)
   push de
   push hl
   call ti.InsertMem
   pop bc
   pop hl
   ld de,ti.userMem
   ldir
   ld hl,64
   add hl,sp
   ld sp,hl
   jp ti.userMem


Any suggestions?
You don't.

Why can't you just tell us what you *want* to do so we can actually give you useful information, rather than some half-baked idea such as this.
MateoConLechuga wrote:
You don't.

Why can't you just tell us what you *want* to do so we can actually give you useful information, rather than some half-baked idea such as this.


I just said what I wanted to do.
Run an assembly program, subroutined from a C program.
Also I would like to be able to run a BASIC program from a C program.
Do you want to run an entire existing program, that is currently stored on the calc, or do you want to run some assembly code from your C program that performs a certain function?

Are you wanting to make a shell or something?
tr1p1ea wrote:
Do you want to run an entire existing program, that is currently stored on the calc, or do you want to run some assembly code from your C program that performs a certain function?

Are you wanting to make a shell or something?


Yes, I am working on BOSshell.
I would like to copy a variable, assuming it contains assembly, to userMem and call it.
Afterwards returning to my program.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement