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,456 of 4,675   
   Kerr-Mudd, John to John"   
   Re: show current Month's calendar in 256   
   17 May 22 08:03:34   
   
   XPost: alt.lang.asm, comp.os.msdos.programmer   
   From: admin@nospicedham.127.0.0.1   
      
   On Mon, 16 May 2022 17:15:53 +0100   
   "Kerr-Mudd, John"  wrote:   
      
   > On Sat, 14 May 2022 09:25:20 +0100   
   > "Kerr-Mudd, John"  wrote:   
   >   
   > > On Fri, 13 May 2022 14:45:01 +0100   
   > > "Kerr-Mudd, John"  wrote:   
   > >   
   > > > On Wed, 11 May 2022 11:11:56 +0100   
   > > > "Kerr-Mudd, John"  wrote:   
   > > >   
   > > > > DOS prog to display current month - parm of capital 'M' starts week at   
   Monday, defaults to Sunday.   
   > > > > uses int 21 fn 2A for getting current date and fn 09 for display.   
   > []   
   > >   
   > > New! Improved! 256 bytes. Warranty expires Dec 31st 9999. (code is OK to   
   y32k, but it won't display 5 digit year)   
   > >   
   > > Thanks for taking a peek Wolfgang, don't get hung up on the DOS interrupt,   
   focus on the leap year test and month length array...   
   >   
   > 244 bytes:   
   >   
   []   
   >   
   >   
   > y2k code slimmed down; still a bit clunky I feel:   
   > actual code for those not keen to convert hex dumps:   
   >   
   > ;PrtYear: I: ax=year ; O: dh=Febadj   
   >          mov cl,100d         ; ch 0 still   
   >        push dx                ; hi=mth lo=StrtDayOff   
   >         ; xor dx,dx   
   >          cwd                 ; prog no good after y32k! but [-1]   
   >          div cx              ; ax=CC, dx=YY ; bad disp after 10k   
   >       push dx   
   > ;; lpyrcalc I: dl=YY, al=CC; O: dh=Febadj     [14]   
   >          or dl,dl            ; YY=0?           [2]   
   >          jnz notcent   
   >          mov dl,al           ; so check CC   
   >   
   >        notcent:              ; lpyr    notlpyr   
   >          and dx,3            ;  0      nz      [3]   
   >          dec dx              ; dh=FFFF dh=0   
      
       ;      not dh              ;  0      -1      [2]   
       ;      dec dh              ; -1,     -2      [2]   
      
   Better: (but only by 1)   
              or dh,-2            ; -1,     -2      [3]   
      
      
      
   >   
   >          mov cl,10           ; lth prt [13]   
   >                putnumal      ; CC (6)   
   >       pop ax   
   >                putnumal      ; YY   
   >         ;;ah nz   
   >   
   > [omitted header print]   
   >   
   >   
   >         pop bx               ; hi=mth lo=StrtDayOff   
   >   
   > ;; calc mthlth  I: bh=mth, dl=Febadj; O: dl=mthlth [17+10=27], dl lost   
   > ;; uses cl, bp.  al untouched   
   >   
   > ;; lpyr check earlier   
   >   
   >          cmp bh,2            ; [3]   
   >          je IsFeb            ; retain dh Febadj   
   >          cwd                 ; dh=0 for non Feb mths any year   
   > IsFeb:   
   >          mov cl,bh           ; DNOSAJJMAMFJ   
   >          mov bp,0x06B5       ; 101011010101; default feb to 30   
   >          shr bp,cl   
   >          adc dh,30           ; this mth lth [16]   
   >   
   >   
   > [omitted rtn to print day numbers offset to correct column, stop at dh]   
   >   
      
   --   
   Bah, and indeed Humbug.   
      
   --- 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