To preface, I am taking systems programming at the local university. We are using Ubuntu on vBox to assemble with yasm and run our programs. I have functioning code, but I believe the vm overhead is causing issues with timing execution. We are working on a threaded program.
I would like to assemble and run the program on my native win7 installation, but get a link error. The commands I am using on windows are:
yasm -f x64 hw12.asm
ld -o hw12.exe hw12.obj
It assembles, but when I link I get hw12.obj: file not recognized: File format not recognized
Here is version information:
yasm --version
yasm 1.3.0
Compiled on Aug 17 2014.
Copyright (c) 2001-2014 Peter Johnson and other Yasm developers.
Run yasm --license for licensing overview and summary.
ld --version
GNU ld (GNU Binutils) 2.25.1
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
A related question, I don't know if it will solve the issue or not (I assume not):
I currently hard code the constants and syscall codes in section .data
. Here is the code for reference:
section .data
; -----
; Define standard constants.
LF equ 10 ; line feed
NULL equ 0 ; end of string
ESC equ 27 ; escape key
TRUE equ 1
FALSE equ 0
SUCCESS equ 0 ; Successful operation
NOSUCCESS equ 1 ; Unsuccessful operation
STDIN equ 0 ; standard input
STDOUT equ 1 ; standard output
STDERR equ 2 ; standard error
SYS_read equ 0 ; system call code for read
SYS_write equ 1 ; system call code for write
SYS_open equ 2 ; system call code for file open
SYS_close equ 3 ; system call code for file close
SYS_fork equ 57 ; system call code for fork
SYS_exit equ 60 ; system call code for terminate
SYS_creat equ 85 ; system call code for file open/create
SYS_time equ 201 ; system call code for get time
My professor had mentioned there is a file that contains all these already, that could be included but did not mention how. I have been unable to find how to do such a thing, and would also like to know the equivalent for win as well, so as not to have to look up syscodes. aka I would simply change the include in order to assemble on windows.