0 Members and 1 Guest are viewing this topic.

#### Xeda112358

• they/them
• Moderator
• LV12 Extreme Poster (Next: 5000)
• Posts: 4641
• Rating: +717/-6
• Calc-u-lator, do doo doo do do do.
« on: December 21, 2012, 10:17:03 am »
About 4 days ago, I started working on this project. Unfortunately, I am not home yet, so I cannot upload it, but I'll edit this post on the 30th (hopefully). Anyways, I decided to make a program like CopyProg, except it works with groups. Naturally, some features were excluded (you cannot delete lines from grouped program, for example), but I think this is a pretty neat program, so far. Here are its features:
• One command lets you read the names and variable types of each variable in the group. It also returns the size of the data in theta (this is similar to the GetName command in CopyProg). If you try to read the zeroth var name, it will instead return how many variables are in the group.
• Another command will let you extract a variable (by name) and copy it to another variable in RAM (this is like the CopyProg command)
• Another command will let you read a line from a variable (like ReadLine)
• Another command will let you recall a picture from the group, using one of these methods: Overwrite, AND logic, OR logic, XOR logic.

As you might imagine, this program can be useful for RPGs, and this is what I am keeping in my thoughts as I plan more routines. As it is, I think it is basically finished (for a version 1). I now need to clean up my code a bit to remove unused stuff. Also, it is a little over 800 bytes at the moment, so hopefully I can optimise it down a bit :/ The largest pieces of code come purely from reading the group data.

Here is an outdated screenie:

As an example, if you want to copy prgmFOO from the group named BACKUP to the protected program named BAR:
Code: [Select]
"BACKUP:EFOO:FBAR→Str1Asm(prgmGRPREADI plan to modify this command to use Ans instead of Str1, by the way. And to recall Pic3 using XOR logic to the graph screen from the same group:
Code: [Select]
"RecallPic  xor BACKUP→Str12     ;2 corresponds to Pic3, 0 corresponds to Pic1Asm(prgmGRPREADI hope I get home on time (9 days from now) so I can upload the program :P
EDIT: I have now uploaded the program and documentation! Here is the readme:

by Zeda Elnara
================================================================
GrpRead is a program for BASIC programmers that want to work
with groups in some pretty cool ways. For example, say you have
an RPG that uses all 10 picture variables and it uses tons of
memory just for item names or monster names, or something like
that. If you group them (using the OS menu), GrpRead will let
you recall those pictures directly from the group and read lines
of code from programs in the group. These are just a few
examples of what GrpRead can do, so read on and I hope this
proves useful!
=============/
Installation/
===========/
===========/
How to Use/
=========/
Arguments are passed mostly through strings or numbers. It
will then return data or perform some function.
==========/
Functions/
========/
/=========================================================\
|GetName                                                  |
\=========================================================/
|  The group variable will have variables in it. If you   |
|want to figure out the names of the variables, their type|
|and their size, this is the command to use. This returns |
|info on the 'nth' variable in the group. It can also be  |
|used to figure out how many variables are in the group.  |
\=========================================================/
Inputs:
Str1 has the name of the group
Ans is the nth var name to return, or zero
Outputs:
Ans has the name of the variable (with a prefix byte)*
Theta has the size of the variable's data
*A prefix byte is used to specify the type of the
variable. This is either the " and " token or a letter.
See the text document named "Prefix Bytes.txt" for info.
Alternate:
If the input Ans was 0, this instead returns the number
of variables in the group. If the group doesn't exist,
0 is returned.
Errors:
"." is returned if the nth variable doesn't exist
Examples:
Check if group BACKUP exists and how many vars it has:
:"BACKUP->Str1
:0
Get the name/size/type of the first variable:
:"BACKUP->Str1
:1
/=========================================================\
|ExtractVar                                               |
\=========================================================/
|  This command allows you to extract a variable from the |
|group, copying it to some variable in RAM. This also     |
|allows you to rename the variable and it automatically   |
|overwrites a preexisting variable (unless you specify not|
|to overwrite). There are some pretty neat things you can |
|do with this, especially for games.                      |
\=========================================================/
Inputs:
Ans is a string containing the name of the group, the
name of the variable to extract, and possibly the new
name to extract to. The format:
"<groupname>:<varname>:<newname>"
The last argument is optional. If you put a "+" before
the new name, the var will not be ungrouped if it already
exists.
Outputs:
The variable is copied from the group to a var in RAM.
Errors:
0 is returned if the group does not exist.
Examples:
First, note that the prefix byte for a program is E and
the prefix for an appvar is U. Now, to extract prgmFOO
from group BACKUP:
:"BACKUP:EFOO
Now to extract prgmFOO to appvar BAR:
:"BACKUP:EFOO:UBAR
Now to extract it to appvar BAR without overwriting:
:"BACKUP:EFOO:+UBAR
To extract prgmFOO without overwriting it if it exists:
:"BACKUP:EFOO:+
Notes:
As you can see, you are able to extract to completely
since lists, real numbers, and matrices have a different
structure from the other variable types, you should not try
to extract them or extract to them (or you will lose RAM).
/=========================================================\
|RecallPic                                                |
\=========================================================/
|  This will let you recall pictures directly from the    |
|group. Not only that, but it gives you four different    |
|methods of recalling the picture instead of the 1 way    |
|that the OS provides.                                    |
\=========================================================/
Input (syntax 1):
Ans is a string with the format
"RecallPic <Pic#><logic><groupname>"
Input (syntax 2):
Ans is the picture number (0=Pic1, 1=Pic2,...,9=Pic0)
Str1 has the format:
"RecallPic <logic><groupname>"
(This is useful for maps and monsters and hacked pics)
Output:
The picture var is drawn and the screen is updated if the
picture variable exists.
Notes:
The logic tokens are as follows:
xor
and
or    (This is what the OS uses).
They can be found at [2nd][Math][Right]. If this argument
is omitted, the picture will simply overwrite the data on
the screen.
Examples:
Recall Pic1 from group BACKUP, overwriting the data on
the screen:
:"RecallPic Pic1BACKUP
Recall Pic3 from group RPG using XOR logic (syntax 2):
:"RecallPic  xor RPG->Str1
:2
/=========================================================\
\=========================================================/
|  This lets you read a line of code from a program in a  |
|group. Note that the line doesn't actually need to be    |
|code. You can store a bunch of names or words line by    |
|line in a program. Then, using this function, you can    |
|recall the data as a string in Ans. Enjoy!               |
\=========================================================/
Input:
Str1 is of the form "Line(<groupname>,<varname>"
Ans is the line number to read (or zero)
Output:
Ans is a string containing the name contents of the line.
If Input Ans was zero, this instead returns the number of
lines in the variable.
Errors:
".NO DATA" is returned if the line is empty.
Examples:
Read the fourth line of prgmRPGDATA from the group RPG:
:"Line(RPG,RPGDATA->Str1
:4
================================================================
Notes:
When I wrote this program, I was away from my computer,
internet (or electricity, for that matter) for several weeks. I
wrote the program using a combination of hex and a program named
ASMCOMP. It was basically like writing the program in hex the
normal way, but with the advantage of having labels and equates
and whatnot. Therefore, the source is in the form of a program
to be compiled by prgmASMCOMP.
================================================================
History:
7:37 PM 12/30/2012- Wrote the readme and prepared for initial
« Last Edit: December 30, 2012, 08:12:17 pm by Xeda112358 »

