riccardinofuffolo

Calcolatori elettronici - #304

Jun 7th, 2011
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DIM EQU 5
  2. .MODEL SMALL
  3. .STACK
  4. .DATA
  5.  
  6. DATA1 DB 01001001B, 01110001B, 11010101B, 10101101B, 01011010B
  7. DATA2 DB 10110101B, 10101001B, 11011101B, 10101111B, 10101011B
  8. DATAR DB DIM DUP(?)          
  9.  
  10. .CODE
  11. .STARTUP
  12.  
  13. MOV SI, 0                       ; Indice scorrimento vettore        
  14. MOV CX, DIM                     ; Contatore passi
  15. MOV AH, 0                       ; Contatore byte con bit a 1 dispari
  16.  
  17. ANDPF:    MOV AL, DATA1[SI]
  18.           AND AL, DATA2[SI]
  19.           MOV DATAR[SI], AL     ; DATAR = DATA1 AND DATA2
  20.           OR DATAR[SI], 0       ; Giusto per settare i flag (e dunque anche PF)  
  21.           JNP DISPARI           ; # Bit a 1 dispari?
  22.           INC AH                ; Se # bit a 1 pari, incremento il contatore
  23. DISPARI:  INC SI                ; In ogni caso passo all'elemento successivo
  24.           LOOP ANDPF            ; e ciclo.
  25.  
  26. .EXIT
  27. END
Advertisement
Add Comment
Please, Sign In to add comment