• Please review our updated Terms and Rules here

Strange BIOS code

vladstamate

Experienced Member
Joined
Dec 2, 2012
Messages
197
Location
Orlando, FL, USA
So I working on my emulator trying to get it working with the 5170 BIOS ( and I am stumped at this point):


Code:
;-----	VERIFY SPEED/REFRESH CLOCK RATES   ( ERROR = 1 LONG AND 1 SHORT BEEP )
	XOR	BL,BL	; CLEAR REFRESH CYCLE REPEAT COUNT
	XOR	CX,CX	; INITIALIZE SPEED RATE REGISTER
	EVEN		; PLACE ON EVEN WORD BOUNDARY
C34:
	IN	AL,PORT_B	; READ REFRESH BIT REGISTER
	TEST	AL,REFRFSH_BIT	; MASK FOR BIT
	LOOPZ	C34	; DECREMENT LOOP COUNTER TILL ON
C35:
	IN	AL,PORT_B	; READ REFRESH BIT REGISTER
	TEST	AL,REFRFESH_BIT	; MASK FOR BIT
	LOOPNZ	C35	; DECREMENT LOOP COUNTER TILL OFF

	DEC	BL	; DECREMENT REFRESH CYCLE REPEAT COUNT
	JNZ	C34	; REPEAT TILL CYCLE COUNT DONE

	CMP	CX,RATE_UPPER	; CHECK FOR RATE BELOW UPPER LIMIT
	JAE	C36	; SKIP ERROR BEEP IF BELOW MAXIMUM
C36E:
	MOV	DX,0101H	; GET BEEP COUNTS FOR REFRESH ERROR
	CALL	ERR_BEEP	; CALL TO POST ERROR BEEP ROUTINES
	HLT		; HALT SYSTEM - BAD REFRESH RATE
C36:
	CMP	CX,RATE_LOWER	; CHECK FOR RATE ABOVE LOWER LIMIT
	JA	C36E	; GO TO ERROR BEEP IF BELOW MINIMUM


Now the values for the upper and lower rate are those (very narrow range)

Code:
RATE_UPPER	EQU	0F8A7H		; 0F952H -10%
RATE_LOWER	EQU	0F9F0H		; 0F952H -10%

My emulator has problems hitting those but more importantly, doesn't this BIOS make some assumptions about the speed of the 286 CPU? If the 286 CPU is faster (or slower than it expects) the IN/TEST/LOOPZ code will execute at different speed and eventually fail the test and Halt the PC.

The BIOS named "BIOS_5170_15NOV85_U27_61X9266_27256" has the lower and uppser slightly different (therefore allowing for a larger variation) since I assume that by then there were faster 286es around but this still sounds like broken coding from IBM.

How is this correct?

Regards,
Vlad.
 
Presumably the BIOS was written with the assumption that it would only be used with a CPU in that particular range of speeds. That's not particularly unusual for BIOS code - portability wasn't a concern, since only that particular machine was the target.
 
At one point, because users were overclocking their 6 MHz 5170s (look in the back of a Computer Week of the time and see the ads for crystals), IBM, in one revision of its 6MHz 5170 BIOS, inserted code to check that the user wasn't overclocking. I know it seems silly now, but it's true.

Are you sure that you haven't stumbled upon that BIOS?
 
AUG84: Type 1 motherboard, runs at 6 MHz, fitted with 10JAN84 BIOS
OCT85: Type 2 motherboard, runs at 6 MHz, fitted with 10JUN85 BIOS <-- BIOS contains speed check
APR86: Type 3 motherboard, runs at 8 MHz, fitted with 15NOV85 BIOS <-- BIOS contains speed check
 
AUG84: Type 1 motherboard, runs at 6 MHz, fitted with 10JAN84 BIOS
OCT85: Type 2 motherboard, runs at 6 MHz, fitted with 10JUN85 BIOS <-- BIOS contains speed check
APR86: Type 3 motherboard, runs at 8 MHz, fitted with 15NOV85 BIOS <-- BIOS contains speed check
Yeah, I am running the last one. I am looking for a BIOS with a functioning INT 15h used by HIMEM.SYS to access memory above 1Mb.

I will try to run the AUG84 one.

Thanks!
Vlad.
 
Back
Top