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,091 of 4,675   
   wolfgang kern to Terje Mathisen   
   Re: small asm code (compo?)   
   23 Aug 20 10:11:34   
   
   From: nowhere@nospicedham.never.at   
      
   On 22.08.2020 20:52, Terje Mathisen wrote:   
   > 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   
   >   
   > That seems somewhat bogus:   
   >   
   > If you can do Mo, Tu, We, Th etc in 40 bytes, then adding one more byte   
   > to each string should only result in 7 more bytes?   
   >   
   > OTOH, if you do all the two-letter abbreviations as two Dos calls and   
   > the 3 and 6-8 letter versions with '$' terminated strings then it makes   
   > more sense. :-)   
   >   
   > For the two-letter case:   
      
   let me check   
      
   00 mov ah,2ah   
   02 int 21h   
   04 cbw   
   05 mov si,ax                  ;1 byte: xchg ax,si   
   07 mov dl,first_letter[si]    ;   
   0a call print1                ;sure about si remain ?   
   0d mov dl,second_letter[si]   
     print1:   
   10 mov ah,2   
   12 int 21h   
   13 ret    ;; Return after first letter, exit after second   
   15 first_letter db "SMTWTFS"   
   1c second_letter db "uouehra"   
   23   
      
   > Close to your own?   
   >   
   > Terje   
      
   Not an A :) missing "$"   
   __   
   wolfgang   
      
   --- 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