# SD_POINT/IOG_DOT etc

These traps draw lines and curves in a window using a graphical system of Cartesian coordinates defined by three values, X, Y and S. The point X,Y in graphical coordinates is the bottom left corner of the window and S is the height of the window. The default values are 0, 0 and 100 which set the graphical origin at the bottom left of the window and the graphical point (0,100) at the top left of the window.

Trap | Value of D0.B | Action |
---|---|---|

SD_POINT/IOG_DOT | $30 | Draw a point |

SD_LINE/IOG_LINE | $31 | Draw a line |

SD_ARC/IOG_ARC | $32 | Draw an arc |

SD_ELIPS/IOG_ELIP | $33 | Draw an ellipse |

SD_SCALE/IOG_SCAL | $34 | Set the graphics scale |

SD_GCUR/IOG_SGCR | $36 | Position the cursor |

Call Parameters | Return Parameters | ||
---|---|---|---|

D0.B | See above | D0.L | Corrupted? |

D1.L | D1.L | Corrupted. | |

D3.W | Timeout | D3.L | Preserved. |

A0.L | Channel ID | A0.L | Preserved. |

A1.L | Arithmetic stack pointer | A1.L | Corrupted. |

## Errors

ERR_NC | Not complete. |

ERR_NO | Channel not open. |

## Notes

- All registers not shown above are not used on entry and are preserved on exit.
- A1.L points to a stack. Note that this is an absolute address and not relative to A6. At entry to each trap this stack must contain various floating point parameters as detailed below. Also there must be at least 240 bytes available on the stack.
- Parameters which are angles must be in radians.
- The Trap SD_GCUR/IOG_SGCR sets the cursor in the window at a position relative to a point in graphical coordinates. The parameters required are those of the graphical point (X,Y) and the offset from that in pixels. This allows text to be added to graphical figures.

## Stack Parameters

Trap | Address | Item |
---|---|---|

SD_POINT/IOG_DOT | $00(A1) | Y-coordinate |

$06(A1) | X-coordinate | |

SD_LINE/IOG_LINE | $00(A1) | Y-coord of line finish |

$06(A1) | X-coord of line finish | |

$0C(A1) | Y-coord of line start | |

$12(A1) | X-coord of line start | |

SD_AEC/IOG_ARC | $00(A1) | angle subtended by arc |

$06(A1) | Y-coord of line finish | |

$0C(A1) | X-coord of line finish | |

$12(A1) | Y-coord of line start | |

$18(A1) | X-coord of line start | |

SD_ELIPS/IOG_ELIP | $00(A1) | Rotation angle |

$06(A1) | Radius of ellipse | |

$0C(A1) | Eccentricity of ellipse | |

$12(A1) | Y-coord of center | |

$18(A1) | X-coord of center | |

SD_SCALE/IOG_SCAL | $00(A1) | Y-coord of bottom of window |

$06(A1) | X-coord of left of window | |

$0C(A1) | Height of window | |

SD_GCUR/IOG_SGCR | $00(A1) | X-coordinate |

$06(A1) | Y-coordinate | |

$0C(A1) | Pixel offset to right | |

$12(A1) | Pixel offset down |

## Example

The example below shows how to draw an ellipse. It is assumed that the graphical scale has the default values, that A0 contains the channel ID and that A1 points to a large enough area (relative to A6).

ellipse lea arith,a3 ; Point to maths code movea.w ri_execb,a2 ; Prepare to do the operations jsr (a2) ; Put the parameters on the stack moveq #sd_elips,d0 ; $33 moveq #-1,d3 ; Timeout trap #4 ; Arrange for A6 to be added to A1 trap #3 ; Draw the ellipse tst.l d0 ; OK? . . bne error ; . . no! ; Arithmetic operations ; Note that the extended set of codes in SMSQE are used here arith dc.b qa_n,50 ; X-coord of centre = 50 dc.b qa_n,48 ; Y-coord of centre = 48 dc.b qa_one ; Put 1 on stack . . dc.b qa_halve ; . . Set eccentricity = 1/2 dc.b qa_n,25 ; Radius = 25 dc.b qa_k,qa_pi2 ; Rotation angle = pi/2