This is an old version from the tos.hyp. The new is on GitHub!

HomeLine-AGet pixelHorizontal line

6.8 Arbitrary line

Name: ğArbitrary lineĞ
Line-A number: $A003
Syntax: See 'Bindings for draw_line'
Description: This Line-A function draws a straight line from top left to bottom right. The following Line-A variables are used:
Variable Meaning
x1 X-coordinate of the first end-point
y1 Y-coordinate of the first end-point
x2 X-coordinate of the second end-point
y2 Y-coordinate of the second end-point
fg_bp_1 Bit value of the first plane for the colour that should be used for filling
fg_bp_2 Bit value of the second plane (only low or medium resolution)
fg_bp_3 Bit value of the third plane (only low resolution)
fg_bp_4 Bit value of the fourth plane (only low resolution)
ln_mask Bit pattern for the line type; the bit pattern is to be interpreted as a dot pattern
wrt_mode Writing mode; the following modes are possible:
REPLACE 0 Replace
TRANS 1 Transparent (OR)
XOR 2 Inverse (XOR)
INVERS 3 Inverse Transparent (XOR with not(LN_MASK))
lstlin Is the last pixel of the line to be drawn (1) or not (0)

Note: Independent of the order of the coordinates, the line is drawn always from top left to bottom right.

For a horizontal line there is a faster function $A004 Horizontal line available.

The bindings of TC passes the line mask, writing mode and colour not to the draw_line function, but uses separate functions set_fg_bp, set_ln_mask and set_wrt_mode for setting the parameters in the Line-A parameter block.
Return value: The function does not return a result. The field ln_mask of the Line-A parameter block is shifted by the output algorithm.
Availability: All TOS versions.
See also: Binding   LINEA   Horizontal line

6.8.1 Bindings for draw_line

Pure-C: void draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2);
movem.l   D0-D2/A0-A2,-(A7)  ; Save registers
move.l    pParamblk,A0       ; Pointer parameter block LINEA
move.w    x1,(38,A0)         ; First X-coordinate in LINEA.x1
move.w    y1,(40,A0)         ; First Y-coordinate in LINEA.y1
move.w    x2,(42,A0)         ; Second X-coordinate in LINEA.x2
move.w    y2,(44,A0)         ; Second Y-coordinate in LINEA.y2
move.w    colbit0,(24,A0)    ; Bit for first plane in LINEA.fg_bp_1
move.w    colbit1,(26,A0)    ; Bit for first plane in LINEA.fg_bp_2
move.w    colbit2,(28,A0)    ; Bit for first plane in LINEA.fg_bp_3
move.w    colbit3,(30,A0)    ; Bit for first plane in LINEA.fg_bp_4
move.w    lnmask,(34,A0)     ; Line style in LINEA.ln_mask
move.w    wmode,(36,A0)      ; Writing mode in LINEA.wrt_mode
move.w    lstlin,(32,A0)     ; Line style in LINEA.lstlin
dc.w      $A003              ; Line-A opcode
movem.l   (A7)+,D0-D2/A0-A2  ; Restore registers

HomeLine-AGet pixelHorizontal line