-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnnansi.txt
1104 lines (785 loc) · 40 KB
/
nnansi.txt
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
NNANSI.COM-- Enhanced MS-DOS ANSI Console Driver
For EGA/VGA Displays
Note: MS-DOS and Windows are trademarks of Microsoft Corporation.
PC/XT, PC/AT, and PS/2 are trademarks of IBM Corporation.
4DOS is a trademark of J.P. Software.
MKS Toolkit is a trademark of Mortice Kern Systems Inc.
PROCOMM is a trademark of Datastorm Technologies, Inc.
Typing Tutor IV is a trademark of Kriya Systems, Inc.
Desqview and QEMM are trademarks of Quarterdeck.
386MAX is a trademark of Qualitas.
Manufacturers' names are the trademarks of their respective manufacturers.
That should take care of everyone.
Documentation for version 1/93.
This version of NNANSI contains the following improvements
over NNANSI version 9/92:
1. Support of DOS/V, the Japanese version of MS/DOS. (thanks, Akira Kikuchi!)
2. Optional support of extended (101+ key) keyboard added, about a
decade late.
3. ANSI state machine code straightened out. Keyboard remapping function
fixed.
IMPORTANT NOTE: the compiled NNANSI.COM is intended for 80286 or later
systems with "AT" style (12 function key) keyboards and VGA displays. You
will need to recompile on systems that don't meet this requirement.
*********INTRODUCTION
NNANSI.COM (version 1/93) is an improved version of NANSI.SYS
(version 2.2), by Daniel Kegel, which is in turn such an improvement
over ANSI.SYS that *no one* should be without one of these.
If you are using ANSI.SYS, be aware that either of these drivers
will offer greatly improved performance and functionality over
your current driver. Current users of NANSI.SYS with EGA or VGA
displays (and other enhanced ANSI.SYS drivers) will notice still
greater performance and functionality in NNANSI.SYS.
Even if you don't use an ANSI.SYS driver, you will achieve major
performance benefits. (Note that there will be no performance
benefits for programs that write directly to the display).
A short list of improvements of NANSI.SYS (version 3.0) over
ANSI.SYS:
1. Intrinsic 43 or 50 line support (MS-DOS 4.0 now has this).
2. Some additional text mode escape sequences: Insert Lines,
Delete Lines, Insert Characters, Delete Characters.
3. Greater to *much* greater performance.
4. Supports higher resolutions, both text and graphic modes.
5. Graphic mode cursor
A short list of improvements of NNANSI.COM (version 1/93) over
NANSI.SYS:
1. Additional escape sequences: erase to start/end of display,
insert/delete lines in graphic modes, added Set Graphic
Rendition codes (and properly working reverse video,
underline, and invisible modes). Accurate ANSI escape
sequence parsing
2. Graphic cursor support is better, and can be disabled.
3. Intrinsic support for both 43 and 50 line modes on a VGA. The
prompt command can be used to maintain 43 or 50 line display
modes. 40 column support for 43 and 50 line modes.
4. Faster text mode performance; *much* faster scrolling
(when in "fast mode").
5. Much faster performance in 640x350 to 800x600 16 color
graphic modes. Every ANSI control sequence (except
insert/delete characters and blink) work in these modes
as well.
6. Readily configured for enhanced graphic and text modes of
various display cards. Support for several popular cards
are provided.
7. Blink in 16 color graphics modes (up to 800x600) will exclusive-OR
characters.
8. Support for MS-DOS V4.0 and later MODE commands, and properly
clears the display in enhanced modes using command.com's CLS.
9. Driver can be loaded as TSR from the command line.
10. Desqview aware.
11. Supports Japanese DOS/V
On the other hand, NANSI is smaller, and works with MDA as distributed.
**********************LICENSE REQUIREMENTS
Daniel Kegel is the author of NANSI.SYS, of which this is a derived
work. I, Tom Almy, think enough of his efforts and programming skills
that I used NANSI.SYS as a base for NNANSI.COM. NANSI.SYS version 2.2
came with sources and free distribution for personal or educational
use, but prohibits commercial use. I have an agreement with Mr.
Kegel to license NNANSI.COM in accordance with his newest NANSI.SYS
license arrangement:
"If you use this program for education or at home, you are
encouraged to send a US$10 donation to the author. If you use
it for business purposes, you are required to purchase a
right-to-use license by sending US$10 to the author."
Send contributions/user fees to:
Daniel Kegel
1977 N. El Molino
Altadena, CA 91001
You can also reach him at his permanent internet address:
Everyone wins with this arrangement!
* Commercial users can now legally use NNANSI.COM
* Personal users can show their gratitude.
* Daniel Kegel can make a little money for his efforts.
* I won't feel guilty for "ripping off" his work.
I place no restrictions on my modifications to NANSI.SYS. I
neither request nor will I accept any contributions for my work
on this program. I made these modifications as part of an effort
to understand the workings of DOS device drivers and the EGA/VGA
display.
On the other hand, I do like to hear from users, satisfied or
(even) not satisfied.
I M P O R T A N T
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Please, if you have problems, check the PROBLEMS section of this
document before contacting me. Greater than 90% of the problem
reports I receive are answered in this section.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
My address is:
[email protected] (Internet)
or
Tom Almy
17830 SW Shasta Trail
Tualatin, OR 97062
I also now run a BBS at (503)-620-0307, 1200-9600 (v.32) bps
If you must use the postal service. Enclose a stamped, self-
addressed envelope if you desire a reply.
*********DISTRIBUTED FILES
The distribution has the following files:
readme.1st - READ THIS FIRST
nnansi.com - Driver, with compilation options set as shown
- in the file CONFIG.INC
nnansi.doc - this file
howto.doc - explaination about the different ways to
write to the display
gcon.bat - turns graphic cursor on
gcoff.bat - turns graphic cursor off
fast.bat - turns fast mode on
slow.bat - turns fast mode off
biosw.bat - turns ANSI bios write_tty on
nobiosw.bat - turns ANSI bios write_tty off
25.bat - set 80x25 text mode
43.bat - set 80x43 text mode
50.bat - set 80x50 text mode (VGA only)
run.bat - load NNANSI TSR as full function driver
norun.bat - unload NNANSI TSR when loaded as full
function driver
dtest.exe - Performance testing program for ANSI drivers
stat.com - Print out information about display status
makefile - for Don Kneller's NDMAKE
nnansi.asm - The source file
config.inc - Configuration selections (part of source)
drivers.inc - Display specific macros (part of source)
*********INSTALLATION
NOTE: If you have an MDA (Monochrome or Hercules display adapter) you
will need to reassemble NNANSI first. You will also need to
reassemble if you are using DOS/V, an 8088 processor, an EGA display,
or an original 84 key keyboard. You will probably want to reassemble
to configure for your specific display card (if it is an "Enhanced"
card), will not be using Desqview, are using a DOS prior to version
4.0, or otherwise want other defaults.
NNANSI installs just like ANSI.SYS (or NANSI.SYS), it is a device
driver that you specify in your CONFIG.SYS file:
DEVICE=NNANSI.COM
If you are using code pages, place this command before the
DEVICE=DISPLAY.SYS command, otherwise code pages will not work.
You can also load NNANSI as a TSR (Terminate and Stay Resident)
program instead. To do this, add the following lines to your
AUTOEXEC.BAT file:
NNANSI D
CTTY CON
If you wish to load the driver as a TSR in Desqview or Windows,
see the section on "NNANSI as a TSR". You cannot use the D option,
and the CTTY command is not needed but the driver will have limited
features.
If NNANSI is the last TSR loaded, it can then be removed. See the
section "NNANSI as a TSR" for the special technique necessary to
remove NNANSI.
For optimum performance, run fast.bat and biosw.bat, but if
applications have trouble with either of these, you will have to
revert back to slower operating modes (read section "FAST MODE").
While the supplied compiled driver is suitable for most
installations, you can get better results by customizing the driver
for your display card. To do this you will need an assembler, such as
Borland Turbo Assembler, a text editor, and (optionally) Don
Kneller's NDMAKE program. I understand that Borland's MAKE will also
work.
Some people have asked why I don't have command line options for
the driver or a separate configuring program but require the user to
use an assembler. The reasons:
1. These make the driver larger and possibly slower than it needs to be.
If you insist on a full-featured display driver try FANSI-CONSOLE.
2. I feel that users who are sophisticated enough to be able to utilize
NNANSI either have an assembler or have access to one. This is not
a program for novices.
3. I'm lazy. I'm not interested. I've got other things to do (which pay).
All options are specified in the file CONFIG.INC. Edit that
file and make changes as appropriate. These descriptions assume
the initial default settings:
DOSV (FALSE)
Set true to use with DOS/V. This option will eliminate most of
NNANSI's performance improvements.
VGA (TRUE)
If you have an EGA display, set this to FALSE. You might
also want to set this to FALSE if you have a VGA and are
used to the ESC [=43h sequence giving 50 line mode.
EGA (FALSE)
If you have an EGA, set this to TRUE.
MONO (FALSE)
Must be TRUE if you have a Monochrome Display Adapter (MDA)
or Hercules card either as your sole display or in addition
to a color display controller. If you don't, leave this FALSE
as it both hurts performance and enlarges the driver. You cannot
use an MDA with Desqview and NNANSI at the same time.
TSR (set on tasm command line)
If TRUE, compiles TSR/DRIVER COM file version, otherwise compiles
DRIVER only, SYS file version.
DESQVIEW (TRUE)
If TRUE, and TSR is TRUE, compiles DESQVIEW awareness code.
If you don't intend to use DESQVIEW you should set this to
FALSE.
VESA (FALSE)
Set TRUE if you have a VESA compatible display card BIOS.
You will also need to have a particular display specified
for best results. VESA has been successfully tested with
a Diamond Speedstar card (TSENG4000 set TRUE) and using
Diamond's VESA BIOS extension, and with a Diamond Steath
with built in VESA support. When using built in VESA, there
seems to be a problem in selecting graphics modes via their
VESA mode numbers.
VEGA, PARADISE, STBVGA... (all FALSE)
Set only one of these TRUE to match your enhanced
EGA/VGA display card. If you have a card not on the list
and experience problems with either blotches in enhanced
text mode or poor performance (unsettable background
colors is a clue) in graphics modes CONTACT THE AUTHOR.
BAD_ERASE (FALSE, except if TSENG4000 selected)
Set to true if erase to end of line and erase to start/end of
screen erase the wrong portion of the display
cheap_pc (FALSE)
Set to FALSE for "PC/AT" and "PS/2" class machines which
have 80186 or greater processors.
ext_keybd (TRUE)
Set to TRUE for "PC/AT" and "PS/2" class machines with 101+ key
keyboards (the kind with 12 function keys and separate cursor keys
from the numeric pad).
key_redef (FALSE)
Set to TRUE if you use key redefinition. There are
Trojan Horse programs that take advantage of this
feature, and most people don't use it anyway, so the
default is FALSE.
init_buffer_size (256)
Enlarge if you use key redefinition and don't have
enough room.
quick_char (TRUE)
Faster graphics display in 16 color modes, at cost of
much extra code since this involves added display
routines. Must be TRUE if gbackground is also TRUE.
fast29 (TRUE)
Makes int29 display calls (used by DOS) 15% faster at a
cost of about 100 bytes.
bios_write_tty (TRUE)
The write tty BIOS call is taken over. It will now
perform faster and understand ANSI escape sequences. This
latter feature can be a mixed blessing. This feature can be
disabled at runtime if it is assembled in.
gbackground (TRUE)
Enables setting of non-black background color in 16 color
graphic modes (640x350 to 800x600 resolutions). If set to
TRUE, quick_char must also be set to TRUE. If this feature is
not desired, it is possible (depending on the system) to get
greater performance by defining both gbackground and
quick_char FALSE. This will also save quite a bit of
code. Experiment and see for yourself.
dos4 (TRUE)
Under MS/PC DOS version 4.0 (and 5.0) allows command.com and
mode.com to recognize NNANSI as an ANSI driver. If you are
using older DOS versions, you can define this to be FALSE.
initgc (FALSE)
Graphic mode cursor is initially off. You can turn it on/off
with a control sequence.
initfast (FALSE)
Fast scroll mode is initially off. This also means that
multiple page support is initially on. You can turn it on/off
with a control sequence, and there are other work-arounds as
well.
initbiosw (FALSE)
ANSI bios write_tty is initially off. You can turn it on/off
with a control sequence.
You can then either use the supplied makefile to generate a new
nnansi.sys/nnansi.com or assemble manually as shown (Borland tools
illustrated):
tasm /m5 /DTSR=0 nnansi (Use /m5 for version 2.0 or later)
tlink nnansi,nnansi.sys/m/t (generates nnansi.sys for config.sys)
tasm /m5 /DTSR=1 nnansi
tlink nnansi,nnansi.bin/m/t (generates nnansi.com for config.sys
rename nnansi.bin nnansi.com or TSR use)
The .sys driver offers no advantages other than it takes less memory
while loading (this might be a consideration with some high memory
management programs). For this reason, a .sys version is no longer
distributed.
IMPORTANT NOTE FOR USERS OF BORLAND TURBO ASSEMBLER V3.0:
There is a bug in this version which causes the assembler to hang
when assembling the sys version of NNANSI. The solution is to only
build the com version. The bug is fixed with V3.1.
NOTE FOR MICROSOFT MASM USERS:
With the Microsoft assembler, you will need to make some changes to
the source to avoid the branch out of range errors, and you will need
to use the exe2bin program to convert the linker generated exe file
into a binary image file, which you then have to rename to
NNANSI.SYS or NNANSI.COM.
To correct the branch out of range, you will need to replace the conditional
branch with an conditional branch of the opposite sense around an
unconditional branch to the same destination. Example:
jne foo ; original statement, now "out of range"
becomes:
je new_label
jmp foo
new_label:
You will also need to delete the first few lines in NNANSI.ASM, which
are directives for the Borland Assembler.
**************NNANSI AS A TSR**
NNANSI can now be loaded as a TSR in two modes, limited and full. If
you intend to use NNANSI as a TSR, such as in a Desqview window, or
for temporary use, please read this section carefully.
To load NNANSI in full driver mode, execute the following two commands
(or execute run.bat):
nnansi d
ctty con
This will load the driver such as it runs identically to NNANSI loaded
as a driver in CONFIG.SYS. This means that not only does it take control
of several interrupt vectors, the driver is also linked into the DOS
driver chain. The CTTY command is necessary to force command.com to
"reopen" its console interface to use the NNANSI driver.
This method must not be used within a multitasking environment such
as Microsoft Windows or Desqview, because the relinking of the driver
chain corrupts system integrity. However it may be used to load
NNANSI before running Windows. In the Desqview case, a batch file can
be used to unload NNANSI, run Desqview, and then reload NNANSI when
finished.
Within each DOS window in Windows or Desqview, the limited version of the
NNANSI TSR can be loaded (described below). The copy of NNANSI should
be unloaded before closing the DOS window.
NNANSI in full driver mode can be unloaded using the following procedure
providing it is the last TSR loaded, you are not "shelled out" of a program,
are running the same instance of COMMAND.COM, and did not load NNANSI
"high" using QEMM, 386/MAX, or DOS 5.0. From a batch file, execute:
@echo off
nnansi u
ctty con
The ctty command must be executed immediately after the NNANSI command,
otherwise the system may "crash". The batch file norun.bat is provided
to unload NNANSI.
Note that full driver mode NANNSI must be uninstalled using NNANSI, and
not with a TSR management program. Such programs are incapable of
unchaining NNANSI from the device driver list.
--------------------
NNANSI also has a limited TSR mode. In this mode the driver is not
linked into the DOS driver chain. To load NNANSI in limited mode execute:
nnansi
In limited mode the device status report will not function, nor will
keyboard key reassignment. The DOS MODE command will not change the
number of display lines either. Also the performance improvement for
RAW mode (which gives NNANSI its greatest performance) will not be
available.
You can unload NNANSI which has been loaded in limited mode by executing:
nnansi u
The limited TSR mode driver can be used in a Microsoft Windows or Desqview
window without problems. You can also uninstall the limited mode driver
with a TSR management program.
**************HOW MUCH PERFORMANCE IMPROVEMENT IS THERE?
I have performed considerable testing on an EVEREX 25Mhz 80386
machine with a Video 7 (Headland) Fastwrite VGA display controller
(and its BIOS), under both DOS 3.3 and 4.0. Your results will
probably vary, and BIOS performance without NNANSI will also improve
if the EGA/VGA BIOS is copied to RAM as supported by some vendors and
also possible with QEMM or 386/MAX on 80386 based systems.
Performance is proportional to roughly independent factors, writing
speed and scrolling speed. Writing speed is the rate at which
characters can be drawn on the display without the display scrolling.
Scrolling speed is the rate at which the display can scroll (no
new characters are drawn). Writing speed tends to be independent of
display mode (except graphic modes are slower), while scrolling speed
tends to be proportional to the number of character positions on the
display (except for NNANSI fast mode, which is independent of screen
size).
When using ANSI.SYS rather than no driver at all, there is roughly a
2.3x degradation in performance for writing. Scrolling performance
improves 44% when DOS 4.0 ANSI driver is used, but remains unchanged
with the DOS 3.3 driver.
Compared to no driver, NANSI.SYS (3.0) is 3x to 3.5x faster for
writing, and is roughly 45x faster when writing using DOS in RAW
mode. It is roughly 2x faster scrolling.
Compared to the no driver or other ANSI drivers, NNANSI is 4x faster
in BIOS TTY write calls.
Compared to NANSI.SYS it is 2x faster in INT29 calls, 73% faster in
DOS write calls, but there is no speedup in RAW mode. When fast mode
is used, scrolling is 15x to 25x faster.
This means that text mode programs that take advantage of RAW
mode and buffering can display 100 times faster with NNANSI (and
without scrolling, NANSI) over ANSI.SYS. It works out to about
420,000 characters per second with my fast machine.
NNANSI also has speedups for 16 color graphic modes with resolutions
between 640x350 and 800x600. With the graphic cursor turned on, the
TTY BIOS call is about 10% slower than the standard BIOS call (which
doesn't display a cursor), but other output calls are 2.5x to 3.5x
faster than that of NANSI.SYS. Turning the graphics cursor off
roughly doubles the writing speed of all modes but RAW.
**************FAST MODE **READ THIS!!**
To get maximum speed, NNANSI has what I call Fast Mode. In text
mode, there is more display memory than there are character on
the display. Normally, the BIOS supports display "pages" that you
can switch among. Changing the display page changes the region
of the display memory that is sent to the display. Fast Mode
uses the same technique (changing the starting location of the
viewable memory region) to scroll the display upwards.
Programs that make use of multiple display pages and scroll the
display require that fast mode be turned off. Many debugging programs
use two pages to maintain separate debugging and application
displays. Some of the programs will still work in fast mode if they
have a "swap screens" option ("-ds" for Borland Turbo Debugger, for
instance).
A number of programs that directly access the display don't work if
starting address has changed. These programs may not work properly in
fast mode (or for that matter in display pages other than the first).
NNANSI tries its best to work with these programs by resetting the
display start location if any program does the "get display mode" or
"scroll/clear display" BIOS calls. These calls are typically done by
potentially offending applications when they start. As long as the
display never scrolls under NNANSI control everything will work fine.
A typical problem occurs in programs that have DOS or "shell escape"
commands. If the DOS sub-shell (invocation of COMMAND.COM) causes the
display to scroll, then upon exiting the sub-shell the display will
be ruined. The solution to this problem (other than not using fast
mode) is to clear the screen just before exiting the sub-shell.
Please note that Windows 3.0 in Enhanced Mode has problems with DOS
applications running in a window using NNANSI's fast mode. You will
need to run Windows with NNANSI in slow mode.
Some offending programs can be "fixed" by invoking them from a
batch file (or alias if you use MKS Toolkit, 4DOS, ANARKEY...)
which first clears the screen. Or you can use a batch file which
turns off fast mode, then turn fast mode back on again after
program execution. Example:
echo ^[[=98l
offendingpgm %1 %2 %3 %4 %5
echo ^[[=98h
Where "^[" is the escape (code 27) character.
Batch programs have been provided to enable (fast.bat) and disable
(slow.bat) fast mode.
NNANSI can also speed up programs that use BIOS calls for writing
characters. NNANSI adds the ANSI features to such calls, which can
cause problems with some applications. This feature is turned off by
default, but can be enabled via an ANSI sequence or by executing the
supplied batch file biosw.bat. The feature can be disabled with
nobiosw.bat.
******************WRITING PROGRAMS FOR BEST PERFORMANCE
To get best performance in programs you write, you must put the
display in RAW mode, and buffer output.
In assembler, you can set raw mode with the following sequence
(adapt this for other languages):
mov ax,4400h ; get device status
mov bx, 1 ; of device 1 (standard output)
int 21h
xor dh, dh ; clear upper byte
mov saved_state, dx ; save it for later
mov ax, 4401h ; set new status
or dl, 20h ; with raw bit set
int 21h
Reset raw mode before terminating the application:
mov ax, 4401h ; set status to original values
mov bx, 1
mov dx, saved_state
int 21h
There is a fixed amount of overhead (and it is high) for each
DOS call. Therefore you should buffer up write requests into a
single call. With the C language, you can use the setvbuf() call
to set a large buffer size.
Even if you don't follow this advice, you will get a major
performance improvement over ANSI.SYS (or no device driver at
all).
Programs using RAW mode and buffering easily beat the
performance of the supposedly high speed console drivers
supplied in Turbo C and Microsoft C. And by using ANSI control
sequences your programs can be made portable to other systems!
*****************TYPICAL PROBLEMS
ALSO READ THE SECTION "FAST MODE"
SYSTEM CRASHES UPON BOOTING, OR DISPLAY BADLY CORRUPTED EVEN IN
STANDARD 80x25 TEXT MODE.
You have assembled NNANSI with cheap_pc set to FALSE on an 8088 based
system, or you are trying to use NNANSI on an MDA or Hercules
Graphics equipped system without reassembling with MONO equal TRUE.
This can also happen if you are using DOS/V with NNANSI not compiled for
DOS/V operation.
KEYBOARD IS "LOCKED"
You have set ext_keybd TRUE when you have an original style (10 function
key) keyboard, or a BIOS that does not support the extended keyboard.
ON A VGA, SETTING 43 LINE MODE GIVES 43 LINES, WHEN IT GAVE 50
WITH AN OLDER VERSION OF NNANSI.SYS OR WITH NANSI.SYS
This is correct. There is now a new setting for 50 line mode. If
you require that 43 line mode give 50 lines, recompile the
system with VGA set to FALSE.
I USED AN EARLIER VERSION OF NNANSI, AND NOW I FIND THAT NNANSI IS
MUCH SLOWER THAN BEFORE
The defaults have changed. You now have to run FAST and BIOSW for
fastest operation.
I USED AN EARLIER VERSION OF NNANSI, AND NOW FIND MY DISPLAY
INEXPLICABLY CHANGING MODES
The commands for graphic cursor, fast mode, and line wrap are
more restrictive. Use the new batch files for fast, slow, gcon, and
gcoff, and change any code of your own appropriately.
ON A VGA, SETTING 50 LINE MODE CAUSES VERY STRANGE BEHAVIOR
Two possibilities. Your display adapter is really an EGA, or you
have compiled NNANSI with VGA set to FALSE. In the latter
case, you can get 50 line mode by setting 43 line mode, while in
the former case you can't get 50 line mode at all.
ON A VGA, AFTER LEAVING 43/50 LINE MODE THE CURSOR IS IN THE
MIDDLE OF THE CHARACTER BLOCK
Recompile the driver with EGA set to FALSE.
ON AN EGA, THE CURSOR DISAPPEARS IN 43 LINE MODE WHEN RUNNING
SOME APPLICATIONS
There is nothing you can do, as this is caused by an error in
the design of the EGA BIOS.
IN 43/50 LINE MODE, THE DOS CLS COMMAND ONLY CLEARS THE FIRST 25
LINES OF THE DISPLAY (DOS 4.0)
Reassemble with "dos4 EQU TRUE", as it is in the distribution NNANSI
driver.
DISPLAY SHOWS UGLY BLOCKS AT THE START AND END OF EACH LINE OR
PERFORMANCE SLOWS GREATLY IN EXTENDED (GREATER THAN 80X25) TEXT MODES
Your display controller sets the display mode byte in the BIOS to
some value other than "3". You can either set the byte (at location
40:49h) back to 3 after setting the display mode, or configure NNANSI
to know about these special modes. This problem is typical for most
cards, it seems. There may already be a proper configuration for your
display in CONFIG.INC.
DISPLAY IS NOTICEABLY SLOWER WRITING OR CANNOT SWITCH BACKGROUND
COLORS IN EXTENDED (GREATER THAN 640x480, OR 640x350 EGA)
GRAPHIC MODES
In 256 color modes or 1024x768 modes, the background color cannot be
changed. In other modes, you will need to configure NNANSI for your
display card. Look for a proper configuration in CONFIG.INC.
DISPLAY GOES BLANK WHEN STARTING AN APPLICATION. DISPLAY SHIFTED
PARTLY OFF SCREEN WHEN STARTING AN APPLICATION. DISPLAY
DISAPPEARS DURING EXECUTION OF A APPLICATION.
First try clearing the screen before execution. If that doesn't
work, leave fast mode (see preceding section on FAST MODE).
FUNNY BLOTCHES OCCASIONALLY APPEAR AT VARIOUS POINTS IN A
GRAPHIC APPLICATION
This is the graphics cursor. You can disable it either by
reconfiguring the driver, or by sending the control sequence to
disable the graphics cursor. A batch file, GCOFF.BAT, has been
provided for this purpose.
TEXT DISPLAY IS MESSED UP, POSSIBLY CHANGING COLORS IN UNUSUAL
PLACES.
This has been observed with programs using the BIOS for writing
to the display, and not expecting the ANSI translation (or the
conversion of the TAB character into spaces instead of a special
graphic). Execute NOBIOSW.BAT to turn the ANSI translation off
for these programs. PROCOMM and Typing Tutor IV have this problem.
CANNOT SET VESA STANDARD EXTENDED DISPLAY MODES
You must compile the driver with VESA defined as TRUE, and then
must request a mode 128 less than that really desired. There are also
problems with boards having built-in VESA support without using a software
VESA driver; for these boards you will need to set the display mode using
the mode changing software supplied by the vendor.
THE MODE COMMAND DOES NOT CHANGE THE NUMBER OF DISPLAY LINES
The mode command does not function if NNANSI is loaded as a limited
TSR -- install as a full TSR or as a device driver. Also, you might
need to reassemble with "dos4 EQU TRUE", as it is in the distribution
NNANSI driver.
A TSR OR REMOTE OPERATION PROGRAM DOES NOT WORK WITH NNANSI BUT DOES WITH ANSI
NNANSI is incompatible with programs that expect the ANSI driver to
write to the display using BIOS calls. I recommend the use of the
program ANSI.COM, from PC Magazine, for these uses.
I USE 4DOS AND CANNOT ALIAS F11 AND F12
You need to recompile with ext_keybd set to TRUE.
THE KEYBOARD REASSIGNMENT COMMAND DOES NOT SEEM TO BE WORKING
By default it is disabled to prevent "ANSI BOMBS". You will need to
recompile with key_redef set to TRUE.
*****************NNANSI COMMAND SEQUENCES
Command sequences start with the escape character (code 27,
referred to in this section as ESC). NNANSI buffers up the
sequence until it has a command to execute. If the sequence is
not a valid command, the entire sequence is passed to the display.
All command sequences have the following format:
ESC [ param1; param2; ...; paramN cmdchar
where
ESC is the escape character
[ is the left bracket character.
param are ascii decimal numbers or quoted strings.
cmdchar is the command character
No spaces are allowed within the command.
Missing arguments are defaulted to "1" unless otherwise specified
(SGR, ED, and IBMKKR).
Quoted strings may use either single or double quote characters
as delimiters. Each character inside the quoted string is
converted to a numeric parameter. Quoted strings are only useful
for the questionable Keyboard Key Reassignment command.
CURSOR POSITIONING COMMANDS
NAME DESCRIPTION COMMAND
CUP cursor position ESC[y;xH
HVP cursor position ESC[y;xf
Either of these set the cursor position. CUP should be
used since HVP has other connotations not implemented in
NNANSI (or ANSI.SYS). The origin (in the upper left
corner) is x=1, y=1.
CUU cursor up ESC[nA
CUD cursor down ESC[nB
n = # of lines to move. You cannot move beyond the edge
of the display.
CUF cursor forward ESC[nC
CUB cursor backward ESC[nD
n = # of columns to move. You cannot move beyond the
edge of the display.
DSR Device Status Report ESC[6n
Find out cursor position. The driver responds with a
cursor position report (CPR) of the form "ESC[y;xR"
followed by a carriage return, as if typed at the
keyboard.
SCP Save Cursor Position ESC[s
RCP Restore Cursor Position ESC[u
Cannot be nested.
EDITING COMMANDS
NAME DESCRIPTION COMMAND
ED Erase in Display ESC[nJ
n=0 or missing: Erase to end of screen (not in ANSI.SYS)
n=1: erase to start of screen (not in ANSI.SYS)
n=2: erase entire screen, and home cursor
Note: there is a bug in ANSI.SYS that performs function
2 regardless of the value of n. This bug is not repeated
in NNANSI because of the extra functionality provided.
Everybody's "ANSI.SYS" homes the cursor, which the standard
does not call for, and NNANSI keeps up that tradition.
EL Erase in Line ESC[K
Erases from cursor to end of line.
IL Insert Lines ESC[nL
Inserts n blank lines at the line containing the cursor.
While the cursor line moves down, the cursor position is
unchanged. Not in ANSI.SYS.
DL Delete Lines ESC[nM
Deletes n lines, starting at the line containing the
cursor. The cursor is not moved. Not in ANSI.SYS
ICH Insert Characters ESC[n@
Inserts n blank characters at cursor position. The
cursor does not move. Not in ANSI.SYS. Does not work in
graphic modes.
DCH Delete Characters ESC[nP
Deletes n characters at the cursor. The cursor does not
move. Not in ANSI.SYS. Does not work in graphic modes.
SET GRAPHIC RENDITION COMMAND
NAME DESCRIPTION COMMAND
SGR Set Graphics Rendition ESC[n;n;...nm
The Set Graphics Rendition command is used to select foreground
and background colors or attributes. When you use multiple
parameters, they are executed in sequence, and the effects are
cumulative. You can set all colors and attributes in any text
mode. In 16 color graphic modes between 640x350 and 800x600
pixels you can set all colors and attributes except for blink.
"Blink" becomes exclusive-OR character mode (very useful!). You
can set foreground colors, blink, and bold, only, in other 16 color
modes. Setting colors does not work correctly for other color
modes -- make sure display is in the normal white on black mode
before changing to these modes.
When a Monochrome Display Adapter (MDA) is used, foreground and
background colors other than black and white should not be set. The
MDA also ignores the underscore and bold attributes while in reverse
video.
If no arguments are given, a single "0" argument is assumed. If multiple
arguments are given, missing arguments are taken to be "0".
Code Value
0 All attributes off (normal white on black)
1 Bold
2 Dim (not Bold)
4 Underscore (emulated via blue foreground in CGA/EGA/VGA)
5 Blink (or EXOR -- see above)
7 Reverse Video (improved implementation over ANSI)
8 Invisible (improved operation -- foreground color
forced to background color, other attributes suppressed)
22 Cancel Bold
24 Cancel Underline (white foreground)
25 Cancel Blink
27 Cancel Reverse video
28 Cancel Invisible
30-37 foreground black/red/green/yellow/blue/magenta/cyan/white
40-47 background black/red/green/yellow/blue/magenta/cyan/white
Codes 2, 22, 24, 25, 27, and 28 are not in ANSI.SYS.
SET DISPLAY MODE COMMAND
NAME DESCRIPTION COMMAND
SM Set Mode ESC[=nh
RM Reset Mode ESC[=nl
The set and reset mode commands are identical in this context.
The BIOS supports many video modes. The code given for the AL
register to the BIOS set mode command is used as the parameter to
this set mode command. That means that extended modes that are
settable in this manner can use this command. As an example, with the
Diamond Speedstar, the command ESC[=34h will set 132 column by 44 row
mode. Display cards that use other techniques to change display mode
are left as an exercise to the user, but if you can get the card into
an extended mode, NNANSI can used it (possibly with a configuration
change, though).
VESA Display Cards: To set VESA modes, select a mode 128 less than the
desired mode number. For instance, for 132x43 text mode, select mode
138 (rather than 266).
Monochrome Display Adapter (MDA): These commands are ignored when the
MDA is in use.
In the graphic modes, the cursor can be simulated with a blob
(the character produced with character code 22).
Mode Code Value
0,1 text 40x25 16 color
2,3 text 80x25 16 color
4,5 graphics 320x200 4 color
6 graphics 640x200 Black & White
7 cursor wrap (see SET DISPLAY ATTRIBUTES, below)
13 graphics 320x200 16 color, VGA only
14 graphics 640x200 16 color, VGA only
16 graphics 640x350 16 color, VGA only
17 graphics 640x480 Black & White, VGA only
18 graphics 640x480 16 color, VGA only
19 graphics 300x200 256 color, VGA only
43 43 line mode for modes 0-3 (Not in ANSI.SYS)
50 50 line mode for modes 0-3 (VGA only, not in
ANSI.SYS)
n When not in above list, sets mode n. (Not in