: # **Warning: This is not a configuration file. This is the #9 # Configuration file generator. It will generate the # "config.age" file. The AGE X server will NOT run # correctly until this file is generated and placed in the # /usr/lib/X11/age directory. # # $Id: 9gen,v 1.4 90/11/27 15:43:35 galen Exp $ # 9gen - generate a config.age file for #9GX board family. # Copyright (C) 1990 Number Nine Computer Corp. # All rights reserved. if [ $# -lt 6 -o $# -gt 8 ] then echo " Usage: 9gen res bpp vram dram map ioaddr [haddr [mode]]" echo " " echo " res (resolution) can be: 640 1024 1280 1280P" echo " bpp (bits per pixel) can be: 1 2 4 8" echo " vram can be: .5 1 2" echo " dram can be: 0 .5 1 2 4" echo " map (mapping) can be: IO MEM" echo " ioaddr (io address) can be: 280 288 290 298" echo " haddr (host address) can be: any segment address from" echo " A000 to FF00" echo " (haddr not required if map = IO)" echo " mode can be: BYTE WORD" echo " (mode defaults to BYTE; not required if map = IO)" exit 1 fi # Set some useful variables gendate="Mon Nov 12 11:16:36 EST 1990" haddr="`echo $7 | cut -c1-2`" haddrhi="0x0`echo $7 | cut -c1`0`echo $7 | cut -c1`" haddrlo="0x`echo $7 | cut -c2`0`echo $7 | cut -c2`0" # set up memory strap bits case "$3" in .5) memflag=1 ;; 1) memflag=0 ;; 2) memflag=32 ;; *) echo "Error in Vram specification" exit 1 ;; esac case "$4" in 0) tmp=2 ;; .5) tmp=4 ;; 1) tmp=20 ;; 2) tmp=0 ;; 4) tmp=16 ;; *) echo "Error in Dram specification" exit 1 ;; esac memflag=`expr $memflag + $tmp` # Set up mapping case "$5" in io | IO) map=IO ;; mem | MEM) map=MEM if [ "$#" -lt 7 ] then echo "Need to specify host address for memory mapped host interface" exit 1 fi ;; *) echo "Error in mapping specification" exit 1 ;; esac bmode="BYTE" if [ $# -eq 8 ] then case "$8" in W* | w*) bmode="WORD" ;; *) ;; esac fi case "$6" in 280) tmp1=280; tmp2=282; tmp3=284; tmp4=286;; 288) tmp1=288; tmp2=28a; tmp3=28c; tmp4=28e;; 290) tmp1=290; tmp2=292; tmp3=294; tmp4=296;; 298) tmp1=298; tmp2=29a; tmp3=29c; tmp4=29e;; *) echo "Error in IO addr specification" exit 1 ;; esac # Set up bits/pixel flag case "$2" in 1) bpp=3; colors=2; BPPnC=F; BPPn8=B ;; 2) bpp=2; colors=4; BPPnC=E; BPPn8=A ;; 4) bpp=1; colors=16; BPPnC=D; BPPn8=9 ;; 8) bpp=0; colors=256; BPPnC=C; BPPn8=8 ;; *) echo "Error in bits/pixel specification" exit 1 ;; esac # Set up display resolution case "$1" in 640) xres=640; yres=480; pitch=1024;; 800) xres=800; yres=600; pitch=1024;; 1024) xres=1024; yres=768; pitch=1024;; 1280) xres=1280; yres=1024; pitch=2048;; 1600) xres=1600; yres=1200; pitch=2048;; 1024I) xres=1024; yres=768; pitch=1024;; 1024S) xres=1024; yres=1024; pitch=1024;; 1024F) xres=1024; yres=768; pitch=1024;; 1280P) xres=1024; yres=1280; pitch=1024;; *) echo "Error in display resolution specification" exit 1;; esac pitch=`expr $pitch \* $2` bmsize=`expr $pitch \* $yres` #set up Dram size case "$4" in 0) base=0x07f00000; size=130048 ;; .5) base=0x07c00000; size=523264 ;; 1) base=0x07800000; size=1047552 ;; 2) base=0x07000000; size=2096128 ;; 4) base=0x06000000; size=4193280 ;; *) ;; esac #set up video ram size case "$3" in .5) vtop=4194304 ;; 1) vtop=8388608 ;; 2) vtop=16777216 ;; *) ;; esac if [ "$4" -eq 0 ] then vtop=`expr $vtop - 1048576` fi if [ "$vtop" -lt "$bmsize" ] then echo "Not enough memory on this board for ${xres}x${yres} at $2 bits/pixel" exit 1 fi totmem=`expr $size \* 8 + $vtop - $bmsize` if [ "$totmem" -lt 4194304 ] then echo "Not enough memory on this board to run Xage" exit 1 fi rm -f config.age ( # Now output the config file echo "# Number Nine Graphics Xccelerator board configuration file" echo "# for $1 mode at $2 bits/pixel." echo "# Memory config is $3 MByte(s) Vram and $4 MByte(s) Dram." echo "# I/O host interface is at $6." if [ $map = "MEM" ] then echo "# Memory Host interface is at $7." echo "# Memory Host interface mode is $bmode." fi echo "# Configuration for $5 mapped board." echo "#" echo "# Date generated: `date`" echo "# Generator date: $gendate" echo "#" # Notes: # The number nine board has 5 (16 bit) control registers that # set various software/hardware options. Their names and address # are as follows: # # # 0x04300000 ==> register 0 # F E D C B A 9 8 7 6 5 4 3 2 1 0 # +--+--+---+---+--+--+--+--+---+-+-----+--+-+------+ # |BE|SE|VSC|VCK|CS|IV|IH|M1|SOG|8| BPP |M0|R| ZOOM | # +--+--+---+---+--+--+--+--+---+-+-----+--+-+------+ # # 0x04300010 ==> register 1 # F ED CBA 9 8 7 6 5 4 3 210 # +--+---+---+---+---+--+---+---+---+-+---+ # |SS|HID|BID|LED|SS0|SR|459|478|VCP|B|MON| # +--+---+---+---+---+--+---+---+---+-+---+ # 0x04300020 ==> register 2 # FEDC B A9 87 6 5 4 3 2 1 0 # +-----+----+--+---+-+--+--+-+---+---+--+ # |LEVEL|BOOT| R|EMU|V|2M|8D|R|DTP|NOI|4V| # +-----+----+--+---+-+--+--+-+---+---+--+ # 0x04000800 ==> map config 0 # 7 6 5 4 3 2 1 0 # +-+-+-+---+---+----+---+---+ # |SWAP |BKE|MDE|IOHE|MHE|MPE| # +-+-+-+---+---+----+---+---+ # 0x04000810 ==> map config 1 # 7 6 5 4 3 2 1 0 # +---+---+----+----+-+---+--+---+ # |DMA|PWE|BRST|IOHW|R|MHW|WP|VGA| # +---+---+----+----+-+---+--+---+ # # Of interest in register 0 is what #9 calls BPP (bits per pixel) # This is coded in bits 4, and 5 in the following fashion: # # 00 ==> 8 bits/pixel (power up default) # 01 ==> 4 bits/pixel # 10 ==> 2 bits/pixel # 11 ==> 1 bits/pixel # In 1280 mode, Zoom must be set equal to BPP. # # Depending on the monitor you need to set the kind of sync. # This file is for an NEC Multisync type monitor which supports # CS (composite sync) so, bit B must be turned on and bits # A, 9, 7 must be turned off. echo "" echo "STARTUP" echo "#" echo "# The video parameters came from the synctab.asm file (NNios)" echo "#" if [ $map = "MEM" ] then echo "# 1. Relocate memory to $7:0000." echo "# Do this by writing $haddrlo to the HIRR at addr 0x04000400" echo "# and $haddrhi to 0x04000410." echo "#" echo "# 2. Turn on the memory addressing bit. This is bit 1 in the configuration" echo "# register at addr 0x04000800." echo "#" echo "# 3. Toggle the video from the VGA to the 34010." echo "#" echo "# set up the host address" else echo "#" fi echo "#" if [ $map != "IO" ] then echo "MIO 0x0400, 0x$tmp1 # Host addr low" echo "MIO 0x0400, 0x$tmp2 # Host addr hi" echo "MIO $haddrlo, 0x$tmp3 # Host data (Set half of host interface relocation register)" echo "#" echo "MIO 0x0410, 0x$tmp1 # Host addr low" echo "MIO 0x0400, 0x$tmp2 # Host addr hi" echo "MIO $haddrhi, 0x$tmp3 # Host data (Set half of host interface relocation register)" echo "#" echo "MIO 0x0800, 0x$tmp1 # Host addr low" echo "MIO 0x0400, 0x$tmp2 # Host addr hi" echo "MIO 0x0606, 0x$tmp3 # Host data (Shut off MDA and memory windows, turn on HI)" echo "# Check Byte/Word mode" echo "MIO 0x0810, 0x$tmp1 # Host addr low" echo "MIO 0x0400, 0x$tmp2 # Host addr hi" if [ $bmode = "WORD" ] then echo "MIO 0xF5F5, 0x$tmp3 # Host data (config register hi)" else echo "MIO 0xF1F1, 0x$tmp3 # Host data (config register hi)" fi echo "#" echo "MVL 0x04000800,R5" else echo "MVL 0x04000800,R5" echo "M3 &R5, R7" echo "AN 0xFEFE, R7 # Shut off memory windows" echo "M3 R7, &R5" fi echo "MVL 0x04300020,R6" echo "M3 &R6, R7" echo "AN 0x0180, R7" echo "SB 0x0080, R7" echo "SZ R7" echo "SK 1" echo "SK 9 # Skip if not previously doing MDA" echo "MVL 0x04000600,R6" echo "M3 0x00, &R6" echo "AD 0x10, R6" echo "M3 0x00, &R6" echo "AD 0x10, R6" echo "M3 0x8282, &R6 # Point emulation relocation register into ROM" echo "M3 &R5, R7" echo "OR 0x0808, R7 # Turn MDA back on" echo "M3 R7, &R5" echo "#" echo "M3 0xd800, 0xC0000100 # Halt" echo "MVL 0x04300020,R5" echo "M3 &R5, R7" echo "AN 0x40, R7" echo "MVL 0x04300010,R6" echo "M3 0x8060, &R6 # Turn LED red" echo "SZ R7" echo "SK 1" echo "SK 17" echo " M3 &R5, R7" echo " AN 0xFFC0, R7" echo " OR $memflag, R7" echo " M3 R7, &R5" echo " MVL 0x044000A0, R5" echo " MVL 0xFFFFFEE0, R7" echo " M3 &R5, R4" echo " M3 R4, &R7" echo " MVL 0x044000B0, R5" echo " MVL 0xFFFFFEF0, R7" echo " M3 &R5, R4" echo " M3 R4, &R7" echo " M3 0x5B00, 0xC0000100 # Reset" echo " # start loop" echo " M3 &R6, R7" echo " AN 0x200, R7" echo " SZ R7" echo " SK -4 # wait for LED to turn green" echo "# end branch" echo "#" echo "M3 0xd800, 0xC0000100 # Halt" if [ $bmode = "WORD" ] then echo "M3 0xF5F5, 0x04000810 # Shut off VGA loop-through" else echo "M3 0xF1F1, 0x04000810 # Shut off VGA loop-through" fi echo "M3 0x0000, 0xFFFFFB00 # Clear the NNios present flag" echo "#" case "$1" in 1280) echo "M3 0x09$BPPnC$BPPn8, 0x04300000 # Setup crystal and other stuff" ;; 800) echo "M3 0x08${BPPnC}1, 0x04300000 # Setup crystal and other stuff" ;; 1024) echo "M3 0x08${BPPnC}0, 0x04300000 # Setup crystal and other stuff" ;; 640) echo "M3 0x09${BPPnC}9, 0x04300000 # Setup crystal and other stuff" ;; 1024I) echo "M3 0x0F${BPPnC}0, 0x04300000 # Setup crystal and other stuff" ;; 1024S) echo "M3 0x08${BPPnC}8, 0x04300000 # Setup crystal and other stuff" ;; 1024F) echo "M3 0x08${BPPnC}8, 0x04300000 # Setup crystal and other stuff" ;; 1280P) echo "M3 0x09$BPPnC$BPPn8, 0x04300000 # Setup crystal and other stuff" ;; *) ;; esac if [ "$1" -eq 1280 -o "$1" -eq 1280P ] then echo "M3 0x8260, 0x04300010 # Turn on 1280 mode, leave LED green" else echo "M3 0x0200, 0x04300010 # Turn off 1280 mode, leave LED green" fi # Set up sync parameters case "$1" in 640) echo "M3 0x16, 0xC0000000 # HESYNC" echo "M3 0x22, 0xC0000010 # HEBLNK" echo "M3 0xC2, 0xC0000020 # HSBLNK" echo "M3 0xC8, 0xC0000030 # HTOTAL" echo "M3 0x1, 0xC0000040 # VESYNC" echo "M3 0x17, 0xC0000050 # VEBLNK" echo "M3 0x1F7, 0xC0000060 # VSBLNK" echo "M3 0x1FC, 0xC0000070 # VTOTAL" echo "MVL `expr 4 '*' $2 + 61440`, R7 # DPYCTL" echo "M3 R7, 0xC0000080 # DPYCTL" ;; 800) ################################################### #34.5 KHz Horiz. #57.3 Hz Vert. echo "M3 0x007, 0xC0000000 # HESYNC" echo "M3 0x02E, 0xC0000010 # HEBLNK" echo "M3 0x34E, 0xC0000020 # HSBLNK" echo "M3 0x380, 0xC0000030 # HTOTAL" echo "M3 0x004, 0xC0000040 # VESYNC" echo "M3 0x008, 0xC0000050 # VEBLNK" echo "M3 0x260, 0xC0000060 # VSBLNK" echo "M3 0x26F, 0xC0000070 # VTOTAL" echo "MVL `expr 4 '*' $2 + 61440`, R7 # DPYCTL" echo "M3 R7, 0xC0000080 # DPYCTL" ;; 1024) echo "M3 0x7, 0xC0000000 # HESYNC" echo "M3 0x1E, 0xC0000010 # HEBLNK" echo "M3 0x9E, 0xC0000020 # HSBLNK" echo "M3 0xA4, 0xC0000030 # HTOTAL" echo "M3 0x4, 0xC0000040 # VESYNC" echo "M3 0x22, 0xC0000050 # VEBLNK" echo "M3 0x322, 0xC0000060 # VSBLNK" echo "M3 0x327, 0xC0000070 # VTOTAL" echo "MVL `expr 4 '*' $2 + 61440`, R7 # DPYCTL" echo "M3 R7, 0xC0000080 # DPYCTL" ;; 1280) echo "M3 0x7, 0xC0000000 # HESYNC" echo "M3 0x16, 0xC0000010 # HEBLNK" echo "M3 0x66, 0xC0000020 # HSBLNK" echo "M3 0x69, 0xC0000030 # HTOTAL" echo "M3 0x3, 0xC0000040 # VESYNC" echo "M3 0x23, 0xC0000050 # VEBLNK" echo "M3 0x423, 0xC0000060 # VSBLNK" echo "M3 0x429, 0xC0000070 # VTOTAL" echo "MVL `expr 8 '*' $2 + 61440`, R7 # DPYCTL" echo "M3 R7, 0xC0000080 # DPYCTL" ;; 1600) ;; 1024I) echo "M3 0xC, 0xC0000000 # HESYNC" echo "M3 0x1B, 0xC0000010 # HEBLNK" echo "M3 0x9B, 0xC0000020 # HSBLNK" echo "M3 0x9D, 0xC0000030 # HTOTAL" echo "M3 0x1, 0xC0000040 # VESYNC" echo "M3 0x16, 0xC0000050 # VEBLNK" echo "M3 0x194, 0xC0000060 # VSBLNK" echo "M3 0x196, 0xC0000070 # VTOTAL" echo "MVL `expr 4 '*' $2 + 45056`, R7 # DPYCTL" echo "M3 R7, 0xC0000080 # DPYCTL" ;; 1024S) echo "M3 0x7, 0xC0000000 # HESYNC" echo "M3 0x1F, 0xC0000010 # HEBLNK" echo "M3 0x9F, 0xC0000020 # HSBLNK" echo "M3 0xA0, 0xC0000030 # HTOTAL" echo "M3 0x4, 0xC0000040 # VESYNC" echo "M3 0x20, 0xC0000050 # VEBLNK" echo "M3 0x420, 0xC0000060 # VSBLNK" echo "M3 0x424, 0xC0000070 # VTOTAL" echo "MVL `expr 4 '*' $2 + 61440`, R7 # DPYCTL" echo "M3 R7, 0xC0000080 # DPYCTL" ;; 1024F) echo "M3 0x7, 0xC0000000 # HESYNC" echo "M3 0x1F, 0xC0000010 # HEBLNK" echo "M3 0x9F, 0xC0000020 # HSBLNK" echo "M3 0xA0, 0xC0000030 # HTOTAL" echo "M3 0x4, 0xC0000040 # VESYNC" echo "M3 0x4A, 0xC0000050 # VEBLNK" echo "M3 0x34A, 0xC0000060 # VSBLNK" echo "M3 0x368, 0xC0000070 # VTOTAL" echo "MVL `expr 4 '*' $2 + 61440`, R7 # DPYCTL" echo "M3 R7, 0xC0000080 # DPYCTL" ;; *) ;; esac echo "M3 0xFFFC, 0xC0000090 # DPYSTRT" echo "M3 0x0, 0xC00000A0 # DPYINT" echo "M3 0xC, 0xC00000B0 # CONTROL" echo "M3 0x0, 0xC00001b0 # DPYTAP" if [ "$1" -eq 1280 -o "$1" -eq 1280P ] then echo "# Initialize Bt459 DAC" echo "MVL 0x04200020, R6" echo "M3 0x02, 0x04200010 # Subtract 1 from index when accessing Control reg" echo "M3 0x00, 0x04200000" echo "M3 0x4`expr 4 + $bpp`, &R6 # 4:1 multiplex, overlay 0 disable, $2 bits/pixel" echo "#" echo "# Check for sync on green" echo "MVL 0x04300010, R5" echo "M3 &R5, R4" echo "AN 0x0800, R4" echo "MVL 0x4C,R5 # X-windows overlay, 7.5 IRE pedestal" echo "SZ R4" echo "SK 1" echo "OR 0x80,R5 # set sync on green" echo "#" echo "M3 R5, &R6" fi echo "END" echo "" echo "" echo "340DAC" if [ "$1" -eq 1280 ] then echo "# Brooktree Bt459 DAC" echo "MVL 0x04200000, R5" echo "MVL 0x04200010, R6" echo "MVL 0x04200030, R7" echo "RV R0, R0 # Bit reverse the 8-bit index" echo "MVS 0x00, &R6" if [ "$2" -ne 8 ] then echo "SR `expr 8 - $2`, R0 # Lop off all but $2 bits/pixel" fi echo "MVS R0, &R5" echo "SR 8, R1" echo "MVS R1, &R7" echo "SR 8, R2" echo "MVS R2, &R7" echo "SR 8, R3" echo "MVS R3, &R7" else echo "# Brooktree Bt478 DAC" echo "MVL 0x04100000, R6" echo "MVS R0, &R6" echo "MVL 0x04100010, R6" echo "SR 8, R1" echo "MVS R1, &R6" echo "SR 8, R2" echo "MVS R2, &R6" echo "SR 8, R3" echo "MVS R3, &R6" fi echo "END" echo "" echo "SHUTDOWN" echo "# now jump to nmi vector" echo "MVL 0xFFFFFFE0,R6" echo "MVL 0xFFFFFEE0,R5" echo "M3 &R6, R7" echo "M3 R7, &R5" echo "MVL 0xFFFFFFF0,R6" echo "MVL 0xFFFFFEF0,R5" echo "M3 &R6, R7" echo "M3 R7, &R5" echo "M3 0x5B00, 0xC0000100 # Reset" echo "END" echo "" echo "CONFIG" echo "ScreenADDR 0 # starting addr of screen (frame buffer)" echo "Pitch $pitch # pitch = displaywidth*bitsperrgbvalue" echo "screenwide 40 # measured in centimeters" echo "screenheight 30 # measured in centimeters" echo "displaywidth $xres # pixels across" echo "displayheight $yres # pixels down" echo "bitsPerRGBValue 24 # bits per red + bits per green + bits per blue" echo "ColormapEntries $colors # $colors combinations w/ $2 bits (bitsperrgbvalue)" echo "nplanes $2 # bits per pixel" echo "Class PseudoColor # either pseudocolor, staticgrey or grayscale" echo "END" echo "" echo "Memory" echo "# this board has $3 MByte(s) Vram and $4 MByte(s) Dram." echo "$base $size # ($4 Mbyte(s) Dram)" if [ "$vtop" -ne "$bmsize" ] then echo "$bmsize `expr \( $vtop - $bmsize \) / 8` # Use extra video ram" else echo "# No extra video ram to use" fi echo "END" echo "" echo "host" echo "mapping $map" if [ "$map" != "IO" ] then echo "HADDRL 0x${haddr}e00" echo "HADDRH 0x${haddr}f00" echo "HCTRL 0x${haddr}d00" echo "HDATA 0x${haddr}000" else echo "HADDRL 0x$tmp1" echo "HADDRH 0x$tmp2" echo "HDATA 0x$tmp3" echo "HCTRL 0x$tmp4" fi echo "HLEN 0x100" echo "end" ) > config.age