John S:
Rudnei's example code, in four pieces, at https://forums.silverfrost.com/Forum/Topic/3333&highlight=winio
Your example code, in two pieces, at http://forums.silverfrost.com/viewtopic.php?t=3769&highlight=npcplex2v2a2test3
DanRRight's example code, in two pieces at https://forums.silverfrost.com/Forum/Topic/3367&highlight=module+allsubsbremms, after fixing the bugs in it
In fact, you can pick any code that contains WINIO@ calls. The bug is perfectly reproducible and simple in nature. It is also easy to work-around, pending a proper fix from Silverfrost. After n calls to WINIO@, add CALL ADJESP(n). The fix-up is done in assembler code, given below, which can be assembled using NASM (obtained from https://www.nasm.us/ ), and linked to your FTN95 code with SLINK.
If you are a victim of stack-anxiety, you can add CALL ADJESP(1) after every call to WINIO@.
; call adjesp(n) -- add 4*n to esp
;
; nasm.exe -f win32 adjesp.asm
;
global _ADJESP
SECTION .text
_ADJESP:
pop eax ; return address
pop ecx ; arg, contains number of 32-bit words to 'pop'
mov ecx, [ecx]; count of 32-bit words to pop
lea esp, [esp + 4*ecx - 4]; -4 since caller will pop arg
jmp eax