Author Topic: Bug Reports  (Read 404906 times)

0 Members and 2 Guests are viewing this topic.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Bug Reports
« Reply #1800 on: December 25, 2012, 10:34:58 pm »
133794m3r,

In Axe, the ONLY data type there is is the 16 bit (and sometimes 8 bit) integer. Why? It's the hardware. The biggest register is 16 bits...so yeah. There are different ways of reading this number (signed, unsigned, char, etc.) but it is still only a number. Fixed point notation is just that- notation. It is a different way of representing a 16 bit integer. As such, all the limitations that come with dividing and multiplying integers still exist.

Let's take a look at the example 1.0/*10.0. Runer explained it up above, but I'll attempt to explain a little differently since you didn't seem to get it the first time.

First, understand that that all that the decimal point does, is convert the value from fixed point notation to an integer. Remember fixed point notation means this: high byte is the integer portion, low byte is a fraction of 256. So, 0.5 in fixed point will become 128 (because 128/256 = 0.5). Similarly, 1.0's integer representation is just 256. 10.0's is 2560.

Anyway, the fixed point division returns 1/10, which is actually the integer 25. Why? Because 1/10 of 256 is 25.6, but that's a no no because everything is still integers really, so you just get 25. Then it goes on to **10.0 which just takes your 25 and fixedpoint multiplies by 2560. Which is the same thing as regular multiplying by 10, which is why you get 250.

So basically, what you have to keep in mind when doing math in Axe are two things: one, divisions will always truncate the decimal part. That's just the way it is, you can ask around and explore the ins and outs of writing an integer division routine. Using fixed point can lessen the impact of this  phenomenon, but it won't eliminate it, especially as you work with smaller and smaller numbers (like 1/10). Second, all Axe operations move left to right. The only order of operations cue there is are parentheses. That might be why you were having trouble with 2/10*65535; Axe saw 2/10, which is 0, and then multiplied 0 by 65535, which is still 0.

