[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
CIRCEXT
Implementation
The implementation of the circle extension is straightforward with one
exception. After standard housekeeping chores are completed (determining
size, saving data segment, clearing playground), it extracts the
radius argument. A for
loop over 2pi is used to plot
a circle using sin()
and cos()
to determine coordinates.
The pixel is plotted using the COORD
macro to convert cartesian
coordiantes into the index of the picture array.
What is tricky is that the floating point emulation library needs access
to the original data segment. Thus, before the sin()
and
cos()
calls are made, a asm mov ds, oldseg
is used to
restore the original datasegment, and a corresponding asm mov ds,
myseg
is used afterwards to return to the extension segment. This issue
is documented above in Data Segments.