Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 4,508 of 4,675    |
|    Paul Edwards to All    |
|    OW compiler bug? (1/2)    |
|    21 Nov 22 20:29:18    |
   
   From: mutazilah@nospicedham.gmail.com   
      
   Does this code look wrong?   
      
   (Generated by Open Watcom 1.6)   
      
   es:di are not pointing to something sensible.   
      
   Here is the source code:   
      
    ln2 = t - s;   
    memcpy(tempbuf, s ,ln2);   
      
    if (ln2 != 0)   
    {   
    tempbuf[ln2++] = '\\';   
    }   
      
    strcpy(tempbuf + ln2, b);   
    ln2 += strlen(b);   
    strcpy(tempbuf + ln2, ".com");   
      
   printf("checking for exists of %s\n", tempbuf);   
    if (exists(tempbuf))   
    {   
   #ifdef __32BIT__   
    strcpy(cmdt, tempbuf);   
    strcat(cmdt, " ");   
    strcat(cmdt, p);   
   #endif   
    PosExec(tempbuf, &parmblock);   
    break;   
    }   
      
    printf("tempbuf is %p, ln2 is %d, exe is %s %s %p %p\n", tempbuf, ln2,   
   ".exe", ".exe", ".exe", ".exe");   
    strcpy(tempbuf + ln2 ,".exe");   
    __brkpoint();   
      
   printf("checking for exists of %s\n", tempbuf);   
      
      
   I was alerted to the problem when tempbuf didn't change.   
      
   Here is the PDOS/86 monitor:   
      
   zap 4870:c961 0xcc   
   exit   
   stop   
   checking for exists of portinit.com   
   got a match for 192 bytes, allocated is 0   
   got a match for 192 bytes, allocated is 0   
   checking for exists of c:\dos\portinit.com   
   got a match for 192 bytes, allocated is 0   
   tempbuf is 55D1:B8F4, ln2 is 15, exe is .exe .exe 55D1:0CF4 55D1:0CF4   
   got a breakpoint   
   AX 5500 BX 55D1 CX B903 DX B8F4   
   SI 0CF8 DI 0008 DS 55D1 ES 55D1   
   BP BA04 CS 4870 IP C962 FLAGS 0246   
   SS 55D1 SP B8EC   
   module loaded at 4870:0000, entry point 4870:B2B4   
   interrupt address is 4870:C962   
   adjusting to 4870:C961   
   current module loaded at 4870:0000, entry point 4870:B2B4   
   enter a hex address or range, exit to exit, help for help   
   55d1:b8f4-55d1:b913   
   55D1:B8F4 633A5C64 6F735C70 6F727469 6E69742E c:\dos\portinit.   
   6161:0004 636F6D00 FCAA0000 DA8A8C1D D7380CAB com..........8..   
   55d1:0cf4-55d1:0cff   
   55D1:0CF4 2E657865 0074656D 70627566 .exe.tempbuf   
      
      
   And here is the generated code:   
      
   166B L$199:   
   166B 5F pop di   
   166C 1F pop ds   
   166D 8B BE EE FE mov di,word ptr -0x112[bp]   
   1671 8E 86 EC FE mov es,word ptr -0x114[bp]   
   1675 B9 FF FF mov cx,0xffff   
   1678 33 C0 xor ax,ax   
   167A F2 AE repne scasb   
   167C F7 D1 not cx   
   167E 49 dec cx   
   167F 8C DE mov si,ds   
   1681 01 4E FE add word ptr -0x2[bp],cx   
   1684 8D 8E F0 FE lea cx,-0x110[bp]   
   1688 B8 C6 0C mov ax,offset DGROUP:L$806   
   168B 03 4E FE add cx,word ptr -0x2[bp]   
   168E 16 push ss   
   168F 07 pop es   
   1690 89 CF mov di,cx   
   1692 1E push ds   
   1693 57 push di   
   1694 96 xchg ax,si   
   1695 8E D8 mov ds,ax   
   1697 L$200:   
   1697 8A 04 mov al,byte ptr [si]   
   1699 26 88 05 mov byte ptr es:[di],al   
   169C 3C 00 cmp al,0x00   
   169E 74 11 je L$201   
   16A0 8A 44 01 mov al,byte ptr 0x1[si]   
   16A3 83 C6 02 add si,0x0002   
   16A6 26 88 45 01 mov byte ptr es:0x1[di],al   
   16AA 83 C7 02 add di,0x0002   
   16AD 3C 00 cmp al,0x00   
   16AF 75 E6 jne L$200   
   16B1 L$201:   
   16B1 5F pop di   
   16B2 1F pop ds   
   16B3 16 push ss   
   16B4 8D 96 F0 FE lea dx,-0x110[bp]   
   16B8 52 push dx   
   16B9 1E push ds   
   16BA B8 CB 0C mov ax,offset DGROUP:L$807   
   16BD 50 push ax   
   16BE 8C D2 mov dx,ss   
   16C0 9A 00 00 00 00 call printf_   
   16C5 8D 86 F0 FE lea ax,-0x110[bp]   
   16C9 83 C4 08 add sp,0x0008   
   16CC 8C D3 mov bx,ss   
   16CE E8 00 00 call exists_   
   16D1 85 C0 test ax,ax   
   16D3 74 3A je L$204   
   16D5 BB 00 00 mov bx,offset _parmblock   
   16D8 8D 86 F0 FE lea ax,-0x110[bp]   
   16DC 8C D9 mov cx,ds   
   16DE 8C D2 mov dx,ss   
   16E0 9A 00 00 00 00 call PosExec_   
   16E5 L$202:   
   16E5 C4 5E FA les bx,dword ptr -0x6[bp]   
   16E8 26 80 3F 00 cmp byte ptr es:[bx],0x00   
   16EC 75 1E jne L$203   
   16EE FF B6 EC FE push word ptr -0x114[bp]   
   16F2 FF B6 EE FE push word ptr -0x112[bp]   
   16F6 1E push ds   
   16F7 B8 29 0D mov ax,offset DGROUP:L$812   
   16FA 50 push ax   
   16FB 9A 00 00 00 00 call printf_   
   1700 B8 01 00 mov ax,0x0001   
   1703 83 C4 08 add sp,0x0008   
   1706 89 EC mov sp,bp   
   1708 5D pop bp   
   1709 5F pop di   
   170A 5E pop si   
   170B C3 ret   
   170C L$203:   
   170C E9 F6 00 jmp L$213   
   170F L$204:   
   170F 1E push ds   
   1710 B8 E6 0C mov ax,offset DGROUP:L$808   
   1713 50 push ax   
   1714 1E push ds   
   1715 50 push ax   
   1716 1E push ds   
   1717 50 push ax   
   1718 1E push ds   
   1719 50 push ax   
   171A FF 76 FE push word ptr -0x2[bp]   
   171D 16 push ss   
   171E 8D 96 F0 FE lea dx,-0x110[bp]   
   1722 52 push dx   
      
   [continued in next message]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca