Programming examples from the book "Programming from the Ground Up" by Josh Bartlett.
- exit.s -- a simple assembly program that just exits and returns a status code back to the Linux kernel.
- maximum.s -- a program that finds the maximum number of a set of numbers.
-
power.s -- a program that illustrates how functions work by solving
$2^3 + 5^2$ . - factorial.s -- a program that calculates factorial using a recursive function.
- toupper.s -- a program that converts an input file to an output file with all letters converted to uppercase.
- record-def.s -- record definitions.
- linux.s -- common Linux definitions.
- read-record.s -- a function that reads a record from the file descriptor.
- write-record.s -- a function that writes a record to the file descriptor.
- write-records.s -- a program that writes some sample records to the file.
- count-chars.s -- a function that counts the characters in the string until a null byte is reached.
- write-newline.s -- a function that writes a newline to the file descriptor.
- read-records.s -- a program that reads records from the file.
- add-year.s -- a program that reads records from the input file, increments the age of each record and writes them to the output file.
- error-exit.s -- a function that writes the error message to the standard error output and exits.
- add-year.s -- a program that reads records from the input file, increments the age of each record and writes them to the output file.
- helloworld-nolib.s -- a program that writes the message "hello world" and exits.
- helloworld-lib.s -- a program that writes the message "hello world" and exits using the standard C library.
- printf-example.s -- a program that demonstrates the use of the
printf
function. - write-record.s, read-record.s -- functions that write and read records, which are used to create a shared library for working with records.
- write-records.s -- a program that writes some sample records to the file and uses the shared library for working with records.
Notes:
-
On x86-64 Linux in order to be able to link 32-bit programs with the
c
library install thelibc6-dev-i386
package:$ sudo apt install libc6-dev-i386
-
In order to run the
write-records.exe
program, execute the following command:$ LD_LIBRARY_PATH=. ./write-records.exe
- alloc.s -- a simple memory manager.
- read-records.s -- a program that reads records from the file and uses a simple memory manager to allocate memory.
- integer-to-string.s -- a function that converts an integer number to a ecimal string representation.
- conversion-program.s -- a program that converts an integer number to a decimal string representation and prints it.
- hello-world.c -- hello world program in C.
- hello-world.pl -- hello world program in Perl.
- hello-world.py -- hello world program in Python.