Author Topic: Axe Q&A  (Read 601010 times)

0 Members and 2 Guests are viewing this topic.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #570 on: August 05, 2011, 08:50:16 pm »
Ashbad, I am not stating that I think the .999 representation is better. I am stating that it is what Axe uses, regardless of which representation any of us thinks is better or worse. Your constants will not be parsed correctly if you use the .255 representation.
« Last Edit: August 05, 2011, 08:52:10 pm by Runer112 »

Ashbad

  • Guest
Re: Axe Q&A
« Reply #571 on: August 05, 2011, 09:04:29 pm »
Yeah, that's true.  But I think the new floating point notation thing is bad simply because how it treats it as a 1000 unit case.  I personally would suggest a different, more accurate notation that conforms to a more realistic approach, since it'll say close numbers like 255.998 and 255.999 are the same; this will throw less advanced users off more so than the concept of a 256 base-unit system.
« Last Edit: August 05, 2011, 09:04:59 pm by Ashbad »

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Axe Q&A
« Reply #572 on: August 05, 2011, 09:24:08 pm »
Well, then you lose the speed advantage present in 8.8 fixed point notation.

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #573 on: August 05, 2011, 09:25:47 pm »
How about EFF.FF ?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Q&A
« Reply #574 on: August 05, 2011, 09:30:28 pm »
You don't use a point if you want to do it like that, Frey. And I'm not sure if the lower nibble is signed or unsigned, but I'm pretty sure the upper nibble is. Otherwise, yeah, you can do it like that.
t0xic: what speed? The decimal->hexadecimal FP conversion is done at compile-time.
Edit: 1984th post.
« Last Edit: August 05, 2011, 09:35:59 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Ashbad

  • Guest
Re: Axe Q&A
« Reply #575 on: August 05, 2011, 09:41:26 pm »
Well, then you lose the speed advantage present in 8.8 fixed point notation.

What are you even talking about?  This is still 8.8 notation we're talking about here, just a different, more suitable form of representation :P

How about EFF.FF ?

Decent pitch idea, I'd go with that for now; though I would still prefer that the decimal notation was changed to represent 256 pieces, instead of 1000, since I find the 1000 fpart base-units rather useless since all it does is unnessicarily sugarcoat the fpart number as a thousandth, rather than a 28th piece.  All it will do in hindsight is confuse less advanced programmers into thinking axe decimal comparisons are broken, since 255.999 should not equal 255.998 in any sane situation.

Edit: yo, calcdude, watch out for big brother.
« Last Edit: August 05, 2011, 09:44:04 pm by Ashbad »

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #576 on: August 05, 2011, 09:49:26 pm »
There is no reason for ᴇFF.FF, since that is exactly the same as ᴇFFFF. And I prefer the .999 notation for fixed point numbers. The point of the XXX.XXX support was to make fixed-point numbers easier to add as decimals for programmers more used to TI-BASIC. If you want to specify an exact fractional part, you should probably be working in hexadecimal anyways since that's more like how the number is actually stored.
« Last Edit: August 05, 2011, 09:52:50 pm by Runer112 »

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #577 on: August 05, 2011, 09:52:16 pm »
Topic change:
What does /0 return and what does //0 return?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Ashbad

  • Guest
Re: Axe Q&A
« Reply #578 on: August 05, 2011, 09:59:16 pm »
perhaps they should be packed differently as BCD or (better yet) u_int8%100.u_int8%100 numbers, so that way stupid rounding errors that make different decimals actually equal don't happen.  XX.XX notation with a 00.00 to 99.99 range would work much, much better, as it would conform to human senses better without providing a false security of a higher containing capacity of a number set than what actually exists.  If this form was truly added to make working with numbers easier, then it's got to lose some efficiency in return to make it work in a way that makes actual sense.  Considering a more realistic FP notation, human ease of use and sense of applied-workingness is worth much more than a petty dozen cycles and a handful of bytes added to routines.

