| Layer | Technology | Purpose |
|---|---|---|
| GUI | Qt 5/6 Widgets (C++) | Window, buttons, timer, display |
| Core Logic | x86-64 NASM Assembly | Character analysis, word counting |
| Communication | Temp files (Option A) | Qt writes input; ASM writes output |
TypingSpeedTest/
├── asm/
│ └── typing_analyzer.asm ← Assembly source (NASM)
├── main.cpp ← Qt entry point
├── mainwindow.h ← Main window declaration
├── mainwindow.cpp ← Main window implementation
├── TypingSpeedTest.pro ← Qt project file (qmake)
├── CMakeLists.txt ← CMake build file (alternative)
├── build_asm.bat ← Script to assemble the .asm file
└── README.md ← This file
- Download: https://www.nasm.us/pub/nasm/releasebuilds/
- Install the Windows x64 installer
- Add to PATH:
C:\Program Files\NASM\
Verify:
nasm -v
- Download Qt Online Installer: https://www.qt.io/download-open-source
- Install Qt 5.15 or Qt 6.x with MinGW 64-bit component
- Qt Creator is included
- Usually installed with Qt. Verify:
gcc --version
Open Command Prompt (not PowerShell) in the project root:
build_asm.batThis produces: asm\typing_analyzer.exe
Manual alternative:
nasm -f win64 asm\typing_analyzer.asm -o asm\typing_analyzer.obj
gcc -o asm\typing_analyzer.exe asm\typing_analyzer.obj -lkernel32 -nostartfiles -e mainOption A — Qt Creator (recommended):
- Open Qt Creator
- File → Open File or Project → select
TypingSpeedTest.pro - Configure kit: Desktop Qt (MinGW 64-bit)
- Build → Build Project (Ctrl+B)
- Run (Ctrl+R)
Option B — Command line (qmake):
qmake TypingSpeedTest.pro
mingw32-makeOption C — CMake:
mkdir build && cd build
cmake .. -G "MinGW Makefiles"
mingw32-makeAfter building, typing_analyzer.exe must be in the same folder as TypingSpeedTest.exe.
The .pro file and CMakeLists.txt both include a post-build copy step that handles this automatically.
User clicks Start
│
▼
Qt picks random sentence → displays it
Qt starts QElapsedTimer + QTimer (display refresh)
│
User types in the text box
│
User clicks Submit
│
▼
Qt stops timer, records elapsed seconds
Qt writes two-line input file to %TEMP%\typing_in.txt:
Line 1: original sentence
Line 2: user-typed text
│
▼
Qt launches typing_analyzer.exe via QProcess:
typing_analyzer.exe "C:\...\typing_in.txt" "C:\...\typing_out.txt"
│
Assembly reads file, analyzes, writes result file:
Line 1: correct_chars
Line 2: incorrect_chars
Line 3: total_chars
Line 4: word_count
│
▼
Qt reads result file, calculates:
Accuracy % = (correct × 100) / total
WPM = word_count / (elapsed_seconds / 60)
│
▼
Qt displays all results in the Results panel
| Function | Description |
|---|---|
parse_args |
Extracts input/output file paths from command line |
copy_line |
Copies one line from file buffer, handles CR/LF |
analyze_text |
Main loop: character comparison + word counting |
build_output |
Formats 4 integers as text lines |
append_decimal |
Converts 64-bit integer to ASCII decimal (no CRT) |
Sentence: Assembly language is powerful
Typed: Assembly language is powerfull
Assembly outputs:
28
1
29
4
Qt calculates:
Accuracy : (28 × 100) / 29 = 96.6%
WPM : 4 / (15/60) = 16
Displayed:
Correct Characters: 28
Incorrect Characters: 1
Accuracy: 96.6%
WPM: 16
Time Taken: 15.0 sec
| Problem | Solution |
|---|---|
nasm: command not found |
Add NASM to PATH or use full path |
gcc: command not found |
Add MinGW to PATH |
| Linking error | Try ld instead of gcc; see build_asm.bat |
typing_analyzer.exe not found |
Copy it next to TypingSpeedTest.exe manually |
| Qt Creator can't find kit | Configure a Desktop Qt MinGW 64-bit kit in Qt Creator settings |
| App opens then crashes | Run from Qt Creator in Debug mode; check QProcess exit code |