Author Topic: [Project] BASIC ReCode  (Read 14234 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: [Project] BASIC ReCode
« Reply #30 on: November 16, 2010, 09:48:15 pm »
Yes, exactly! I just decided to mention it just to document it. It saves on memory a little, so it will probably just be a trick used by people who are really into it. Otherwise, yes, it is kind of tough to grasp. Now that I am back from work, I can start working on some math functions... Yay?

@Nemo: Thanks, I have trouble looking for the right words, so that really helped.
...
"Parameter"

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: [Project] BASIC ReCode
« Reply #31 on: November 16, 2010, 09:51:21 pm »
no problem. where oh where would we be without math functions though? quigibo may be able to help you there.


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: [Project] BASIC ReCode
« Reply #32 on: November 16, 2010, 09:53:01 pm »
I actually have them planned out (I was working in classes on them :D), but I am sure I could use some help on more advanced functions... I have a 16-bit routine for each of the four main functions...

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: [Project] BASIC ReCode
« Reply #33 on: November 16, 2010, 11:04:35 pm »
It's been an hour, right? Okay, I was having a problem with adding the addition routinem but then I realised that I had forgotten a 7E (ld a,(hl)). Now To move on to Subtraction, then multiplication and division...

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: [Project] BASIC ReCode
« Reply #34 on: November 17, 2010, 04:15:58 am »
It has been 59 minutes and 59 seconds. A glitch caused your previous post time to be off by about 9 minutes and half. ;D

Joking aside, I wonder how many nested commands there can be? Like, could we do Line(1,1,1,Pause Text(33,10,"HI")) and it would work? That might get confusing, though. :P

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: [Project] BASIC ReCode
« Reply #35 on: November 17, 2010, 09:34:32 am »
Well, theoretically you could keep going, but yeah it gets very confusing. On another note, at the moment at least, commas are not needed and unless you use a Disp command, you don't need to jump down to the next line. However, you do need an unused variable to separate numbers. So, for example, you can separate everything using a space if you wanted to. Of course, that just gets confusing, so I wouldn't try it...

*Actually, you can only go until the stack is filled, so don't go more than a hundred (just to stay on the safe side-- some commands use the stack, too).

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: [Project] BASIC ReCode
« Reply #36 on: November 17, 2010, 10:27:04 am »
It has been 59 minutes and 59 seconds. A glitch caused your previous post time to be off by about 9 minutes and half. ;D

Joking aside, I wonder how many nested commands there can be? Like, could we do Line(1,1,1,Pause Text(33,10,"HI")) and it would work? That might get confusing, though. :P

So let me get this straight...
Line( sees the parameter list {1,1,1,33,10,"HI"} and just ignores everything past the fifth? and pause sees {33,10,"HI} and similarly ignores everything except the first?
Cool!  :D
« Last Edit: November 17, 2010, 11:23:49 am by lookitsan00b »
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: [Project] BASIC ReCode
« Reply #37 on: November 17, 2010, 11:51:07 am »
It's been an hour, right? Okay, I was having a problem with adding the addition routinem but then I realised that I had forgotten a 7E (ld a,(hl)). Now To move on to Subtraction, then multiplication and division...

Can it add in base N yet?
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: [Project] BASIC ReCode
« Reply #38 on: November 17, 2010, 01:26:24 pm »
Just got out of classes and a Math Club meeting...
Let's see...
The commands should be seen as functions. They either take an input and output a result or they just output a result. The result they output is always (at the moment, anyway) the last converted value. When I add things like getKey, the result will obviously be based on that. So for example, Line(T,A,B,X,Y will output Y as a result. Disp Y,X,<<String>> will output X as the result, since X is the last calculated result. So, when you use Disp Y,X in place of T for the Line( command, you are actually only using the X from the Disp command.

So to lookitsan00b, yes, you are right, if you think of it that way. It took me a bit to understand how you were saying it, but yes.

@Qwerty.55: I have not added any ability to work with number bases other than ten, but I do have 16-bit addition, subtraction, and multiplication ready. I just finished a 16 bit divide routine during Calc III, so now I have to add that in...

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: [Project] BASIC ReCode
« Reply #39 on: November 17, 2010, 02:59:18 pm »
Well, theoretically you could keep going, but yeah it gets very confusing. On another note, at the moment at least, commas are not needed and unless you use a Disp command, you don't need to jump down to the next line. However, you do need an unused variable to separate numbers. So, for example, you can separate everything using a space if you wanted to. Of course, that just gets confusing, so I wouldn't try it...

*Actually, you can only go until the stack is filled, so don't go more than a hundred (just to stay on the safe side-- some commands use the stack, too).
Ah ok cool. I personally may not use this very much, because I easily get confused at stuff, but I might still use it for some optimizations.

Btw will it be possible to squish data and be able to read it (from archive) using this? The major problem with BASIC is that data is rather large. In ASM, you can store a 12x8 tilemap with tiles from 0 to F in 48 bytes. In BASIC, in string format it's 96 and in list format, it's like 2-3 bytes per elements because of all the commas.

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: [Project] BASIC ReCode
« Reply #40 on: November 17, 2010, 03:06:13 pm »
Okay, I know have the four functions added for +, -, *, and /, but I have to go to class soon...
So pretty much:
-the result will never go above 65535
-Negative numbers have 65536 added to them (not really, but it is a BASIC version of the explanation) This means that -2 will result as 65534
-Division only returns the integer part of the quotient. Later I will add a way to get the remainder

I may have missed something...
Oh yeah, order of operations...
This is from the commands readme:
Code: [Select]
           |points. Order of operations is not used. functions
           |are evaluated from right to left. Here is an example
           |   3+2*6-3
           |   3+2*3
           |   3+6
           |   9

I hope that makes sense...

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: [Project] BASIC ReCode
« Reply #41 on: November 17, 2010, 03:12:36 pm »
Ah I see, so basically operations are evaluated in the complete opposite way than Axe?

Also could you answer my question in the previous post, about data?

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: [Project] BASIC ReCode
« Reply #42 on: November 17, 2010, 03:33:17 pm »
Just got out of classes and a Math Club meeting...
Let's see...
The commands should be seen as functions. They either take an input and output a result or they just output a result. The result they output is always (at the moment, anyway) the last converted value. When I add things like getKey, the result will obviously be based on that. So for example, Line(T,A,B,X,Y will output Y as a result. Disp Y,X,<<String>> will output X as the result, since X is the last calculated result. So, when you use Disp Y,X in place of T for the Line( command, you are actually only using the X from the Disp command.

So to lookitsan00b, yes, you are right, if you think of it that way. It took me a bit to understand how you were saying it, but yes.

@Qwerty.55: I have not added any ability to work with number bases other than ten, but I do have 16-bit addition, subtraction, and multiplication ready. I just finished a 16 bit divide routine during Calc III, so now I have to add that in...

That's not exactly what I was saying, but yes that answers my question.

I was thinking that when it sees the line
Code: [Select]
Line(1,1,1,Pause Text(33,10,"HI"))

It parses it to a list like this

Code: [Select]
Arguments:
{1,1,1,33,10,"HI"}

Commands:
Line at an index of 0
Pause 3
Text 3

Line would then grab the first five parameters starting at an index of 0,
Pause would grab the first parameter starting at an index of 3, and
Text would grab the first three parameters starting at an index of 3.

Now that I think about it, it seems a little idiotic, since it wouldn't allow for addition and subtraction in parameters...

But that's what I meant.  You're doing it so much better :P
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: [Project] BASIC ReCode
« Reply #43 on: November 17, 2010, 03:38:11 pm »
Xeda, is there any reason operations are evaluated right to left instead of left to right? unless it makes the code more optimized, i'd suggest left to right for readability, and it would also be similar to axe, which people are used to by now.
Also, if/when you add support to define data, what will the scope of the data be? for example, could i start the interpreter, define some data, use Stop, and then if i re-start the interpreter will my data still be there (assuming i haven't used the Asm() token to modify anything).


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: [Project] BASIC ReCode
« Reply #44 on: November 17, 2010, 06:08:58 pm »
Sorry, I just got out of class...
@nemo: It is easier, more optimized, and faster for the numbers to be calculated this way. Sorry about that...Well, actually, now that I think about it, I might be able to come up with a way to fix that. Okay, I will work on that and come up with a definite answer later...

@DJ Omni: Actually, once I get to making variables, it will be easier to use compressed data. If you check SpriteLib, I have a method to take a 128 byte "screen shot" of the homescreen which then gets compressed to 64 bytes (because only 16 tiles are used). Plus, I have a method to extract that data from archive. So yes, when I get to that point, I will definitely add the ability to compress data and access archived data because I already have the calls made.


I have a bunch of calls made from previous programs, but I am only implementing them as I need them so as not to take up too much memory. I have been making a bunch of new ones for this program and I still have a few more I need to make (like getting all the data I need when accessing a string argument...). So for now, I will be making a bunch of random calls and using them, but the commands are going to be more SpriteLib-like. Also, I need to make a way to implement variables... I tried a method that worked, but the variables were accessed using numbers. I think I am going to stick with using the letters like in BASIC...