This is only a preview of the May 1991 issue of Silicon Chip. You can view 41 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Articles in this series:
Articles in this series:
Items relevant to "13.5V 25A Power Supply For Transceivers, Pt.1":
Articles in this series:
Articles in this series:
Articles in this series:
|
COMPUTER BITS
BY JENNIFER BONNITCHA
Colouring your PC world
Following on from last month's article, this
month we have more adventures with the
PROMPT command to set screen colours and
customise your display.
The DOS command PROMPT lets
you change the dull, boring C> to
almost anything you like - you can
change the colours, location and the
information shown at the prompt.
PROMPT changes video attributes
only. You can create a wide range of
output possibilities by using symbolic
replacements called metasymbols.
You must precede each character with
a dollar sign ($) and note that unlike
the ANSI sequences, PROMPT is not
case sensitive. Table 1 shows the details.
PROMPT $P$G is probably the most
popular way to customise the system
prompt. With this sequence, you can
see instantly the current drive and
path, eg, C: \ WP51 \DATA>. PROMPT
also lets you add instructions:
any number of times through the keyboard or executed from within a batch
file.
Display screen attributes
This command displays on one line
the drive and path ($P), a space, the
date ($D), a space and the time ($T).
On the second line ($_), it displays
the message What's Up Doc? and the
greater than sign ($G).
The Set Graphics Rendition command ESC[#; ... ;#m sets the screen display attributes. The command sequence may contain one or more of
the parameters listed below. You
should, however, check your DOS
manual for any additions or alterations from your computer's manufacturer. Most monitors today support
graphic functions, therefore you can
call the graphic functions from the
following list. The functions remain
until the next occurence of a Set
Graphics Rendition escape sequence.
Setting and adjusting the screen
colours and background intensity of
the monitor is quite useful. ANSI uses
the same colour codes for both the
foreground and background. You start
with the digit 3 for foreground colours and the digit 4 for background
colours . In addition, you can specify
several attributes such as high intensity (bold), reverse video etc.
Escape sequences
O All attributes off
As noted briefly last month, you
can send escape sequences to
ANSI.SYS using the PROMPT command $E which represents the escape
character.
There are several advantages when
you use PROMPT, because you can
easily change the instructions you
send and the commands can be used
1 High intensity display on (ie,
bright)
2 Normal intensity display on
4 Underline (monochrome monitor
only)
5 Blink on
7 Reverse video on
8 Concealed on, no display
(invisible)
PROMPT $P $D $T$_What's Up
Doc?$G
76
SILICON CHIP
Foreground
30 Black
31 Red
32 Green
33 Brown
34 Blue
35 Magenta (purple)
36 Cyan (light blue)
37 White
Background
40 Black
41 Red
42 Green
43 Brown
44 Blue
45 Magenta
46 Cyan
47 White
Note that turning on high intensity
brightens the foreground colours only,
with the exception that black turns to
grey and brown to yellow.
You can set one or more numerical
values. Make sure you use only the
semicolon to delimit (separate) the
parameters in the escape sequence.
Using the above table, you could set
the following:
ESC[37m - Foreground colour to
white
ESC[44m - Background colour to
blue
ESC[37;44m - Foreground and
background colours simultaneously
ESC[1;37;44m - Foreground to bright
(1) white (37) on a blue (44) background
It's good practice to use the three
parameters to specify colour changes.
Keep the parameters together rather
than issuing one by itself. Note that
changing the foreground colour
doesn't turn the intensity on or off you need to do that with the O or 1
parameter - and that parameter O also
clears the colours to their default value
of white on black.
You could build a set of simple
batch files to show different coloured
prompts for directories or drives so
you can see at a glance what's going
on, such as:
<at>ECHO OFF
C:
PROMPT $E[36m$P$G
TABLE 1
SPECIFY THIS
CHARACTER
$
b
d
e
g
I
n
p
t
V
TO GET THIS PROMPT
The $ character
The I character
The current date
Escape character (ASCII code 1b hex, 27 decimal)
The > character
The < character
The default drive
The working directory of the default drive
The current time
The DOS version number
Carriage return, linefeed sequence. Note that this is
the underscore character.
This specifies cyan as the foreground colour with the current drive
and path.
<at>ECHO OFF
C:
CD\DBASE
PROMPT $E[1;37;45m$P$G
This changes to the dBASE
subdirectory and alters the prompt to
show bright (1) white (37) on a magenta background (45).
You may like to set your prompt to
a different colour but have the text
you type at the prompt return to normal video mode:
PROMPT $E[7m$P$G$e[m
Date & time display
For a really fancy display, complete
with date and time display (which
only updates when you press the Enter key):
PROMPT $e[s$e[25;56H$e[1;37;45m
$t$h$h$h$h$h$h $d$e[0m$e[u$p$g
Phew! Take a close look at the above
command which need not necessarily be entered in this sequence. You
can enter the ANSI comm~nds in any
sequence, provided the parameters for
each are entered correctly.
$e[s Saves the cursor's current position.
$e[25;56H Moves the cursor to row
25, column 56 (bottom righthand corner of the screen).
$e[1 ;37 ;45m specifies bright white on
a magenta background.
$t displays the current time.
$h$h$h$h$h$h displays the current
time as hours and minutes.
(space) the space character separates
the time from the next parameter.
$d displays the current date.
$e[0m resets the text to normal.
$e[u returns the cursor to its starting
position.
$p displays the current drive and path
information.
$g displays the greater than sign (> ).
The space in the command is critical to the separation of the time and
date display. The space character is
treated by the PROMPT command just
like any other keyboard character and
will appear in the final DOS prompt
line.
You may need to set your screen
colours when you exit a program, so it
is worthwhile to include the prompt
line in any batch files you may be
using. Experiment with the following
batch fil e, TEST5.BAT (the IF, GOTO
and % statements will be covered in a
future article):
<at>ECHO OFF
CLS
IF !NORMAL==!%1 GOTO %1
IF !BRIGHT==!%1 GOTO %1
IF !REVERSE== !%1 GOTO %1
GOTO HELP
:NORMAL
PROMPT $e[0m$P$G
GOTO FINISH
:BRIGHT
PROMPT $e[0;1m$P$G
GOTO FINISH
:REVERSE
PROMPT $e[0;7m$P$G
GOTO FINISH
:HELP
ECHO THE PROPER FORMAT IS
ECHO either TEST5 NORMAL
ECHO OR TEST5 BRIGHT
ECHO OR TEST5 REVERSE
ECHO MAKE SURE YOU TYPE THE
REQUIRED ATTRIBUTE IN
UPPERCASE
GOTO FINISH
:END
CLS
:FINISH
If you type the attribute in other
than uppercase, the batch file displays the help messages shown above.
Naturally, you can include any additional colours as required.
It sometimes helps to have the entire screen change to the new colour/
intensity, etc immediately. If you add
the ESC [2J sequence to the end of any
command, the entire screen is cleared
and your choices are in effect.
Set display mode
You may also need to reset the
HEAVY DUTY TV/SPEAKER
WALL-CEILING BRACKETS
The M83 and M85 are
heavy duty two platform
mounting brackets
designed for securing
small TVs and speakers
to walls, ceilings, desks or
bench tops. When
mounted both units can
··
be rotated
, 360 degrees
~
~th_•::,\t_'W; ~
__--:::~rto-a-·-~
~~4i
1l''rt-___;j
I
as .well as being swivelled
up or down to any viewing
or listening angle. The
metal platforms have
predril/ed holes for
mounting ana are easily
adjusted with a large al/en
key supplied with the unit.
,
·
·9i
Imported and distributed by:
ARISTA
ELECTRONICS
Available through the following retailers:
David J Reid
All Electronic
Electronics.
Components.
127 York Street.
118 Lonsdale St.
Sydney. 2000.
Melbourne. 3000.
NSW. (02) 267-1385.
Vic. (03) 662 3506.
MAY1991
77
THE BARGAINS CONTINUE
AT SHERIDANS
SURPLUS POWER SUPPLY
We have secured a limited quantity of these power
supplies. Input 180 - 280V AC 45 - 65 Hz. Output
+5.2V at 10A, + 12V at 4A, -12V at 2A, 24V at 2A. Total
output power 130W continuous, 160W peak.
Efficiency - greater than 70% at fu ll load.
WORTH
AROUND
$280.00
OUR PRICE $69.95
COMPUTER BITS ...
screen mode (the screen width of 40 or 80 columns),
which can be accomplished to a certain degree using the
external DOS command MODE. MODE BW40 sets the
display to black and white, and to 40 characters per line;
MODE COBO sets the display to 80 characters per line
colour. Function h of ANSI.SYS gives you much more
flexibility since you can access all of the possible CGA
text and graphics modes, including those which MODe
ignores.
Using the set mode ESC[ =#h command, you can set the
display mode according to the parameter (#) specified.
Reset the display mode using ESC[=#l. The character
wrap functions ESC[=#h and ESC[#l (lowercase letter
"el") let you decide whether the characters wrap at the
end of each line. Table 2 shows the details.
FORCED AIR COOLED TRIODE
TABLE2
These are a quality triode and valued at nearly
double the asking price. Spee sheets are available. Their type number is 3J/170E. Rated at
2KW.
PARAMETER
0
1
BARGAIN PRICED
AT $999.00
SUPER CAPS
.047 5.5v KEEP THE
VOLTAGE IN YOUR MEMORY
80 cents
each
240v MOTOR BY
JAPAN SERVO co~
80mm x 80mm x 75mm
1800 rpm 100mA with 3uF
STARTER CAP ·
THERMALLY
PROTECTED
16
17
18
19
1500v 2.5a Replaces BU208
Only
$4.95
.~
Character wrap
240v/110v lmput
Output
14.SV <at> 5A
SV<at> .SA
Has internal Sheild
$25.00 ea
Sheridans are beginning to bring in a range of TVVideo spare parts. Please send your name & address
for your copy of our catalogue.
SHERIDAN ELECTRONICS, I
328 ELIZABETH ST,
.
SURRY HILLS, NSW, 2010
TELEPHONE: {02) 281 7727
78
SILICON CHIP
colou r
mono (EGA)
colour (EGA)
mono (VGA)
colour (VGA)
colour
The parameters for Reset Mode are the same as for Set
Mode, except for parameter 7 which resets the mode that
causes wrapping at the end of each line.
BU205
TOROIDAL TRANSFORMER
(Cnr Kippax St. opp. Central
Station & Dental Hospital)
640x200
640x350
640x350
640x480
640x480
320x200
$19.95each
PROJECT CASE
In . two parts amd measures
250(W) x 130(0) X 110(H),
screw mounting holes . Has
many uses.
ONLY
$14.95
2
3
4
5
6
7
DOS 4.x only
14
15
FUNCTION
40x25 black and white
40x25 colour
80x25 black and white
80x25 colou r
320x200 colour
320x'200 black and white
640x200 black and white
Wraps at the end of each line
,. ~
~
0M .
SHOP HOURS:
MON - FRI
SAT
9.00am- 5.30pm
9.30am-12.00pm
I
The ESC[=lh command activates the 40 character by
25 line black and white text mode. Another handy feature is the function ESC[#l mentioned above, which
disables character wrap. When character wrap is on
(which by default it is), any lines containing more than
80 characters "wrap" to the next line. When wrap is
disabled, only 80 characte~s display so you can view any
file using the DOS command TYPE and not be distracted
by the remaining information displaying on the subsequent line. Restore character wrap using ESC[=7h, as
described above.
Note that the type of monitor you own will determine
the success or otherwise of the various commands described this month. This is particularly true if you have a
monochrome (green/black, amber/black etc) monitor.
Next month, we will discuss using ANSI to control
keyboard reassignment. Happy colouring!
SC
|