william007
asked on
Assembly language vs C programming
I am researching a small operating system, visopsys on how it works,
the source code can be downloaded here:
http://visopsys.org/files/visopsys/visopsys-0.63-src.zip
There are some file(with .s extension) in writtern in assembly language in the folder
visopsys-0.62-src/src/oslo ader
May I know
(i) What are the main functions of the software in this directory?
(ii) Why can the code not be written in C?
the source code can be downloaded here:
http://visopsys.org/files/visopsys/visopsys-0.63-src.zip
There are some file(with .s extension) in writtern in assembly language in the folder
visopsys-0.62-src/src/oslo
May I know
(i) What are the main functions of the software in this directory?
(ii) Why can the code not be written in C?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Assembly is nothing but mnemonics for machine instructions ... An assembler would easily convert it to machine code.
ASKER
a)If I am in Fedora, am I right that there is a build in assembler(Nasm or something else), and I just need to type
./myAssembly.s
and it can be run directly even do not need to compile it?
b)Is there a command in C that allows us to run an assembly file?
(I am very new to assembly, please bear with my ignorance)
./myAssembly.s
and it can be run directly even do not need to compile it?
b)Is there a command in C that allows us to run an assembly file?
(I am very new to assembly, please bear with my ignorance)
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks...you have given my a clearer picture...
Following is the snippet of make file
//**********start snippet*********
AS = nasm
CC = gcc355
WARNOPTS = -w+orphan-labels
SECTOPTS = -f bin ${WARNOPTS}
LDROPTS = -f aout ${WARNOPTS}
LINKOPTS = -mcpu=pentium -Wl,-warn-common,-X,--ofor mat,binary ,-e,loader Main,-Ttex t,0x000000 00
STDDEPEND = loader.h Makefile
OBJS = obj/loaderMain.o \
obj/loaderVideo.o \
obj/loaderDetectHardware.o \
obj/loaderLoadFile.o \
obj/loaderLoadKernel.o \
obj/loaderDiskError.o \
obj/loaderPrintRoutines.o
all: target-dirs bootsectors ${LOADERBUILDDIR}/vloader
target-dirs:
mkdir -p obj ${BOOTBUILDDIR} ${LOADERBUILDDIR}
bootsectors: ${BOOTBUILDDIR}/mbr.simple ${BOOTBUILDDIR}/mbr.bootme nu ${BOOTBUILDDIR}/bootmenu ${BOOTBUILDDIR}/bootsect.f at ${BOOTBUILDDIR}/bootsect.f at32 ${BOOTBUILDDIR}/bootsect.f atnoboot ${BOOTBUILDDIR}/bootsect.f atnoboot32
#
# MBRs and Boot sectors
#
${BOOTBUILDDIR}/mbr.simple : mbr-simple.s ${STDDEPEND}
${AS} ${SECTOPTS} $< -o $@
//**********end snippet*********
Seems like it is using nasm <something> to compile the assembly...
Am I run that after compiling we can run it like any other executable on command line
./executable
?
Following is the snippet of make file
//**********start snippet*********
AS = nasm
CC = gcc355
WARNOPTS = -w+orphan-labels
SECTOPTS = -f bin ${WARNOPTS}
LDROPTS = -f aout ${WARNOPTS}
LINKOPTS = -mcpu=pentium -Wl,-warn-common,-X,--ofor
STDDEPEND = loader.h Makefile
OBJS = obj/loaderMain.o \
obj/loaderVideo.o \
obj/loaderDetectHardware.o
obj/loaderLoadFile.o \
obj/loaderLoadKernel.o \
obj/loaderDiskError.o \
obj/loaderPrintRoutines.o
all: target-dirs bootsectors ${LOADERBUILDDIR}/vloader
target-dirs:
mkdir -p obj ${BOOTBUILDDIR} ${LOADERBUILDDIR}
bootsectors: ${BOOTBUILDDIR}/mbr.simple
#
# MBRs and Boot sectors
#
${BOOTBUILDDIR}/mbr.simple
${AS} ${SECTOPTS} $< -o $@
//**********end snippet*********
Seems like it is using nasm <something> to compile the assembly...
Am I run that after compiling we can run it like any other executable on command line
./executable
?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks=)
ASKER