From: notsaying@nospicedham.127.0.0.1   
      
   On Mon, 24 Aug 2020 09:32:28 GMT, "Kerr-Mudd,John"   
    wrote:   
      
   > On Mon, 24 Aug 2020 08:57:30 GMT, Terje Mathisen   
   > wrote:   
   >   
   >> Kerr-Mudd,John wrote:   
   >>> On Sun, 23 Aug 2020 18:41:33 GMT, aen@nospicedham.spamtrap.com wrote:   
   >>>   
   >>>> On Sun, 23 Aug 2020 13:11:07 -0400, "Rick C. Hodgin"   
   >>>> wrote:   
   >>>>> ...   
   >>>>> mov ah,2ah   
   >>>>> int 21h   
   >>>> shl al,1   
   >>>>> cbw   
   >>>>> mov bx,ax   
   >>>>> add bx,offset days   
   >>>>> mov byte ptr [bx+2],'$'   
   >>>>> mov dx,bx   
   >>>>> mov ah,9   
   >>>>> int 21h   
   >>>>> ret   
   >>>   
   >>> Yup, that's about it; I forgot to put in the original spec that I   
   want   
   >>> the return code set to 1 for Sun etc, Otherwise the 'mov bx,ax' could   
   >>> have been an 'xchg'.   
   >>>   
   >>> Anyone want to try the long version? ('Monday' 'Tuesday' etc?)   
   >>>   
   >> It seems obvious that you would print "day" separately from the   
   leading   
   >> day name chars, since that would save ~18 data bytes.   
   >>   
   >> One complication is that the names are different lengths, and we   
   cannot   
   >> pad them all to fit "Wednes$", so maybe use XLAT to convert day number   
   >> to starting offset via a 7-byte table?   
   >>   
   >   
   > One of my 'best' does a table lookup. I don't use xlat, as it changes   
   al.   
   >   
      
   Just for completeness this is one that tied for 67   
      
   cpu 8086 ; show day str l67   
   org 0x100 ; look bkwd, use caps as dlm saved extra dlm, but same lth   
    mov ah,0x2A ; get system date   
    int 0x21 ; al daynum, 0=sun; [cx=yr-1980, dh=mth,dl=dom]   
    inc ax ; 1-7   
    cbw ; 2A->0   
    mov cx,ax ; keep ax for exit   
    mov ah,0x4C ; exitwrc   
    mov si,daydollar ; to append   
    mov bx,si ;; save 1 here, 1 for noEOS, lose 2 in mov   
   dx,bx   
   nextday:   
    mov di,bx ; update day end ptr   
   backone:   
    dec bx   
    test byte [bx],0x20 ; al untouched   
    jnz backone   
    loop nextday   
    mov dx,bx ; prt start   
    movsw ; append 'day$'   
    movsw   
   exitint:   
    xchg ax,bp ; bp=09xx == mov ah,09 ; prtstr   
    int 0x21 ; al=$   
    jmp exitint ; have ax setup for exit   
      
   sSat db 'Satur'   
   sFri db 'Fri'   
   sThu db 'Thurs'   
   sWed db 'Wednes'   
   sTue db 'Tues'   
   sMon db 'Mon'   
   sSun db 'Sun'   
   daydollar db 'day$'   
      
      
      
   --   
   Bah, and indeed, Humbug.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|