Edit: programmers used to TI-BASIC not only expect a working decimal system (I totally agree with you on that), but they also expect 255.999 and 255.998 not to be equal. In a decimal sense, it makes zero sense, so you have constantly think in both a hexadecimal AND decimal perspective at the same time, which is a lot more confusing than just learning what hexidecimal and a 256 base-units system is (in fact, they'll get it a LOT faster this way).

Edit2: or even better, eliminate the XXX.XXX system, and make a similar XX.XX system where each of the 100 base-units is equal to .390625 256 base-unit units, which would mean ever one of those 10,000 would fit within the range; therefore, no round-off errors would happen, and no one gets confused.
« Last Edit: August 05, 2011, 10:06:44 pm by Ashbad »

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #579 on: August 06, 2011, 07:44:02 pm »
Umm, can I ask a question?

So, I'm trying to make a list of values, much of a Pascal triangle row. I'm expecting something similar to {1 5 10 10 5 1} like in TI-BASIC, or something that is workable with to get individual byte's value later on. I'm getting 34540 whenever I run the program.

EXC returns a factorial of a number. Each value in a pascal triangle row is found out by finding n!/(k!(n-k)!) where n is the nth row, in this case 5. k is from 1 to 5. First value in that row is 5, not 1. Because k cannot be 0, I declare L1 by starting with 1.

Code: [Select]
.PASCAL
ClrHome
sub(PAS,5)
Disp L1>Dec
Return

Lbl PAS
1->{L1}
1->C
For(J,1,r1
r1-J->B
sub(EXC,r1
A->C
sub(EXC,J
C/A->C
sub(EXC,B
C/A->C
C->{L1+J}
End
Return

Lbl EXC
1->A
For(I,1,r1
A*I->A
End
Return

EDIT: I just looked at Axe Q&A first page, and the first post says GDB cannot be modified. So I've modified the code above to see whether I can use free RAM, but I still get a number instead a range of numbers.
« Last Edit: August 06, 2011, 07:51:35 pm by selectcoaxial »

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #580 on: August 06, 2011, 09:33:25 pm »
Axe can display strings, characters, tokens, numbers, and hexadecimal numbers, but not a list of numbers. To display a list of numbers, you'd have to loop through them and display them one by one. The reason you're seeing 34540 is because L₁ is a pointer to an area of free memory, and 34540 happens to be the decimal value of the pointer. Try calling the following modified version of PAS, it should display the values as it calculates them.

Code: [Select]
Lbl PAS
ClrHome
For(J,0,r1
r1-J->B
sub(EXC,r1
A->C
sub(EXC,J
C/A->C
sub(EXC,B
C/A->C
C->{L1+J}
Disp C>Dec,i
.Imaginary ^
End
Return
« Last Edit: August 06, 2011, 09:34:16 pm by Runer112 »

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #581 on: August 10, 2011, 07:36:39 am »
Thank you Runner. Trace's working now. Is there a routine or axe's way to display and prompt user input at the same time like Prompt in BASIC? This is currently what I'm working on. like, how can I make the cursor blinks at the same time as user input and I'm finding out a way to delete number like in Prompt in BASIC.

Also, if you have the APP Finance that comes with the calculator, the screen has a list of variables and user can scroll up and down to input number. Can Axe do this?

Code: [Select]
Lbl 001
getKey->K

If K=15
.QUIT
Return
./QUIT
End

If K=33:N*10+0->NEnd
If K=34:N*10+1->NEnd
If K=26:N*10+2->NEnd
If K=18:N*10+3->NEnd
If K=35:N*10+4->NEnd
If K=27:N*10+5->NEnd
If K=19:N*10+6->NEnd
If K=36:N*10+7->NEnd
If K=28:N*10+8->NEnd
If K=20:N*10+9->NEnd
If N<10
Output(1,1,N>Dec)
Else
Return
End
Goto 001

EDIT: Just wondering, what is main buffer and back buffer?
« Last Edit: August 10, 2011, 09:29:14 am by selectcoaxial »

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Q&A
« Reply #582 on: August 10, 2011, 09:36:59 am »
Hey, selectcoaxial, let me teach you about a cool feature Axe has called inData(). It's basically like BASIC's instring()...We can use it to search for K in a list of key values, then add its position in the list -1 to N*10; if K=34, the inData piece will return 2 for example then minus 1. Here's the modified code

Code: (with indata) [Select]
Lbl 001
getKey->K

ReturnIf K=15

If K            //if K is not 0
N*10+inData(K,Data(33,34,26,18,35,27,19,36,28,20,0))-1->N   
End

If N<10
Output(1,1,N>Dec)
Else
Return
End
Goto 001

Also, to answer your other question, the main buffer is in L6, and it displays regular black/white gfx. The back buffer is in L3, and isnt displayed unless you use a variant of DispGraph^r, in which case it will display grayscale
« Last Edit: August 10, 2011, 09:37:48 am by squidgetx »

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #583 on: August 11, 2011, 04:27:31 am »
That's fantastic! Thanks Squidgetx!

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #584 on: August 12, 2011, 07:04:25 pm »
This is probably very stupid to ask, but I find myself learning Axe very slowly. I read through the document and I read tutorials on Axe. But when I read codes from open source Axe programs, I have to spend a really long time to figure out what it does, most of the time, I can't figure out either. So I'd like to ask how you learned Axe at the beginning and how did you progress to this stage?