flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Projects and Ideas > Programmes and Examples for fasmGoto page Previous 1, 2, 3, 4  | 
  
| Author | 
  | 
              
| 
                  
                   dead_body 02 Aug 2007, 15:23 
                  please write not procedures, but examples.
 
                  
                Or rename thread.  | 
              |||
                  
  | 
              
| 
                  
                   0.1 03 Aug 2007, 06:20 
                  Can someone please post examples of AAA, AAS, AAD and AAM instructions.
 
                  Thanks a lot in advance! _________________ Code: o__=- ) (\ /\  | 
              |||
                  
  | 
              
| 
                  
                   Madis731 03 Aug 2007, 08:41 
                  nobody's got 32-bit OSs these days  
                  Anyways, I didn't debug this because I've only got FDBG so here: AAA: Code: mov al,36h add al,49h ;Here the al register is 7Fh but in BCD it should be 85 aaa ;That is where its modified so that last digit is 5 and 3+4+carry=8 ;al=85h same for aas AAM: Code: mov al,6h ;ONLY one digit imul al,9h ;Here the al register is 36h but in BCD it should be 54 aam ;That is where its modified so that last digit is 4 and first is 5 ;ax=54 same for aad... MACROS: ======= AAA: Code: ;Code is intentionally long to make the internals clear ;displaying (al1+al2)/10,(al1+al2) mod 10 would explain anything AAM: Code: al1=9 al2=6 myAL=al1*al2 ;36h myAH = myAL / 10; myAL = myAL MOD 10; display "AX=",myAH+30h,myAL+30h ;Displays 54 for 6*9 AAD: (This is the only one that is BEFORE the operation itself) Code: ;0609h => 69h ah1=6 al1=9 ;This is 69 in unpacked form al2=7 myAL=ah1*10+al1 myAH=0 display "AX=",myAL/10+30h,myAL mod 10+30h,'h' Last edited by Madis731 on 03 Aug 2007, 10:43; edited 3 times in total  | 
              |||
                  
  | 
              
| 
                  
                   0.1 03 Aug 2007, 08:51 
                  Thanks Madis for AAA example!
 
                  Please give examples of AAS, AAD and AAM also. Thanks. PS: Thanks for all your help! _________________ Code: o__=- ) (\ /\ Last edited by 0.1 on 03 Aug 2007, 10:05; edited 2 times in total  | 
              |||
                  
  | 
              
| 
                  
                   0.1 03 Aug 2007, 08:56 
                  Code: mov ax,99h add ax,99h aaa  | 
              |||
                  
  | 
              
| 
                  
                   0.1 03 Aug 2007, 08:58 
                  dead_body wrote: please write not procedures, but examples. It's Programs and Examples so examples are ok to post here. PS: If i'm wrong I hope m will change the title _________________ Code: o__=- ) (\ /\  | 
              |||
                  
  | 
              
| 
                  
                   Madis731 03 Aug 2007, 09:28 
                  I will update my post if I get more info, but I read the AAA description a bit off. The only part of the register that is concerned is AL so no 16-bit calculations for you :S http://board.flatassembler.net/topic.php?p=60769#60760 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   0.1 03 Aug 2007, 09:36 
                  Thanks for your time Madis! 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   0.1 03 Aug 2007, 10:03 
                  If someone else is also interested in AAA,AAS,AAD and AAM then I
 
                  will suggest using DEBUG under DOS/Windows. I'm also using it to learn these instructions! PS: Ofcourse you can also use Madis's macro (see above)! _________________ Code: o__=- ) (\ /\  | 
              |||
                  
  | 
              
| 
                  
                   Madis731 03 Aug 2007, 12:07 
                  Update 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   0.1 03 Aug 2007, 12:25 
                  Thanks Madis! 
                  Last edited by 0.1 on 17 Sep 2007, 05:40; edited 1 time in total  | 
              |||
                  
  | 
              
| 
                  
                   0.1 31 Aug 2007, 13:19 
                  A binary tree example that is not here now  
                  Yeh meri do sauvi post hai .tsop htderdnuh owt ym si sihT Last edited by 0.1 on 17 Sep 2007, 05:44; edited 4 times in total  | 
              |||
                  
  | 
              
| 
                  
                   LocoDelAssembly 31 Aug 2007, 13:56 
                  I can't check you code now, I leave here with something I did to show to some friends     
                  Code: ; Make the executable in the following way: ; fasm tree.asm ; gcc -m32 tree.o -o tree ; rm tree.o (OPTIONAL) ; strip tree (OPTIONAL, reduce executable's size) ; PROGRAM Tree; format ELF ; TYPE struc TTree { .: .left dd ? .right dd ? ; DON'T CHANGE THE POSITION OF THE FIELDS ABOVE .datum dd ? sizeof.#. = $ - . } ; To be able to use the structure without associating it to a variable virtual at 0 TTree TTree end virtual ; VAR section '.bss' writable tree dd 0 section '.text' executable extrn printf extrn scanf extrn malloc extrn exit public main ; BEGIN main: call readInt test eax, eax jz .print mov edx, tree call insert jmp main .print: push message call printf add esp, 4 mov eax, tree call printTree xor eax, eax ret message db 10, "In-order print:", 10, 0 ; #### TREE PROCEDURES insert: ; EAX = datum ; EDX = var ^TTree mov ecx, [edx] test ecx, ecx jz .createNode xor edx, edx cmp eax, [ecx+TTree.datum] setge dl lea edx, [ecx+edx*4] jmp insert .createNode: push edx push eax push sizeof.TTree call malloc add esp, 4 mov [eax+TArbol.left], 0 mov [eax+TArbol.right], 0 pop [eax+TArbol.datum] pop edx mov [edx], eax ret ; #### printTree: ; EAX = var ^TArbol mov eax, [eax] test eax, eax jz .exit push ebx mov ebx, eax call printTree mov eax, [ebx+TTree.datum] call writeLnInt lea eax, [ebx+4] call printTree pop ebx .exit: ret ; #### I/O PROCEDURES readInt: push eax ; Reserves space to store the integer push esp ; Stores a pointer to the space reserved above push .fmt call scanf add esp, 4*2 test eax, eax jz .error pop eax ret .error: push .errorStr call printf pop eax push -1 call exit .fmt db "%d", 0 .errorStr db "ERROR: Invalid number", 10, 0 ; #### writeLnInt: ; EAX=integer push eax push .fmt call printf add esp, 8 ret .fmt db "%d", 10, 0 (I'll edit my post to translate it to English later) [edit]Translated...[/edit] Last edited by LocoDelAssembly on 05 May 2008, 14:41; edited 1 time in total  | 
              |||
                  
  | 
              
| 
                  
                   penang 05 May 2008, 10:10 
                  Por favor, donde el translaciones? 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   LocoDelAssembly 05 May 2008, 14:43 
                  Done 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   penang 05 May 2008, 15:07 
                  Muchos Gracias !! 
                  
                 | 
              |||
                  
  | 
              
| Goto page  Previous  1, 2, 3, 4 < Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.