Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Xeda112358 on April 25, 2012, 08:36:28 pm

Title: TPROG
Post by: Xeda112358 on April 25, 2012, 08:36:28 pm
I feel like I have made a topic about this before, but I am not sure... I cannot find it anywhere.

Anyways, jsj795 had a great idea for a program back in January that will prove useful to others, too, I am sure.

What it does:
At its core, it copies a program in RAM or Archive to a temp program. Temp programs get automatically cleaned up by the OS (deleted) when all programs are finished running. it also has the functionality to delete programs and temprograms, just in case.

Notes:
When you copy to the temp program, any existing program or temp program with the same name will get deleted!

How to use it:
All arguments are passed in Ans. Currently, there are no outputs. The syntax for copying a var is:
"<<original>>:<<copy>>":Asm(prgmTPROG
So for example, say you want to copy prgmRAWR to prgmZZTEMP1:
Code: [Select]
"RAWR:ZZTEMP1
Asm(prgmTPROG
Notice that unlike some of my other programs, you don't need a type byte for these. Also note that a colon separates the names.
To delete a program, put a minus sign before the name:
Code: [Select]
"-ZZTEMP1
Asm(prgmTPROG
But that isn't all! Say you want to do a bunch of things at once. Simply put them all in one string and run the program:
Code: [Select]
"RAWR:ZZTEMP1:-HELLO:WORLD:MEOW:-BRIDGE:-THEGAME
Asm(prgmTPROG
That copies RAWR tot he temp prog ZZTEMP1, deletes prgmHELLO, copies prgmWORLD to temp prog MEOW, deletes prgmBRIDGE, and deletes prgmTHEGAME.

So what is the size of this lovely program? 172 bytes. That's it. Have fun.

More notes:
If you try to copy a program that doesn't exist, those two arguments get ignored. If you try to delete a variable that doesn't exist, that argument also gets ignored.

EDIT: Uploaded a faulty version, originally. This version is fixed.
Title: Re: TPROG
Post by: jsj795 on April 25, 2012, 09:31:38 pm
The program you sent me via email and this program doesn't match. And also, for both cases, it seems to give me various errors :o especially if the program I'm copying from is archived. I just got Error:Memory, which led me to the line
Asm(prgmTPROG

and another time I got Error:Syntax which didn't have Goto so I was guessing it was PROG, since I didn't change any code
Title: Re: TPROG
Post by: Xeda112358 on April 25, 2012, 09:38:32 pm
Hmm, this version is slightly updated to catch certain issues. As to the errors, the only reason ERR:MEM would pop up is if you didn't have enough RAM :/

As for Err:Syntax, if that occurs inside the temp program, there will be no Goto option (the OS won't allow it).

If these are absolutely not the problem, then some other App or program is interfering, possibly. What is the exact code you are using?
Title: Re: TPROG
Post by: jsj795 on April 25, 2012, 09:43:55 pm
My RAM was at 22000 bytes and the program I was trying to copy was 1730 bytes, so I don't think there was any problem there. as for Syntax error, it runs fine if I run it without using TPROG :( Also the very first TPROG u sent me works with my codes.

The code that it gives me error is the very first time I use it, which is:
This line:
Asm(prgmTPROG

Code: [Select]
:"Tale of the Lost Map
getKey
"TINIT:T1
Asm(prgmTPROG
prgmT1
If Z!=4:Then
"TLOOP:T1
Asm(prgmTPROG
prgmT1
End
"TCLEAN:T1
prgmT1
Title: Re: TPROG
Post by: Xeda112358 on April 25, 2012, 10:02:13 pm
Hmm, it isn't giving me any errors :/
Title: Re: TPROG
Post by: jsj795 on April 25, 2012, 10:07:34 pm
attached the screenshot
Title: Re: TPROG
Post by: Xeda112358 on April 25, 2012, 10:13:49 pm
Hmm, the first error tells me that the error is definitely in TINIT (that is the only reason you would not have the option to Goto). But I see no reason for the other error. :[
I would ask for maybe a copy of the programs to see if there is some sequence of commands causing the issue, but I don't think your game has been released yet D:
Title: Re: TPROG
Post by: jsj795 on April 25, 2012, 10:15:46 pm
I'll actually send you the programs via email.

I just don't understand why it worked with previous TPROG and it suddenly doesn't work with new TPROG when I didn't change any code :(
Title: Re: TPROG
Post by: Xeda112358 on April 25, 2012, 10:19:06 pm
Yeah, it should have remained reverse compatible :[ I hope it has an easy fix D: I might not be able to solve the problem tonight because I have to sleep and get up in 6.5 hours (5:00 AM)
Title: Re: TPROG
Post by: jsj795 on April 25, 2012, 10:20:10 pm
it's fine, I'm just going to use the old version to develop and when the bug is fixed, switch to new one :P Also, email sent
Title: Re: TPROG
Post by: Xeda112358 on April 25, 2012, 10:45:20 pm
I edited the first post with the good version :) What happened was I accidentally erased 7 lines of code before compiling, so I fixed that. For the curious, the code in question was:
Code: [Select]

     out (6),a
     ld b,0
     or a
     jr z,$+6
       add hl,bc
       ld c,10
       add hl,bc
That is pretty much the code that allows it to get the pointer and size of an archived variable. There was also one other line of code, but that had no affect since this code wasn't there.

EDIT: Also, I emailed you back :)
Title: Re: TPROG
Post by: blue_bear_94 on May 11, 2012, 09:15:04 pm
Does TPROG work now? I'm planning to use this on Sunrise 4.
Title: Re: TPROG
Post by: jsj795 on May 11, 2012, 09:40:37 pm
yes it works :) Xeda currently is away right now without much internet access so if you need his assistance, shoot him an email and he might respond within... some time :P
Title: Re: TPROG
Post by: blue_bear_94 on May 13, 2012, 02:43:25 pm
yes it works :) Xeda currently is away right now without much internet access so if you need his assistance, shoot him an email and he might respond within... some time :P
You mean her assistance.
Title: Re: TPROG
Post by: jsj795 on May 13, 2012, 07:14:32 pm
ah yeah x.x i always forget :/