home bbs files messages ]

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,096 of 4,675   
   Rick C. Hodgin to John   
   Re: small asm code (compo?)   
   23 Aug 20 13:11:07   
   
   From: rick.c.hodgin@nospicedham.gmail.com   
      
   On 8/22/20 7:44 AM, Kerr-Mudd,John wrote:   
   > Spec is to show the day of week as a literal string;   
   >   
   > given these DOS functions (maybe others?)   
   >   
   > get daynum: DOS has int 0x21, fn 0x2A which returns al as 0-6 (Sun-Sat)   
   >   
   > print: int 21, fn 2 with dl=char   
   >    or int 21, fn 9 with dx pointing to a string terminated with a $ (x24)   
   >   
   > terminate with return code: int 0x21 fn 0x4C, code in al   
   >   
   >   
   > Write shortest programs to show day string of the current day;   
   >   
   > 1) full string e.g. "Monday", "Saturday"   
   > 2) 3 letter e.g. "Mon", "Sat"   
   > 3) 2 letter e.g. "Mo", "Sa"   
   >   
   >   
   > My current shortests are:   
   > 1) 67   
   > 2) 49   
   > 3) 40   
      
   17 bytes code, 32 bytes code + data.   
      
    Open Watcom 16-bit DOS EXE small memory model:   
   .MODEL small   
   .8086   
      
   .data   
        days BYTE "SuMoTuWeThFrSa$"   
      
   .code   
        test_ PROC PUBLIC   
            mov     ah,2ah   
            int     21h   
            cbw   
            mov     bx,ax   
            add     bx,offset days   
            mov     byte ptr [bx+2],'$'   
            mov     dx,bx   
            mov     ah,9   
            int     21h   
            ret   
        test_ ENDP   
      
   END   
      
   --   
   Rick C. Hodgin   
      
   --- 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