# Copyright (c)1994-2000 Begemot Computer Associates. All rights reserved.
# See the file COPYRIGHT for details of redistribution and use.
#
# $Id: p11conf.in 509 2004-10-19 08:21:44Z brandt $

#
# This configuration file is somehow tailored to my setup, but it is usable
# as a fallback in any case. Make a private copy and change it as you need it.
#

#
# Documentation for the configuration syntax is not yet ready :-( so here
# is a short version. You may look also in main.c
#
# The file is read line by line. If the line is empty or starts with a #
# it is ignored. The first word of each line is a keyword and determines how
# the rest of the line is interpreted:
#
#  define NAME [VALUE]
#	Define a variable (or change it's value). Variables can be access by
#	the $(NAME) construct. Substitution takes place on VALUE, but not on
#	NAME. Referencing an undefined variable is an error unless the form
#	$(NAME?) is used, in which case an empty string is substituted.
#
#  set OPTION [VALUE]
#	Set OPTION to value and define a variable OPTION with the given VALUE.
#	There are global and controller specific options. Global options
#	should be set outside all controller declarations (outside 'ctrl'-'end'
#	blocks.
#	Subsitution is done on VALUE but not on OPTION.
#	Options are:
#
#	libpath		- this is a colon-separated list of paths where help
#			  and configuration files are looked
#			  for as well as rom images (global).
#	iodir		- directory for the IO programs (global).
#	clock_rate	- clock ticks per second (usually 50 or 60). (global).
#	cpu_options	- these are the jumpers on the KDJ11A (ctrl KDJ11A).
#	csw_enable	- enable the console switch register (default) (ctrl KDJ11A).
#	csw		- starting contents of the switches (ctrl KDJ11).
#	maxreq		- maximum number of pending line clock interrupts
#			  (default is 1) (ctrl KDJ11A).
#	localtime	- toy clock should report local time, not GMT (ctrl toy).
#
#  include FILE
#	Include the given FILE. Substitution takes place on FILE.
#
#  print LINE
#	Print LINE on stdout after performing substitutions.
#
#  if EXPR
#	Substitute on EXPR, evaluate it and process the following lines up to
#	a matching else, elif of endif if EXPR is non-zero. There is a limit
#	on nested if's.
#
#  elif EXPR
#	If all if-clauses where false up to now, perform substitution, compute
#	EXPR and process all lines up to the matching else, elif or endif if
#	EXPR is non-zero.
#
#  else
#	If all if-clauses where false up to now, process all lines up to the
#	matching endif.
#
#  endif
#	Ends an if construct.
#
#  ctrl NAME [ARGS]
#	Plug in the given controller into the backplane. Substitution is done
#	on ARGS. What ARGS are needed depends on the concrete controller.
#	Note, that controllers are plugged in bottom-down, i.e. the last one
#	gets nearest to memory (which is automatically inserted), which in turn
#	gets nearest to the CPU. The controller line may be followed by
#	device lines which must be followed by end 'end' line.
#
#  dev [ARGS]
#	Connect a device to the current controller. Substitution is done on
#	ARGS and if this yields empy ARGS, the line is ignored. ARGS depends
#	on the controller.
#
#  end
#	End the current controller definition.
#
#  eval NAME [EXPR]
#	Compute EXPR after performing substitutions and assign the result as
#	a signed decimal integer to NAME.
#
#
# Expressions consists of the usual +, -, *, /, %, (, ), == and !=.
# The following builtin functions are available:
#
#	acess(FILE, MODE)
#		Check whether FILE is accessable (mode may be one or more
#		of 'f', 'r', 'w' and 'x'. Returns 1 if ok.
#
#	accessp(FILE, MODE, PATH)
#		Check whether there is a FILE in PATH that is accessible.
#
#	eq(STR1,STR2)
#		Compare the two strings after stripping leading and trailing
#		space and return 1 of they are equal.
#
#	exec(COMMAND)
#		Execute COMMAND with sh -c and return the exit code of the
#		shell (this may or may not be the exit code of the command).
#
##

if !defined(diskdir)
  define diskdir /home/private/p11/disks
endif

