.model small
.stack
.data
.code
chr1 db ?
chr2 db ?
chr3 db ?
r1 db ?
r2 db ?
ac db 0
.startup
;cls
mov ah,00h ;Function(Set video mode)
mov al,03 ;Mode 80x25 8x8 16
int 10h ;Interruption Video
mov ah,01h ;Function(character read)
int 21h ;Interruption DOS functions
sub al,30h ;ajustamos valores
mov chr1,al ;[chr1].chr2 * chr3 = ac.r1.r2
mov ah,01h ;Function(character read)
int 21h ;Interruption DOS functions
sub al,30h ;Ajustamos valores
mov chr2,al ;chr1.[chr2] * chr3 = ac.r1.r2
mov ah,02h ;Function(character to send to standard output)
mov dl,'*' ;Character to show
int 21h
mov ah,01h ;Function(Read character)
int 21h ;Interruption DOS Functions
sub al,30h ;Transform(0dec = 30hex)
mov chr3,al ;chr1.chr2 * [chr3] = ac.r1.r2
mov ah,02h ;Character to send to standar output
mov dl,'=' ;
int 21h ;Interruption DOS functions
;Realizamos operación
mov al,chr3 ;al = chr3
mov bl,chr2 ;bl = chr2
mul bl ;AL = chr3*chr2 (BL*AL)
mov Ah,0h ;
AAM ;ASCII Adjusment
mov ac,AH ;ac = AH (Acarreo)
mov r2,AL ;r2 = AL (Unidad del resultado)
mov al,chr3 ;AL = chr3
mov bl,chr1 ;BL = chr1
mul bl ;AL = chr1*chr3 (BL*AL)
mov r1,al ;r1 = AL (Decena del resultado)
mov bl,ac ;BL = Acarreo anterior
add r1,bl ;r1 = r1+ac (r1 + Acarreo)
mov ah,00h ;
mov al,r1 ;AL = r1 (Asignación para el ajust)
AAM ;ASCII Adjustment
mov r1,al ;r1 = AL
mov ac,ah ;ac = AH (Acarreo para la Centena del resultado)
;Mostramos resultado
mov ah,02h
mov dl,ac
add dl,30h
int 21h ;Mostramos ac (Centena)
mov ah,02H
mov dl,r1
add dl,30h
int 21h ;Mostramos r1 (Decena)
mov ah,02H
mov dl,r2
add dl,30h
int 21h ;Mostramos r2 (Unidad)
.exit
end
No hay comentarios.:
Publicar un comentario