Diagnostic Programs
BASIC Code Listings
TEST IO PORTS

2000 REM ==== TEST I/O PORTS ====
2002 DIM R(4)
2004 GOSUB 2070
2010 FOR I% = 256 TO 1023 STEP 8
2012 L% = 0
2014 FOR J% = 0 TO 7
2015 K% = INP(I% + J%)
2016 IF K% <> R(1) AND K% <> R(2) AND K% <> R(3) AND K% <> R(4) THEN L% = 1
2018 NEXT J%
2020 IF L% = 0 THEN 2028
2022 PRINT "Range "; HEX$(I%); " to "; HEX$(I% + 7); " used - ";
2024 GOSUB 2040
2028 NEXT I%
2030 END
2040 IF I% = 496 THEN PRINT "AT hard disk controller": GOTO 2060
2041 IF I% = 512 THEN PRINT "Game port": GOTO 2060
2042 IF I% = 632 THEN PRINT "Parallel port 2": GOTO 2060
2043 IF I% >= 688 AND I% < 736 THEN PRINT "EGA/VGA adapter (alternate)": GOTO 2060
2044 IF I% = 760 THEN PRINT "Serial port 2": GOTO 2060
2045 IF I% = 800 THEN PRINT "XT hard disk controller": GOTO 2060
2046 IF I% = 888 THEN PRINT "Parallel port 1": GOTO 2060
2047 IF I% = 896 OR I% = 928 THEN PRINT "Bisynchronous communications": GOTO 2060
2048 IF I% = 944 THEN PRINT "MDA adapter": GOTO 2060
2049 IF I% = 952 THEN PRINT "Parallel port": GOTO 2060
2050 IF I% >= 960 AND I% < 976 THEN PRINT "EGA or VGA adapter": GOTO 2060
2051 IF I% >= 976 AND I% < 992 THEN PRINT "CGA or VGA adapter": GOTO 2060
2052 IF I% = 1008 THEN PRINT "Diskette controller": GOTO 2060
2053 IF I% = 1016 THEN PRINT "Serial port 1": GOTO 2060
2059 PRINT "(unknown)"
2060 RETURN
2070 REM == test values returned from unused locations ==
2072 FOR I% = 0 TO 3
2073 R(I% + 1) = INP(&H120 + I%): REM assume ports 120-123 unused
2074 NEXT I%
2075 RETURN