I wrote the initial code for this problem but I want to be able to take -1 as an input. Right now it takes only one input 1 or - and then shows the result.
I'm a novice when it comes to assembly language and emu8086 so it would really help me out if someone could help me to solve this problem.
Here's the code so far:
.model small .stack 100h .data msg db 0ah,0dh,'negative$' msg1 db 0ah,0dh,'positive$' msg2 db 0ah,0dh, 'zero$' .code main proc mov ax,@data mov ds,ax mov ah,1 int 21h mov bl,al mov cl,30h cmp bl,cl jl negative je zero jg positive negative: lea dx,msg mov ah,9 int 21h jmp END zero: lea dx,msg2 mov ah,9 int 21h jmp END positive: lea dx,msg1 mov ah,9 int 21h END: mov ah,4ch int 21h main endp end mainAtharva Satyendra Agrawal April 09, 2019
Code:
; Program to check number is positive or not .MODEL SMALL .STACK 100H .DATA NUM DB -12H RES DB ? .CODE MOV AX , @DATA ; Initializing Data Segment MOV DS , AX MOV AL , NUM ; LOAD NUMBER ROL AL , 01 ; ROTATE BY 01 JC DN MOV RES , 1 ; POSITIVE JMP EXIT DN: MOV RES , 2 ; NEGATIVE EXIT: MOV DL , RES MOV AH , 4CH ; Service routine for exit INT 21H END
Ouput: