Shop OBEX P1 Docs P2 Docs Learn Events
qdiv neg,pos — Parallax Forums

qdiv neg,pos

rjo__rjo__ Posts: 2,114
edited 2015-12-29 21:31 in Propeller 2
If I use qdiv to divide a negative number by a positive number, the upper two bits from getqx are being cleared.
?
Example: if I use 25 as my y coordinate and then rotate by 90 degrees ... fine. But if I use 100 and then divide the result by 4, rather than FF FF FF E7, I get 3F FF FF E7.
get_op         
                    
                mov yy,#25         
                mov xx,##0
                
		qfrac	##90,#360	'convert to degrees
		getqx	mytheta		'angle = ?
                wrlut  mytheta,#2
                setq yy
                qrotate	xx,mytheta
		getqx	new_x		'new_x = result x
               
		getqy	new_y		'new_y = result y
               ' qdiv  new_x,#4
              '  getqx	new_x    ' doesn't work 
	        wrlut new_x,#3
                wrlut new_y,#4
                call #point2screen
              
               
                 ret

to see this, substitute #100 for number #25 and uncomment the two lines qdiv and getqx
Sign In or Register to comment.