A command-line GPA calculator written in x86 Assembly (MASM/TASM) that accepts letter grades and credit hours, computes GPA with validation, and displays the result with formatted output. Ideal for learning assembly-level input/output and arithmetic.
This is a command-line GPA Calculator written in x86 Assembly (MASM/TASM compatible). It takes user input for subjects, letter grades (with + or - modifiers), and credit hours, then calculates the GPA with accurate handling of decimal values.
- Supports GPA calculation for up to 9 subjects
- Accepts letter grades with modifiers: A+, A, A-, ..., F
- Validates both grade format and credit hour ranges (1 to 4)
- Accurately computes GPA including decimal point (tenths place)
- Clears screen and formats output for a clean user experience
- Compatible with EMU8086, MASM, and TASM assemblers
This project includes strong input validation:
- Grade Validation: Ensures only valid letter grades (A-F) with optional
+
or-
modifiers are accepted. Invalid input triggers a re-prompt. - Credit Hour Validation: Accepts only numeric values from 1 to 4. Invalid entries outside this range prompt the user again.
- Point Value Handling: GPA values are handled in fixed-point format by storing integer and decimal parts separately. This ensures the final output (e.g.,
3.7
,2.3
) is mathematically correct, even after credit hour multiplication and total GPA calculation.
- Open DOSBox or command prompt with MASM/TASM set up.
- Assemble and link the program:
tasm gpa.asm tlink gpa.obj gpa.exe
Open EMU8086 IDE.
Paste the code into a new .asm file.
Click Compile and Run.
- Decimal accuracy is achieved through fixed-point arithmetic (integer + fractional byte).
- The screen is cleared using INT 10h with background and text attributes.
- This project handles invalid input more robustly than many other similar GPA calculators on GitHub.
This project is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License.
You are free to:
- Use, copy, and distribute the code for any purpose, including commercial use, as long as you do not modify it.
However, you may not:
- Modify, adapt, or create derivative works based on this project.
- Distribute the modified version.
The terms of the license are as follows:
-
Attribution: You must give appropriate credit, provide a link to the license, and indicate if changes were made. However, you may not suggest that the licensor endorses you or your use.
-
NoDerivatives: If you remix, transform, or build upon the material, you may not distribute the modified material.