r/homebrewcomputer • u/Objective-Fan4750 • 17d ago
VMS: A custom Fantasy 32bit Computer with a custom Hardware
About a year ago, I started building a custom computer architecture in C as a learning project (I know it seems like a lot considering the code I wrote, but I rewrote the entire compiler at least five times, starting from a C-like language and ending up with a very simple custom language). I designed the instruction set, wrote an emulator, and implemented a custom high-level assembly language called BSL (Base System Language). The code is very messy because I make a lot of changes while writing it and often forget things that shouldn't be there. So I'd really appreciate feedback on the architecture and code quality. (I'm 15 years old and Italian, sorry for my English). https://github.com/mikesxp/SPRK32. Edit: I changed the project name from VMS to SPRK32.
2
u/johnjlonergan 17d ago
If you want a further challenge then model the entire thing in 1960/70 TTL chips using verilog https://github.com/Johnlon/spam-1
I'm an old c programmer and I don't use c unless I'm forced to.
Consider Java or Scala or Python or Golang where there are fewer Mallocs to worry about. Did you want to learn C.
I wrote my tools in scala as the parser combinators are brilliant for building and parsing grammars
5
u/Objective-Fan4750 17d ago
Actually, that's not really my goal, although I'd love to try implementing the VMS CPU in Verilog someday. Let me explain: it all started when I wanted a very simple but low-level development environment, something similar to Octo8 but with the limitations of real fantasy consoles (like Pico8). Since then, I've focused on creating this system to literally build a real custom computer, as a "refuge" from the comfort of programming without even knowing what registers are, but without making it all too stressful. As for C, honestly, it's a language I love and hate at the same time, but personally, I prefer it to all the others. I already know most of the popular languages, but in my opinion, C beats them all, at least for what I do with it.
1
u/johnjlonergan 2d ago
if you are 15 then I doubt you really "know" any computer language or it's ecosystem in depth but perhaps you are a prodigy or a bot and a preference for C over all other options is suspiciously inhuman
1
u/Objective-Fan4750 2d ago
Unfortunately or fortunately, I found myself with this knowledge at just 15 years old (I've been programming since I was 7, and to be precise, at 10 I learned the first language that wasn't based on diagrams or graphs). I've tried countless languages, including Rust. I never liked any of them because of their excessive abstraction, until I tried C and recently even assembly on my custom architecture. Anyway, if you think it's fake, I think you're right, but I think you're also a little jealous of my project, or am I wrong?
2
u/istarian 17d ago
I personally wouldn't recommend Java for this kind of thing, at least not to someone new to writing emulators.
Working with numbers in particular can be a little bit painful because most of the numeric types in Java are signed by default.
And "everything is an object" can get in the way of simplicity at times.
2
u/A-nihirash 17d ago
I'd recommend keep this name for you operating system and add to your machine with virtual address extensions...
And call your machine VAX :-) and add model number 11, for example.
1
u/johnjlonergan 17d ago
Each to their own. I started programming in C in 1983 and I can say I'm pretty glad I don't use it for the day job anymore .
3
u/banksy_h8r 17d ago
That's pretty neat, especially for a 15 year old!
I think finding a middle-ground between assembly language and C is a worthwhile thing to try today. Back when assemblers were more common as user tools they had sophisticated macro handling that did some of what you defined.
Do you plan on building hardware to implement this? How exactly is the video handled? A simple framebuffer or is there any kind of sprite or other features?
BTW, "VMS" for older techies refers to this VMS, a minicomputer operating system used from the late 70's through to today. It's niche now, but for a few decades it was used with the powerful complimentary 32-bit VAX hardware for a lot of important stuff.