I am new to assembly and I have to write this program.
The title says:
Write a program in assembly 8086 language that ask the user to input a number. If the character read is '0' it executes a + 3, otherwise if it is '1' it executes a-3 otherwise (if different from '0' and '1') it prints the character 'E' on the screen. The variable 'a' is 16 bits long and initialized at 15h
What I have tried:
.model small
.stack 100h
.data
num db ?
num1 db 15h
msg1 db "Inserisci un numero... $"
msg2 db "24 $"
msg3 db "18 $"
msg4 db "Premere un tasto per uscire... $"
.CODE
mov ax, @data
mov ds,ax
lea dx, msg1
mov ah, 09h ;output
int 21h
mov ah, 01h ;input
int 21h
and al, 0Fh
mov num, al
call newLine
CMP num, 00
je numUguale1
mov ah, 09h
lea dx, msg2
mov ah, 09h
int 21h
mov ah, 01h
int 21h
call newLine
jmp fine
numUguale1:
lea dx, msg3
mov ah, 09h
int 21h
mov ah, 01h
int 21h
mov ax, 4c00h
int 21h
call newLine
fine:
lea dx, msg4
mov ah, 09h
int 21h
mov ah, 01h
int 21h
mov ax, 4c00h
int 21h
call newLine
newLine:
mov ah, 02h
mov dl, 0Ah
int 21h
mov ah, 02h
mov dl, 0Dh
int 21h
ret
END