Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: ACagliano on July 05, 2010, 05:50:57 pm

Title: Create Groups
Post by: ACagliano on July 05, 2010, 05:50:57 pm
Hey guys. I am looking for an assembly subroutine (in hex, please) that does this:

You have a bunch of program names stored into Str4. The asm program creates a group consisting of those programs listed in Str4. Is this possible?
Title: Re: Create Groups
Post by: thepenguin77 on July 05, 2010, 08:35:13 pm
I was about to jump right on this, but then I realized, I have no idea how to make groups.

I've done quite a bit of searching and there is almost no information on this, the best thing I can find is JForceGroup. I believe all this does is bring up the group menu. I think I can manually select the groups data wise, but it would still probably need a rawKey hook to press right and then enter.

So it depends what you are using this for. I would imagine that the group screen will pop up for a second. I also think this might be quite a program to type in with hex.

Edit:
   Looks like you'd have to use a getCSC hook because you would also have to regain control after the group completes.
Title: Re: Create Groups
Post by: ACagliano on July 06, 2010, 05:57:18 am
Well, it seems complicated. And, to increase the "awesomeness" associated with its release, I'd rather not say at the moment exactly what it's purpose would be (at least not on forums or IRC). Just know that the grouping itself needs to be fully automated, with its name defined in one String and its contents defined by another String.


Question about CelticIII: Let's say I have a program in RAM called prgmTEST. Can I then create an appvar TEST, and them not interfere with each other, so long as one stays an appvar and the other a program, or should the name be changed?
Title: Re: Create Groups
Post by: _player1537 on July 06, 2010, 11:10:03 am
affirmitive, they will not mess with each other, in the ram each one has a sort of "header" that says what type it is, and the name.  Appvar's header's start with one number, programs start with a 5, and protected programs start with a 6. 
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 11:26:08 am
The grouping would be fully automated, but it would not be hidden. Unless you turn the screen off, the user will see the group menu appear, then watch the calculator working on grouping, and then saying complete.

I'll start making it, if what I just said is fine, then you'll be able to group.

One last thing, will this be a program, or will this be an in-line code section.

Edit:
     What string are you putting the name in?
Title: Re: Create Groups
Post by: ztrumpet on July 06, 2010, 11:44:39 am
You have a bunch of program names stored into Str4. The asm program creates a group consisting of those programs listed in Str4. Is this possible?
Str4 :)

This sounds pretty complicated.  Good luck! ;D
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 11:47:11 am
The name of the group variable.

Does anyone know how to make the calculator normal again when returning from a hook? Like resume operation of a basic program?
Title: Re: Create Groups
Post by: _player1537 on July 06, 2010, 11:52:05 am
I could have sworn that there was a bcall to do this...

Regardless, after you use the hook its needed number of times, use the disable hook bcall to turn it off (I like hooks :P)
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 12:00:13 pm
Ya, it looks like it has to press 3, right, enter, then return.

The last time I tried to normalize from a hook, I called an os specific call, made a temp program, executed it and called my program. Hopefully there is an easier way.
Title: Re: Create Groups
Post by: _player1537 on July 06, 2010, 12:01:54 pm
I write my hooks for the ram ^^, I'll have to look for the template I used, one sec
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 12:28:58 pm
Here's how the syntax is coming out.

String 3 is the group name.
String 4 is the programs's names.

The program names are 9 characters long where, first byte is o = unprotected or p = protected, then the name followed by spaces to make it 8 bytes.

So for example ztris and ztetris would be, pZTRIS___pZTETRIS__
Title: Re: Create Groups
Post by: DJ Omnimaga on July 06, 2010, 12:39:47 pm
To whoever is making this, good luck on the project :)
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 01:50:13 pm
lol, this is the most hacked up thing I've ever seen.

It will be complete as soon as some one figures out how to normalize from a hook.

Edit:
    + is unprotected - is protected. Turns out that o and p are actually 2 byte tokens
