Home

IBM 5160  -  Test of SW1 via BASIC


SW1 is the only switch block on an IBM 5160 motherboard. It contains 8 switches.

There are rare times when you might want to see if the switches are being read correctly.
Example: An EGA works in your 5160, but a known working MDA card does not initialise. Maybe switch 5 or 6 is at fault.

Unlike in the IBM 5150, switches 3 and 4 selectively enable/disable the 4 banks of motherboard RAM. Because of that, the 5160 is somewhat intolerant of switches 3 or 4 being changed whilst the 5160 is running. The tests below compensates for that. More information on this subject is here.

There are two tests. You only need to do the second test if you need to check switches 3 and 4.

Failure of either test below indicates either a faulty switch or failure of the associated circuitry that selects/reads the switch.

The tests are not applicable to SW1 on the IBM 5150 - SW1 is wired up differently on a 5150 motherboard.


--------------------------------------------------------------------------------------------------------------------------------------------------
TEST 1 OF 2
--------------------------------------------------------------------------------------------------------------------------------------------------

Scope :  Tests switches 1,2,5,6,7,8 fully, and partially tests switches 3 and 4
RAM required :  At least 1 bank of motherboard RAM
Note :  Once the 5160 has been powered on, no step will result in either switch 3 or 4 being changed.

1. If the 5160 is turned on, then turn it off.

2. Take a note of what the 8 switches on SW1 are presently set to.

3. On SW1, turn ON switches 3 and 4.

4. If A: drive contains a boot floppy, remove it, and if your 5160 has a hard drive, disconnect it.
    Those actions will result in the 5160 booting to cassette BASIC.

5. Power on the 5160, and watch it boot to BASIC. If you earlier disconnected a hard drive, then at some point you will be prompted to press the F1 key.

6. Enter the following 5 lines of program:

   10 out &h61,&h40
   20 lower4 = inp(&h62) and &h0f
   30 out &h61,&h48
   40 upper4 = inp(&h62) and &h0f
   50 print 16 * upper4 + lower4

7. Set all switches on SW1 to ON.
8. Run the program (enter RUN). You should see "0" displayed.

9. Set SW1 as follows: 1=ON, 2=OFF, 3=ON, 4=ON, 5=OFF, 6=ON, 7=OFF, 8=ON
10. Run the program. You should see "82" displayed.                            [ 82 decimal = 01010010 binary ]

11. Set SW1 as follows: 1=OFF, 2=ON, 3=ON, 4=ON, 5=ON, 6=OFF, 7=ON, 8=OFF
12. Run the program. You should see "161" displayed.                            [ 161 decimal = 10100001 binary ]

13. Power off the 5160.
14. Set the 8 switches on SW1 back to the settings that you noted in step 2.

15. If at step 4, you disconnected a hard drive, then reconnect it.


--------------------------------------------------------------------------------------------------------------------------------------------------
TEST 2 OF 2  -  Switches 3 and 4
--------------------------------------------------------------------------------------------------------------------------------------------------

Scope :  Tests switches 3 and 4
RAM required :  At least 1 bank of motherboard RAM
Note :  The program entered is different to the one in the first test.

1. If the 5160 is turned on, then turn it off.

2. Take a note of what switches 3 and 4 on SW1 are presently set to.

3. On SW1, set switches 3 and 4 as follows: 3=ON, 4=ON

4. If A: drive contains a boot floppy, remove it, and if your 5160 has a hard drive, disconnect it.
    Those actions will result in the 5160 booting to cassette BASIC.

5. Power on the 5160, and watch it boot to BASIC. If you earlier disconnected a hard drive, then at some point you will be prompted to press the F1 key.

6. Enter the following 2 lines of program:

   out &h61,&h40
   print str$(inp(&h62) and &h0c)

7. After the second line is entered, you should have seen "0" displayed.

8. Power off the 5160.

9. On SW1, set switches 3 and 4 as follows: 3=OFF, 4=ON
10. Power on the 5160, and watch it boot to BASIC.
11. Enter the program shown at step 6. As a result, you should have seen "4" displayed.
12. Power off the 5160.

13. On SW1, set switches 3 and 4 as follows: 3=ON, 4=OFF
14. Power on the 5160, and watch it boot to BASIC.
15. Enter the program shown at step 6. As a result, you should have seen "8" displayed.
16. Power off the 5160.

17. On SW1, set switches 3 and 4 as follows: 3=OFF, 4=OFF
18. Power on the 5160, and watch it boot to BASIC.
19. Enter the program shown at step 6. As a result, you should have seen "12" displayed.
20. Power off the 5160.

21. Set switches 3 and 4 on SW1 back to the settings that you noted in step 2.

22. If at step 4, you disconnected a hard drive, then reconnect it.