On Mon, 12 Apr 2004, Arkady V.Belousov wrote:
> 6-���-2004 23:51 [EMAIL PROTECTED] (Bart Oldeman) wrote to
> [EMAIL PROTECTED]:
>
> > +++ inthndlr.c 6 Apr 2004 23:51:33 -0000 1.68
> > case 0x11: /* normalise ASCIIZ filename */
>
> In my patch applied (UBYTE) casting for character literals (like 'a').
> For OpenWatcom this reduces code (by eliminationg extraneous promotions byte
> arguments to int).
not for me:
case 0x11: /* normalise ASCIIZ filename */
{
char c;
char FAR *s = MK_FP(r.DS, r.SI);
100D L$285:
100D 8B 76 0E mov si,0xe[bp]
1010 8B 4E 0A mov cx,0xa[bp]
char FAR *t = MK_FP(r.ES, r.DI);
1013 8B 5E 0C mov bx,0xc[bp]
1016 8B 56 08 mov dx,0x8[bp]
do
{
c = *s++;
1019 L$286:
1019 8E C1 mov es,cx
101B 26 8A 04 mov al,es:[si]
101E 46 inc si
/* uppercase character */
/* for now, ASCII only because nls.c cannot handle DS!=SS */
if (c >= 'a' && c <= 'z')
101F 3C 61 cmp al,0x61
1021 7C 08 jl L$287
1023 3C 7A cmp al,0x7a
1025 7F 04 jg L$287
c -= 'a' - 'A';
1027 2C 20 sub al,0x20
else if (c == '/')
1029 EB 06 jmp L$288
102B L$287:
102B 3C 2F cmp al,0x2f
102D 75 02 jne L$288
c = '\\';
102F B0 5C mov al,0x5c
*t++ = c;
1031 L$288:
1031 8E C2 mov es,dx
1033 26 88 07 mov es:[bx],al
1036 43 inc bx
>
> > case 0x13:
> > + r.AX = (unsigned char)r.callerARG1;
> > + if (r.AX >= 'a' && r.AX <= 'z')
> > + r.AX -= 'a' - 'A';
>
> 1. Bug: RBIL says that returned AL, not AX.
> 2. This code in any case may be optimized by reducing comparisions to bytes:
>
> if (r.AL >= (UBYTE)'a' && ...
>
> 3. My code looks so:
>
> case 0x13: /* uppercase character */
> {
> /* for now, ASCII only because nls.c cannot handle DS!=SS */
> unsigned char ch = r.callerARG1;
> if (ch >= (UBYTE)'a' && ch <= (UBYTE)'z')
> ch -= (UBYTE)('a' - 'A');
> r.AL = ch;
> break;
> }
Something funny is going here. Your code by itself is a little smaller (5
bytes) but it adds 4 bytes to inthndlr.obj. The reason is that some common
code is used -- if r.AL < 'a' then it can jump directly to the break
statement, and this jump can be used by some code down the line. As
above, I already get the byte comparison without casting.
> > + put_string("unimplemented internal dos function INT2F/12");
> > + put_unsigned(r.AL, 16, 2);
>
> What wrong in (shorter code):
>
> put_string("unimplemented internal dos function INT2F/");
> put_unsigned(r.AX, 16, 4);
>
> ?
Nothing really.
Bart
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel