qdiv neg,pos

rjo__rjo__ Posts: 2,087
edited 2015-12-29 - 21:31:38 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.
                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

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