From: notsaying@nospicedham.127.0.0.1   
      
   On Sun, 23 Aug 2020 08:11:34 GMT, wolfgang kern   
    wrote:   
      
   > 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;   
      
   plain 8086 for me!   
      
   >>>   
   >>> 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   
   >>>   
   I forgot that I 'up' the return code/errorlevel, I want 1 for Sun, 7 for   
   Saturday.   
      
   >>>   
   >>> 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. :-)   
   >>   
   Yes.   
      
   >> 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 ?   
   yes, si same   
   > 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   
   >   
   >   
   No the $ is only used for the fn 9 call, it doesn't get printed.   
   But it fails as there's no errorlevel set by 'ret'.   
      
   Here's one of mine: (42)   
      
   cpu 8086 ; show 3^w 2 chr day str l42   
   org 0x100 ;   
      
    mov ah,0x2A ; get system date   
    int 0x21 ; al daynum, 0=sun; cx:dx   
    push ax   
    cbw   
    shl ax,1   
    xchg si,ax ; to ix reg   
    mov ah,2   
   pnc:   
    mov dl,[dystrs+si] ; getc   
    int 0x21 ; al lost   
    inc si   
    dec bx   
    jpe pnc ; prt twice   
    pop ax   
    mov ah,0x4C   
    inc ax   
    int 0x21 ; erl 1=Sun   
      
   dystrs db 'SuMoTuWeThFrSa'   
      
      
      
      
   --   
   Bah, and indeed, Humbug.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|