Hi! - inthndlr.c: ______________O\_/_________________________________\_/O______________ /* Display String */ case 0x09: { unsigned char c; unsigned char FAR *bp = FP_DS_DX;
while ((c = *bp++) != '$') write_char_stdout(c); lr.AL = c; } _____________________________________________________________________ O/~\ /~\O Using `c' after loop (and after write_char_stdout() call) breaks optimization, because compiler should now preserve value of `c' on stack. I suggest, better return old line "lr.AL = '$'". Also, both `c' and `*bp' are not required to be unsigned. - inthndlr.c: ______________O\_/_________________________________\_/O______________ /* Extended Open-Creat, not fully functional. (bits 4,5,6 of BH) */ case 0x6c: { long lrc; /* high nibble must be <= 1, low nibble must be <= 2 */ if ((lr.DL & 0xef) > 0x2) goto error_invalid; lrc = DosOpen(MK_FP(lr.DS, lr.SI), (lr.BX & 0x70ff) | ((lr.DL & 3) << 8) | ((lr.DL & 0x10) << 6), lr.CL); _____________________________________________________________________ O/~\ /~\O First, losted AL check (for AX=6C00) - should be "if (lr.AL || ((lr.DL". Also, RBIL says about DH=0. If add check for DH, then `if' wiil look so: "if ((lr.AL | lr.DH) || ((lr.DL" or "if (lr.AL || ((lr.DX & 0xFFEF". Also, last expression, probably, may be optimized so: lrc = DosOpen(MK_FP(lr.DS, lr.SI), (lr.BX & 0x70ff) | ((((lr.DL << 2) | lr.DL) & 0x1C) << 6), lr.CL); or so: unsigned action = lr.DX; /* high nibble must be <= 1, low nibble must be <= 2 */ if (lr.AL || (action & ~0x10) > 2u) goto error_invalid; /* place bit 4 to bit 10, bits 0-1 to bits 8-9 */ action = (((action << 2) | action) & 0x1C) << 6; lrc = DosOpen(MK_FP(lr.DS, lr.SI), (lr.BX & 0x70ff) | action, lr.CL); - inthndlr.c: ______________O\_/_________________________________\_/O______________ case 0x11: /* normalise ASCIIZ filename */ [...] if (c >= 'a' && c <= 'z') c -= 'a' - 'A'; else if (c == '/') c = '\\'; _____________________________________________________________________ O/~\ /~\O `else' before second `if' may be removed. - inthndlr.c: ______________O\_/_________________________________\_/O______________ struct int2f12regs { [...] - UWORD di, si, bp, bx, dx, cx, ax; + UWORD di, si, bp; + xreg b, d, c, a; [...] VOID ASMCFUNC int2F_12_handler(struct int2f12regs r) [...] case 0x06: /* invoke critical error */ /* code, drive number, error, device header */ - r.ax &= 0xff00; - r.ax |= CriticalError(r.callerARG1 >> 8, + r.AL = CriticalError(r.callerARG1 >> 8, [...] case 0x20: /* get job file table entry */ - { - psp FAR *p = MK_FP(cu_psp, 0); - unsigned char FAR *idx; - if (r.bx >= p->ps_maxfiles) + if (r.BX >= ((psp FAR*) MK_FP (cu_psp, 0))->ps_maxfiles) { - r.ax = (r.ax & 0xff00) | (-DE_INVLDHNDL); + r.AL = -DE_INVLDHNDL; r.flags |= FLG_CARRY; break; } - idx = &p->ps_filetab[r.bx]; + r.es = cu_psp; + r.di = offsetof (psp FAR, ps_maxfiles) + r.BX; r.flags &= ~FLG_CARRY; - r.es = FP_SEG(idx); - r.di = FP_OFF(idx); - } break; [...] case 0x23: /* check if character device */ - { - struct dhdr FAR *dhp; - dhp = IsDevice((BYTE FAR *) DirEntBuffer.dir_name); - if (dhp) + if (!IsDevice ((BYTE FAR*) DirEntBuffer.dir_name)) + { + r.flags |= FLG_CARRY; + break; + } - { - r.bx = (r.bx & 0xff) | (dhp->dh_attr << 8); + r.BH = dhp->dh_attr << 8; r.flags &= ~FLG_CARRY; - } - else - { - r.flags |= FLG_CARRY; - } - } break; _____________________________________________________________________ O/~\ /~\O ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel