Program Counter Simulator
Use labels like loop:, sequential instructions such as LOAD or ADD, branches such as BR label or BR +8, plus JMP, CALL, RET and HALT.
This teaching simulator assigns an address to each non-empty instruction line and traces how a simplified program counter (PC) moves. It is not a line, statement or token counter and does not compile or execute a programming language.
How to trace a listing
-
1
Enter a short listing
Use one fixed-width instruction per line, with optional ASCII labels such as loop:.
-
2
Choose the address model
Set the start address, 1-, 2-, 4- or 8-byte instruction size, 16-, 24- or 32-bit width and address display.
-
3
Set trace behavior
Treat every recognized branch as taken or not taken, choose 1–80 steps, then inspect each PC transition.
Supported model
| Listing item | Simulator behavior |
|---|---|
Other opcode, such as LOAD or ADD |
Advance by the selected fixed instruction size |
BR, BRA, BRANCH, BEQ, BNE, BGT, BGE, BLT, BLE, BZ, BNZ, JZ, JNZ |
Follow the global taken/not-taken setting |
JMP, JUMP, GOTO |
Jump to a label or numeric target |
CALL, JSR, BL / RET, RETURN |
Push / pop a simulated return address |
HALT, HLT, STOP |
Stop at the current PC |
Targets may be ASCII labels, decimal addresses or 0x hexadecimal addresses. A signed target such as +8 is relative to the next sequential PC; an unsigned number is absolute. Addresses wrap to the chosen 16-, 24- or 32-bit width. // and ; start comments. Operands are displayed but never evaluated.
Limits and privacy
- Input is truncated to 1,800 characters and parsing stops after 200 instructions.
- The trace is limited to 1–80 steps. All recognized conditional branches share one global branch choice.
- The model does not emulate registers, memory, flags, pipelines, delay slots, instruction encoding or variable instruction lengths.
- In the standard tool the listing is sent to this site. Funnel mode also includes it in the page URL. Do not paste confidential or proprietary code.
Frequently Asked Questions
No. It assigns addresses to instruction lines and traces PC control flow; it does not report source lines, statements or tokens.
No. It recognizes a small generic set of control-flow opcode names. All other opcodes simply advance the PC, and operands are not executed.
The signed offset is added to the next sequential PC. At PC 0x1000 with 4-byte instructions, BR +8 targets 0x100C.
It is sent to this site for server-side rendering, and funnel mode places it in the URL. No external code-analysis API is used, but confidential code should not be pasted.
Related Tools
ASCII Table Reference
Full ASCII table from 0 to 127 with decimal, hex, octal, binary, standard names and HTML numeric-reference notation, including NUL, LF and DEL.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
HEX Color Picker
Pick or enter a HEX colour and get RGB, HSL, approximate CMYK, relative luminance and contrast ratios against white and black.
HTML Character Reference
Searchable list of HTML entities, their named and numeric codes, and a one-click copy for special characters and symbols.
JSON Formatter
Paste JSON to pretty-print with 2 or 4 spaces, minify it to compact output, or run a quick syntax check before copying the result.
Phone Validator
Validate phone numbers by country, detect the region and type, and normalize valid numbers to E.164, international, national and RFC 3966 formats.
Tool available in other languages
- เครื่องจำลองตัวนับโปรแกรม [TH]
- プログラムカウンターシミュレーター [JA]
- Programmatellersimulator [NL]
- Program sayacı simülatörü [TR]
- 프로그램 카운터 시뮬레이터 [KO]
- 程序计数器模拟器 [ZH]
- Simulateur de compteur de programme [FR]
- Trình mô phỏng bộ đếm chương trình [VI]
- Simulator program counter [ID]
- Simulator för programräknare [SV]
- Simulador del contador de programa [ES]
- Programmzähler-Simulator [DE]
- محاكي عدّاد البرنامج [AR]
- Symulator licznika rozkazów [PL]
- Simulador de contador de programa [PT]
- Simulatore del program counter [IT]
- Симулятор счётчика команд [RU]