Title: Re: Create Groups
Post by: nemo on July 06, 2010, 01:59:50 pm
lol that's so cool. nice job penguin77! and yeah, i think that all lowercase letters are 2 byte tokens.
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 02:26:11 pm
Ok, new idea, maybe I can make a group variable in ram and then archive it. That would be much simpler, I just have to figure out how groups work. It is also so anti-TI to have a group in ram.
Title: Re: Create Groups
Post by: calcdude84se on July 06, 2010, 03:16:18 pm
Making a group in RAM shouldn't be too hard... Just create a program/protprog/appvar and change the type byte. As for format...
* calcdude stares at some group vars in calcsys and plans to report back later
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 03:57:27 pm
That's ok, I already figured out the format. It just looks like you put the vat entry in front of the program data. Very simple to do.
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 05:13:31 pm
Sorry for the double post, but I finished the program. This one works way better, but is a lot less cool. Since I believe you are putting this within a celtic program, I will make you an unsquisher so that you send the program to calc, unsquish, and then recall it into your program since i doubt you want to type 400 numbers (200 bytes).

Anyways, the official format for groups is:
2 bytes: size
{
7 bytes: prog vat entry
1-8 bytes: prog name
2 bytes: prog size
0-65k: prog data
}
Repeat the bottom part for each entry.

Then when it's all done, archive it with bcall(_archiveVar).
Title: Re: Create Groups
Post by: ztrumpet on July 06, 2010, 05:30:45 pm
Nice job!  That's really nice.  :)
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 05:47:30 pm
Well here it all is. The unsquisher takes the program name in string 1, using the same syntax for programs as the grouper, and converts it into hex code in a program of the same name just with A as its first letter.

