From: zfysz@nospicedham.fysnet.net   
      
   "Benjamin David Lunt" wrote in message   
   news:oiu7g7$5to$1@gioia.aioe.org...   
   >   
   > I have decided to change the requirements from -1, 0, +1, as   
   > C would have it, to the above. As long as I document it well,   
   > future projects using this code should be just fine.   
      
   See the code below for what I have come up with. This allows   
   all ascii chars to be in either string. It is two bytes larger   
   than I need, but I can find two bytes in another part of my   
   code easy enough.   
      
   Ben said:   
   > Unfortunately, ext2 only allows 512 bytes for the first stage   
   > boot code.   
      
   Sorry, this was a mistake. Ext2 allow two 512 byte sectors, or   
   1024 bytes of first stage boot code. The Superblock is at 0x400.   
    Too many file systems...   
    Not enough memory (the memory between my ears) :-)   
      
   Thanks for your comments,   
   Ben   
      
   =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-   
   this routine compares (case insensitive) two strings   
   ds:si->string0 (asciiz)   
   es:di->string1 (asciiz)   
   returns zero flag set if equal   
   carry flag set if string0 < string1   
   carry flag clear if string0 > string1   
   preserves: si, di   
   destroys: ax   
   stricmp proc near uses si di   
      
   @@: mov al,es:[di]   
    inc di   
    call upper_case   
    mov ah,al   
      
    lodsb   
    call upper_case   
      
    ; if both strings are equal and we are at   
    ; the null terminator, we need to exit now   
    or ax,ax   
    jz short @f   
      
    ; 'sub' will set/clr the zero flag   
    ; and the carry flag for us   
    sub al,ah   
    jz short @b   
      
   @@: ret   
   stricmp endp   
      
   upper_case proc near   
    cmp al,'a'   
    jb short @f   
    cmp al,'z'   
    ja short @f   
    sub al,('a'-'A')   
   @@: ret   
   upper_case endp   
      
    .end   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|