diff options
| author | Richard M. Stallman | 1994-05-30 09:14:39 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-05-30 09:14:39 +0000 |
| commit | 09e2ac30b1e0245cc4d832084c1ada33a7e6f317 (patch) | |
| tree | 1b88be3cfa102bb122f27fab9d88c6ea65a34cd5 /src | |
| parent | 21b16c1f1acd5a2775f9c1f4dad39dfa19e1b373 (diff) | |
| download | emacs-09e2ac30b1e0245cc4d832084c1ada33a7e6f317.tar.gz emacs-09e2ac30b1e0245cc4d832084c1ada33a7e6f317.zip | |
(output_string): New function.
(internal_flush): Use output_string for faster screen update.
(internal_flush): Clear to end of line by writing a string of spaces.
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/src/msdos.c b/src/msdos.c index 58733b418aa..154ee1501c5 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -809,6 +809,35 @@ visible_bell_3: | |||
| 809 | popl %eax"); | 809 | popl %eax"); |
| 810 | } | 810 | } |
| 811 | 811 | ||
| 812 | /* At screen position (X,Y), output C characters from string S with | ||
| 813 | attribute A. Do it fast! */ | ||
| 814 | |||
| 815 | static void | ||
| 816 | output_string (x, y, s, c, a) | ||
| 817 | int x, y, c; | ||
| 818 | unsigned char *s; | ||
| 819 | unsigned char a; | ||
| 820 | { | ||
| 821 | char *t = (char *)ScreenPrimary + 2 * (x + ScreenCols () * y); | ||
| 822 | asm volatile | ||
| 823 | (" movl %1,%%eax | ||
| 824 | call dosmemsetup | ||
| 825 | movl %%eax,%%edi | ||
| 826 | movb %0,%%ah | ||
| 827 | movl %2,%%ecx | ||
| 828 | movl %3,%%esi | ||
| 829 | output_string1: | ||
| 830 | movb (%%esi),%%al | ||
| 831 | movw %%ax,%%gs:(%%edi) | ||
| 832 | addl $2,%%edi | ||
| 833 | incl %%esi | ||
| 834 | decl %%ecx | ||
| 835 | jne output_string1" | ||
| 836 | : /* no output */ | ||
| 837 | : "m" (a), "g" (t), "g" (c), "g" (s) | ||
| 838 | : "%eax", "%ecx", /* "%gs",*/ "%esi", "%edi"); | ||
| 839 | } | ||
| 840 | |||
| 812 | static int internal_terminal = 0; | 841 | static int internal_terminal = 0; |
| 813 | #undef fflush | 842 | #undef fflush |
| 814 | 843 | ||
| @@ -816,10 +845,11 @@ int | |||
| 816 | internal_flush (f) | 845 | internal_flush (f) |
| 817 | FILE *f; | 846 | FILE *f; |
| 818 | { | 847 | { |
| 848 | static char spaces[] = " "; | ||
| 819 | static int x; | 849 | static int x; |
| 820 | static int y; | 850 | static int y; |
| 821 | char c, *cp; | 851 | unsigned char *cp, *cp0; |
| 822 | int count, i; | 852 | int count, i, j; |
| 823 | 853 | ||
| 824 | if (internal_terminal && f == stdout) | 854 | if (internal_terminal && f == stdout) |
| 825 | { | 855 | { |
| @@ -828,7 +858,7 @@ internal_flush (f) | |||
| 828 | count = stdout->_ptr - stdout->_base; | 858 | count = stdout->_ptr - stdout->_base; |
| 829 | while (count > 0) | 859 | while (count > 0) |
| 830 | { | 860 | { |
| 831 | switch (c = *cp++) | 861 | switch (*cp++) |
| 832 | { | 862 | { |
| 833 | case 27: | 863 | case 27: |
| 834 | switch (*cp++) | 864 | switch (*cp++) |
| @@ -852,8 +882,17 @@ internal_flush (f) | |||
| 852 | count -= 2; | 882 | count -= 2; |
| 853 | break; | 883 | break; |
| 854 | case 'E': | 884 | case 'E': |
| 855 | for (i = ScreenCols () - 1; i >= x; i--) | 885 | i = ScreenCols () - x; |
| 856 | ScreenPutChar (' ', ScreenAttrib, i, y); | 886 | j = x; |
| 887 | while (i >= sizeof spaces) | ||
| 888 | { | ||
| 889 | output_string (j, y, spaces, sizeof spaces, | ||
| 890 | ScreenAttrib); | ||
| 891 | j += sizeof spaces; | ||
| 892 | i -= sizeof spaces; | ||
| 893 | } | ||
| 894 | if (i > 0) | ||
| 895 | output_string (j, y, spaces, i, ScreenAttrib); | ||
| 857 | count -= 2; | 896 | count -= 2; |
| 858 | break; | 897 | break; |
| 859 | case 'R': | 898 | case 'R': |
| @@ -889,8 +928,12 @@ internal_flush (f) | |||
| 889 | count--; | 928 | count--; |
| 890 | break; | 929 | break; |
| 891 | default: | 930 | default: |
| 892 | ScreenPutChar (c, ScreenAttrib, x++, y); | 931 | cp0 = cp - 1; |
| 893 | count--; | 932 | count--; |
| 933 | while (count > 0 && *cp >= ' ') | ||
| 934 | cp++, count--; | ||
| 935 | output_string (x, y, cp0, cp - cp0, ScreenAttrib); | ||
| 936 | x += (cp - cp0); | ||
| 894 | } | 937 | } |
| 895 | } | 938 | } |
| 896 | fpurge (stdout); | 939 | fpurge (stdout); |