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.

So you like infinite loops?

REPETE:
    CMP AL,'1'

     ...blah blah blah...

   CMP AL,'5'
    JE SAIR


    JNE REPETE ; <--   INFINITE LOOP!!!!

Also you never return from a MAIN $100 entry. You actually use a DOS terminate command!

SOMA code runs into SUBT

SUBT code runs into MULT

MULT code runs into DIVI


After executing each sub-function jump to the point of function return, or code termination.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.