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,113 of 4,675   
   Rick C. Hodgin to Rick C. Hodgin   
   Re: small asm code (compo?)   
   24 Aug 20 22:54:35   
   
   From: rick.c.hodgin@nospicedham.gmail.com   
      
   On 8/23/20 5:19 PM, 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   
      
   I had an idea this evening to remove all those extra $ symbols.   
   Here's a version that uses CAPS characters as a delineator.  It's   
   40 code bytes, 34 data bytes, 74 total.   
      
        matrix_days BYTE "SunMonTuesWednesThursFriSaturZ"   
        day BYTE "day$"   
      
        test3_ PROC PUBLIC   
            mov     ah,2ah   
            int     21h   
            mov     bx,offset matrix_days   
        top_loop:   
            cmp     byte ptr [bx],'Z'   
            ja      move_next   
            cmp     al,0   
            jz      found_it   
            dec     al   
        move_next:   
            inc     bx   
            jmp     top_loop   
      
        found_it:   
            mov     ah,2   
        show_next_char:   
            mov     dl,byte ptr [bx]   
            int     21h   
            inc     bx   
            cmp     byte ptr [bx],'Z'   
            ja      show_next_char   
      
            mov     ah,9   
            mov     dx,offset day   
            int     21h   
            ret   
        test3_ ENDP   
      
   It's been a long time since I've programmed in 8086 assembly.  Usually   
   it's in 686 or later.  These little small asm code challenges take me   
   back to the man who taught me MASM 1.0.  Alan Earheart.  A quadriplegic   
   who damaged his spine falling off a roof.  He typed with a 30 inch stick   
   in his teeth touching a keyboard mounted on a special fixture holding   
   also the RGB monitor where he could see it, and the keyboard where he   
   could access it.  We chatted over 300 baud modems and I learned how to   
   do assembly that way.  I was introduced to him by an employer I had in   
   1987.  That employer saw a spark in me, and sent me to Alan to learn   
   low-level coding, which I had no experience in before that save PEEKs   
   and POKEs on my 6502-based BASIC apps.   
      
   Alan died a few years later, but he left a legacy with me.  Were it not   
   for his tutilege, I may never have had such a passion for low-level asm   
   code, ISAs or hardware in general.  I've remembered Alan multiple times   
   over the years.  Always a dual set of emotions there.   
      
   It's been almost 20 years since I've written extensively in assembly.   
   Now it's mostly nostalgia, and a requirement for compiler development,   
   but most of that is a reasoned application considering various models,   
   and not a real coding goal as for a task, but only a particular need of   
   processing data types in particular ways.   
      
   I'm thankful for CLAX and other low-level software and hardware groups.   
      
   --   
   Rick C. Hodgin   
      
   --- 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