270 '

280'Subroutine to draw a line from Xl,Yl to X2,Y2.

290

300

XL = X2 - Xl

: YL = Y2 - Yl

310

Nx = ABS(XL"LXFAC) : NY = ABS(YL$cLYFAC)

320

IF NX < NY THEN NX = NY

330

NS% = INT(NX+l)

 

340

DX = XL/NS%

: DY = YL/NS%

354)FOR 1% = 1 TO NS%

 

364)xl = Xl + DX

: Yl = Yl + DY

370

GOSUB 400

 

384)NEXT 1%

 

390

RETURN

 

400

410'Subroutine to plot a point at Xl,Yl.

424)

430 XX = Xl * LXFAC : YY = Yl ;:LYFAC- 440 COL% = INT(XX) + 1

454)ROW% = INT(YY/b)

460 XIT% = IST(YY - ROIJZ-'6)- + 1

470BIT?(COL%,ROW%) = BIT?'(COLP,ROWZ)OR ?lASK%(XITZ)

480RETURN

600

61g Subroutine to plot a circle.

620

634)KAD = 9

644)Xl = 19: Yl = 10

650 FOR ANG? = 0 TO 360 STEP 10

660 RANG = ANGb"6.28/360

670 x2 = RAD"COS(RANG)i-10 : Y2 = RAD"SIN(RANG)+ 0 680 GOSUB 270

699)NEXT ANG%

700 RETURN

If you are using with the IBM mode, change the following lines to the program given above.

160 LPRINT CHR$(27) "A" CHR$(6) CHR$(27) "2" 250 LPRINT CHR$(27) "A" CHR$(12) CHR$(27) "2"

H How the program works

In the program above, we’ve created an array called BIT%, which is dimensioned in line 50. You’ll note that instead of using numeric constants to dimension the array, we used the variables MAXCOL% and MAXROW%. This way, if your computer has enough memory and you want to plot a larger image. all

-

-

-

-

-

112

Page 120
Image 120
Star Micronics SB-15 user manual If NX NY then NX = NY