News for hackers. Stuff that matters.

gdevic

Re:Doing Nothing at Work on Thursday June 11, 2026 @04:42PM (#48496141)
Great recipe for mediocrity. Do not follow OPs advice. (Source: 23+ years at NVIDIA).
That. I blatantly "stole" those from Z80 since they are elegant and effective. I have BF (flag) that gets set in ALU when the result is > 9, then DAA/DAS that add 6 or 10 (the latter wraps around as -6 since registers are 4-bit wide).

     12'b0000_0000_001?: begin : instr_daas    // DAA, DAS
       if (flags[BF_BIT])
         rx[0] <= rx[0] + (op_is_daa ? 4'd6 : 4'd10);
       flags[CF_BIT] <= flags[BF_BIT];
       state <= FETCH;
     end : instr_daas
I added a rather lousy video to the end of the chapter https://baltazarstudios.com/calculator-conclusion/

Creating the kind of quality video we're all used to seeing is beyond my skill level and ... motivation.

Corrected. Thank you!
There is a WebAssembly version running online here, with and without debugger panel:

https://baltazarstudios.com/files/calculator-d/Calculator.ht...

https://baltazarstudios.com/files/calculator/Calculator.html

This WebAsm code is compiled using Qt and Verilator so it runs the "hardware" and its microcode inside the simple UI shell that provides the calc interface. In the debug version you can list the ucode, set breakpoints, see regs etc.

The core question: how did HP's scientific calculators actually work at the gate level? That rabbit hole led to building one from scratch.

The architectural decision everything else follows from: a decimal calculator should store numbers as BCD — one decimal digit per 4-bit nibble. A standard byte-oriented CPU (Z80, 6502) fights that layout constantly. So I designed a small custom CPU in Verilog where 4 bits is the natural data width and memory is nibble addressable.

What the project covers:

- Custom CPU: Harvard architecture, 12-bit ISA, 8-state execution FSM, hardware stack guard with a FAULT state for microcode debugging

- CORDIC for trig functions, verified to 14 significant digits

- Two-pass assembler in Python (~700 lines)

- Verilator + Qt framework: same Verilog source runs in simulation, as a desktop GUI debugger, as WebAssembly, and on real hardware

- Scripting language on top of the microcode for adding functions without touching hardware

- Custom PCB (EasyEDA/JLCPCB), battery, charging circuit

Write-up: https://baltazarstudios.com

Hackaday: https://hackaday.com/2026/05/13/build-the-cpu-then-build-the...

Re:I love Linux, but I can't quit Windows on Friday May 15, 2026 @01:04PM (#48151070)
Absolutely agree with the OP! My first Linux installation was in 1993 when I hauled dozens of floppies from my Uni back home (X-Windows was like 15 floppies?). Even remember emailing to Linus about some issue and he responded. Ever since I _wanted_ to be using Linux but was always put off for all the reasons described in that post. I wanted a nice OS so I can do my school/work/hobbies but not constantly having to work on that OS, figure out dozens of config files, brick the system etc.

At this point WSL2 is more than filling this void. I even stopped using VMWare since WSL is that good.

Re:A Chopin Waltz Unearthed After Nearly 200 Years on Sunday October 27, 2024 @05:25PM (#41965817)
Agree. Lang Lang is all about theatrics, also.
Re:How Microchips Work on Sunday March 17, 2024 @03:05AM (#39732494)
I loved the article! Spot on and just the right depth for the article size (I am a CPU architect).