Category : Files from Magazines
Archive   : N7V11.ZIP
Filename : DOLINE.BAS

 
Output of file : DOLINE.BAS contained in archive : N7V11.ZIP
SUB DoLine (X1#, Y1#, X2#, Y2#) STATIC

IF ABS(X2# - X1#) < .01 THEN 'calc slope of line
My# = SGN(Y2# - Y1#) 'based on configuration
Mx# = 0 'of the end points
ELSE
M# = (Y2# - Y1#) / (X2# - X1#)
IF ABS(M#) > 1 THEN
My# = SGN(Y2# - Y1#)
Mx# = SGN(X2# - X1#) / ABS(M#)
ELSE
My# = M# * SGN(Y2# - Y1#)
Mx# = SGN(X2# - X1#)
END IF
END IF

DrawPixel:

IF POINT(X1#, Y1#) = 0 THEN PSET(X1#, Y1#) 'plot if black

X1# = X1# + Mx# 'increment current pixel on screen
Y1# = Y1# + My# ' whether or not a point was plotted
IF INT(X1#) = INT(X2#) AND INT(Y1#) = INT(Y2#) THEN _
EXIT SUB 'we reached the end of the line

GOTO DrawPixel 'attempt to draw the next pixel

END SUB


  3 Responses to “Category : Files from Magazines
Archive   : N7V11.ZIP
Filename : DOLINE.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/