Testing SW1 and SW2 via BASIC
Testing SW1 and SW2 via BASIC
If your 5150 board is getting to BASIC, you can use the following procedure to check out
the switch blocks AND the associated circuitry that selects and reads the switch blocks.
=================================================
IBM 5150 - TESTING SW1 AND SW2 BLOCKS VIA BASIC
=================================================
Failure indicates EITHER a faulty switch block OR the associated circuitry that selects/reads the switch blocks.
-----------------------------------
TEST 1 of 2 - switch block SW1
-----------------------------------
1. Boot to BASIC
2. Enter the following 3 lines of program:
10 OUT &H61,&HCC
20 PRINT INP(&H60)
30 OUT &H61,&H4C
Note: line 30 required to re-enable the keyboard (keyboard reading and SW1 can't be enabled at the same time).
3. Set all switches on SW1 to OFF.
4. Run the program. You should see "255" displayed.
5. Set all switches on SW1 to ON.
6. Run the program. You should see "0" displayed.
7. Set SW1 so that switch 1 is the only switch OFF.
8. Run the program. You should see "1" displayed.
9. Repeat steps 7 and 8 for each of the remaining 7 switches:
switch 2 is only one OFF - should see "2"
switch 3 is only one OFF - should see "4"
switch 4 is only one OFF - should see "8"
switch 5 is only one OFF - should see "16"
switch 6 is only one OFF - should see "32"
switch 7 is only one OFF - should see "64"
switch 8 is only one OFF - should see "128"
10. Set SW1 so that switches 1,3,5,7 are ON and switches 2,4,6,8 are OFF.
11. Run the program. You should see "170" displayed. [ 170 dec = 10101010 binary ]
12. Set SW1 so that switches 1,3,5,7 are OFF and switches 2,4,6,8 are ON.
13. Run the program. You should see "85" displayed. [ 55 dec = 01010101 binary ]
14. Set SW1 to normal setting.
15. Reboot computer.
-----------------------------------
TEST 2 of 2 - switch block SW2
-----------------------------------
INFO: Only the first 5 switches are connected. Not all 5 can be read at once - you can read the first 4 in one operation and the 5th in another.
1. Boot to BASIC
2. Enter the following 5 lines of program:
10 OUT &H61,&H4C
20 LOWER4% = INP(&H62) AND &H0F
30 OUT &H61,&H48
40 BIT5% = INP(&H62) AND &H01
50 PRINT LOWER4% " / " BIT5%
3. Set switches 1 to 5 on SW2 to OFF (don't care about other switches - they do nothing).
4. Run the program. You should see "15 / 1" displayed.
INFO: The first figure displayed is for switches 1 to 4 and the next figure is for switch 5
5. Set switches 1 to 5 on SW2 to ON.
6. Run the program. You should see "0 / 0" displayed.
7. Set SW1 so that switch 1 is OFF and switches 2 to 5 are ON (don't care about other switches).
8. Run the program. You should see "1 / 0" displayed.
9. Repeat steps 7 and 8 for each of the remaining 3 switches:
switch 2 is only one OFF - should see "2 / 0"
switch 3 is only one OFF - should see "4 / 0"
switch 4 is only one OFF - should see "8 / 0"
switch 5 is only one OFF - should see "0 / 1"
10. Set SW2 so that switches 1,3,5 are ON and switches 2 and 4 are OFF (don't care about other switches).
11. Run the program. You should see "10 / 0" displayed.
12. Set SW2 so that switches 1,3,5 are OFF and switches 2 and 4 are ON (don't care about other switches).
13. Run the program. You should see "5 / 1" displayed.
14. Set SW2 to normal setting.
15. Reboot computer.