-
Notifications
You must be signed in to change notification settings - Fork 2
/
BCHELP.PAS
281 lines (270 loc) · 13.6 KB
/
BCHELP.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
unit BCHELP;
interface
procedure ShowCommands;
implementation
uses Dos, Crt;
procedure ShowCommands;
procedure Pause;
var
C: Char;
begin
Write ('-- More --');
C := ReadKey;
if C = #0 then C := ReadKey;
WriteLn;
end;
begin
WriteLn;
WriteLn ('DOS commands:');
WriteLn;
WriteLn ('BREAK [on | off] Turn BREAK on or off.');
WriteLn ('CALL ... Run a batch file and return to your program.');
WriteLn ('CD/CHDIR ... Change directory.');
WriteLn ('CLS Clear the screen or the current window.');
WriteLn ('COMMAND [/c ...] Run COMMAND.COM.');
WriteLn ('COPY ... Copy file(s) (COPY is handled by COMMAND.COM).');
WriteLn ('DEL/ERASE ... Delete file(s).');
WriteLn ('DIR [/p][/w] Show a list of files in a directory.');
WriteLn ('ECHO ... Write text to the screen.');
WriteLn ('EXIT Exit program and return to DOS.');
WriteLn ('FOR %%C in (list) Set the variable %%C to all items of list and');
WriteLn (' do ... perform a command.');
WriteLn ('GOTO label Go to another line in the batch file');
WriteLn (' (a label is any word after a colon ":").');
WriteLn ('IF [NOT] EXIST ... If the file exists, then ...');
WriteLn ('IF ERRORLEVEL x ... If the ERRORLEVEL is x or below x, then ...');
WriteLn ('IF ... == ... If the two strings are equal, then ...');
WriteLn ('MD/MKDIR ... Create a new directory.');
WriteLn ('PATH ... Set or show the PATH.');
WriteLn ('PAUSE [...] Wait for a keystroke.');
WriteLn;
Pause;
WriteLn;
WriteLn ('PROMPT ... Change the DOS prompt.');
WriteLn ('REM ... Remark (Note: The first remark is placed at the');
WriteLn (' beginning of the .COM program, so it is displayed');
WriteLn (' when you TYPE the program).');
WriteLn ('RD/RMDIR ... Remove a directory.');
WriteLn ('REN/RENAME ... Rename a file or a group of files.');
WriteLn ('SET [var=[value]] Set an environment variable (Note: All variables');
WriteLn (' are restored after running the program).');
WriteLn ('SHIFT Move all parameters (%1, %2, ..) one place back.');
WriteLn ('TYPE ... Show the contents of a file.');
WriteLn ('VER Show the current DOS version.');
WriteLn ('VERIFY [on | off] Set VERIFY on or off.');
WriteLn ('VOL ... Show the volume of a drive.');
WriteLn;
WriteLn ('Special characters (for the commands ECHO, PAUSE, IF and SET):');
WriteLn;
WriteLn ('$g ">" $q "=" $s <Space>');
WriteLn ('$l "<" $h <BackSpace> $e <Esc>');
WriteLn ('$b "|" $_ <CR/LF> $$ "$"');
WriteLn ('$(n) ASCII number');
WriteLn;
WriteLn ('"$" at the end of a line: No <CR>.');
WriteLn;
Pause;
WriteLn;
WriteLn ('Variables:');
WriteLn;
WriteLn ('Besides the environment variables you may also define up to 100');
WriteLn ('32-bit variables to work with numbers. You can set these variables to');
WriteLn ('integer numbers in the range -2147483648...+2147483647.');
WriteLn;
WriteLn ('Variable commands:');
WriteLn;
WriteLn ('VAR varname [=number] Define a new variable (if no number is specified');
WriteLn (' the variable is set to 0).');
WriteLn ('LET var = number Set the variable to a new value.');
WriteLn ('LET var1 = var2 Copy the value of var2 into var1.');
WriteLn ('LET var = %1 If %1 is not a valid number, the ERRORLEVEL is set');
WriteLn (' to the position of the error.');
WriteLn ('LET var = ERRORLEVEL Sets var to the current errorlevel.');
WriteLn ('ADD var, x Add the value of x to var.');
WriteLn ('SUB var, x Subtract the value of x from var.');
WriteLn ('NEG var Change the sign of var (+/-).');
WriteLn ('ABS var If var < 0 then the sign is changed.');
WriteLn ('MUL var, x Multiply var with x.');
WriteLn ('DIV var, x Integer division.');
WriteLn;
WriteLn;
Pause;
WriteLn;
WriteLn ('Writing variable numbers:');
WriteLn;
WriteLn ('ECHO ... %VAR% ... Show the number of VAR (decimal).');
WriteLn ('ECHO %VAR:10% Use 10 spaces for the number (like this: " 123").');
WriteLn ('ECHO %VAR:-10% Spaces after the number ("123 ").');
WriteLn ('ECHO %VAR:010% Use "0" instead of spaces ("0000000123").');
WriteLn ('ECHO %VAR:b% Show the binary value ("1111011").');
WriteLn ('ECHO %VAR:X% Show the hexadecimal value ("7B").');
WriteLn ('ECHO %VAR:x% The same, but use lowercase letters ("7b").');
WriteLn ('ECHO %VAR:o% Show the octal value (173).');
WriteLn;
WriteLn ('Comparing variables:');
WriteLn;
WriteLn ('IF %var1% = %var2% ... If the two variables are the same then ...');
WriteLn ('IF %var1% <> %var2% .. If the variables are different then ...');
WriteLn ('IF %var1% > %var2% ... If var1 is larger than var2 then ...');
WriteLn ('IF %var1% < %var2% ... If var1 is smaller than var2 then ...');
WriteLn ('IF %var1% >= %var2% .. If var1 is larger than or equal to var2 then ...');
WriteLn ('IF %var1% <= %var2% .. If var1 is smaller than or equal to var2 then ...');
WriteLn;
WriteLn ('- You may always insert the word NOT to reverse the condition.');
WriteLn ('- If you compare strings with <, >, <= or >=, first the length is compared.');
WriteLn;
Pause;
WriteLn;
WriteLn ('GOSUB and RETURN:');
WriteLn;
WriteLn ('You can create subroutines in your programs by using these commands.');
WriteLn ('Example:');
WriteLn;
WriteLn (' GoTo Start');
WriteLn (' :Proc1');
WriteLn (' ...');
WriteLn (' Return');
WriteLn (' :Start');
WriteLn (' ...');
WriteLn (' GoSub Proc1');
WriteLn (' ...');
WriteLn (' GoSub Proc1');
WriteLn;
WriteLn;
WriteLn ('You can run the same procedure as often as you like without having to');
WriteLn ('write it again.');
WriteLn;
WriteLn ('NOTE: Never go to a subroutine using the GOTO command.');
WriteLn (' RETURN without GOSUB could cause the system to crach.');
WriteLn;
WriteLn;
Pause;
WriteLn;
WriteLn ('Other commands:');
WriteLn;
WriteLn ('CRT After this command all the output to screen is written');
WriteLn (' directly to the video buffer.');
WriteLn ('DOS Use DOS routines to handle output to screen.');
WriteLn ('SETCOLOR n Change the attribute. Only if CRT procedures are installed.');
WriteLn (' (valid attributes are 0..255 or $00..$FF)');
WriteLn ('MOVETO x, y Change the position of the cursor.');
WriteLn ('SETWINDOW x1, Define a window (Use this command before CLS, FILLWINDOW,');
WriteLn (' y1, x2, y2 FRAMEWIN, MENU, SCROLL). Default: 1, 1, 80, 25.');
WriteLn ('SCROLL n Scroll the current window n lines up (or down: n < 0).');
WriteLn ('FRAMEWINDOW Draw a frame in the current window. Chars is either');
WriteLn (' chars, title DOUBLEFRAME or SINGLEFRAME or the characters to be used');
WriteLn (' in the frame, eg. ÉÍ»ººÈͼ. Title is any text.');
WriteLn ('FILLWINDOW n Fills the window with one character (n = 0..255)');
WriteLn ('CHECKANSI Set the errorlevel to 1 if ANSI.SYS is installed.');
WriteLn ('GETSCREEN Save the contents of the entire screen in memory.');
WriteLn ('PUTSCREEN Restores the last screen saved by GETSCREEN or LOADSCREEN');
WriteLn ('SAVESCREEN file Save a screen to the disk.');
WriteLn ('LOADSCREEN file Load a screen from the disk into memory (use PUTSCREEN to');
WriteLn (' display it).');
WriteLn ('COUNTPARAMS Set the errorlevel to the number of parameters.');
WriteLn;
Pause;
WriteLn;
WriteLn ('Menus:');
WriteLn;
WriteLn ('MENU [c1,] [c2,] [c3,] "[" ~O~ption1 "/" O~p~tion2 [/...] "]" [";"]');
WriteLn;
WriteLn (' c1 Attribute of highlighted bar.');
WriteLn (' c2 Attribute of hot keys.');
WriteLn (' c3 Attribute of hot key in highlighted bar.');
WriteLn (' ~X~ Hot key.');
WriteLn (' ";" Return if the user presses <-- or --> (errorlevel 254, 255).');
WriteLn;
WriteLn ('If the user presses a hot key or <Enter>, the errorlevel will be set to the');
WriteLn ('number of the option. If <Esc> is pressed the errorlevel is set to 0.');
WriteLn ('Example:');
WriteLn;
WriteLn (' Cls');
WriteLn (' SetWindow 10, 5, 20, 9');
WriteLn (' FrameWindow SingleFrame, Menu ');
WriteLn (' SetWindow 11, 6, 19, 8');
WriteLn (' Menu $70, $0F, $70, [ ~E~dit / ~R~un / ~Q~uit ]');
WriteLn (' if ErrorLevel 3 GoTo Quit');
WriteLn (' if ErrorLevel 2 GoTo Run');
WriteLn (' ...');
WriteLn;
Pause;
WriteLn;
WriteLn ('Keyboard commands:');
WriteLn;
WriteLn ('ASK ["prompt"], keylist Set the errorlevel to the position in the list.');
WriteLn ('ASKYN ["prompt"] Yes: errorlevel = 1, No errorlevel = 0.');
WriteLn ('GETKEY Set the errorlevel to the ASCII value of a');
WriteLn (' keystroke.');
WriteLn ('GETKBFLAGS Set the errorlevel to the keyboard flags byte.');
WriteLn ('SETKBFLAGS <var> Change the keyboard flags.');
WriteLn ('SETBIT n <var> Set bit n of <var> to 1.');
WriteLn ('RESETBIT n <var> Set bit n of <var> to 0.');
WriteLn ('GETBIT n <var> Set the errorlevel to the value of bit n of <var>.');
WriteLn;
WriteLn ('Keyboard flag bits:');
WriteLn;
WriteLn ('76543210');
WriteLn ('.......1 Right Shift key pressed');
WriteLn ('......1. Left Shift key pressed');
WriteLn ('.....1.. Ctrl key pressed');
WriteLn ('....1... Alt key pressed');
WriteLn ('...1.... ScrollLock on');
WriteLn ('..1..... NumLock on');
WriteLn ('.1...... CapsLock on');
WriteLn ('1....... Insert mode on');
WriteLn;
Pause;
WriteLn;
WriteLn ('INPUT <Env-var> Input any environment variable (from the keyboard).');
WriteLn ('GETX <var> Store the cursor position in a variable.');
WriteLn ('GETY <var> Store the cursor line in a variable.');
WriteLn ('GETCURSOR <var> Store the cursor size in a variable.');
WriteLn ('SETCURSOR <var> Set the size of the cursor (Default $0B0C,');
WriteLn (' Block cursor: $001F, No cursor: $1F00).');
WriteLn ('DISKFREE <var> Get the free space on a disk into a variable.');
WriteLn ('UPPERCASE <env-var> Change all letters in a variable to capitals.');
WriteLn ('LOWERCASE <env-var> Change the capitals into lowercase letters.');
WriteLn ('GETDRIVE <env-var> Set an environment variable to the current drive.');
WriteLn ('GETDIR <env-var> Set a variable to the current directory.');
WriteLn ('GETDAY <env-var> Set a variable to the day of the week.');
WriteLn ('GETDATE <env-var> Set a variable to the current date.');
WriteLn ('GETTIME <env-var> Set a variable to the current time.');
WriteLn ('GETLENGTH <env-var> Set the errorlevel to the length of the var.');
WriteLn ('CHECKERRORS ON|off if on the program will stop and ask the user.');
WriteLn (' wether to continue or not. If off, the');
WriteLn (' error number is stored in the ERRORLEVEL.');
WriteLn ('Example:');
WriteLn;
WriteLn (' CheckErrors OFF');
WriteLn (' ChDir %1');
WriteLn (' if ErrorLevel 1 Echo THERE IS NO DIRECTORY NAMED "%1".');
WriteLn;
Pause;
WriteLn;
WriteLn ('BEEP Make a short sound.');
WriteLn ('IF KEYPRESSED ... If the user has pressed any key on the keyboard then ...');
WriteLn ('GETRANDOM Set the errorlevel to a random number (0..255).');
WriteLn ('WRITECHAR n1 [,n2] Write 1 (or n2) character(s) with ASCII code n1.');
WriteLn ('INLINE n1, n2, ... Use machine language in your programs (Hex numbers only).');
WriteLn;
WriteLn ('Example:');
WriteLn;
WriteLn (' REM This will print the screen (int 5):');
WriteLn (' INLINE cd 05');
WriteLn;
WriteLn ('An INLINE procedure may destroy the values of the registers AX, BX, CX, DX,');
WriteLn ('SI, DI and BP. The other registers must be restored.');
WriteLn;
WriteLn ('There are two ways to run any program:');
WriteLn ('- Type only the name. A copy of COMMAND.COM is loaded and searches all');
WriteLn (' directories of the PATH for the program. If the program is not found,');
WriteLn (' you will get the message "Bad command or filename".');
WriteLn ('- Type the full pathname and extension ("C:\UTIL\BC.EXE"). Use this');
WriteLn (' method if you want to know what errorlevel is left by the program.');
WriteLn;
WriteLn (' -- e-mail: mike@wieringsoftware.nl --');
WriteLn;
Halt(0);
end;
end.