[PATCH] Video-mode menu made optional

Aaron Tiensivu (tiensivu@pilot.msu.edu)
Sat, 22 Jun 1996 17:48:37 -0400 (EDT)


I made this patch so that the video mode menu prompt code is optional.
Many people have said that the video probes that are done make their
video cards go batty, so this will probably help them too.

It reduces the binary size about 2.5k.

I tried to change as little as possible so that this patch will
go in cleanly, hopefully, in versions above v2.0.0.

Let me know how it works out.
Next patch to come is a rewritten SBPro CD-ROM driver.
Featuring 0 code of the original.

Aaron Tiensivu
tiensivu@pilot.msu.edu

--- linux/arch/i386/boot/video.S.orig Sat Jun 22 13:18:45 1996
+++ linux/arch/i386/boot/video.S Sat Jun 22 17:37:20 1996
@@ -4,6 +4,14 @@
! Copyright (C) 1995, 1996 Martin Mares <mj@k332.feld.cvut.cz>
! Based on the original setup.S code (C) Linus Torvalds
!
+! 06/22/96 - Aaron Tiensivu - tiensivu@pilot.msu.edu
+! Made video probing/menu-select optional
+! Reduces kernel size by about 2.5k
+
+! Enable video card probing/menu selection
+#undef CONFIG_VIDEO
+
+#ifdef CONFIG_VIDEO

! Enable autodetection of SVGA adapters and modes
#define CONFIG_VIDEO_SVGA
@@ -51,6 +59,8 @@
! The "recalculate timings" flag
#define VIDEO_RECALC 0x8000

+#endif CONFIG_VIDEO
+
! Positions of various video parameters passed to the kernel
#define PARAM_CURSOR_POS 0
#define PARAM_VIDEO_PAGE 4
@@ -61,12 +71,16 @@
#define PARAM_HAVE_VGA 15
#define PARAM_FONT_POINTS 16

+#ifdef CONFIG_VIDEO
+
! Define DO_STORE according to CONFIG_VIDEO_RETAIN
#ifdef CONFIG_VIDEO_RETAIN
#define DO_STORE call store_screen
#else
#define DO_STORE
-#endif
+#endif CONFIG_VIDEO_RETAIN
+
+#endif CONFIG_VIDEO

!
! This is the main entry point called by setup.S
@@ -85,6 +99,7 @@
mov gs,ax ! GS is zero
cld
call basic_detect ! Basic adapter type testing (EGA/VGA/MDA/CGA)
+#ifdef CONFIG_VIDEO
seg fs ! User-selected video mode
mov ax,[0x01fa]
cmp ax,#ASK_VGA ! Bring up the menu
@@ -97,7 +112,8 @@
vid1:
#ifdef CONFIG_VIDEO_RETAIN
call restore_screen ! Restore screen contents
-#endif
+#endif CONFIG_VIDEO_RETAIN
+#endif CONFIG_VIDEO
call mode_params ! Store mode parameters
pop ds ! Restore original DS
ret
@@ -180,6 +196,7 @@
! The video mode menu
!

+#ifdef CONFIG_VIDEO
mode_menu:
lea si,keymsg ! "Return/Space/Timeout" message
call prtstr
@@ -736,7 +753,7 @@
pop es ! Done
res1: ret

-#endif /* CONFIG_VIDEO_RETAIN */
+#endif CONFIG_VIDEO_RETAIN

!
! Write to indexed VGA register (AL=index, AH=data, DX=index reg. port)
@@ -791,16 +808,16 @@

#ifdef CONFIG_VIDEO_LOCAL
call local_modes
-#endif
+#endif CONFIG_VIDEO_LOCAL
#ifdef CONFIG_VIDEO_VESA
call vesa_modes ! Detect VESA VGA modes
-#endif
+#endif CONFIG_VIDEO_VESA
#ifdef CONFIG_VIDEO_SVGA
cmpb [scanning],#0 ! Bypass when scanning
jnz mscan2
call svga_modes ! Detect SVGA cards & modes
mscan2:
-#endif
+#endif CONFIG_VIDEO_SVGA

mtabe:

@@ -826,7 +843,7 @@
jmp cmt1

cmt2:
-#endif /* CONFIG_VIDEO_COMPACT */
+#endif CONFIG_VIDEO_COMPACT

mov (di),#ASK_VGA ! End marker
mov [mt_end],di
@@ -940,7 +957,7 @@
db 50, 132 ! 010B
db 60, 132 ! 010C

-#endif /* CONFIG_VIDEO_VESA */
+#endif CONFIG_VIDEO_VESA

!
! Scan for video modes. A bit dirty, but should work.
@@ -1622,7 +1639,7 @@
.ascii "REALTEK"
.byte 0

-#endif /* CONFIG_VIDEO_SVGA */
+#endif CONFIG_VIDEO_SVGA

!
! User-defined local mode table (VGA only)
@@ -1654,7 +1671,7 @@
.ascii "Local"
.byte 0

-#endif /* CONFIG_VIDEO_LOCAL */
+#endif CONFIG_VIDEO_LOCAL

!
! Read a key and return the ASCII code in al, scan code in ah
@@ -1738,18 +1755,23 @@
pop ax
ret

+#endif CONFIG_VIDEO
+
! Variables:

adapter: .byte 0 ! Video adapter: 0=CGA/MDA/HGA,1=EGA,2=VGA
+#ifdef CONFIG_VIDEO
mt_end: .word 0 ! End of video mode table if built
edit_buf: .space 6 ! Line editor buffer
card_name: .word 0 ! Pointer to adapter name
scanning: .byte 0 ! Performing mode scan
do_restore: .byte 0 ! Screen contents altered during mode change
svga_prefix: .byte VIDEO_FIRST_BIOS>>8 ! Default prefix for BIOS modes
+#endif CONFIG_VIDEO
video_segment: .word 0xb800 ! Video memory segment
force_size: .word 0 ! Use this size instead of the one in BIOS vars

+#ifdef CONFIG_VIDEO
! Messages:

keymsg: .ascii "Press <RETURN> to see video modes available, "
@@ -1768,6 +1790,7 @@
vesaer: .ascii "Error: Scanning of VESA modes failed. Please "
.ascii "report to <mj@k332.feld.cvut.cz>."
db 0x0d, 0x0a, 0
+#endif CONFIG_VIDEO
old_name: .ascii "CGA/MDA/HGA"
db 0
ega_name: .ascii "EGA"