"GROUPER2->Str1
Asm(prgmUNSQUISHER

then later
Rcl prgmAROUPER2
Title: Re: Create Groups
Post by: BrandonW on July 06, 2010, 06:05:28 pm
Ok, new idea, maybe I can make a group variable in ram and then archive it. That would be much simpler, I just have to figure out how groups work. It is also so anti-TI to have a group in ram.

While it defeats the purpose of having groups (you'd just be duplicating the RAM variables in RAM), you absolutely could have done this using _archiveVar. That's a subroutine of _Arc_Unarc, the latter which has all the checks to make sure you don't try archiving a group or something.
Title: Re: Create Groups
Post by: Builderboy on July 06, 2010, 06:23:04 pm
I have to say i like the editing memory directly solution better than the hacky menu one :P Either way however, great job!
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 06:36:32 pm
Ok, new idea, maybe I can make a group variable in ram and then archive it. That would be much simpler, I just have to figure out how groups work. It is also so anti-TI to have a group in ram.

While it defeats the purpose of having groups (you'd just be duplicating the RAM variables in RAM), you absolutely could have done this using _archiveVar. That's a subroutine of _Arc_Unarc, the latter which has all the checks to make sure you don't try archiving a group or something.


I did use _archiveVar. The only problem was that wiki ti didn't have the inputs right, you have to call _chkFindSym right before you use it.

And ram groups are pretty funny. Since the os expects them to be in archive they get pretty glitchy and tend to clear ram when you ungroup them.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 06, 2010, 06:44:27 pm
Interesting stuff ^^
Title: Re: Create Groups
Post by: ACagliano on July 06, 2010, 07:00:13 pm
Well here it all is. The unsquisher takes the program name in string 1, using the same syntax for programs as the grouper, and converts it into hex code in a program of the same name just with A as its first letter.

"GROUPER2->Str1
Asm(prgmUNSQUISHER

then later
Rcl prgmAROUPER2

Now, can you have multiple programs in Str1. And I am at a loss. Where do you define the name of the group itself and where do you define the programs to be included? And, with the unsquisher, what happens if you unsquish and a program already exists in RAM. Overwrite or skip? and is it auto? cuz it would be best if it is auto.

And can you please provide me with a sort of readme for the stuff- i dont want to make any mistakes.

And thanks. You guys rock.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 06, 2010, 07:04:18 pm
Btw just one thing: make sure those routines are safe and that you don't do bad mistakes while using them, since it involves writing to Flash. Accidentally overwriting the OS certificate == bad
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 07:43:39 pm
Btw just one thing: make sure those routines are safe and that you don't do bad mistakes while using them, since it involves writing to Flash. Accidentally overwriting the OS certificate == bad
No, no, no. I would never write to flash from a basic program lol. That's just scary. I make a group variable in ram and then archive it.

Group2:
Input: Str3 = group name, must be 8 characters, use spaces if it's not 8, Ex: "GROUP___"
         Str4 = programs to group, each name is 8 characters with a + or - prefixing it to show it's type
                + = unprotected/unlocked program
                - = protected/locked program
                Ex: "+A_______+BASIC___-PHOENIX_-GROUP2__"
Then just run group2, or it's hex equivalent, and your group from string 3 will be made with the programs in string 4.

Unsquish:
This program is so you don't have to type in all 500 numbers by hand.
Input: Str1 = program name, must be 8 characters with + or - prefix, Ex: "-GROUP2__"
Output: A program will be made with the same name as the original, except the first letter will be an 'A'.

Then run it and AROUP2 will be made which you can recall the numbers from.


Both of these programs auto overwrite. The group one makes a program and a group but deletes the program, so don't name your group the same as your program. Ex: Your game is call GAME, you go to make a group called GAME, your game just got deleted in the process.

By doing the auto overwrite, I basically eliminated any chance of you accidentally clearing ram, (which would suck.) Also, if either of them error, you won't really know aside from they won't have completed their task.

Edit:
    I am stupid, during my final optimize I made a little error. Fixed now though. Also, I just tested, if you don't have enough memory, thankfully you just get an error memory.
Title: Re: Create Groups
Post by: ACagliano on July 06, 2010, 07:53:21 pm
can i have a screenshot of the unsquisher running. if you dont mind, i may just use celtic 3 for the ungrouping, but i will use your grouper.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 06, 2010, 08:46:06 pm
Btw just one thing: make sure those routines are safe and that you don't do bad mistakes while using them, since it involves writing to Flash. Accidentally overwriting the OS certificate == bad
No, no, no. I would never write to flash from a basic program lol. That's just scary. I make a group variable in ram and then archive it.
Oh ok phew, I thought those programs wrote directly to Flash instead of RAM then archiving.
Title: Re: Create Groups
Post by: thepenguin77 on July 06, 2010, 09:02:19 pm
Well during the making of this screenshot, (which took a long time), I found some more errors because I had never actually tried embedding the program in a basic program. But it finally works.
Title: Re: Create Groups
Post by: ACagliano on July 06, 2010, 09:39:23 pm
thank you. you have at least halved the time i projected it to take for me to ready my project for release and spared me massive quantities of coding. How would you like to be credited?
Title: Re: Create Groups
Post by: ztrumpet on July 06, 2010, 09:40:24 pm
thank you. you have at least halved the time i projected it to take for me to ready my project for release and spared me massive quantities of coding. How would you like to be credited?
My guess is by rickroll. :P
Title: Re: Create Groups
Post by: DJ Omnimaga on July 06, 2010, 09:59:22 pm
Nice Thepenguin77. Btw, did you plan the addition of ungrouping and support for group names with fewer than 8 chars, allowing the user to not have to fill empty spots with space tokens?

thank you. you have at least halved the time i projected it to take for me to ready my project for release and spared me massive quantities of coding. How would you like to be credited?
My guess is by rickroll. :P
wut? o.O
Title: Re: Create Groups
Post by: thepenguin77 on July 07, 2010, 12:49:57 am
My program actually replaces the spaces with 0's, I just felt spaces would be the easiest thing to fill the gap with. I could have even used pi's if I wanted to.

For ungrouping, doesn't celtic do a pretty good job? I don't really know as I've never used it.
Title: Re: Create Groups
Post by: ACagliano on July 07, 2010, 05:47:54 pm
what sort of problems did the first one have? because i tried to use it and it crashed. i had a full memory dump (RAM and Archive) and now my calc randomly crashes when i try to do some basic functions or run certain apps.

I'm hoping ARCHUTIL will be of some service in recovering my archive.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 07, 2010, 05:52:52 pm
My program actually replaces the spaces with 0's, I just felt spaces would be the easiest thing to fill the gap with. I could have even used pi's if I wanted to.

For ungrouping, doesn't celtic do a pretty good job? I don't really know as I've never used it.
Oh I mean, not forcing the user to add those spaces when typing his string.

As for Celtic I don't remember much, I thought it might be cool to have a program that doesn't require installing a large APP, though, for people who have less space, and you would have both tools in one.
Title: Re: Create Groups
Post by: thepenguin77 on July 07, 2010, 07:49:41 pm
That's not a bad idea. I don't think ungrouping would be hard, I would do the whole thing at once though.

Also, I guess by the way it works, you technically only need one space for the group name. So it would be "A_" or "AB_" or whatever. You just have to stick a 0 in there so the OS knows the name is done.

I guess I could technically do the same for the second list as well, my program would just see the + or - as the start of the next variable and then . That would work.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 07, 2010, 08:32:48 pm
You mean a 0 after a space? Because what if the prgm name contains a zero as the last char?
Title: Re: Create Groups
Post by: thepenguin77 on July 07, 2010, 08:50:48 pm
What I mean is I have a little routine that replaces all the spaces with 0s. So putting a space after it technically makes it look like "GROUP2", 0 after I parse it.

I suppose I could technically not require the space. The only problem is, the less you do in basic, the bigger the program is. And since the program gets its sized doubled by unsquishing, it's a tough balance.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 07, 2010, 09:04:23 pm
I'm not sure if I understand D: , sorry. it might just be too technical for me
Title: Re: Create Groups
Post by: thepenguin77 on July 07, 2010, 09:13:11 pm
What I mean is I have a little routine that replaces all the spaces with 0s. So putting a space after it technically makes it look like "GROUP2", 0 after I parse it.

The way it currently works, you only have to put one space after the group name.


I suppose I could technically not require the space. The only problem is, the less you do in basic, the bigger the program is. And since the program gets its sized doubled by unsquishing, it's a tough balance.

Since memory is the goal in basic, adding more features might not make it smaller. It requires less on the user's part, but the asm program gets bigger.

lol I just quoted myself
Title: Re: Create Groups
Post by: DJ Omnimaga on July 07, 2010, 09:31:03 pm
oh ok because in your screenshot, it seemed like you put multiple spaces after the names, depending of the name lenght, like if you needed to fill all 8 char slots with something.

I guess if it's gonna make the routine much larger then it's not worth changing it, though.
Title: Re: Create Groups
Post by: ACagliano on July 09, 2010, 05:45:10 pm
what sort of problems did the first one have? because i tried to use it and it crashed. i had a full memory dump (RAM and Archive) and now my calc randomly crashes when i try to do some basic functions or run certain apps.

I'm hoping ARCHUTIL will be of some service in recovering my archive.

Did anyone see this bug report?


The calc now requires ON+CLEAR to turn on.
Any of the reset memory functions freeze.
CalcSys Crashes

Edit: ArchUtil was able to recover my archives once i put it back on my calc. Now, seeing my above problems, should i do an OS reinstall.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 09, 2010, 09:04:09 pm
sadly I can't help much, but I think if a full mem reset did not fix your calc, an OS reinstall may be the best
Title: Re: Create Groups
Post by: calcdude84se on July 09, 2010, 09:07:00 pm
Yeah, if a full reset can't fix it, you don't know the problem, and you don't want to leave your calc as-is for diagnostic purposes later on, I agree with DJ.
Title: Re: Create Groups
Post by: thepenguin77 on July 09, 2010, 09:17:06 pm
what sort of problems did the first one have? because i tried to use it and it crashed. i had a full memory dump (RAM and Archive) and now my calc randomly crashes when i try to do some basic functions or run certain apps.

I'm hoping ARCHUTIL will be of some service in recovering my archive.

Did anyone see this bug report?


Idk, I could have sworn that post wasn't there.

The problem with the first one was that it just jumped to the wrong spot if run as embedded. And if it was run from the homescreen, it did a push without a pop and returned to somewhere random.

But this is just little stuff, I have never had this little of an error cause what you have.

Edit:
    Either something else happened, or you got the most unlucky crash ever.

Title: Re: Create Groups
Post by: ACagliano on July 09, 2010, 09:35:20 pm
I posted in slightly more detail about whats happening on cemetech
Title: Re: Create Groups
Post by: TC01 on July 09, 2010, 09:50:06 pm
I don't have a Cemetech account, but:

Quote
Edit: ArchUtil was able to recover my archives once i put it back on my calc. Now, seeing my above problems, should i do an OS reinstall? Will reinstalling delete my Archive?

If you can link your calculator, then can't you can make a backup of your archive?

But I'm pretty sure installing an OS doesn't delete your archive.
Title: Re: Create Groups
Post by: thepenguin77 on July 09, 2010, 10:00:11 pm
On reading what's over at cemetech, I would say that one of your os sectors got deleted. One way to check would be to use calcsys, and check page 0, 4, 74, 78, and 7C. If any of them are all FF's then it got deleted.

The other possibility is that bcall(_archiveVar) created some garbage object in the archive, and anything that runs across it crashes. Though, I think you said your archive has already been cleared, so I guess that's not it.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 09, 2010, 10:00:31 pm
It depends. I think downgrading can (it did when I downgraded my 83+SE from OS 1.18 to 1.13). It might depend, though.
Title: Re: Create Groups
Post by: TC01 on July 09, 2010, 10:12:39 pm
It depends. I think downgrading can (it did when I downgraded my 83+SE from OS 1.18 to 1.13). It might depend, though.
On Cemetech, BrandonW says it doesn't.

But I suppose downgrading might be different?

Still, though, as long as you can send the OS (and ArchUtil, for that matter), you should be able to use TI Connect or TiLP to make a backup... so I'm still not sure why it would be a problem.
Title: Re: Create Groups
Post by: ACagliano on July 10, 2010, 06:41:08 pm
Here's what I realized I did. I made sure all the names in Str4 were 9 characters, the + or -, then the name (8 chars, spaces for blanks). But, for Str3, I forgot the spaces at the end.


Edit: Can someone link me to TI-84 Plus SE OS V 2.43?
Title: Re: Create Groups
Post by: thepenguin77 on July 10, 2010, 06:54:22 pm
Ahh, yes, the way your memory fell into place that could create a group with a very weird name.

Do you want me to fix up the program so that it doesn't require spaces for the title or programs? Or are you done with this?

Btw, I think somehow you already found a link.  ;)

Edit:
   Too late.

Now it will make whatever name you put in str3. So "A", "ABC", "ABCDEFGH" are all valid. And for str4, "+A+B-IMPOSBLE-GROUP2", will work too. Just do everything the same, but leave out the spaces.
Title: Re: Create Groups
Post by: ACagliano on July 10, 2010, 07:56:07 pm
thanks.

PS: I didn't mind crashing for the sake of helping this routine be bug-free, just as long as its fixable, and I don't have to restart my project. ALL HAIL ARCHUTIL.

PSS: So in the new version, I dont need to worry about crashing or wacking out because I forgot spaces?
Title: Re: Create Groups
Post by: thepenguin77 on July 10, 2010, 08:32:18 pm
No, the new one is safe. I guess the only bad thing you could do now is if you put stupid stuff in the name. Like lowercase letters, pi, etc.
Title: Re: Create Groups
Post by: thepenguin77 on July 12, 2010, 12:23:55 pm
I hate it when I make stupid mistakes.

Code: [Select]
dec bc
ld a, b
or a      ;too bad I actually care about c
jr nz, copyloop
Title: Re: Create Groups
Post by: DJ Omnimaga on July 12, 2010, 01:00:16 pm
If you put random junk in the names, will it create the group anyway, just with different name? I remember Mario 83+ allowed you to create levels in PRGM form that had lowercase letters. I think SourceCoder lets you do that, too.
Title: Re: Create Groups
Post by: thepenguin77 on July 12, 2010, 02:15:22 pm
You can kind of do it, but you have to trick the OS.

Here is the alphabet of lower case.
d = radian
e = degree
f = normal
g = sci
h = eng
i = float
j = =
k = <
l = >
m = <=
n = >=
o = !=
p = +
q = -
r = ans
s = fix
t = horiz
u = full
v = func
w = param
x = polar
y = seq
z = indpntAuto

Use these instead of the letter.

Edit:
    Wow, it actually works.
Title: Re: Create Groups
Post by: DJ Omnimaga on July 12, 2010, 02:32:22 pm
lol wow nice XD
Title: Re: Create Groups
Post by: calcdude84se on July 12, 2010, 04:44:40 pm
What about a, b, and c? :P
Title: Re: Create Groups
Post by: thepenguin77 on July 12, 2010, 06:31:03 pm
They don't map to anything useful. They are the first byte of two bytes variable tokens. For instance 61h 05h is graphDataBase 4.