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,090 of 4,675    |
|    Terje Mathisen to John    |
|    Re: small asm code (compo?)    |
|    22 Aug 20 20:52:32    |
      From: terje.mathisen@nospicedham.tmsw.no              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:              mov ah,2ah       int 21h       cbw       mov si,ax       mov dl,first_letter[si]       call print1       mov dl,second_letter[si]       print1:       mov ah,2       int 21h       ret ;; Return after first letter, exit after second       first_letter db "SMTWTFS"       second_letter db "uouehra"              Close to your own?              Terje       --       - |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca