Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Write a program that computes the (integer) average between DIM values of a vector of type byte, and saves the
- ;result into variable 'risultato'
- ;Verify rounding effected
- DIM EQU 4
- .MODEL small
- .STACK
- .DATA
- vett DB 3,4,3,4
- res DB ?
- .CODE
- .STARTUP
- XOR SI,SI ;I initialize SI to 0
- MOV CX,DIM
- XOR AL,AL
- ciclo: ADD AL,vett[SI]
- INC SI
- DEC CX
- CMP CX,0
- JNZ ciclo
- MOV AH,0
- MOV DL,DIM
- DIV DL ;Into division, DL is divisor,
- ;and it must be a register. Dividend
- ;is AX, but since I am considering 8 bit, it is AL
- ;and AL is also the quotient of the division
- ;The rest of division is into AH
- .EXIT
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement