I'm working in Microsoft Visual Studios 2017 with 32-bit 8086 MASM. This exact code worked for me before, but now for some reason it won't build anymore. Here is the error message I'm getting:
error LNK2019: unresolved external symbol _putchar referenced in function _main
error LNK2019: unresolved external symbol _exit referenced in function _main
fatal error LNK1120: 2 unresolved externals
I was seeing messages like this before, but they went away after I went to debug -> options -> symbols and then checked the box for "Microsoft Symbol Servers"
One thing that did change is that my internet connection keeps dropping out. Could that cause it to have trouble accessing the symbol servers?
If it's not the internet connection, I'm out of ideas. I've been all over this site and tried everything I can find.
.586
option casemap :none
.Model FLAT, C
.DATA
array DWORD 44h, 61h, 6Eh, 69h, 65h, 6Ch, 0 ;Array storing 'Daniel' in Ascii
.CODE
includelib MSVCRT
extrn putchar:near
extrn exit:near
main PROC
mov esi, 0 ;Set esi to 0
printChar:
mov eax, array[esi] ;Load the array value at index esi into eax
push eax ;Push the value in eax onto the stack
call putchar ;Print character
inc esi ;increment esi
mov eax, array[esi] ;eax was emptied when we pushed the contents onto the stack, so we need to refill it.
cmp eax, 0
je endProgram ;End program if eax equals 0
jmp printChar ;Otherwise, continue the loop
endProgram:
call exit
main ENDP
END