Jump to content

Photo

IntyBASIC compiler v1.2.9: The good things are now better!

Intellivision IntyBASIC

384 replies to this topic

#376 artrag ONLINE  

artrag

    Stargunner

  • 1,061 posts

Posted Thu Aug 9, 2018 4:20 PM

Using the fixed point math I've spotted this

 

 

data -0.7071,0.7071
                                SRCFILE "testbasic.bas",48
DECLE -46336
asm\testbasic.asm:1864: ERROR - expression exceeds available field width
asm\testbasic.asm:1864: ERROR - expression exceeds available field width
 
I do not get errors by Intybasic but the assembler reports an "out of range error"....
Is there any mean to overcame this errors?


#377 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 11,038 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Thu Aug 9, 2018 4:24 PM

Using the fixed point math I've spotted this
 
 
data -0.7071,0.7071
                                SRCFILE "testbasic.bas",48
DECLE -46336
asm\testbasic.asm:1864: ERROR - expression exceeds available field width
asm\testbasic.asm:1864: ERROR - expression exceeds available field width
 
I do not get errors by Intybasic but the assembler reports an "out of range error"....
Is there any mean to overcame this errors?


AND with $FFFF ?

The assembler uses 32-bit values internally, but renders 16-bit values when assembling.

#378 intvnut OFFLINE  

intvnut

    River Patroller

  • 3,053 posts
  • Location:@R6 (top of stack)

Posted Thu Aug 9, 2018 5:48 PM

 

Using the fixed point math I've spotted this

 

 

data -0.7071,0.7071
                                SRCFILE "testbasic.bas",48
DECLE -46336
asm\testbasic.asm:1864: ERROR - expression exceeds available field width
asm\testbasic.asm:1864: ERROR - expression exceeds available field width
 
I do not get errors by Intybasic but the assembler reports an "out of range error"....
Is there any mean to overcame this errors?

 

 

 

AND with $FFFF ?

The assembler uses 32-bit values internally, but renders 16-bit values when assembling.

 

 

I don't think -46336 is a meaningful number here.  Masking with $FFFF (even if you could) is the wrong thing to do.

 

AS1600 allows the range -32768 to 65536, which encompases the entire signed and unsigned 16-bit ranges.  -46336 is outside both of those ranges.

 

As a fixed point number in Q8 notation, 0.707 is $00B5, and in the rotated Q8, would be $B500.   -0.707 would be $FF4B, and in rotated Q8, $4BFF.

 

-46336 is $FFFF4B00, which is the wrong value, since the negation is being applied to the rotated value.

 

Negation should be applied before rotation, resulting oin $4BFF.  (Or if it's 1s complement, $4AFF.  I forget, is the rotated Q8 in 1s complement?)



#379 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 11,038 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Fri Aug 10, 2018 3:31 AM

 

 

 

 

I don't think -46336 is a meaningful number here.  Masking with $FFFF (even if you could) is the wrong thing to do.

 

AS1600 allows the range -32768 to 65536, which encompases the entire signed and unsigned 16-bit ranges.  -46336 is outside both of those ranges.

 

As a fixed point number in Q8 notation, 0.707 is $00B5, and in the rotated Q8, would be $B500.   -0.707 would be $FF4B, and in rotated Q8, $4BFF.

 

-46336 is $FFFF4B00, which is the wrong value, since the negation is being applied to the rotated value.

 

Negation should be applied before rotation, resulting oin $4BFF.  (Or if it's 1s complement, $4AFF.  I forget, is the rotated Q8 in 1s complement?)

 

Yeah, I didn't even think of what the value was.  I just thought that perhaps that the values generated by IntyBASIC were correct but too large.  That's what I get for responding quickly without paying to much attention.  DOH! :dunce:

 

If IntyBASIC is mangling the fraction values by negating after rotation then that needs to be fixed, obviously.

 

   -dZ.



#380 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 11,038 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Fri Aug 10, 2018 3:37 AM

 

Using the fixed point math I've spotted this

 

 

data -0.7071,0.7071
                                SRCFILE "testbasic.bas",48
DECLE -46336
asm\testbasic.asm:1864: ERROR - expression exceeds available field width
asm\testbasic.asm:1864: ERROR - expression exceeds available field width
 
I do not get errors by Intybasic but the assembler reports an "out of range error"....
Is there any mean to overcame this errors?

 

 

artrag:  One possible work-around is to use the correct 16-bit values given by intvnut above in hexadecimal to avoid the broken encoding.

 

A quick test with the IntyBASIC SDK shows that "0.707" is encoded as "46336," which is $B500, so Q8 rotated.  So try with $4BFF (or $4AFF if 1's complement).

 

  -dZ.



#381 artrag ONLINE  

artrag

    Stargunner

  • 1,061 posts

Posted Fri Aug 10, 2018 4:19 AM

Do not worry, I was already generating the correct data.

I was referring any parameter of intybasic or of as1600 to change behavior that leads to the error, but it is definitely an Intybasic bug connected to fixed point constants



#382 artrag ONLINE  

artrag

    Stargunner

  • 1,061 posts

Posted Fri Aug 10, 2018 4:35 AM

Oscar: fixed point math seems quite buggy

This line of code 

 

#ex(0) = -1.0+.#ex(0)

 

does not work!

 

While this other

 

#ex(0) = #ex(0)-.1.0

 

works as expected


Edited by artrag, Fri Aug 10, 2018 4:35 AM.


#383 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 11,038 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Fri Aug 10, 2018 4:45 AM

Oscar: fixed point math seems quite buggy

This line of code 

 

#ex(0) = -1.0+.#ex(0)

 

does not work!

 

While this other

 

#ex(0) = #ex(0)-.1.0

 

works as expected

 

Could you provide some sample values?  The first one seems to work (although I removed the "." in front of the ex(0) expression, since I thought it was a typo).

 

Sample:

#ex = 2.0
#ex = -1.0 + #ex
PRINT <>#ex

Prints "1".

#ex = 0.0
#ex = -1.0 + #ex
PRINT <>#ex

Prints "65535" (or -1 unsigned)

 

   -dZ.


Edited by DZ-Jay, Fri Aug 10, 2018 4:53 AM.


#384 artrag ONLINE  

artrag

    Stargunner

  • 1,061 posts

Posted Fri Aug 10, 2018 5:04 AM

no, the '.' is for fixed point math

 

  #A=#A+.#B         Fixed addition (note use of 16-bits variables)
  #A=#A-.#B         Fixed substraction (note use of 16-bits variables)

Edited by artrag, Fri Aug 10, 2018 5:04 AM.


#385 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 11,038 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Fri Aug 10, 2018 5:13 AM

 

no, the '.' is for fixed point math

 

  #A=#A+.#B         Fixed addition (note use of 16-bits variables)
  #A=#A-.#B         Fixed substraction (note use of 16-bits variables)

 

 

Sorry, you are right, I saw that as soon as I sent the message.  And you are also right that it does not work correctly.

 

Sample:

#ex = 2.0
#ex = -1.0 +.#ex
PRINT <>#ex

Prints "2".

 

   -dZ.







Also tagged with one or more of these keywords: Intellivision, IntyBASIC

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users