Depending on your numbers, you should (mostly) be able to play around with the way you write your statements to achieve a respectable degree of accuracy. Typically you want to try to get as large a number as you can before performing a division. For example, you can get 1.0/*10.0**10.0 to return 256 if you do 1.0**10.0/*10.0. Unfortunately, you have to be careful not to get a number larger than 65535, otherwise everything will break. So, 2/10*65535 becomes a little trickier. But you can still do it; while 2*65535/10 is not going to help us (because 2*65535 goes over 65535), 2*32767/5+1 gives you 13107. You can play around with the numerator and denominator a bit to try to get optimal results. This is the down and dirty truth of Axe and z80 asm in general. If you want something more accurate and/or larger range than 65535 (or -128 to 128 with x256 accuracy), get ready to write some really complicated routines.
« Last Edit: December 25, 2012, 10:50:07 pm by squidgetx »

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Bug Reports
« Reply #1801 on: December 25, 2012, 10:56:33 pm »
Okay, let's tackle this one bit at a time, and hopefully we can fully settle everything:



OK, it _has_ to be a bug then. I'm using Axe 1.2.1 and changing the values to "1.0, and 10.0" makes the number the _same_ 250, which means that, according to you, there's a rounding error(for some reason).

I can assure you that fixed point math worksas intended. Any "bugs" you experience with fixed point math, like this rounding error, are simply due to the nature of doing math with numbers squashed into only 16 bits. Stepping through the calculation, 1.0/*10.0 would ideally give 0.1, but because fixed point numbers in Axe hold fractional information as 256ths, this (25.6/256) actually results in 25/256. Multiplying this by 10.0 then gives 250/256, giving you the result you see of 250.



Also the thing that got me into this whole crazy thing in the first place was some "big"(at least I think it is) numbers not working right in Axe.

This is related to the issue above. Doing math with 16-bit numbers can have some fairly tight range limitations, unfortunately: 0 to 65535 for unsigned integers, -32768 to 32767 for signed integers, and -128 to 127.996 for (signed) fixed point numbers.



It was (2/10)*65535. I was expecting a whole number 13,107.  But, it never turns into that value... ever. I doubt Axe would be able to do it right now since you're saying it's all 256ths and 65535 256ths wouldn't be the 65535 value(a maximum for the total range in the range encoder I was working), just isn't working at all. I tried the fixed point math, it doesn't work either, nothing seems to work.

The value I get is 65485(which is almost 1.0*65535), and it well should've been 0.2(51/256ths clearly close enough), but somehow that gets converted into nearly 1.0 which makes no sense to me(at the moment) but I imagine it's something with the parser.

The calculation (2/10)*65535 can't really work in Axe, once again due to 16-bit number limitations. In the notation you gave, treating the numbers as integers, we have a precision problem: 2/10 will give 0, which multiplied by 65535 is still 0. Change the notation to fixed point like (2.0/*10.0)**65535.0, and now we have a range problem: 65535.0 is well beyond the range of Axe's fixed points. Try to mix the two like (2.0/*10.0)*65535, which I believe is what you did, and we have a sort of number identity problem: 2.0/*10.0 would result in 51/256, as you said. But then multiplying by 65535 gives 3342285/256, which does not fit into 16 bits. So all the data that overflowed past 16 bits is lost, and we're left with the 16-bit result 65485/256, giving you your result.



Edit: Basically, I wanted to do a simple rouguelike with psuedo-procedural generated content. But I wanted a way to compress the premade "rooms" and other data, in range encoding(seemed like a perfect first program... at least has always worked just fine for all of my other language excursions). Well to be honest, I normally do LZW, as the first one, but axe it looked to be requiring way too much work. But now I don't even know if range encoding will even work, because that's the _only_ spot I have to use non integers, and of course the one spot where I need some sort of non-whole number math, it doesn't work... Basically even if I don't do "real numers" it says it's 0. Even though (2/10)*65535 should be that 13,107. This is _only_ spot I needed non integer math, and of course it's not going to work.

Well... I guess there's two spots, the part where I calculate the share of the range, and then once again when I'm running over the data... but either way I had always used 65535(or some similar "big") number as I don't need super-duper precision. I just needed a way to do fixed point during that part. Then a single operation during the second part too. I was planning on just storing the counts(x bits) one after another and then recalculating the whole range later on. But anyway yeah, 3 decimal points _should_ be way more than enough.(with the whole range I'm using I just need for the values at the end to add up to the whole thing), and then of course make sure that the ranges work right(for the final two byte range value).

I might suggest first making the engine without any data compression. It might be good to get a bit of a feel for the language doing some lighter tasks first, anyways. But when you do get around to compression, I do agree that length encoding may not be an effective approach due to the strengths of weaknesses of Axe. Your alternate idea of LZW may be more reasonable, or a simpler algorithm like LZ77 would be even more so.



As for the few pieces of your post which you may have noticed I did not feel like specifically quoting and responding to: I am currently the sole developer and maintainer of the Axe project, and I feel that in this role I have a responsibility to assist others with its use on an individual level, which I hope this post has been able to do. Being the one solely responsible for its proper functioning, I have to say that your insistence on features of it simply not working and lack of consideration for the possibilities of language limitations or misunderstandings doesn't really help either of us. So for remedying any future issues, rather than simply telling me that it doesn't work, I would appreciate your asking why things seem problematic and how I/we can help you come to a solution. :)
« Last Edit: December 25, 2012, 10:58:08 pm by Runer112 »

Offline tincopper2

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Corrupted backups and deleted program source
« Reply #1802 on: January 09, 2013, 02:32:20 pm »
I have been working on a fun rpg game with an advanced movement system for two months, when I tried compiling it passed the first run then it stopped the second run with a battery low error, it deleted my source and corrupted my backup!

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Bug Reports
« Reply #1803 on: January 09, 2013, 10:46:15 pm »
That sounds more like an issue of you running your calc on low batteries. The low battery msg is built into the OS, and it's no surprise that if it interrupts you while you are compiling something in Axe it would cause major issues. In the future:
1.) Always try to keep a backup on PC
2.) Keep fresh batteries.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Bug Reports
« Reply #1804 on: January 10, 2013, 06:38:48 am »
this morning I was compilating a programme
when I get

UNKNOW ERROR
99% compilating at second pass
 ???

-I try to see my source but it doesn't respond to any keys except [alpha] and [seconde] (the icon at right top corner was visible)
-some weird stuff with screen : blacks rects appear and dissapear quickly.

So I pull over batteries, have a clear RAM.
Then I check the memory (to see if anything was corrupt), and I see the axe appv in RAM :crazy:
size 16280 octets !!!!!!!!!!
I deleted it and then I have an other clear RAM
now everything is ok.


CALC STATE :
-Ti-84+
-hardware rev B
-OS 2.43

AXE STATE :
-ion compilating
-alpha on
-safety off
-ver 1.2.1a

I saddely lost the source but maybe I can rewrite it.
« Last Edit: January 10, 2013, 06:39:53 am by TheMachine02 »
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Bug Reports
« Reply #1805 on: January 10, 2013, 12:11:32 pm »
Yeah, I got that several times too o_O

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Bug Reports
« Reply #1806 on: January 11, 2013, 12:10:00 pm »
I succed to reapet this error 6 or 7 time on an emu.  O.O

It's look like it's a problem with a low memory situation. (RAM=10000 octets, ROM=12000 o and compiling a 5000 o prog)

And when it start to compile and there will be this error,  press ON during the comp will throw the error.  :o

This really a strange bug....

AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Bug Reports
« Reply #1807 on: January 11, 2013, 12:52:38 pm »
For me, I only got the "Unknown Error" and RAM clear, never backup corruption.

And as a side note : "octet" is "byte" in English ;D

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Bug Reports
« Reply #1808 on: January 23, 2013, 02:37:36 pm »
Bump,

It seems that compilation as App is completely broken with Axe 1.2.1a ... I can't even compile an empty program as an app, it always says "UNKNOWN ERROR" and then send me at the end of the source.

Error code :
Code: [Select]
009DB900B3AB3FB4
B3ABB3AB55D48AA7
1F00000040018478
8B8068CB

EDIT : I re-sent Axe 1.2.1a to my calc (exactly the same version) and compilation as app worked ???
« Last Edit: January 23, 2013, 02:56:08 pm by Matrefeytontias »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Bug Reports
« Reply #1809 on: January 25, 2013, 01:02:57 pm »
it's seem there is a problem with >TOK command. It's disp very strange thing (and not only tokens)
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Bug Reports
« Reply #1810 on: January 25, 2013, 01:05:55 pm »
Just checking, you know that it displays the token pointed to, right?

http://axe.eeems.ca/Commands.html#textCommands
« Last Edit: January 25, 2013, 01:06:18 pm by Runer112 »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Bug Reports
« Reply #1811 on: January 25, 2013, 01:10:02 pm »
we can't use with Disp EXP▶Tok ??

EDIT : sorry, I was confuse by the command list. With disp it says Disp EXP>Tok whereas with text it says Text PTR>Tok
« Last Edit: January 25, 2013, 01:13:57 pm by TheMachine02 »
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Bug Reports
« Reply #1812 on: January 25, 2013, 01:13:29 pm »
In what scenario are you trying to display this token? Usually tokens are displayed as part of a program or OS string, in which case you should have a pointer to the token. There isn't really much reason to be displaying a constant token, which I think should be the only time when you wouldn't have a pointer to it.

(If you're wondering why the command is like this, it's because there is a B_CALL to easily draw a token pointed to, but not one to draw a token itself.)
« Last Edit: January 25, 2013, 01:15:02 pm by Runer112 »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Bug Reports
« Reply #1813 on: January 25, 2013, 01:18:49 pm »
I was trying to have a list of values-tokens-chars ;D
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Bug Reports
« Reply #1814 on: January 25, 2013, 01:23:27 pm »
Oh, well in that case you should still be able to display the token fairly simply. Instead of using the variable itself, use the pointer of the variable holding the value, perhaps like:

Disp °T►Tok


And just to clarify, this behavior of ►Tok is not a bug, it does exactly what Commands.html says it should. :P
« Last Edit: January 25, 2013, 01:25:24 pm by Runer112 »