define RP_211_BOOT	0 $(diskdir)/RP_211bsd_root 1999
define RP_41_BOOT	0 $(diskdir)/RP_rsx_4.1boot 2000
define RP_41_SRC	1 $(diskdir)/RP_rsx_4.1src 2001

#
# standard rlv12 controller with four drives attached
# numbers are csr, vector, interrupt level and ms between msyncs
#
ctrl rl 017774400 0160 4 60000
end

#
# rp06 disk controller with 2 drives attached
# numbers are csr, vector, interrupt level and ms between msyncs
#
ctrl rp 017776700 0254 5 600000
if defined(BOOT)
 if eq($(BOOT),211)
  print Booting 2.11BSD
	dev $(RP_211_BOOT)
 elif eq($(BOOT),RSX)
  print Booting RSX4.1
	dev $(RP_41_BOOT)
	dev $(RP_41_SRC)
 endif
endif
end

#
# kl11a async interface with up to 4 lines
# kl0 is console
# numbers are csr, vectors, interrupt level, driver program and parameters
# for driver program
# drivers:
#	tty_tty [-7] device
#	tty_net [-7] [-t] [-lLogFile] port-number
#	tty_xterm [-7] [-t title] [-g geometry] [-p position] [-i] [-x xterm-args]
#	tty_fifo [-7] fifo-name
#	tty_file [-7] [-p pidfile] [-e eof-seq] [-c] file-or-prog [args...]
#
ctrl kl
	dev 017777560 060 064 4 tty_net -t -7 10000
	dev 017776500 0300 0304 4 tty_net -t -7 10001
	dev 017776510 0310 0314 4 tty_fifo /tmp/fifo
end

#
# MRV12 rom option
# args are csr and file containing boot-rom
#
if !defined(BOOT_ROM)
  if access(./boot.rom, r)
    define BOOT_ROM ./boot.rom
  elif access(Boot/boot.rom, r)
    define BOOT_ROM Boot/boot.rom
  else
    define BOOT_ROM boot.rom
  endif
endif
ctrl mr 017777520 $(BOOT_ROM)
end

#
# parallel lp interface
# numbers are csr, vector and interrupt level
# the device line contains either a filename or a '|' which creates a pipe
# followed by the program to pipe in and optional args
#
ctrl lp 017777514 0200 4
end

#
# DEQNA ethernet controller
# I can't distribute my ROM's image. So check whether there is any. If not
# don't plug in the thing. You can create a file consisting of 0's and use
# that instead. Use either tun or tap (hey - tap let's you use MOPR/MOPDL or
# DreckNet or ...)
#
if !defined(QNA_ROM)
  if access(./qna.rom, r)
    define QNA_ROM ./qna.rom
  elif accessp(qna.rom, r, $(libpath))
    define QNA_ROM qna.rom
  endif
endif

if defined(QNA_ROM)
  ctrl qna 017774440 5 0x08:0x00:0x2b:0x07:0x82:0x6c 0xf8:0x7a $(QNA_ROM)
# FreeBSD:
	dev epp_tun /dev/tun0 0x08:0x00:0x2b:0x07:0x82:0x6c 0x08:0x00:0x2b:0x07:0x82:0x00
# Linux:
	dev epp_tun /dev/net/tun 0x08:0x00:0x2b:0x07:0x82:0x6c 0x08:0x00:0x2b:0x07:0x82:0x00

# FreeBSD:
#	dev epp_tap /dev/tap0
# Linux:
#	dev epp_tap /dev/net/tun

#	eval dummy exec(ifconfig tap0 <your host> up)
#	eval dummy exec(ifconfig tap0)
  end
endif

#
# Tape controller
#
ctrl tm 017772520 0224 5
end

#
# The toy clock.
#
# Beware of the consequences of the year offset with regard to DST rules:
# Europa changed the winter time switching point from the last sunday in
# september to the last sunday in october in 1996. If you set the year_offs
# such that your year falls before that point and your current date is between
# these two dates, your hour will shift by one (because you shift from a
# DST date to a non-DST date).
#
ctrl toy 017777526
#  set localtime yes
#  set offs_year 10
#  set settoy 12:30:00 12/31/74
end

#
# Plug in the memory board.
#
ctrl mem
end

#
# Plug in processor board
#
ctrl KDJ11A
  if defined(CSW)
    set csw $(CSW)
  endif
end
