Hello, I'm new to assembly ...
I wonder how I can write the variable res screen...
By sending write writes trash...
Code:
name "mycode" ; output file name (max 8 chars for DOS compatibility)
ORG 100H
JMP MAIN
NUM1 DB 12H
NUM2 DB 12H
RES DB ?
MAIN:
LEA DX, OPCAO
CALL ESCREVA
mov ah, 7
int 21h
REPETE:
CMP AL,'1'
JE SOMA
CMP AL,'2'
JE SUBT
CMP AL,'3'
JE MULT
CMP AL,'4'
JE DIVI
ATE:
CMP AL,'5'
JE SAIR
JNE REPETE
RET
SOMA:
MOV AH, NUM1
ADD AH, NUM2
MOV RES, AH
LEA DX, RES
CALL ESCREVA
SUBT:
MOV AH, NUM1
SUB AH, NUM2
MOV RES, AH
LEA DX, RES
CALL ESCREVA
MULT:
MOV AH, NUM1
MOV BH, NUM2
MUL BH
MOV RES, AH
LEA DX, RES
CALL ESCREVA
DIVI:
MOV AH, NUM1
MOV BH, NUM2
DIV BH
MOV RES, AH
LEA DX, RES
CALL ESCREVA
SAIR:
RET
;--------------------------------------------------------------------------------
ESCREVA PROC NEAR ;PROCEDIEMENTO QUE ESCRVE NO ECRA
MOV AH, 09H
INT 21H
RET
;---------------------------------------------------------------------------------
opcao db '1-Soma/2-Subt/3-Mult/4-Divi/5-Sair :$',0DH, 0AH, 024h
Urgent please.