Author Topic: CopyProg  (Read 29079 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: CopyProg
« Reply #15 on: January 31, 2011, 08:01:48 pm »
Wait, how is that adult content...
* Xeda112358 wonders if she wants to know...

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: CopyProg
« Reply #16 on: January 31, 2011, 08:29:57 pm »
This looks excellent, Xeda!  Do you think you could add features to make it able to Delete the Variables it creates?  If you do, I'll use it instead of XCopy in Elmgon. ;D

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: CopyProg
« Reply #17 on: January 31, 2011, 08:52:35 pm »
Do you mean create temp vars? I can check... probably.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: CopyProg
« Reply #18 on: February 01, 2011, 01:33:55 am »
I don't think temp vars specifically, I think just the functionality to delete the variables would by nature allow programs to use them as temporary variables

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: CopyProg
« Reply #19 on: February 01, 2011, 02:07:27 am »
Ah, okay. Well, I was thinking I could make it so that using "[" as the prefix would make a twmp program and using "E" as the prefix would make a regular program. Then again, I could make it so that if "Delvar " was the prefix it would delete it... Okay! I think I will go with the "Delvar " prefix thing, does that sound good?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: CopyProg
« Reply #20 on: February 01, 2011, 02:18:01 am »
Sounds good to me :D

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: CopyProg
« Reply #21 on: February 01, 2011, 04:34:20 pm »
I almost like the DelVar idea - can it be a one byte token instead of a two byte one?  Something like - maybe? :D

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: CopyProg
« Reply #22 on: February 01, 2011, 05:32:12 pm »
ztrumpet is a mind reader. I was just going to look for this topic and I had just typed "copyprog" into the search thing when ztrumpet made a post. Nice. Anywho, I am glad he did because I was about to upload the version that used "Delvar " (well, actually, it could use any 'BB' token), but his way was a lot more practical. Also, I found a problem when Str1 is archived, so I fixed that. The total cost was 20 bytes, but it is definitely worth it (143 bytes). So here is how it works:

CopyProg is still compatible with the previous syntax. However, if you add a "-" (the minus sign, not the negative sign) to the beginning, you delete the var. In this case, Str1 is not needed. The name of the var to be deleted is in Ans. So for example, to delete prgmTEMP, "E" is a prefix for a program:
Code: [Select]
:"-ETEMP
:Asm(prgmCOPYPROG

Also note that there is no need to delete the variable if you want to reuse it for temporary storage. For example:
Code: [Select]
:"5PROG1→Str1
:"[T
:Asm(prgmCOPYPROG        ;appvar PROG1 is copied to prgmT
:prgmT
:"5PROG2→Str1
:"[T
:Asm(prgmCOPYPROG        ;appvar PROG2 is copied to prgmT
:prgmT
:"-[T
:Asm(prgmCOPYPROG        ;deletes prgmT

EDIT: I noticed I accidentally typed that "E" is a suffix instead of prefix :D

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: CopyProg
« Reply #23 on: February 01, 2011, 08:33:57 pm »
Is 'E' the prefix for programs, or '['?  What are the other prefixes?

Looks great.  Nice job! ;D

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: CopyProg
« Reply #24 on: February 01, 2011, 08:36:48 pm »
The other prefixes are in the readme. And "E" and "[" are both program prefixes. It was just that for strings, I had → as the prefix, but that isn't normally doable in BASIC, so I use "D" for strings. There are actually 8 prefixes for each type, but the letters are easier to use.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: CopyProg
« Reply #25 on: February 01, 2011, 08:43:12 pm »
Ah, how'd you get 8?  Do you modulus it by 16 or something?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: CopyProg
« Reply #26 on: February 01, 2011, 08:44:50 pm »
Oh, "F" happens to be 46h and "[" is 06h... I do and 1Fh, so that leaves the upper 3 bits to be anything. 2^3=8

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: CopyProg
« Reply #27 on: February 01, 2011, 08:58:10 pm »
Ah, clever.  Gotta love bit masking. ;D  Nice! :D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: CopyProg
« Reply #28 on: February 02, 2011, 05:12:45 pm »
Wait, how is that adult content...
* Xeda112358 wonders if she wants to know...
http://en.wikipedia.org/wiki/Lolicon :P

Also I like the features in this :D, I'm glad to see more ASM libs for BASIC programmers.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: CopyProg
« Reply #29 on: February 02, 2011, 05:24:02 pm »
Oh, that's what that is...
Anywho, pretty much all of the programs I make are intended for BASIC programmers. I have:
ASMHex-Lets you execute a string of hex code (instead of using sub programs)
BASIC Sprite- A small program to display a sprite. Uses a hex string and some vars for coordinates
DataString-Converts a list to a string or the other way around
DataType-Changes the type of variables (helpful if you have lots of sub programs or you want to hide vars)
HexToken-Converts a string of hex to its tokens
ListToReal-Copies list elements to real vars
MultiGraphs-Gives the user 16 additional graph screens to manipulate (using no user RAM)
MultiPics-Manipulate any of 256 pic vars using 6 functions
TokenHex-Converts tokens to their hex
Xtra-Makes hacked vars

I have a few other ones, but they aren't as easy to use.