0 Members and 1 Guest are viewing this topic.
"BACKUP:EFOO:FBAR→Str1Asm(prgmGRPREAD
"RecallPic xor BACKUP→Str12 ;2 corresponds to Pic3, 0 corresponds to Pic1Asm(prgmGRPREAD
GRPREAD 985 bytesby Zeda Elnara================================================================ GrpRead is a program for BASIC programmers that want to workwith groups in some pretty cool ways. For example, say you havean RPG that uses all 10 picture variables and it uses tons ofmemory just for item names or monster names, or something likethat. If you group them (using the OS menu), GrpRead will letyou recall those pictures directly from the group and read linesof code from programs in the group. These are just a fewexamples of what GrpRead can do, so read on and I hope thisproves useful!=============/Installation/===========/ Send GRPREAD.8xp to your calculator. You can now use it.===========/How to Use/=========/ Arguments are passed mostly through strings or numbers. Itwill 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 :Asm(prgmGRPREAD Get the name/size/type of the first variable: :"BACKUP->Str1 :1 :Asm(prgmGRPREAD /=========================================================\ |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 :Asm(prgmGRPREAD Now to extract prgmFOO to appvar BAR: :"BACKUP:EFOO:UBAR :Asm(prgmGRPREAD Now to extract it to appvar BAR without overwriting: :"BACKUP:EFOO:+UBAR :Asm(prgmGRPREAD To extract prgmFOO without overwriting it if it exists: :"BACKUP:EFOO:+ :Asm(prgmGRPREAD Notes: As you can see, you are able to extract to completely different variable types. Use this to your advantage, but 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 :Asm(prgmGRPREAD Recall Pic3 from group RPG using XOR logic (syntax 2): :"RecallPic xor RPG->Str1 :2 :Asm(prgmGRPREAD /=========================================================\ |LineRead | \=========================================================/ | 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 :Asm(prgmGRPREAD================================================================Notes: When I wrote this program, I was away from my computer,internet (or electricity, for that matter) for several weeks. Iwrote the program using a combination of hex and a program namedASMCOMP. It was basically like writing the program in hex thenormal way, but with the advantage of having labels and equatesand whatnot. Therefore, the source is in the form of a programto be compiled by prgmASMCOMP. ================================================================History:7:37 PM 12/30/2012- Wrote the readme and prepared for initialrelease. GetName,ExtractVar,RecallPic,LineRead. 985 bytes
Interesting, so basically it lets you ungroup stuff within BASIC programs so RPGs, for example, can be kept in as few files as possible?
Quote from: DJ_O on December 22, 2012, 02:43:08 amInteresting, 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 Finally, I attached the download to the first post, as well as the readme/documentation so you can read about it