From c68d73faa6525837c27b6b8404168a9e5dcf761d Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sat, 23 May 2026 16:59:44 +0200 Subject: [PATCH] tests --- kern_wasm.asm | 55 ++++++++++++++++++++++++--------------------------- nwtests.c | 28 ++++++++++++++------------ 2 files changed, 41 insertions(+), 42 deletions(-) diff --git a/kern_wasm.asm b/kern_wasm.asm index 61fbe70..abfc602 100644 --- a/kern_wasm.asm +++ b/kern_wasm.asm @@ -6,7 +6,7 @@ ; Keep kern.asm as the historical TASM source and use this file for the ; reproducible Open Watcom build. -.386 +.286 .model large .data @@ -290,21 +290,19 @@ _Net_Call_VLM_Raw endp ; int C32_LoadNios_Probe(UI axfunc, void *outbuf) ; -; Probe the Client32/NIOS INT 2F entry used by DeveloperNet dninit.asm: -; AX = axfunc, normally D8C1h -; INT 2Fh -; AX = 0000 on success -; ESI and ECX contain Client32/NIOS function pointers/data +; 16-bit-safe Client32/NIOS probe. +; Calls INT 2F AX=D8C1 like DeveloperNet LoadNiosFunctions, +; but stores only 16-bit visible registers so kern.obj stays 16-bit. ; -; outbuf layout, little endian: -; +00 word AX after int 2F -; +02 dword ESI after int 2F -; +06 dword ECX after int 2F -; +0A word BX -; +0C word CX low -; +0E word DX -; +10 word SI low -; +12 word DI low +; outbuf: +; +00 AX +; +02 BX +; +04 CX +; +06 DX +; +08 SI +; +0A DI +; +0C DS +; +0E ES _C32_LoadNios_Probe proc far push bp mov bp, sp @@ -314,26 +312,25 @@ _C32_LoadNios_Probe proc far push si push di - xor ecx, ecx - xor esi, esi - xor ebx, ebx - xor edx, edx - xor edi, edi - mov ax, [bp+6] int 2Fh + push ds + push ax les di, dword ptr [bp+8] + pop ax mov es:[di+0], ax - mov dword ptr es:[di+2], esi - mov dword ptr es:[di+6], ecx - mov es:[di+10], bx - mov es:[di+12], cx - mov es:[di+14], dx - mov es:[di+16], si - ; DI currently points at outbuf, so store caller-visible DI is not useful. - mov word ptr es:[di+18], 0 + mov es:[di+2], bx + mov es:[di+4], cx + mov es:[di+6], dx + mov es:[di+8], si + ; store caller-visible DI is lost because DI now points to outbuf + mov word ptr es:[di+10], 0 + pop ax + mov es:[di+12], ax + mov ax, es + mov es:[di+14], ax pop di pop si diff --git a/nwtests.c b/nwtests.c index ce68855..fa12b7c 100644 --- a/nwtests.c +++ b/nwtests.c @@ -1147,33 +1147,35 @@ static int tests_c32type(void) uint8 out[32]; int rc; uint16 ax; - uint32 esi; - uint32 ecx; uint16 bx; uint16 cx; uint16 dx; uint16 si; + uint16 di; + uint16 dsreg; + uint16 esreg; memset(out, 0, sizeof(out)); - fprintf(stdout, "TEST Client32/NIOS probe\n"); + fprintf(stdout, "TEST Client32/NIOS probe 16-bit safe\n"); fprintf(stdout, "Call INT 2F AX=D8C1 like DeveloperNet dninit.asm\n\n"); rc = C32_LoadNios_Probe(0xD8C1, out); - ax = tests_get_word_lh(out + 0); - esi = tests_get_dword_lh2(out + 2); - ecx = tests_get_dword_lh2(out + 6); - bx = tests_get_word_lh(out + 10); - cx = tests_get_word_lh(out + 12); - dx = tests_get_word_lh(out + 14); - si = tests_get_word_lh(out + 16); + ax = tests_get_word_lh(out + 0); + bx = tests_get_word_lh(out + 2); + cx = tests_get_word_lh(out + 4); + dx = tests_get_word_lh(out + 6); + si = tests_get_word_lh(out + 8); + di = tests_get_word_lh(out + 10); + dsreg = tests_get_word_lh(out + 12); + esreg = tests_get_word_lh(out + 14); fprintf(stdout, "C32 probe rc=%04X\n", rc); fprintf(stdout, "INT2F D8C1 result AX=%04X\n", ax); - fprintf(stdout, "ESI=%08lX ECX=%08lX\n", esi, ecx); - fprintf(stdout, "BX=%04X CX=%04X DX=%04X SI=%04X\n", bx, cx, dx, si); - tests_dump_bytes("RAW:", out, 20); + fprintf(stdout, "BX=%04X CX=%04X DX=%04X SI=%04X DI=%04X\n", bx, cx, dx, si, di); + fprintf(stdout, "DS=%04X ES=%04X\n", dsreg, esreg); + tests_dump_bytes("RAW:", out, 16); if (ax == 0) { fprintf(stdout, "\nClient32/NIOS entry appears present.\n");