EasyManua.ls Logo

Atari ST series - Page 148

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CHAPTER 7
nextx:
addq.w #2,point * skip even columns
move.w #49,d4 * draw 50 dots vertically
move.w d4,point+2 * starting at y of 51
nexty:
addq.w #2,point+2 * skip even rows
dc.w PutPixel * draw a point
dbra d4,nexty * if the column's not done, do next
dbra d3,nextx * if the row's not done, do next
*** wait for key press, then end
move.w #l,-(sp) * call conin() to wait for key press
trap #1
addq.l #2,sp
move.l #0,-(sp) * GEHOOS terminate command
trap #1 * call GEMDOS and exit
*** Data for input is stored here
.data
color: dc.w 1 * use color register 1 (black)
.bss
point: ds.w 2 * storage for x,y coordinates
.end
The inverse operation of Put Pixel is Get Pixel ($A002).
Given a set of x,y coordinates, Get Pixel finds the color regis
ter used to display the dot located at that point. As with Put
Pixel, the x and y coordinates are placed in an array of 16-bit
words and a pointer to that array is placed in the PTSIN vari
able. Upon return from the Get Pixel call, the color register
used for the specified pixel is returned in register DO.
The next step in complexity from drawing points is
drawing straight lines. The main routine for drawing lines is
called Arbitrary Line ($A003), because it can be used to draw
a straight line between any two points. This function re
quires a lot more input than Put Pixel. The variables used
(and their offsets from the base address of the table) are
shown below:
COLBITO = $18 * bit value (0 or 1) for color plane 0
COLBIT1
= $1A * bit value (0 or 1) for color plane 1
COLBIT2
= $1C
* bit value (0 or 1) for color plane 2
COLBIT3
= $1E * bit value (0 or 1) for color plane 3
LSTLIN = $20 * draw last pixel of the line?
* (0 = yes, 1 = no)
LNMASK = $22 * line pattern mask
WMODE = $24 * writing mode (0 = replace,
* 1 = transparent, 2 = XOR, 3 = reverse
* transparent)
XI
= $26
* starting x coordinate
140

Related product manuals