#### Yeong

• Not a bridge
• LV12 Extreme Poster (Next: 5000)
• Posts: 3739
• Rating: +278/-12
• Survivor of Apocalypse
« Reply #1 on: December 21, 2012, 02:00:50 pm »
Finally a program that I've been wanting for so long
Can't wait for it!
Sig wipe!

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55830
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
« Reply #2 on: December 22, 2012, 02:43:08 am »
Interesting, so basically it lets you ungroup stuff within BASIC programs so RPGs, for example, can be kept in as few files as possible?

One thing, though, if you have the ability to group files or add them to groups, make sure to check for archived stuff, because I once tried to group an archived program on an old OS (way back in Feb 2002) that sometimes displayed archived programs in the group menu when archive was on the verge of garbage collection, and the result was not pretty... (thankfully I had the receipt so I got a new calc in exchange)
« Last Edit: December 22, 2012, 02:43:33 am by DJ_O »
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

#### Xeda112358

• they/them
• Moderator
• LV12 Extreme Poster (Next: 5000)
• Posts: 4641
• Rating: +717/-6
• Calc-u-lator, do doo doo do do do.
« Reply #3 on: December 30, 2012, 08:12:41 pm »
Interesting, so basically it lets you ungroup stuff within BASIC programs so RPGs, for example, can be kept in as few files as possible?
Yes, precisely! I was also thinking of having a function to execute programs from a group. That would save you from having to manually copy it to RAM and execute it.
I also won't be adding the ability to group files, so I won't have to worry about causing that kind of a problem

#### NonstickAtom785

• LV3 Member (Next: 100)
• Posts: 47
• Rating: +4/-0
• Just live life. Cal-cu-lat-or style!
« Reply #4 on: February 21, 2020, 10:28:04 am »
Interesting, so basically it lets you ungroup stuff within BASIC programs so RPGs, for example, can be kept in as few files as possible?
Yes, precisely! I was also thinking of having a function to execute programs from a group. That would save you from having to manually copy it to RAM and execute it.
I also won't be adding the ability to group files, so I won't have to worry about causing that kind of a problem

You know... I would like to see you implement something like this. It would be neat to execute programs from a group file. I want to do some research about making a group Memory Management system. I think that would be cool. If I could list the things in the group then I could find a way to extract it and execute it.
Grammer2 is Good!

#### Xeda112358

• they/them
• Moderator
• LV12 Extreme Poster (Next: 5000)
• Posts: 4641
• Rating: +717/-6
• Calc-u-lator, do doo doo do do do.