home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
VRAC
/
TVPROMPT.EXE
/
TV_PROMP.DOC
< prev
next >
Wrap
Text File
|
1992-06-02
|
6KB
|
115 lines
This is a scrolling teleprompter type program. It uses CGA 640x200
mode and is intended to be run on a CGA board with NTSC composite video
output. It is a small example of useful multitasking in Ada. It may also
be a useful program for a TV studio that depends on old, cheap, donated
equipment since it will run on rather old, slow CGA PCs. Note though that
not all CGA boards are compatible - some may produce excessive snow or
fail to scroll properly.
Running the program
To run the program type
tv_prompt [optional script file name]
and the computer will load and start scrolling the script file.
Available keyboard controls are:
1 to 9 digits from 1 to 9 specify speed. 1 is slowest, 9 fastest.
0 (zero) pause scrolling
+ (plus) scroll 10% faster
- (minus) scroll 10% slower
. (period) stop the program
Any other character starts a line of text to be interspersed with the
script file (but white letters on black background) and scrolled. A
carriage return or hitting the right hand side (19 characters) ends a
line of text input at which point it will be scrolled. When the script
file is done, the program will simply scroll white space on the screen.
You can type things from the keyboard and they will be scrolled. This
might be useful for instructions to talent when there is no teleprompter
script. If you start the program with a simple 'tv_prompt' without naming
a script file, it will display white space except when you type something
at the keyboard.
Internals
Since a teleprompter is normally read from some distance it displays
letters 16 pixels high by 32 wide. They are simply blown up from the CGA
BIOS letter patterns, which looks just fine from 10 feet. This allows
only 20 characters across the screen, which means words will often be
broken. The program ignores line breaks in the input file and if it
finds itself breaking a word it will instead search back for a space and
break on that space. (This applies to the text script file, not operator
typeins, which are presumably very short.)
If the operator types in text which is longer than one line, the program
will attempt not to intermix script file and operator type in. The
algorithm is to defer reading the script file until either the operator
enters a CR or the operator has not typed anything for 3 seconds.
The program consists of three simultaneous tasks: 1) Screen.Scroller
keeps the screen scrolling smoothly, accepting new text as space opens at
the bottom of the screen, 2) Reader.Read_File reads the script file,
breaking it into short lines and feeding them to Screen.Scroller, and 3)
the main program (initial task) processes operator keystrokes for
commands or interjected lines of text, supervising the other tasks as
appropriate.
Files
interface specifications
ALTSLICE.LIB movmem, setmem
COMMAND_.LIB get parts of original command line
CRT.LIB deal with CGA mode, scrolling 6845
DOS_IO.LIB MSDOS file IO interface
LETTERS.LIB bit patterns of letters
READER.LIB script file reader
SCREEN.LIB scroll text at variable speed
internal code
CRT.PKG deal with CGA mode, scrolling 6845
LETTERS.PKG bit patterns of letters
READER.PKG script file reader
SCREEN.PKG scroll text at variable speed
main program
TV_PROMP.PKG handle operator keyins, control
Note on Ada tasking syntax
This is a simple program so it uses simple tasks - no task types, dynamic
creation of tasks, etc. In this program all three tasks start running
essentially at the beginning of the program. They communicate by
rendezvous: one task calls an entry point of another and the other
accepts the call. Tasks proceed until they wish to accept calls from
another task or initiate calls of another task. During a rendezvous the
caller is suspended until the callee lets it go. Syntactically, 'accept
simple_entry(parameters...);' lets the callee continue once the
parameters have been passed, whereas 'accept simple_entry(parameters...)
do statements...;end' lets the callee proceed only when the 'end' of the
accept statement is reached.
An accepting task may execute either a bare 'accept' statement, in which
case it is suspended until someone calls that entry, or a 'select ...
accept ... accept ... delay ... else' to allow any of several entries
to be called, or a delay to expire, or it can simply proceed if there are
no current callers.
A calling task proceeds until it either calls an entry of another task,
in which case it is suspended until that task finishes accepting its
call, or it may use a select with alternatives to call another task only
if that task is immediately, or within some given delay time, willing to
accept its call. Note that TV_prompt has code to handle a Tasking_Error
in case Reader.Read_File terminates (runs into EOF on the script file)
between the time TV_Prompt tests if it is callable or terminated and the
time TV_Prompt actually attempts to call an entry in Reader.Read_File.
I would greatly appreciate any comments and suggestions.
Thanks,
Tom Moran BIX tmoran
CIS 71541,3125
2113665@MCIMail.com
voice (408) 741-5952
June 2, 1992