wok rev 5060

linux/boot: keyboardless support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Mar 09 13:32:08 2010 +0100 (2010-03-09)
parents f642eb9dd1b4
children b4fa2f5e2632
files linux/stuff/linux-header-2.6.30.6.u
line diff
     1.1 --- a/linux/stuff/linux-header-2.6.30.6.u	Tue Mar 09 00:20:04 2010 +0100
     1.2 +++ b/linux/stuff/linux-header-2.6.30.6.u	Tue Mar 09 13:32:08 2010 +0100
     1.3 @@ -18,37 +18,34 @@
     1.4   
     1.5   #ifndef SVGA_MODE
     1.6   #define SVGA_MODE ASK_VGA
     1.7 -@@ -39,53 +41,394 @@
     1.8 +@@ -39,53 +41,412 @@
     1.9   #define ROOT_RDONLY 1
    1.10   #endif
    1.11   
    1.12 -+#define SHOW_REGS	show int13 status & parameters
    1.13 -+#define EDIT_CMDLINE	add kernel command line support
    1.14 ++/* some extra features */
    1.15 ++#define	EDIT_CMDLINE		on hotkey
    1.16 ++#define SHOW_REGS		show int13 status & parameters
    1.17  +
    1.18   	.code16
    1.19   	.section ".bstext", "ax"
    1.20   
    1.21   	.global bootsect_start
    1.22   bootsect_start:
    1.23 ++	cld				# assume nothing
    1.24  +stacktop	= 0x9E00		# in 0x8000 .. 0xA000
    1.25 -+					# with 512 bytes for cmdline
    1.26 -+	movw	$stacktop-12, %di	# stacktop is an arbitrary value >=
    1.27 ++zeroed		= 48+10			# gdt + zeroed registers
    1.28 ++	movw	$stacktop-12-zeroed, %di	# stacktop is an arbitrary value >=
    1.29  +					# length of bootsect + length of
    1.30  +					# setup + room for stack;
    1.31  +					# 12 is disk parm size.
    1.32 -+					# gdt will heat 48 more bytes.
    1.33 -+curcx	=	0
    1.34 -+curdx	=	curcx+2
    1.35 -+	cld				# assume nothing
    1.36 -+#ifndef FLOPPY_1440K_ONLY
    1.37 -+limits	=	4
    1.38 -+#endif
    1.39 ++	pushw	$INITSEG
    1.40 ++	popw	%es			# %es = INITSEG
    1.41   
    1.42  -	# Normalize the start address
    1.43  -	ljmp	$BOOTSEG, $start2
    1.44 -+	pushw	$INITSEG
    1.45 -+	popw	%es			# %es = INITSEG
    1.46 -+	xorw	%cx, %cx		# %cx = 0
    1.47 ++	pushw	%es
    1.48 ++	popw	%ss			# %ss and %es already contain INITSEG
    1.49 ++	movw	%di, %sp		# put stack at INITSEG:stacktop-...
    1.50   
    1.51  -start2:
    1.52  -	movw	%cs, %ax
    1.53 @@ -58,11 +55,6 @@
    1.54  -	xorw	%sp, %sp
    1.55  -	sti
    1.56  -	cld
    1.57 -+	pushw	%es
    1.58 -+	popw	%ss			# %ss and %es already contain INITSEG
    1.59 -+	movw	%di, %sp		# put stack at INITSEG:stacktop-12.
    1.60 - 
    1.61 --	movw	$bugger_off_msg, %si
    1.62  +# Many BIOS's default disk parameter tables will not recognize
    1.63  +# multi-sector reads beyond the maximum sector number specified
    1.64  +# in the default diskette parameter tables - this may mean 7
    1.65 @@ -76,7 +68,15 @@
    1.66  +# High doesn't hurt.  Low does.  Let's use the max: 63
    1.67  +#
    1.68  +# Segments are as follows: %es = %ss = INITSEG,
    1.69 -+# %fs and %gs are unused.
    1.70 + 
    1.71 +-	movw	$bugger_off_msg, %si
    1.72 ++	xorw	%ax, %ax		# %ax = 0
    1.73 ++	movw	$zeroed/2, %cx		# clear gdt + offset, %ds, limits
    1.74 ++	rep				# don't worry about cld
    1.75 ++	stosw				# already done above
    1.76 ++	popw	%bx			# offset = 0
    1.77 ++	popw	%ds			# %ds = 0
    1.78 ++	popw	%gs			# %gs = 0
    1.79   
    1.80  -msg_loop:
    1.81  -	lodsb
    1.82 @@ -84,133 +84,127 @@
    1.83  -	jz	bs_die
    1.84  -	movb	$0xe, %ah
    1.85  -	movw	$7, %bx
    1.86 -+	movw	$0x78, %bx		# %ds:%bx is parameter table address
    1.87 -+	movw	%cx, %ds		# %ds = 0
    1.88 -+	ldsw	(%bx), %si		# %ds:%si is source
    1.89 ++	movb	setup_sects+0x7C00, %al	# read bootsector + setup (%ds = 0)
    1.90 ++	incw	%ax
    1.91 ++
    1.92 ++	pushw	%es
    1.93 ++	pushw	%di			# %ds:%bx+0x78 is parameter table address
    1.94 ++	ldsw	0x78(%bx), %si		# %ds:%si is source
    1.95  +	movb	$6, %cl			# copy 12 bytes
    1.96  +	rep				# don't worry about cld
    1.97  +	movsw				# already done above
    1.98 -+	movw	%cx, %ds		# %ds = 0
    1.99 -+	movw	%sp, (%bx)		# %sp = stacktop-12
   1.100 -+	movw	%es, 2(%bx)
   1.101 -+
   1.102 -+	movb	setup_sects+0x7C00, %al	# read bootsector + setup (%ds = 0)
   1.103 -+	cbw
   1.104 -+	incw	%ax
   1.105 -+
   1.106 ++	popl	%gs:0x78(%bx)		# update parameter table address
   1.107  +	pushw	%es
   1.108  +	popw	%ds			# now %ds = %es = %ss = INITSEG
   1.109  +	movb	$63, 0x4-12(%di)	# patch sector count, %di = stacktop
   1.110 -+
   1.111  +	cli
   1.112  +
   1.113 -+	movb	$24, %bl		# allocate 48 bytes in stack
   1.114 -+init_gdt:
   1.115 -+	pushw	%cx			#   initialized with 0
   1.116 -+	decw	%bx
   1.117 -+	jnz	init_gdt
   1.118 -+
   1.119  +	xchg	%ax, %di		# sector count
   1.120 -+	cbw				# limits = 0
   1.121 ++	popw	%ax			# limits = 0
   1.122  +	incw	%cx			# cylinder 0, sector 1
   1.123  +	call	read_first_sectors	# read setup
   1.124  +
   1.125 -+#define version_offset		0xE
   1.126 -+#define loadflags_offset	0x11
   1.127 -+#define heap_end_ptr_offset	0x24
   1.128 -+
   1.129 -+	movw	$_start,%si
   1.130 -+	orb	$0x80, loadflags_offset(%si)
   1.131 -+	movw	$stacktop-0x200, heap_end_ptr_offset(%si)
   1.132 -+
   1.133 -+	addw	version_offset(%si),%si	# starting protocol 2.00, Kernel 1.3.73
   1.134 ++#define kernel_version	0xE
   1.135 ++	movw	$0x200,%si
   1.136 ++	addw	kernel_version(%si),%si	# starting protocol 2.00, Kernel 1.3.73
   1.137  +	call	puts			# show which kernel we are loading
   1.138  +
   1.139 ++# The cmdline can be entered and modifed at boot time.
   1.140 ++# Only characters before the cursor are passed to the kernel.
   1.141 ++	popw	%bx			# clear %bx
   1.142 ++	orw	cmd_line_ptr, %bx
   1.143 ++	jz	nocmdline
   1.144 ++	pushw	%bx
   1.145 ++	call	read_one_sector
   1.146 ++	popw	%si
   1.147 ++	call	puts
   1.148  +#ifdef	EDIT_CMDLINE
   1.149 -+# The cmdline can be entered and modifed on hot key.
   1.150 -+# Only characters before the cursor are passed to the kernel.
   1.151 -+	movw	$cmd_line_ptr, %si
   1.152 -+	cmpw	%bx,(%si)		# %bx = 7
   1.153 -+	jb	nocmdline
   1.154 -+	incw	%di			# read 1 sector
   1.155 -+	movw	(%si), %bx
   1.156 -+	pushw	%si
   1.157 -+	call	read_sectors
   1.158 -+	popw	%di
   1.159 -+	movw	(%di), %si
   1.160 -+	call	puts
   1.161  +cmdlp:
   1.162 -+	movb	$32, %al		# clear end of line
   1.163 ++	movb	$0x20, %al		# clear end of line
   1.164  +	int	$0x10			#  with Space
   1.165  +	movb	$8, %al			#   and BackSpace
   1.166   	int	$0x10
   1.167  -	jmp	msg_loop
   1.168  +	decw	%si
   1.169  +cmdget:
   1.170 -+	cbw				# %ah = 0, get keyboard character
   1.171 -+	int	$0x16
   1.172 ++	call	wait4key
   1.173  +	cmpb	$8, %al			# BackSpace ?
   1.174  +	je	cmdbs
   1.175  +	movb	%al, (%si)		# store char
   1.176  +	lodsw				# %si += 2
   1.177  +cmdbs:
   1.178 -+	cmpw	(%di), %si		# lower limit is checked
   1.179 -+	je	cmdget			#   but upper limit not
   1.180 ++#if 1
   1.181 ++	cmpw	%si,cmd_line_ptr
   1.182 ++	je	cmdget
   1.183 ++#endif
   1.184  +	call	putc			# set %ah and %bx
   1.185  +	cmpb	$10, %al		# Enter ?
   1.186  +	jne	cmdlp
   1.187 -+	movb	%bh,-2(%si)		# set end of line, remove CR
   1.188 ++	movb	%bh,-2(%si)		# set end of string and remove CR
   1.189  +endcmdline:
   1.190 -+	
   1.191 ++#endif
   1.192  +nocmdline:
   1.193 -+#endif
   1.194   
   1.195  -bs_die:
   1.196  -	# Allow the user to press a key, then reboot
   1.197  -	xorw	%ax, %ax
   1.198 +-	int	$0x16
   1.199 +-	int	$0x19
   1.200  +# This routine loads the system at address SYSSEG, making sure
   1.201  +# no 64kB boundaries are crossed. We try to load it as fast as
   1.202  +# possible, loading whole tracks whenever we can.
   1.203 -+
   1.204 + 
   1.205 +-	# int 0x19 should never return.  In case it does anyway,
   1.206 +-	# invoke the BIOS reset code...
   1.207 +-	ljmp	$0xf000,$0xfff0
   1.208 ++ramdisk_image	=	0x0218
   1.209 ++ramdisk_size	=	0x021C
   1.210  +	movw	%sp, %si		# for bootsect_gdt
   1.211 ++	decw	16(%si)			# bootsect_src = 64Kb
   1.212 ++	decw	24(%si)			# bootsect_dst = 64Kb
   1.213 ++	movw	$syssize, %di
   1.214 ++type_of_loader	=	0x210
   1.215 ++loadflags	=	0x211
   1.216 ++heap_end_ptr	=	0x224
   1.217 ++ksyssize	= 	500
   1.218 ++	orw	$0x80FF, type_of_loader-ksyssize(%di) # loader type = 0xFF
   1.219 ++	movw	$stacktop-0x200, heap_end_ptr-ksyssize(%di)
   1.220  +	movb	$0x0F, %al		# destination = 0x100000
   1.221 -+	movw	$syssize, %di
   1.222 -+#define type_of_loader_offset	0x1C	/* type_of_loader - syssize */
   1.223 -+	decb	type_of_loader_offset(%di)	# loader type = 0xFF
   1.224  +	movb	$5, %cl
   1.225  +initrdlp:
   1.226  +	movb	$0x93,%ah
   1.227  +	movw	%ax, 28(%si)		# bootsect_dst_base+2
   1.228  +	movb	$(SYSSEG/4096), %al	# source = SYSSEG
   1.229  +	movw	%ax, 20(%si)		# bootsect_src_base+2
   1.230 -+	cwd
   1.231 -+	movw	%dx, 16(%si)		# bootsect_src = 64Kb
   1.232 -+	movw	%dx, 24(%si)		# bootsect_dst = 64Kb
   1.233 -+	xorl	%ebx, %ebx
   1.234 -+	incw	%bx
   1.235 -+	shlw	%cl,%bx
   1.236 -+	decw	%bx
   1.237 -+	addl	(%di),%ebx
   1.238 -+	shrl	%cl, %ebx
   1.239 ++	cbw
   1.240 ++	cwde
   1.241 ++	shlw	%cl, %ax
   1.242 ++	decw	%ax
   1.243 ++	addl	(%di),%eax
   1.244 ++	shrl	%cl, %eax
   1.245  +syslp:
   1.246  +	pushw	$SYSSEG
   1.247  +	popw	%es
   1.248  +	movw	$128,%di		# 64Kb
   1.249 -+	subw	%di, %bx		# max 32M > int 15 limit
   1.250 ++	subw	%di, %ax		# max 32M > int 15 limit
   1.251  +	pushf
   1.252  +	jnc	not_last
   1.253 -+	addw	%bx, %di
   1.254 ++	addw	%ax, %di
   1.255  +not_last:
   1.256 -+	pushw	%bx
   1.257 ++	xorw	%bx, %bx		# clear %bx
   1.258 ++	pushw	%ax
   1.259 ++#if defined(SHOW_REGS)
   1.260  +	pushw	%si
   1.261 -+	xorw	%bx, %bx
   1.262  +	call	read_sectors
   1.263  +	popw	%si
   1.264 ++#else
   1.265 ++	call	read_sectors
   1.266 ++#endif
   1.267  +	movw	$0x8000, %cx		# full 64K
   1.268  +	movb	$0x87, %ah
   1.269  +	incb	28(%si)			# bootsect_dst_base+2
   1.270  +	int	$0x15			# max 16M
   1.271 -+	popw	%bx
   1.272 ++	popw	%ax
   1.273  +	popf
   1.274  +	ja	syslp
   1.275  +	movw	ramdisk_image+2,%ax
   1.276 @@ -219,14 +213,28 @@
   1.277  +	movb	$9, %cl
   1.278  +	cmpb	%al,28(%si)
   1.279  +	jb	initrdlp
   1.280 -+
   1.281 + 
   1.282 +-	.section ".bsdata", "a"
   1.283 +-bugger_off_msg:
   1.284 +-	.ascii	"Direct booting from floppy is no longer supported.\r\n"
   1.285 +-	.ascii	"Please use a boot loader program instead.\r\n"
   1.286 +-	.ascii	"\n"
   1.287 +-	.ascii	"Remove disk and press any key to reboot . . .\r\n"
   1.288 +-	.byte	0
   1.289  +# This procedure turns off the floppy drive motor, so
   1.290  +# that we enter the kernel in a known state, and
   1.291  +# don't have to worry about it later.
   1.292 -+
   1.293 + 
   1.294 ++#if 1
   1.295  +kill_motor:
   1.296 -+	xorw	%ax, %ax		# reset FDC
   1.297 ++	xchgw	%ax, %bx		# reset FDC
   1.298  +	int	$0x13
   1.299 ++#else
   1.300 ++kill_motor:
   1.301 ++	movw	$0x3f2, %dx
   1.302 ++	xchgw	%ax, %bx
   1.303 ++	outb	%al, %dx
   1.304 ++#endif
   1.305  +
   1.306  +# After that (everything loaded), we jump to the setup-routine
   1.307  +# loaded directly after the bootblock:
   1.308 @@ -252,11 +260,13 @@
   1.309  +	movw	$regs, %si		# caller %si is saved
   1.310  +	call	putcs			# putc(%al) + puts(%si)
   1.311  +# it will print out all of the registers.
   1.312 -+	popw	%bp			# load word into %bp
   1.313 ++	popw	%bp			# load word into %si
   1.314  +	jmp	print_all		# print %bp (status)
   1.315  +#endif
   1.316  +check_limits:
   1.317 -+#ifndef FLOPPY_1440K_ONLY
   1.318 ++#ifndef SHOW_REGS
   1.319 ++	popw	%dx
   1.320 ++#endif
   1.321  +	cmpb	$FLOPPY_SECTORS+1, %cl	# 18 sectors minimum
   1.322  +	jb	check_head
   1.323  +        cmpb    %al, %cl		# max sector known ?
   1.324 @@ -267,9 +277,6 @@
   1.325  +        cmpb    %ah, %dh		# max head known ?
   1.326  +        ja	next_cylinder		#   no -> store it
   1.327  +check_cylinder:
   1.328 -+	cmpb	$FLOPPY_CYLINDERS, %ch	# 80 cylinders minimum
   1.329 -+	jae	next_floppy
   1.330 -+#endif
   1.331  +	pushaw
   1.332  +#ifdef SHOW_REGS
   1.333  +	cmpw	$0x600,%bp		# disk changed ?
   1.334 @@ -278,15 +285,12 @@
   1.335  +	pushw	%dx			# print %dx
   1.336  +	pushw	%cx			# print %cx
   1.337  +	pushw	%bx			# print %bx
   1.338 -+#ifndef FLOPPY_1440K_ONLY
   1.339  +	xchgw	%ax, %si
   1.340 -+#endif
   1.341  +	movb	$2,%ah
   1.342  +	pushw	%ax			# print %ax
   1.343 -+	movw	$6,%cx
   1.344 ++	movb	$6,%cl
   1.345  +print_all:
   1.346 -+	pushw	%cx			# save count remaining
   1.347 -+	movb	$4, %cl			# 4 hex digits
   1.348 ++	movb	$4, %ch			# 4 hex digits
   1.349  +print_digit:
   1.350  +	rolw	$4, %bp			# rotate to use low 4 bits
   1.351  +	movb	$0x0f, %al
   1.352 @@ -296,118 +300,121 @@
   1.353  +	adcb	$0x40, %al
   1.354  +	daa
   1.355  +	call	putc			# set %ah and %bx
   1.356 -+	loop	print_digit
   1.357 ++	decb	%ch
   1.358 ++	jnz	print_digit
   1.359  +	movb	$0x20, %al		# SPACE
   1.360  +	int	$0x10
   1.361 -+	popw	%cx
   1.362  +	loop	print_loop
   1.363 ++	call	wait
   1.364 ++	cbw				# %ah = 0
   1.365  +reset_floppy:
   1.366 ++#else
   1.367 ++	cbw				# %ah = 0
   1.368  +#endif
   1.369 -+	cbw				# %ah = 0
   1.370  +        int     $0x13			# reset controler
   1.371  +	popaw
   1.372  +read_sectorslp:
   1.373 -+	xorw	%si, %si
   1.374 -+	lodsw
   1.375 -+	xchgw	%ax,%cx			# restore disk state
   1.376 -+	lodsw
   1.377 -+	xchgw	%ax,%dx
   1.378 -+#ifndef FLOPPY_1440K_ONLY
   1.379 -+#   al is last sector+1
   1.380 -+#   ah is last cylinder+1
   1.381 -+	lodsw
   1.382 -+#endif
   1.383 -+#ifndef FLOPPY_1440K_ONLY
   1.384 ++	pushw	%dx			# some bios break dx...
   1.385  +        pushw   %ax			# limits
   1.386  +	subb	%cl, %al		# sectors remaining in track
   1.387  +	ja	tolastsect
   1.388  +	movb	$1, %al			# 1 sector mini
   1.389  +tolastsect:
   1.390 -+#else
   1.391 -+	mov	$FLOPPY_SECTORS+1, %al
   1.392 -+	subb	%cl, %al		# sectors remaining in track
   1.393 -+#endif
   1.394  +	cbw
   1.395  +	cmpw	%di, %ax
   1.396  +	jb	more1trk
   1.397  +	movw	%di, %ax		# sectors to read
   1.398  +more1trk:
   1.399  +	pushw	%ax			# save context
   1.400 -+	pushw	%dx			# some bios break dx...
   1.401  +	movb	$2, %ah			# cmd: read chs
   1.402  +        int     $0x13
   1.403 -+	popw	%dx
   1.404 ++#ifdef SHOW_REGS
   1.405  +	xchgw	%ax, %bp		# status
   1.406 -+#ifndef FLOPPY_1440K_ONLY
   1.407 ++#endif
   1.408 ++# ifdef SHOW_REGS
   1.409  +	popw	%si			# save %ax
   1.410  +        popw    %ax			# limits
   1.411 -+#else
   1.412 -+	popw	%ax			# restore context
   1.413 -+#endif
   1.414 ++	popw	%dx
   1.415 ++# else
   1.416 ++	popw	%dx			# save %ax
   1.417 ++        popw    %ax			# limits
   1.418 ++# endif
   1.419  +	jc	check_limits
   1.420 -+#ifndef FLOPPY_1440K_ONLY
   1.421 -+	subw	%si,%di			# update sector counter
   1.422 -+	addw	%si,%cx			# next sector
   1.423 -+	shlw	$9,%si
   1.424 -+	addw	%si,%bx			# next location
   1.425 -+#else
   1.426 -+	subw	%ax,%di			# update sector counter
   1.427 -+	addw	%ax,%cx			# next sector
   1.428 -+	addw	%ax,%ax
   1.429 -+	addb	%al,%bh			# next location
   1.430 -+#endif
   1.431 -+#ifndef FLOPPY_1440K_ONLY
   1.432 ++# ifdef SHOW_REGS
   1.433 ++update_regs:
   1.434 ++	decw	%di			# update sector counter
   1.435 ++	incw	%cx			# next sector
   1.436 ++	addb	$2,%bh			# next location
   1.437 ++	decw	%si
   1.438 ++	jnz	update_regs
   1.439 ++# else
   1.440 ++	subw	%dx,%di			# update sector counter
   1.441 ++	addw	%dx,%cx			# next sector
   1.442 ++	addw	%dx,%dx
   1.443 ++	addb	%dl,%bh			# next location
   1.444 ++	popw	%dx
   1.445 ++# endif
   1.446  +        cmpb    %al,%cl			# reach sector limit ?
   1.447  +        jne     bdendlp
   1.448  +next_head:
   1.449  +        movb    %cl,%al
   1.450 -+#else
   1.451 -+        cmpb    $FLOPPY_SECTORS+1,%cl	# reach sector limit ?
   1.452 -+        jne     bdendlp
   1.453 -+#endif
   1.454  +        incb    %dh			# next head
   1.455  +        movb    $1,%cl			# first sector
   1.456 -+#ifndef FLOPPY_1440K_ONLY
   1.457  +        cmpb    %ah, %dh		# reach head limit ?
   1.458  +        jne     bdendlp
   1.459  +next_cylinder:
   1.460  +        movb    %dh,%ah
   1.461 -+#else
   1.462 -+        cmpb    %cl,%dh			# reach head limit ?
   1.463 -+        je	bdendlp
   1.464 -+#endif
   1.465  +# NOTE : support 256 cylinders max
   1.466  +        incb    %ch			# next cylinder
   1.467  +read_first_sectors:
   1.468  +        movb    $0,%dh			# first head
   1.469 -+#ifndef FLOPPY_1440K_ONLY
   1.470 -+	cmpb	$FLOPPY_SECTORS+1,%al	# 1.44M floppy ?
   1.471 -+        jne	bdendlp
   1.472 -+#endif
   1.473 ++cylinder_count	= 496
   1.474 ++	cmpb	cylinder_count, %ch
   1.475 ++        jb	bdendlp
   1.476  +        cmpb    $FLOPPY_CYLINDERS,%ch	# reach cylinder limit ?
   1.477  +        jb	bdendlp
   1.478  +next_floppy:
   1.479  +	movb	$0,%ch			# first cylinder
   1.480  +	pushaw
   1.481  +	movw	$swap_floppy,%si
   1.482 ++	incb	12(%si)
   1.483 ++	pushw	%bx
   1.484  +	call	puts
   1.485 -+	cbw				# %ah = 0, get keyboard character
   1.486 - 	int	$0x16
   1.487 --	int	$0x19
   1.488 ++	popw	%bx
   1.489 ++waitfloppy:
   1.490 ++	call	wait
   1.491 ++	jne	waitfloppydone
   1.492 ++	pushw	%dx			# some bios break dx...
   1.493 ++	cbw
   1.494 ++	int	$0x13			# reset FDC
   1.495 ++	movw	$0x201,%ax
   1.496 ++#	cwd
   1.497 ++#	movw	$1,%cx
   1.498 ++	int	$0x13			# read first sector
   1.499 ++	popw	%dx
   1.500 ++	rclb	$1,%ah			# floppy changed 06=>0D no error 00
   1.501 ++	cmpb	-2(%si), %ah		# 0D then 00
   1.502 ++	jne	waitfloppy		# no => try again
   1.503 ++	incw	%si
   1.504 ++	orb	%ah,%ah			# was 00 ?
   1.505 ++	jne	waitfloppy
   1.506 ++waitfloppydone:
   1.507  +	popaw
   1.508  +bdendlp:
   1.509 -+#ifndef FLOPPY_1440K_ONLY
   1.510 -+	movw	%ax, limits
   1.511 -+#endif
   1.512 -+	pushw	%dx
   1.513 -+	pushw	%cx
   1.514 -+	popl	curcx			# save disk state
   1.515 ++	xchgw	%ax, %bp
   1.516 ++	movw	%cx, %fs
   1.517  +read_sectors:
   1.518 -+	orw	%di,%di
   1.519 -+        jne	read_sectorslp
   1.520 ++	decw	%di
   1.521 ++read_one_sector:
   1.522 ++	movw	%fs, %cx
   1.523 ++#   al is last sector+1
   1.524 ++#   ah is last cylinder+1
   1.525 ++	movw	%bp, %ax
   1.526 ++	incw	%di
   1.527 ++        jnz	read_sectorslp
   1.528  +	pushw	%ss
   1.529  +	popw	%es			# restore es
   1.530 -+	movb	$0x2e+3, %al 		# 2e = .
   1.531 ++	movb	$0x2e+3, %al 		# loading... message 2e = .
   1.532  +putclf:
   1.533  +	subb	$3, %al
   1.534  +putc:
   1.535 @@ -417,10 +424,7 @@
   1.536  +	cmp	$0xd, %al		# CR ?
   1.537  +	je	putclf
   1.538  +	ret
   1.539 - 
   1.540 --	# int 0x19 should never return.  In case it does anyway,
   1.541 --	# invoke the BIOS reset code...
   1.542 --	ljmp	$0xf000,$0xfff0
   1.543 ++
   1.544  +puts:
   1.545  +	movb	$0xd, %al		# CR
   1.546  +putcs:
   1.547 @@ -429,19 +433,34 @@
   1.548  +	orb	%al,%al			# end of string is \0
   1.549  +	jnz	putcs
   1.550  +	ret
   1.551 - 
   1.552 --	.section ".bsdata", "a"
   1.553 --bugger_off_msg:
   1.554 --	.ascii	"Direct booting from floppy is no longer supported.\r\n"
   1.555 --	.ascii	"Please use a boot loader program instead.\r\n"
   1.556 --	.ascii	"\n"
   1.557 --	.ascii	"Remove disk and press any key to reboot . . .\r\n"
   1.558 --	.byte	0
   1.559 ++
   1.560 ++clock	= 0x46C
   1.561 ++wait:
   1.562 ++wait4key:
   1.563 ++	movw	$clock, %di
   1.564 ++#define DELAY 5
   1.565 ++	movb	$(DELAY*182)/10,%cl
   1.566 ++	addb	%gs:(%di),%cl
   1.567 ++waitkbd:
   1.568 ++	movw	$0x10D, %ax		# test keyboard, timeout => CR
   1.569 ++	cmpb	%gs:(%di),%cl
   1.570 ++	je	waitdone
   1.571 ++	int	$0x16
   1.572 ++	jz	waitkbd
   1.573 ++	cbw
   1.574 ++	int	$0x16			# eat char
   1.575 ++	movw	%di, %gs		# disable timeout
   1.576 ++	incw	%di			# clear Z
   1.577 ++waitdone:
   1.578 ++	ret
   1.579 ++
   1.580 ++#ifdef SHOW_REGS
   1.581  +regs:	.asciz	"X:"
   1.582 - 
   1.583 -+swap_floppy:
   1.584 -+	.ascii	"Insert next floppy and press any key to continue."
   1.585 -+	.byte	7,13,0
   1.586 ++#endif
   1.587 ++
   1.588 ++swap_floppy:	.ascii	"Insert disk 1"
   1.589 ++		.ascii	"."
   1.590 ++		.byte	7,13,0
   1.591   
   1.592   	# Kernel attributes; used by setup.  This is part 1 of the
   1.593   	# header, from the old boot sector.