I wish to, through a z80 program, create a new program, with specified code in it, then hand over execution to that program. I know how to copy data from one place to another, and I know how to use bcall _ExecuteProg.

What I need to know is, what is the basic header for a TI-83+/84+ Z80 assembly file, that I will need to start my temporary program with in order to not cause an error? What does that equate to in hex?

and lastly, what does _ExecuteProg do with regard to the stack and 'ret'. Will I be able to, once execution is done in the temporary program, safely use _ExecuteProg to return to the start of the main program (i dont need to return to any particular spot). or do you recommend a more efficient way?
Almost every TI-83+/84+ assembly file starts with $BB,$6D; beyond that, there's no guarantee. I recommend you use something like RunProg over _ExecuteProg, as it handles a lot more special cases. I believe that when it completes, _ExecuteProg will return to the next line of your program.
So, ill go with RunProg.

Now, when I use the ball _CreateProg, is the $BB, $6D automatically put there, or is that something I will need to make sure is at the beginning of the bytes I'm writing into the program?
ACagliano wrote:
So, ill go with RunProg.

Now, when I use the ball _CreateProg, is the $BB, $6D automatically put there, or is that something I will need to make sure is at the beginning of the bytes I'm writing into the program?
No, the only thing that's placed automatically is the size of the program in (de) and (de+1). The contents of the program are random, and it's up to you to put whatever you want in there (including zeroing it out, if necessary).
ok, so basically, in the bytes to copy..


.db $BB, $6D
...rest of code here
That's correct, if you want it to be recognized by the OS and most shells as an assembly program.
Theory help... assuming I have the following code:


   .db   $BB,$6D
   ld   a,(Cn2_In_Size)
   bit   7,a
   jr   z,loop
   ld   a,(Cn2_In_Data)
   cp   $A0
   jr   nz,loop
; lets start updating the program
   ld   hl,MainName
   bcall   _DelVarArc
   ld   hl,MainName
   rst   20h
   ld   hl,(Cn2_In_Data+1)
   bcall   _CreateProg
   push   hl
   call   Cn2_ClearRecBuf
#define   CurrentByte   SaveData_End+5
   pop   hl
   ld   (CurrentByte),hl
   call   copyProgramLoop
   ld   hl,MainName
   rst   20h
   bcall   _Arc_Unarc

   ld   a,(Cn2_In_Size)
   bit   7,a
   jr   z,copyProgramLoop
   ld   a,(Cn2_In_Data)
   cp   $A1
   jr   z,InTrans_Data
   cp   $A2
   ret   z
   jr   copyProgramLoop

   ld   c,(Cn2_In_Size+1)
   dec   c
   ld   b,0
   ld   de,(CurrentByte)
   ld   hl,Cn2_In_Data+1
   ld   (CurrentByte),de
   call   Cn2_ClearRecBuf
   jr   copyProgramLoop

   .db   ProtProgObj, "STARTREK"

This is the full excerpt of the code that I will be copying into an external program, then executing (not yet debugged). My issue is that the label MainName when copied over will become a new, different memory address in the external program. How then, do I return a pointer to it into hl?

Or am I over thinking it, and its just the same way as usual?
ACagliano wrote:
If you're using Brass, try the [url=http://benryves.com/bin/brass/directives/relocate.htm].relocate[/ul] directive.
oh ok. so simply use the relocate and relocate_end directives and the offset it automatically applied. that works.

Where I do, relocate address, should address be progstart as defined in dcs7.inc, since thats where all executing programs are moved to?

Edit: Wait, using this, can't I just copy the code to some out-of-program location, execute it out of there, and then execute the new program, without actually creating the temporary program?
It should be progStart-2 - the $BB, $6D (which are really t2ByteTok, tasmCmp) are only used for identification of the program, so when the program is loaded into memory (at progStart) those two bytes are skipped. The byte immediately after those two needs to have the address of progStart.

And yes, in response to your edit, I'd recommend just copying the temporary code to some other scratch buffer and executing it there.
Ok, thanks. And a final question, I think...

say I have .relocate saferam1+300

Will the relocate directive actually copy the code to saferam1+300 itself? or do I still need to copy the code to the target address on my own?

In the link Kerm send me, I'm seeing the code manually copied, but where does the label "ram" come from?
You still need to copy the code to the target address - "relocate" only changes the value of the program counter inside the relocate block, but the code is still output in the regular place in the final program file.

The example is running a block of code that's normally stored in ROM from RAM, so I picked some arbitrary definitions for "ram". In your case it looks like you'd use saferam1+300 instead.
The OS X Mavericks update broke my computer's compatibility with gedit for OS X. Is there a similar text editor I can replace it with.
ACagliano wrote:
I would think there are about a thousand text editors you could use.
I badly phrased this question. I'm looking for a text editor designed for programming. Similar to Apple's Xcode, but less feature-intensive. Text Wrangler worked pretty well, but it had no syntax color scheme for Z80. Gedit has one that I could install.

I guess my question is (1) If I can't run the precompiled binary of gedit for OS X, can I download a Linux version source package and compile it myself and see if that works? Or should I look into another Mac specific editor?
What about WabbitCode for Mac?

EDIT: Or why not download the Mac sources?
WabbitCode for Mac is buggy on Mountain Lion and Mavericks. I filed a bug report over a year ago on codeplex, enclosing a full crash report and explaining the steps to reproduce the error and never heard back.

As for the Mac sources for gedit, I did find a version that works on Mavericks. It's in that link you sent me as well. Thanks.
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 4
» 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