SCREEN 0 CLS 'Demo program for communication from a BS2 to QBASIC COM.Port = 1 'Find COM port BASE-Address DEF SEG = &H40 COM.Port = COM.Port - 1 Low$ = CHR$(PEEK(COM.Port * 2 + 1)) High$ = CHR$(PEEK(COM.Port * 2 + 0)) BaseAddress = CVI(High$ + Low$) DEF SEG OPEN "com1:4800,n,8,1,CS,TB6" FOR RANDOM AS #1 'Turn DTR line ON to "Dissable" the Stamp DTR = 1 OUT BaseAddress + 4, (INP(BaseAddress + 4) AND 254) + DTR SLEEP (1) 'Turn DTR line OFF to "Enable" the Stamp DTR = 0 OUT BaseAddress + 4, (INP(BaseAddress + 4) AND 254) + DTR Xhome = 229 Yhome = 98 Laser = 1 X = Xhome Y = Yhome CLS LOCATE 10, 1 PRINT "Use Arrow keys to single step laser pointer." PRINT "Hold Alt key while pressing Arrow keys to pan laser pointer." PRINT PRINT "Home - Upper Left" PRINT "End - Lower Right" PRINT PRINT "+ - Laser ON" PRINT "- - Laser OFF" PRINT "Left Shift - Blink ON" PRINT "Right Shift - Blink OFF" WHILE 1 IF Sw3 = 1 THEN Blink = Blink + 1 IF Blink > 25 THEN Blink = 0 Lblink = 1 - Lblink END IF ELSE Lblink = 1 END IF Msg$ = "LPO" + CHR$(X) + CHR$(Y) + CHR$(Laser * Lblink) PRINT #1, Msg$; X$ = INKEY$ Z = INP(&H60) LOCATE 1, 1 PRINT X, Y, " " IF Sw2 = 1 THEN Sw1 = 0 IF Z = 42 THEN Sw3 = 1 END IF IF Z = 54 THEN Sw3 = 0 END IF IF Z = 78 THEN Laser = 1 END IF IF Z = 74 THEN Laser = 0 END IF IF Z = 71 THEN X = Xhome Y = Yhome END IF IF Z = 79 THEN X = 20 Y = 157 END IF IF Z = 72 AND Sw1 = 0 THEN Sw1 = 1 Y = Y - 1 IF Y < 0 THEN Y = 0 END IF IF Z = 80 AND Sw1 = 0 THEN Sw1 = 1 Y = Y + 1 IF Y > 255 THEN Y = 255 END IF IF Z = 77 AND Sw1 = 0 THEN Sw1 = 1 X = X - 1 IF X < 0 THEN X = 0 END IF IF Z = 75 AND Sw1 = 0 THEN Sw1 = 1 X = X + 1 IF X > 255 THEN X = 255 END IF IF Z = 56 THEN Sw2 = 1 END IF IF Z = 184 THEN Sw2 = 0 END IF IF Z > 128 THEN Sw1 = 0 END IF WEND