Question
ASSEMBLY language - Implement the code that is commented on the right side so that the function on the left accepts positive and negative numbers.
ASSEMBLY language - Implement the code that is commented on the right side so that the function on the left accepts positive and negative numbers.
PICTURE:
CODE:
IS_UNSIGNED_INT PROC
mov byte ptr IS_VALID, TRUE mov di, 0h mov ah, STRING[di] NEXT_CHAR: cmp ah, '$' ;mov byte ptr SIGNO,1h jz DECIDIR :cmp ah, '-' cmp ah, '0' ;jnz NEXT_CHAR jb DECIDIR ;mov byte ptr SIGNO,-1 cmp ah, '9' ;cmp ah, '+' ja DECIDIR ;jnz NEXT_CHAR inc di ;inc di mov ah, STRING[di] ;mov ah, STRING[di] jmp NEXT_CHAR
DECIDIR:
jnz NOT_VALID cmp di, 0h jnz KEEP NOT_VALID: mov byte ptr IS_VALID, FALSE
KEEP:
RET IS_UNSIGNED_INT ENDP
XXXXXXX : IS_UNSIGNED_INT PROC mov byte ptr IS_VALID, TRUE mov d, oh mov ah, STRING[di] NEXT_CHAR: cmp ah, '' jz DECIDIR cmp ah, 'O' jb DECIDIR cmp ah, '9' ja DECIDIR inc di mov ah, STRING[di] jmp NEXT_CHAR ;mov byte ptr SIGNO, 1h cmp ah, ; jnz NEXT_CHAR ; mov byte ptr SIGNO, -1 icmp ah, + inz NEXT_CHAR ; inc di ;mov ah, STRING[di] DECIDIR: jnz NOT_VALID cmp di, oh jnz KEEP NOT_VALID: mov byte ptr 1S_VALID, FALSE KEEP: RET IS_UNSIGNED_INT ENDP XXXXXXX : IS_UNSIGNED_INT PROC mov byte ptr IS_VALID, TRUE mov d, oh mov ah, STRING[di] NEXT_CHAR: cmp ah, '' jz DECIDIR cmp ah, 'O' jb DECIDIR cmp ah, '9' ja DECIDIR inc di mov ah, STRING[di] jmp NEXT_CHAR ;mov byte ptr SIGNO, 1h cmp ah, ; jnz NEXT_CHAR ; mov byte ptr SIGNO, -1 icmp ah, + inz NEXT_CHAR ; inc di ;mov ah, STRING[di] DECIDIR: jnz NOT_VALID cmp di, oh jnz KEEP NOT_VALID: mov byte ptr 1S_VALID, FALSE KEEP: RET IS_UNSIGNED_INT ENDPStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started