I'm completely new to Assembly and right now I'm using X86 assembly. I'm using the NASM and right now my code isn't compiling. I got it from a book and basically the code works with strings:
; This program demonstrates the string-handling procedures in
; the book's link library.
INCLUDE Irvine32.inc
.data
string_1 BYTE "abcde////",0
string_2 BYTE "ABCDE",0
msg0 BYTE "string_1 in upper case: ",0
msg1 BYTE "string1 and string2 are equal",0
msg2 BYTE "string_1 is less than string_2",0
msg3 BYTE "string_2 is less than string_1",0
msg4 BYTE "Length of string_2 is ",0
msg5 BYTE "string_1 after trimming: ",0
.code
main PROC
call trim_string
call upper_case
call compare_strings
call print_length
exit
main ENDP
trim_string PROC
; Remove trailing characters from string_1.
INVOKE Str_trim, ADDR string_1, '/'
mov edx,OFFSET msg5
call WriteString
mov edx,OFFSET string_1
call WriteString
call Crlf
ret
trim_string ENDP
upper_case PROC
; Convert string_1 to upper case.
mov edx,OFFSET msg0
call WriteString
INVOKE Str_ucase, ADDR string_1
mov edx,OFFSET string_1
call WriteString
call Crlf
ret
upper_case ENDP
compare_strings PROC
; Compare string_1 to string_2.
INVOKE Str_compare, ADDR string_1, ADDR string_2
.IF ZERO?
mov edx,OFFSET msg1
.ELSEIF CARRY?
mov edx,OFFSET msg2 ; string 1 is less than...
.ELSE
mov edx,OFFSET msg3 ; string 2 is less than...
.ENDIF
call WriteString
call Crlf
ret
compare_strings ENDP
print_length PROC
; Display the length of string_2.
mov edx,OFFSET msg4
call WriteString
INVOKE Str_length, ADDR string_2
call WriteDec
call Crlf
ret
print_leng
th ENDP
END main
Like I said I'm using NASM so this might be the problem but it should still work, but when i compile it using nasm -f win32 other.asm -o other.o
it comes up witha plethora of errors most of which say parser instruction expected. I'm using a Windows 8 64 bit, but there's no reason why it can't run a 32 bit program- correct me if i'm wrong. The problem with the MASM compiler is that it says I need precisely Visual C++ Express 2005 (PRECISELY 2005) to download otherwise it doesn't download. How can I get this program to work along with other programs I might write in future- and I did remember to put the nasm assembler into the bin file of my C compiler. Like I said I'm fairly new and believe it or not the book doesn't actually tell you how to run the program. Also is there a way to download masm without VS 2005 (which i can't seem to find anyway) or any of the VS for that metter
Other programs (in ASM) don't seem to run on it either. I'm pretty sure this is the windows version otherwise it wouldn't have downloaded to begin with.