Hi I have this school project and i can't make this code work..
I'm trying to make a program which makes fraction summation and answer mixed integer..
Like this:
Give number 1: 1
Give number 2: 2
Give number 3: 3
Give number 4: 4
Your answer is: 38
If someone could fill my code so it works because I'm out of skills...
U can commet it in english and free will to make any changes..
Thanks!
My code:
.MODEL small
.STACK 100
.DATA
teksti1 DB " Give_First_num: $"
teksti2 DB " Give_second_num: $"
teksti3 DB " Give_third_num: $"
teksti4 DB " Give_fourth_num: $"
teksti5 DB " tulos$"
teksti6 DB " Kokonaisluvut: $"
teksti7 DB " Jakojaannos: $"
rivinvaihto DB 13,10,0
.CODE ;koodi
.STARTUP
alku:
mov ah,9
mov dx,OFFSET teksti1
int 21h
mov ah,1
int 21h
sub ch,'0'
mov ch,al
mov ah,9
mov dx,OFFSET teksti2
int 21h
mov ah,1
int 21h
sub bl,'0'
mov bl,al
mov ah,9
mov dx,OFFSET teksti3
int 21h
mov ah,1
int 21h
sub bh, '0'
mov bh,al
mov ah,9
mov dx,OFFSET teksti4
int 21h
mov ah,1
int 21h
sub cl,'0'
mov cl,al
cmp bl,cl
je muunnos
mov ax,0
mov al,bl
mul cl
push ax
push ax
div bl
mul ch
mov ch,al
pop ax
div cl
mul bh
mov bh,al
add ch,bh
;compare
pop ax
cmp ch,al
jle tulos
jmp muunnos
muunnos:
mov bl,al
mov al,ch
div bl
mov ch,ah
mov cl,al
push cx
push cx
tulos:
mov ah,9
mov dx,OFFSET teksti5
int 21h
mov ah,9
mov dx,OFFSET teksti6
int 21h
pop cx
mov dl,cl
mov ah,2
int 21h
mov ah,9
mov dx,OFFSET teksti7
int 21h
pop cx
mov dl,ch
mov ah,2
int 21h
jmp alku
.EXIT
END