News for hackers. Stuff that matters.
Re:Show HN: I wrote an OS in 1000 lines of Zig by WD-42 on Sunday September 21, 2025 @08:57PM (#45328093)
There is a todo in the putchar stub. Looks like it’s not implemented yet.

I have it implemented here in my own roughly 1k line zig kernel: https://github.com/Fingel/aeros-v/blob/ddc6842291e9cf4876729...

Re:Show HN: I wrote an OS in 1000 lines of Zig by noone_youknow on Monday September 22, 2025 @12:48AM (#45329172)
Thanks! I see that you’re using the SBI routines, which is what I was expecting here but couldn’t find - the reference to “output text to VGA” in the post made me curious.

I did see the putchar stub in the user.zig but, lacking understanding of zig, wasn’t sure how that could work given common.zig is looking for putChar in kernel.zig as far as I could tell.

I just jumped through a couple of hoops to get zig 0.13 installed and see an error about “root struct of file ‘kernel’ had no member named ‘putchar’” so I guess maybe it’s not implemented here at all.

Re:Show HN: I wrote an OS in 1000 lines of Zig by WD-42 on Monday September 22, 2025 @10:22AM (#45333874)
I don’t know what output to the VGA means from the OP. I suspect that entire project was vibe coded including the readme. It’s a common first step when writing an OS for x86 but for riscv you don’t use vga to get text output, you go through the UART.

Are you saying you had trouble getting putchar working in my implementation? As far as I know common.console is fully implemented and working. Let me know if something is wrong.

Re:Show HN: I wrote an OS in 1000 lines of Zig by noone_youknow on Monday September 22, 2025 @01:45PM (#45336925)
Sorry for the confusion, I was referring to the putchar not being implemented in OPs code, I got yours working right away (nice work btw).

What you mention about VGA being common on x86 was what got me curious, since it’s not a thing on riscv. In my own OS project I’m using a framebuffer to show a graphical terminal on both x86 and riscv64 so I wondered if OP was doing similar or was really using SBI output.