Commodore‎ > ‎BASIC‎ > ‎Keywords‎ > ‎

RDOT

Keyword Abbreviation Token (hex) Version(s) Classification
RDOT R{Shift+D} D0 3.5, 7.0 Function
HEADER H{Shift+E} D0 4.x Command and Statement

  Syntax  
RDOT dotAttribute )
 
Parameters Type Legal Value(s) Default Value Note(s)
dotAttribute Integer
  1. xOrdinate
  2. yOrdinate
  3. colorSource
returned from the pixel cursor
 
Returns Type Value(s) Note(s)
xOrdinate Integer
-32768 to 32767
yOrdinate Integer -32768 to 32767  
colorSource Integer
0 to 1 (high-resolution)
0 to 3 (multi-color)
 
 
  Purpose  
Return information about the pixel cursor.

 
  Remarks  
The pixel cursor is an internal BASIC variable which basically "remembers" the last physical pixel plotted on the screen.  It is used as default value in many of the bitmap graphic commands.  Use RDOT if you would like to retrieve the x and y ordinates of the pixel cursor.  Because the value returned by RDOT refers to a physical pixel, SCALE does not apply.  In contrast, use LOCATE to assign the pixel cursor (it does apply SCALE when active).
 
Passing RDOT a dotAttribute of 2 will retrieve the colorSource of the pixel located at the pixel cursor.  If the pixel cursor is off-screen, the return value will be zero.  Even if the coordinate is on-screen, know that the colorSource refers to only a bit pattern stored in bitmap memory.  The actual color seen on screen will depend on the actual colors assigned to the colorSource in the cell where the pixel cursor is located.  If you have not changed any colors (with the COLOR command) since you cleared the bitmap (you did clear it before you started, right?) then you can use the RCLR function to look-up the video-chip color that has been assigned to the colorSource.  In other words, chip_color_at_pixel_cursor = RCLR(RDOT(2)).  Remember this is unreliable if you changed colors after clearing the bitmap.  If you have changed colors, then the only reliable way to get the displayed color of the pixel is to PEEK the color memory -- but this video chip and mode specific.
 
A floating-point dotAttribute will be converted to an integer (see INT).  You will get TYPE MISMATCH ERROR with a string dotAttribute.
  
Examples:
SCALE 1: LOCATE 512,512: PRINT RDOT(1)
 100                   : REM this would be 512 if it were scaled!
 
READY.
SCALE 0: LOCATE 75,100
 
READY.
PRINT RDOT(0); RDOT(1)
 75  100

READY.
PRINT RDOT(2)
 
?NO GRAPHICS AREA ERROR 
READY.
GRAPHIC 2,1
 
READY.
PRINT RDOT(2)
 0                     the pixel is set to the Background color

PRINT RCLR(RDOT(2))
 12                    color of the pixel (may be wrong after COLOR changes)

READY.
Those are pretty trivial examples as you can probably guess what the value of RDOT would be.  Much more interesting is using RDOT as follow-up to a complex graphic command like a rotated BOX, or a CIRCLE that has been mutated to create an arc or polygon.  Might even be interesting as a follow-up to a simple DRAW command if you used a polar coordinate!
 
  Compare With  
 
  Contrast With  
 
  See Also  

© H2Obsession, 2014
Comments