assembly - NASM compilation on DOSBox -


i'm trying link assembly files, i'm having problems. use nasm , make object file with:

nasm program.asm -f bin -o program.exe 

code book

    %include "io.mac"  .data name_prompt db "please type name: ",0 out_msg db "your name in capitals is: ",0  .udata in_name resb 31  .code     .startup     putstr name_prompt ; request character string     getstr in_name,31 ; read input character string      putstr out_msg     mov ebx,in_name ; ebx = pointer in_name process_char:     mov al,[ebx] ; move char. al     cmp al,0 ; if null character     je done ; conversion done     cmp al,’a’ ; if (char < ’a’)     jl not_lower_case ; not lowercase letter     cmp al,’z’ ; if (char > ’z’)     jg not_lower_case ; not lowercase letter lower_case:     add al,’a’-’a’ ; convert uppercase not_lower_case:     putch al ; write character     inc ebx ; ebx points next char.     jmp process_char ; go process next char. done: nwln     .exit 

this code work me @ windows xp not work @ windows 7, here error log error.please me find error.

the line numbers in error messages appear refer macros. nasm complain if didn't find %include file, it's finding "io.mac", isn't liking it. wag, looks late dr. sivarama dandamudi's stuff... should have "io.obj" link against, right?

you're assembling nasm's "-f bin" output mode, produces flat binary file - not linkable object file. "-o" switch causes output file named ".exe", it's still flat binary file, not ".exe" nor linkable object file. suspect should assembling "-f obj" or "-f win32" , linking with... linker... did when worked? i'll guess "-f obj" want. don't need "-o" switch - default filename should okay.

if else fails, can try "-e" switch (preprocess only). won't produce useful output, expand macros. won't solve problems, let see nasm's complaining about. shouldn't have this!

despite fact uses 32-bit register, may 16-bit code (yeah, can that). difference between xp , 7 7 won't run dos code. dosbox should take care of (if goes well). try assembling "-f obj" , see you. once nasm "shut , assemble", can go on getting linked , running...


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -