[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The problem with mbr... [PATCH]

In tom.lists.debian-devel, you wrote:
> I'm not sure that there is space technically for this.  Dunno, this is
> a guess, but I suspect that with all the features in it, they are
> REALLY pushing the limit already.
Well, I looked and there were a few bytes left. So, using what I
remembered from the assembly language course I took last year, I
managed to add this feature. (With precious few bytes to spare.)

When the enclosed patch is applied, the first thing that mbr does is
to print out the string "MBR<cr>". It then proceeds to behave as
before, respecting all options, etc. 

Hopefully, this will be enough to end confusion by making it obvious
that mbr runs before lilo in the boot sequence.

Should I submit this patch as a wishlist bug?

Tom Rothamel --------- http://onegeek.org/~tom/ ---------- Using GNU/Linux
	"Students who successfully accomplish this task will be given 
	 extra credit (and a complete psychiatric examination)."
		- Andrew S. Tannenbaum, _Structured Computer Organization_

--- mbr-1.1.1/mbr.S86	Mon Jan 10 15:06:50 2000
+++ mbr-tom/mbr.S86	Thu Feb  3 10:25:56 2000
@@ -15,6 +15,7 @@
 !    along with this program; if not, write to the Free Software
 !    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#define LOGO
 #undef COMPAT
 ! We are loaded at 0:0x7c00 by the BIOS, but need to load boot sectors
@@ -40,7 +41,27 @@
 	mov si,#table+0x30 ! Set bootable flags from partition table
 	mov al,#8 ! AH=0 is set from above
 	jmp 0:cont ! Switch to the newly made copy. From now on labels work.
-cont:	cmpb drive,#0xFF ! If drive==0xFF, use the value in DL instead.
+#ifdef LOGO
+	! Code to print the word "MBR" at boot time, to let people
+	! know that we are here. - Tom Rothamel <tom-10990@onegeek.org>
+	! Inspired by a discussion on debian-devel.
+logolen	equ 4 	! The length of the logo string.
+	pusha
+	mov ah,#0xe
+	mov si,#logo
+	xor bx,bx
+	mov cx,#logolen
+	mov al,[si]
+	int 0x10
+	inc si
+	loop logol
+	popa
+	cmpb drive,#0xFF ! If drive==0xFF, use the value in DL instead.
 	jne ptloop
 	mov drive,dl ! Now DL is free for use
 ptloop:	cmpb [si],#0 ! Check for bootable flag
@@ -199,6 +220,9 @@
 lbit:	cmp 0x7dfe,#0xaa55
 	jnz il3
 	jmp 0:0x7c00
+#ifdef LOGO
+logo:	.ascii "MBR\r"
 request:.byte 0x10, 0, 1, 0
 	.word 0x7c00, 0
 	.word 0, 0, 0, 0

Reply to: