boot0 and boot0sio testers please...

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Tue, 27 Apr 2004 23:16:45 +0200
(Ruslan is getting a repo copy done to get things done right,
so this file will change to boot0_512.S at some point)

This patch further reduces the diff between boot0 and boot0sio,
in particular the "Def:" becomes "Default:" in boot0sio as well.

A bug in boot0sio is fixed where we relied on %dx being retained
across a bios call and one in boot0 where we did not reset the
timer when the user typed a wrong key.

Please test

Poul-Henning


Index: boot0_512.s
===================================================================
RCS file: /home/ncvs/src/sys/boot/i386/boot0/boot0_512.s,v
retrieving revision 1.1
diff -u -r1.1 boot0_512.s
--- boot0_512.s	27 Apr 2004 19:07:35 -0000	1.1
+++ boot0_512.s	27 Apr 2004 21:11:59 -0000
_at__at_ -98,12 +98,9 _at__at_
 // Initialize the serial port.
 // Must save DX (contains drive number)
 //
-		pushw %dx			// Save
-		xorw %dx,%dx			// Port: COM1
 		movb COMSPEED,%al		// defined by Makefile
 		movb $0x00,%ah			// BIOS: Set COM Port
-		int $0x14			//  Parameters
-		popw %dx			// Restore
+		call bioscom
 #endif /* SIO */
 //
 // Check what flags were loaded with us, specifically, Use a predefined Drive.
_at__at_ -198,23 +195,21 _at__at_
 		callw putx			//  item
 //
 // Now that we've printed the drive (if we needed to), display a prompt.
-// Get ready for the input by noting the time.
 //
 main.7:		movw $prompt,%si		// Display
 		callw putstr			//  prompt
 		movb _OPT(%bp),%dl		// Display
 		decw %si			//  default
 		callw putkey			//  key
-main.7_1:
+//
+// Start of input loop.  Beep and take note of time
+//
+main.10:	movb $ASCII_BEL,%al		// Signal
+		callw putchr			//  error
 		xorb %ah,%ah			// BIOS: Get
 		int $0x1a			//  system time
-#ifndef SIO
 		movw %dx,%di			// Ticks when
 		addw _TICKS(%bp),%di	 	//  timeout
-#else /* SIO */
-		movw %dx,%si			// Ticks when
-		addw _TICKS(%bp),%si		//  timeout
-#endif /* SIO */
 //
 // Busy loop, looking for keystrokes but
 // keeping one eye on the time.
_at__at_ -225,19 +220,14 _at__at_
 		int $0x16			//  for keypress
 		jnz main.11			// Have one
 #else /* SIO */
-		xorw %dx,%dx			// Use COM1
 		movb $0x03,%ah			// BIOS: Read COM
-		int $0x14			//  Status
+		call bioscom
 		testb $0x01,%ah			// Check line status
 		jnz main.11 			// (bit 1 indicates input)
 #endif /* SIO */
 		xorb %ah,%ah			// BIOS: Get
 		int $0x1a			//  system time
-#ifndef SIO
 		cmpw %di,%dx			// Timeout?
-#else /* SIO */
-		cmpw %si,%dx			// Timeout?
-#endif /* SIO */
 		jb main.8			// No
 //
 // If timed out or defaulting, come here.
_at__at_ -245,18 +235,6 _at__at_
 main.9:		movb _OPT(%bp),%al		// Load default
 		jmp main.12			// Join common code
 //
-// User's last try was bad, beep in displeasure.
-// Since nothing was printed, just continue on as if the user
-// hadn't done anything. This gives the effect of the user getting a beep
-// for all bad keystrokes but no action until either the timeout
-// occurs or the user hits a good key.
-//
-main.10:	movb $ASCII_BEL,%al		// Signal
-		callw putchr			//  error
-#ifdef SIO
-		jmp main.7_1			// Go back
-#endif /* SIO */
-//
 // Get the keystroke.
 //
 main.11:
_at__at_ -266,7 +244,7 _at__at_
 		movb %ah,%al			// Scan code
 #else /* SIO */
 		movb $0x02,%ah			// BIOS: Receive
-		int $0x14			//  COM Byte
+		call bioscom
 #endif /* SIO */
 //
 // If it's CR act as if timed out.
_at__at_ -389,15 +367,18 _at__at_
 		movb $0xe,%ah			// BIOS: Display
 		int $0x10			//  character
 		popw %bx			// Restore
+		retw				// To caller
 #else /* SIO */
-putchr:		pushw %dx			// Save
-		xorw %dx,%dx 			// Use COM1
-		xorw %cx,%cx 			// No timeout
+putchr:		
 		movb $0x01,%ah			// BIOS: Send
+		xorw %cx,%cx 			// No timeout
+bioscom:
+		pushw %dx			// Save
+		xorw %dx,%dx 			// Use COM1
 		int $0x14			//  Character
 		popw %dx			// Restore
-#endif /* SIO */
 		retw				// To caller
+#endif /* SIO */
 
 // One-sector disk I/O routine
 
_at__at_ -424,12 +405,11 _at__at_
 
 // Menu strings
 
-#ifndef SIO
 item:		.ascii "  ";	     .byte ' '|0x80
+#ifndef SIO
 prompt:		.ascii "\nDefault:"; .byte ' '|0x80
 #else /* SIO */
-item:		.ascii " ";	     .byte ' '|0x80
-prompt:		.ascii "\nDef:";     .byte ' '|0x80
+prompt:		.ascii "\nDefault:";     .byte ' '|0x80
 #endif /* SIO */
 crlf:		.ascii "\r";	     .byte '\n'|0x80
 
-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Received on Tue Apr 27 2004 - 12:16:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:52 UTC