Question: Need help fixing jump destination too far [ : by ' n ' bytes ] error in . asm. Edit code as needed code provided:
Need help fixing jump destination too far : by n bytes error in asm. Edit code as needed
code provided:
INCLUDE C:IrvineIrvineinc
INCLUDE C:IrvineMacrosinc
data
prompt BYTE "Enter string:
buffer BYTE DUp
code
main PROC
; Prompt users
mov edx, OFFSET prompt
call WriteString
; Get string from user
mov edx, offset buffer
mov ecx, LENGTHOF buffer
call ReadString
; Save the number of characters read in
mov ecx, eax
call categorize
exit
main ENDP
; Loops through the given string, identifying the type of each character
; Receives: edx address of buffer
; ecx number of characters to look at not length
categorize PROC USES EAX ECX EDX
TOP:
mov aledx
cmp al ; Nondestructive SUB sets flags but AL is unchanged
jb CONTROL ; Jump if AL is below
; AL
cmp al
jb PUNCTUATION ; Jump if AL
cmp al
jbe DIGIT ; Jump if AL is between and
cmp alA
jb PUNCTUATION ; Jump if AL A
cmp alZ
jbe LETTER ; Jump if AL is between A and Z
cmp ala
jb PUNCTUATION ; Jump if AL a
cmp alz
jbe LETTER ; Jump if AL is between a and z
cmp al~
jbe PUNCTUATION ; Jump if AL is between and ~
; AL ~
jmp CONTROL
DIGIT:
call WriteDec
mwrite is a digit character
call WriteChar
call CRLF
jmp BOTTOM
PUNCTUATION:
call WriteDec
mwrite is a punctuation character
call WriteChar
call CRLF
jmp BOTTOM
LETTER:
call WriteDec
mwrite is a letter character
call WriteChar
call CRLF
jmp BOTTOM
CONTROL:
call WriteDec
mwrite is a control character"
ret
BOTTOM:
inc edx
loop TOP
ret
categorize ENDP
END main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
