From: dennisf@Miles.COM (Dennis Flaherty)
Newsgroups: comp.os.linux
Subject: Re: Patch to preset the SVGA mode
Date: 13 Apr 92 19:13:37 GMT
Organization: Miles, Inc.  Diagnostics Divis.

In article <12120@tamsun.tamu.edu> ail8070@tamsun.tamu.edu (Andy I. Liaw) writes:
> In article <1992Apr9.164927.11540@Miles.COM> dennisf@Miles.COM (Dennis Flaherty) writes:
> >
> >If you are tired of hitting RETURN and selecting the
> >same SVGA mode every time you boot Linux, apply this
> >patch and rebuild the kernel.  It allows you to preset
> >the mode in the Makefile, so that the setup program
> >proceeds as if you had hit RETURN and your favorite number.
>
> Could you please also post the same thing for presetting
> the mode to VGA (or EGA)?  Maybe it's trivial, but I'm
> not a C programmer and have no idea how this is done.
> 
> Thanks!

Sure.  This took some doing, and I'd appreciate some feedback.
I moved the # sign from the Makefile to boot/setup.S, so I now
use "2" instead of "\#2" in the Makefile.  And now if you set
SVGA_MODE to "VGA" it will compile a kernel that boots EGA/VGA
mode, no questions asked (well, it doesn't wait for you to 
answer :-,).

I've assembled all three versions; SVGA_MODE undefined prompts
you for a RETURN key and then a number, SVGA_MODE=VGA acts like
you hit another key and sets EGA/VGA mode, and SVGA_MODE=2 sets
my favorite SVGA mode.  They all seem to work right for me.

Dennis

Here's the revised patch:

*** Makefile 	Mon Apr  6 15:41:45 1992
--- Makefile	Mon Apr 13 13:48:02 1992
***************
*** 44,49 ****
--- 44,56 ----
  AS86	=as86 -0 -a
  LD86	=ld86 -0
  
+ #
+ # If you want to preset the SVGA mode, uncomment the next line
+ # and set SVGA_MODE to whatever number you want.  I use 2.
+ # Set it to -DSVGA_MODE=VGA if you just want the EGA/VGA mode.
+ #
+ #SVGA_MODE=	-DSVGA_MODE=2
+ 
  AS	=as
  LD	=ld
  #LDFLAGS	=-s -x -M
***************
*** 124,130 ****
  	$(LD86) -s -o boot/setup boot/setup.o
  
  boot/setup.s:	boot/setup.S include/linux/config.h
! 	$(CPP) -traditional boot/setup.S -o boot/setup.s
  
  boot/bootsect.s:	boot/bootsect.S include/linux/config.h
  	$(CPP) -traditional boot/bootsect.S -o boot/bootsect.s
--- 131,137 ----
  	$(LD86) -s -o boot/setup boot/setup.o
  
  boot/setup.s:	boot/setup.S include/linux/config.h
! 	$(CPP) -traditional $(SVGA_MODE) boot/setup.S -o boot/setup.s
  
  boot/bootsect.s:	boot/bootsect.S include/linux/config.h
  	$(CPP) -traditional boot/bootsect.S -o boot/bootsect.s
*** boot/setup.S 	Mon Apr  6 13:32:48 1992
--- boot/setup.S	Mon Apr 13 12:56:03 1992
***************
*** 245,250 ****
--- 245,251 ----
  	mov	es,ax
  	lea	si,msg1
  	call	prtstr
+ #ifndef SVGA_MODE
  flush:	in	al,#0x60		! Flush the keyboard buffer
  	cmp	al,#0x82
  	jb	nokey
***************
*** 256,264 ****
--- 257,268 ----
  	ja	nokey
  	cmp	al,#0x9c
  	je	svga
+ #endif
+ #if !defined(SVGA_MODE) || SVGA_MODE == VGA
  	mov	ax,#0x5019
  	pop	ds
  	ret
+ #endif
  svga:	cld
  	lea 	si,idati		! Check ATI 'clues'
  	mov	di,#0x31
***************
*** 497,502 ****
--- 501,509 ----
  	call	prtstr
  	pop	si
  	add	cl,#0x80
+ #if defined(SVGA_MODE) && SVGA_MODE != VGA
+ nonum:	mov	al,#SVGA_MODE		! Preset SVGA mode 
+ #else
  nonum:	call	getkey
  	cmp	al,#0x82
  	jb	nonum
***************
*** 508,513 ****
--- 515,521 ----
  zero:	sub	al,#0x0a
  nozero:	sub	al,#0x80
  	dec	al
+ #endif
  	xor	ah,ah
  	add	di,ax
  	inc	di

-- 
Dennis T. Flaherty     dennisf@Miles.com
Miles, Inc.            dflahert@chekov.helios.nd.edu
Diagnostics Division
My doctor says Mylanta, but my boss says Alka-Seltzer!