Here are some source files written in GNU assembly. The resulting executeable outputs an integer to the terminal.
The files are taken from the book Programming from the ground up written by Jonathan Bartlet.
To build a test program that prints the number of 824 to the terminal, follow the following steps:
as --32 -g write_newline.s -o write_newline.o
as --32 -g count_chars.s -o count_chars.o
as --32 -g integer_to_string.s -o integer_to_string.o
as --32 -g conversion_program.s -o conversion_program.o
ld -m elf_i386 integer_to_string.o count_chars.o write_newline.o conversion_program.o -o conversion_programTo run the program, write ./conversion_program on the terminal.
as --32 -g write_newline.s -o write_newline.o
as --32 -g count_chars.s -o count_chars.o
as --32 -g integer_to_string.s -o integer_to_string.o
as --32 -g conversion_program.s -o conversion_program.o
as --32 -g print_inreger.s -o print_integer.o
as --32 -g print_multiples.s -o print_multiples.o
ld -m elf_i386 integer_to_string.o count_chars.o write_newline.o print_integer.o print_multiples -o multipleTo run the program, write ./multiple on the terminel. The printed sum of the multiples should be 60945.
>>> sum = (3 * 170 * 171 + 5 * 102 * 103 - 15 * 34 * 35) / 2
>>> sum
60945.0