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,104 of 4,675   
   Kerr-Mudd,John to rick.c.hodgin@nospicedham.gmail.com   
   Re: small asm code (compo?)   
   24 Aug 20 09:27:52   
   
   From: notsaying@nospicedham.127.0.0.1   
      
   On Sun, 23 Aug 2020 21:19:14 GMT, "Rick C. Hodgin"   
    wrote:   
      
   > On 8/23/20 3:48 PM, Kerr-Mudd,John wrote:   
   >> Anyone want to try the long version? ('Monday' 'Tuesday' etc?)   
   >   
   > 21 bytes code plus 47 bytes data = 68 bytes.   
   >   
   > .MODEL small   
   > .8086   
   >   
   > .data   
   >      long_days BYTE 0,"Sun$"   
   >                BYTE 1,"Mon$"   
   >                BYTE 2,"Tues$"   
   >                BYTE 3,"Wednes$"   
   >                BYTE 4,"Thurs$"   
   >                BYTE 5,"Fri$"   
   >                BYTE 6,"Satur$"   
   >      day BYTE "day$"   
   >   
   > .code   
   >      test2_ PROC PUBLIC   
   >          mov     ah,2ah   
   >          int     21h   
   >          mov     di,offset long_days   
   >          std   
   >          scasb   
   >          mov     dx,di   
   >          inc     dx   
   >          mov     ah,9   
   >          int     21h   
   >          mov     dx,offset day   
   >          int     21h   
   >          ret   
   >      test2_ ENDP   
   >   
   > END   
   >   
      
   All those extra '$'s! I can see no-one wants to set the return code on   
   exit, it adds to the fun of retaining the day number. 74 with rc   
      
   cpu 8086  ; show day str l74   
   org 0x100 ; lookup, dbl prt   
            mov     ah,0x2A     ; get system date   
            int     0x21        ; al daynum, 0=sun; cx:dx   
   	   push ax   
            mov     di,long_days   
            repne   scasb       ; find daystr   
            mov     dx,di   
            mov     ah,9   
            int     0x21   
            mov     dx,day      ; prt 'day'   
            int     0x21   
           pop ax   
         ;   add ax,0x100*(0x4C-0x2A)+1   
            mov     ah,0x4C     ; exit with rc   
            inc ax   
            int 0x21   
      
   long_days db 0,"Sun$",1,"Mon$",2,"Tues$",3,"Wednes$"   
             db 4,"Thurs$",5,"Fri$",6,"Satur$"   
   day db "day$"   
      
   --   
   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