An 8087 in the 5160

/ IBM 5160 and 3270 PC bring-up / updated 2026-10-27 ibm-5160 8087 fpu debug

The 5160 has an Intel D8087-2 in its coprocessor socket next to the V20. It initializes, and it loads pi and writes it to memory as the right 64-bit double. Both tests were a few bytes typed into DEBUG.

Switch 2 on SW1

The BIOS only knows the 8087 is there if SW1 switch 2 is off. I flipped it after seating the chip.

DEBUG can’t assemble 8087 instructions

DEBUG’s a command doesn’t know any 8087 mnemonics, so I entered the opcodes as db bytes, each with a 9B (FWAIT) in front.

First test, FINIT and then store the status word at 0200h:

db 9b,db,e3          ; FWAIT, FINIT
db 9b,dd,3e,00,02    ; FWAIT, FSTSW [0200]
int 20

0200h read back 00 00. That’s the status word after a reset: no exceptions, stack top 0.

Second test, load pi and store it as a double at 0200h:

db 9b,db,e3          ; FWAIT, FINIT
db 9b,d9,eb          ; FWAIT, FLDPI
db 9b,dd,1e,00,02    ; FWAIT, FSTP qword [0200]
int 20

0200h to 0207h read back:

18 2D 44 54 FB 21 09 40

That’s 400921FB54442D18 little-endian, which is pi as an IEEE-754 double.

Next