2 INTEGER SECT,ADDR,POSIT(20),ERAS(10),RCMAX,RRMAX,RLFCR 3 INTEGER LEADIN,CLOCK,ROWPOS,COLPOS,RBFLEN,CHKSUM 4 INTEGER J,ANSI,A,I,OFFSET,DELAY 10 STRING B$(30),TNAME$(8),KY$(50) 20 INTEGER X,Y 50 FOR I=1 TO 30: PRINT : NEXT I 60 FOR I=1 TO 20 62 POSIT(I)=0 64 NEXT I 70 FOR I=1 TO 10 72 ERAS(I)=0 74 NEXT I 90 PRINT 100 PRINT "PRIMER MTBASIC Configuration" 103 PRINT "The default answers are characteristics of the ADM-3A. You may" 104 PRINT "enter numbers in decimal, or in hex by prefixing the number with" 105 PRINT "a '$'." 110 PRINT 130 PRINT "Enter your computer's clock frequency in Mhz" 140 PRINT " (e.g., 2) "; 150 INPUT CLOCK 160 IF CLOCK < 1 OR CLOCK > 10 THEN GOTO 130 165 PRINT 170 PRINT "Enter Ascii value for your terminal's lead-in character" 180 PRINT "The lead in is almost always 27 decimal. "; 190 INPUT LEADIN 200 IF LEADIN < 0 OR LEADIN > 127 THEN GOTO 170 210 POKE ( CFGADD + 18),LEADIN 255 PRINT 260 PRINT "Enter the string to send to your terminal to erase the CRT." 270 PRINT "This string must be entered as a sequence of integers separated" 280 PRINT "by carriage returns. The last number must be a -1. For an" 290 PRINT "ADM-3A, enter": PRINT 26: PRINT - 1 295 PRINT : PRINT "Enter string:" 300 FOR I=1 TO 6 310 INPUT ERAS(I) 320 IF ERAS(I) = -1 THEN GOTO 322 321 NEXT I 322 FOR I=1 TO 6 324 POKE ( CFGADD + I - 1 + 19),ERAS(I) 326 NEXT I 331 PRINT : PRINT " If your terminal uses an Ascii cursor positioning sequence" 332 PRINT "(i.e., it needs two numeric Ascii characters for both the row" 333 PRINT "and column positions), then enter a 1. Otherwise, as in the case" 334 PRINT "of the ADM-3A, enter a 0." 335 PRINT "Enter a 0 or 1: "; 336 INPUT ANSI 337 IF ANSI > 1 OR ANSI < 0 THEN GOTO 331 338 POKE ( CFGADD + 37),ANSI 339 PRINT 340 PRINT "Enter the string to send to your terminal to position the" 350 PRINT "cursor. This string, as before, must be entered as a sequence" 360 PRINT "of integers separated by carriage returns, the last entry being a -1." 370 PRINT "Typically, several characters are sent followed by the row and" 380 PRINT "column address. For example, the ADM-3A requires 27,61,row,column." 390 PRINT "Enter a zero where the row and where the column would go. In this" 400 PRINT "example, enter": PRINT 27: PRINT 61: PRINT 0: PRINT 0: PRINT - 1 402 PRINT "If your terminal needs Ascii Cursor position commands, be sure" 403 PRINT "to leave two zeroes for both the row and column." 405 PRINT : PRINT "Enter string:" 410 FOR I=1 TO 10 420 INPUT POSIT(I) 430 IF POSIT(I) = -1 THEN GOTO 442 440 NEXT I 442 FOR I=1 TO 10 444 POKE ( CFGADD + I - 1 + 25),POSIT(I) 445 NEXT I 459 PRINT 460 PRINT "Enter the position of the row address in the cursor positioning" 470 PRINT "string you just entered. The row position is where in the string" 480 PRINT "MTBASIC should stick row characters. If your terminal uses an Ascii" 481 PRINT "cursor position sequence, you left two zeroes in the cursor string" 482 PRINT "(above), so enter the position of the first of the two zeroes." 485 PRINT "In the example from above, the" 490 PRINT "row address was the third character (27,61,row,column), so a 3" 500 PRINT "would be entered. "; 510 INPUT ROWPOS 512 IF ROWPOS < 0 OR ROWPOS > 10 THEN GOTO 459 514 ROWPOS=ROWPOS - 1 516 POKE ( CFGADD + 38),ROWPOS 520 PRINT 530 PRINT "Now enter the position of the column address. In the example" 540 PRINT "we've been using, that would be a 4. "; 550 INPUT COLPOS 560 IF COLPOS < 0 OR COLPOS > 10 THEN GOTO 520 570 COLPOS=COLPOS - 1 573 POKE ( CFGADD + 39),COLPOS 575 PRINT 580 PRINT "Enter the offset to add to the row and column" 590 PRINT "positions. In the ADM-3A, a 32 would be entered. "; 600 INPUT OFFSET 610 IF OFFSET < 0 OR OFFSET > 127 THEN GOTO 575 612 POKE ( CFGADD + 40),OFFSET 620 PRINT 630 PRINT "Enter the delay in milliseconds required after positioning" 640 PRINT "the cursor (0 to 255). "; 650 INPUT DELAY 660 IF DELAY < 0 OR DELAY > 255 THEN GOTO 620 670 DELAY=DELAY * 1.2 * 2 / CLOCK 675 POKE ( CFGADD + 41),DELAY 680 PRINT "Enter the number of columns that the terminal displays." 690 PRINT "In the ADM-3A an 80 would be entered." 700 INPUT RCMAX 710 IF RCMAX < 1 OR RCMAX > 128 THEN GOTO 680 715 POKE ( CFGADD + 42),RCMAX 720 PRINT "Enter the number of rows that the terminal displays." 730 PRINT "In the ADM-3A a 12 or 24 would be entered." 740 INPUT RRMAX 750 IF RRMAX < 1 OR RRMAX > 80 THEN GOTO 710 755 POKE ( CFGADD + 43),RRMAX 760 PRINT "If your terminal doesn't automatically add a linefeed " 780 PRINT "character after a carriage return, enter 0. For the " 790 PRINT "ADM-3A, enter 1" 800 INPUT RLFCR 810 IF RLFCR < 0 OR RLFCR > 1 THEN GOTO 760 815 POKE ( CFGADD + 44),RLFCR 816 POKE ( CFGADD + 45),0: ' THIS IS INCLUDED IN CHKSUM 920 PRINT "Enter 8 characters to identify the terminal" 925 TNAME$="........" 930 INPUT TNAME$ 950 FOR I=0 TO 7 960 POKE ( CFGADD + 10 + I),PEEK(ADR(TNAME$) + 1 + I) 970 NEXT I 2200 ' 2210 ' DEFINE THE EDIT KEYS 2220 ' 2221 PRINT 2222 PRINT " DEFINING EDIT KEYS:": PRINT 2223 PRINT " It is best to only use control characters as edit keys." 2224 PRINT " Do not use control-S or control-C." 2225 PRINT 2230 B$="Press the key to be used for" 2240 DATA " right cursor movement"," left cursor movement" 2241 DATA " toggling between insert and typeover" 2242 DATA " deleting a character to the right of the cursor " 2250 DATA " deleting a character to the left of the cursor " 2252 DATA " moving the cursor to the end of the line" 2254 DATA " moving the cursor to the beginning of the line" 2256 DATA " the return or enter key " 2260 FOR I=0 TO 7 2270 READ KY$ 2280 PRINT B$;KY$ 2290 POKE ( CFGADD + 2 + I),GET 2300 NEXT I 2400 ' CALCULATE AND STORE CHECKSUM SO MTBASIC KNOWS 2500 ' THAT THERE ARE PARAMETERS IN RAM 2505 CHKSUM=0 2510 FOR I=2 TO 45 2520 CHKSUM=CHKSUM + PEEK( CFGADD + I) 2530 NEXT I 2540 WPOKE ( CFGADD ), - CHKSUM