Skip to content

Programming examples from the book "Programming from the Ground Up" by Josh Bartlett.

Notifications You must be signed in to change notification settings

vshender/programming-from-the-ground-up

Repository files navigation

programming-from-the-ground-up

Programming examples from the book "Programming from the Ground Up" by Josh Bartlett.

3. Your First Programs

  • 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.

4. All About Functions

  • 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.

5. Dealing with Files

  • toupper.s -- a program that converts an input file to an output file with all letters converted to uppercase.

6. Reading and Writing Simple Records

  • 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.

7. Developing Robust Programs

  • 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.

8. Sharing Functions with Code Libraries

  • 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 the libc6-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
    

9. Intermediate Memory Topics

  • 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.

10. Counting Like a Computer

  • 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.

11. High-Level Languages

About

Programming examples from the book "Programming from the Ground Up" by Josh Bartlett.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published