Diagnostic Programs
BASIC Code Listings
CHECK SERIAL PORTS

3100 REM ==== ====
3105 REM ==== CHECK SERIAL PORTS ====
3120 DEF SEG = &H0: E1% = PEEK(&H411)
3130 N% = INT(E1% / 2) - INT(E1% / 16) * 8
3140 PRINT "Number of serial ports installed is:", N%: PRINT
3150 FOR I% = 0 TO 3
3152 PRINT "COM"; I% + 1; ": ";
3153 J% = (PEEK(&H400 + I% + I% + 1)) * 256 + PEEK(&H400 + I% + I%)
3154 IF J% = 0 THEN PRINT "not installed": GOTO 3188
3156 PRINT "installed - base address "; HEX$(J%); "h ";
3158 LC% = INP(J% + 3)
3160 IF INT(LC% / 128) - INT(LC% / 256) * 2 = 0 THEN LC% = LC% + 128
3162 OUT J% + 3, LC%
3164 B = INP(J%) + INP(J% + 1) * 256
3166 OUT J% + 3, LC% - 128
3168 PRINT INT(115200! / B); "baud, ";
3170 PRINT LC% - INT(LC% / 8) * 8 + 5; "- ";
3172 N% = INT(LC% / 8) - INT(LC% / 64) * 8
3174 IF N% = 1 THEN PRINT "O -"; : GOTO 3184
3176 IF N% = 3 THEN PRINT "E -"; : GOTO 3184
3178 IF N% = 5 THEN PRINT "S -"; : GOTO 3184
3180 IF N% = 7 THEN PRINT "M -"; : GOTO 3184
3182 PRINT "N -";
3184 PRINT INT(LC% / 4) - INT(LC% / 8) * 2 + 1
3188 NEXT I%