diff --git a/kern.c b/kern.c index b2d2da3..7ea5e52 100644 --- a/kern.c +++ b/kern.c @@ -136,10 +136,8 @@ int KERN_C_CALL Net_Call_CX(unsigned int ax, unsigned int bx, * int 21h * * Return convention mirrors Novell wrapper and old kern.asm Net_Call: - * if AL != 0, AH is set to 89h in Net_Call_F2_C_Last.out_ax - * return AL only - */ -int KERN_C_CALL Net_Call_F2_C(UI conn, UI function, UI cx, void *req, void *repl) +int KERN_C_CALL Net_Call_F2_C(UI function, UI req_len, UI repl_len, + void *req, void *repl) { union REGS inregs; union REGS outregs; @@ -151,10 +149,19 @@ int KERN_C_CALL Net_Call_F2_C(UI conn, UI function, UI cx, void *req, void *repl memset(&segregs, 0, sizeof(segregs)); memset(&Net_Call_C_Last, 0, sizeof(Net_Call_C_Last)); + /* + * Official FLAG.EXE wrapper shape: + * AH = F2h + * AL = NCP function, e.g. 57h for NCP 87 + * CX = request length + * DX = reply buffer length + * DS:SI = request buffer + * ES:DI = reply buffer + */ inregs.h.ah = 0xF2; inregs.h.al = (uint8)(function & 0xff); - inregs.x.dx = conn; - inregs.x.cx = cx; + inregs.x.cx = req_len; + inregs.x.dx = repl_len; inregs.x.si = FP_OFF(req); inregs.x.di = FP_OFF(repl); segregs.ds = FP_SEG(req); @@ -191,10 +198,6 @@ int KERN_C_CALL Net_Call_F2_C(UI conn, UI function, UI cx, void *req, void *repl } -/* - * Text dump for quick testing. Later we can expose this through DEBUG.EXE - * as "debug netcall" or similar. - */ void KERN_C_CALL Net_Call_C_Dump(void) { fprintf(stdout, "NETCALLC in : AX=%04X BX=%04X CX=%04X DX=%04X DS:SI=%04X:%04X ES:DI=%04X:%04X\n", diff --git a/kern.h b/kern.h index ed6ca1d..d391b4f 100644 --- a/kern.h +++ b/kern.h @@ -16,7 +16,7 @@ extern int KERN_CALL Net_Call(UI func, void *req, void *repl); extern int KERN_CALL Net_Call_C(UI func, void *req, void *repl); extern int KERN_CALL Net_Call_CX(UI func, UI bx, UI cx, UI dx, void *req, void *repl); -extern int KERN_CALL Net_Call_F2_C(UI conn, UI function, UI cx, +extern int KERN_CALL Net_Call_F2_C(UI function, UI req_len, UI repl_len, void *req, void *repl); extern void KERN_CALL Net_Call_C_Dump(void); extern UI KERN_CALL Net_Call_C_GetDebug(UI idx); diff --git a/nwtests.c b/nwtests.c index d994e79..292736f 100644 --- a/nwtests.c +++ b/nwtests.c @@ -266,11 +266,11 @@ static int tests_ncpf2_read_one(char *name, UI cx_mode) else cx = sizeof(repl.data); /* alternate: reply buffer size */ - fprintf(stdout, "NCPF2DBG name=%s func=57 conn=%u cx=%u mode=%u req.len=%u repl.max=%u\n", - name, connid, cx, cx_mode, (UI)(p - req.data), (UI)sizeof(repl.data)); + fprintf(stdout, "NCPF2DBG name=%s func=57 conn=%u cx=%u dx=%u mode=%u req.len=%u repl.max=%u\n", + name, connid, cx, (UI)sizeof(repl.data), cx_mode, (UI)(p - req.data), (UI)sizeof(repl.data)); tests_dump_bytes("NCPF2DBG req:", req.data, (p - req.data) > 64 ? 64 : (int)(p - req.data)); - rc = Net_Call_F2_C((UI)connid, 0x57, cx, req.data, repl.data); + rc = Net_Call_F2_C(0x57, cx, (UI)sizeof(repl.data), req.data, repl.data); fprintf(stdout, "NCPF2DBG rc=%04X\n", rc); tests_dump_bytes("NCPF2DBG repl:", repl.data, 64);