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 3,777 of 4,675   
   aen@spamtrap.com to All   
   bbcsdl   
   29 Jan 19 17:14:48   
   
   Hi!   
      
   I just discovered a nice little language.  The code below runs   
   unchanged on bbcsdl for windows and bbcsdl for linux32:   
      
      10 ON ERROR REPORT : PRINT " at " ERL : END   
      20 INSTALL @lib$+"asmlib"   
      30 :   
      40 DIM code% 43,ispal% 51   
      50 FOR pass% = 0 TO 11 STEP 11   
      60   PROCmain(pass% AND &E)  REM Delete AND &E for listing   
      70   PROCispal(pass% AND &E) REM Delete AND &E for listing   
      80 NEXT pass%   
      90 :   
     100 X=USR(start) : PRINT X   
     110 END   
     120 :   
     130 DEF PROCmain(pass%)   
     140 P% = code%   
     150 L% = code%+43   
     160 ON ERROR LOCAL [OPT FN_asmext   
     170 [OPT pass%   
     180 .start   
     190 mov     esi,0   
     200 mov     edi,999   
     210 .four   
     220 mov     ebx,edi   
     230 mov     ecx,edi   
     240 .one   
     250 mov     eax,ebx   
     260 imul    ecx   
     270 call    ispal%   
     280 jne     three   
     290 .two   
     300 cmp     esi,eax   
     310 cmovle  esi,eax   
     320 .three   
     330 sub     ebx,1   
     340 jne     one   
     350 sub     edi,1   
     360 jne     four   
     370 mov     eax,esi   
     380 ret   
     390 ]   
     400 ENDPROC   
     410 :   
     420 DEF PROCispal(pass%)   
     430 P%=ispal%   
     440 L%=ispal%+51   
     450 ON ERROR LOCAL [OPT FN_asmext   
     460 [OPT pass%   
     470 pushad   
     480 mov     ebx,&CCCCCCCD   
     490 mov     ecx,0   
     500 mov     edi,eax   
     510 ;       Divide by 10.   
     520 ; Divide by 10   
     530 .nil   
     540 mov     esi,eax   
     550 mul     ebx   
     560 mov     eax,edx   
     570 shr     eax,3           ; EAX = quotient   
     580 lea     edx,[eax*8]   
     590 lea     edx,[edx+eax*2]   
     600 xchg    edx,esi   
     610 sub     edx,esi         ; EDX = remainder   
     620 ;       Reverse.   
     630 lea     ecx,[ecx+ecx*4]   
     640 lea     ecx,[edx+ecx*2]   
     650 cmp     eax,0           ; Quotient 0?   
     660 jne     nil   
     670 cmp     edi,ecx   
     680 popad   
     690 ret   
     700 ]   
     710 ENDPROC   
     720 REM       A palindromic number reads the same both ways.  The   
     730 REM largest palindrome made from the product of two 2-digit   
     740 REM numbers is 9009 = 91 x 99.   
     750   
     760 REM Find the largest palindrome made from the product of two   
     770 REM 3 -digit numbers.   
     780   
     790 REM 906609   
   --   
   aen   
      
   --- 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