# Plan B for retirement: DIY SoC with some 8-16 bit CPU & Co



## Maissilapsi (Aug 19, 2021)

8-BIT DIY COMPUTING DEVICE ISN'T GOING​TO BUILD ITSELF, SO I NEED YOUR HELP​(OR, AN INTERVENTION)​
Introduction:​I been thinking about building this a while now, I mean why not? I got time... I have 3 decades of history as PC enthusiast, including overclocking etc and PC building/repairing/tuning is still one of my favorite activities. People around me are well aware of this and won't hesitate to ask me to go fix their hardware. Which I do, with joy. I suspect it's because how much detective work it all requires, not sure though, but I find the search for answers most fullfilling.
I'm not computer/software/ engineer, and I only have some expertise in electronic- and mechatronic automation. What I lack in expertise on certain specific PC related fields, I compensate it with my infinite interest on subject. Anyway_..._

*The beef here is:*​
*I'm  a bit lost where to even begin this all. So I'm asking some general tips and guidance on easy to avoid big mistakes so won't lose interest etc. *

I've thought through the design on like, on logical level (not logical gate level), I haven't drawn even circuit diagram yet and only kind of have the idea how it (at least in theory) should work. Although I'm not 100% sure which type of parts and with what parameters give the hoped results, yet. Parts such as transistors, capacitors, diodes, flip-flops, EROM's (or EEROM's?)... Even currents and voltages are "hanging freely" at this stage.

I don't want copy anyone but build mine own, so no step by step guides please, unless it's only way to explain something for my smooth brains. I have some last century tools to write on ROM chip, of course soldering tools, spectrum of measuring tools well.. a lot of tools really so that's all good. Going to need small parts obviously but they can be cannibalised from old obsolete electronics. 

Guess I could list some of my biggest questions...

What would work best as "RAM", or drive it's purpose?
How about harddrive, do I even need one though, 8-bit CPU's data output can be basically stored on any number of systems... so... on a harddrive after all.
...I only have questions actually so better I stop listing them because soon it's just replica of someone elses...
But I mean, feel free to comment if you've built one or tried to and share me your experiences?


----------



## Blue4130 (Aug 19, 2021)

If you have to ask these questions, you don't have the skill to build a computer from bare components. There is a reason why people spend years and years going to school for this. It's not meant as a dig on you. 99.9% of the population can't do what you are thinking of.


----------



## W1zzard (Aug 19, 2021)

Look into Atmel AVR microcontrollers, use its SPI bus to add an external DRAM memory chip and interface with an SD Card


----------



## Ferrum Master (Aug 19, 2021)

I kinda do not want to spoil the party... but thinking about making something first... and especially with 80ies tech gear.... it is not possible. Someone did it already during 8bit ZX Spectrum DIY clone era etc and not just because of fun, but because they were poor and exhibited even greater spare part deficit than even now. They had to be creative.

You have to stick to datasheet on most parts... ATMEGA's external RAM has been optional, but it was just dismissed as a cuckoo option, just because of price, device footprint and reliability. As a single project just because you can, you can do it... as this example.

For starters... to peek into the area and if you are into making something... make a simple clock made from logic... but with proper compensation circuit, that is a aware of it's fault. It is done many times, but the implementation can vary a lot, thus in the end the result will be quite unique.

If you want to make it even more complex... peek into early speech synthesis.


----------



## TheLostSwede (Aug 19, 2021)

Maybe what you want, is to use an FPGA, something akin to this project.








						Consolite, a Tiny Game Console on an FPGA
					

If you wish to make a game from scratch, you must first invent the universe. Hardware source | Tron source | Circles source | Emulator source | Assembler source | Compiler source For my latest project, I am diving back into Verilog to create the hardware side of Consolite. For those who don't...




					fotino.me
				




Or if you really want to get your hands dirty.








						Building a 'homebrew' video game console
					

This post serves as an introduction to a "homebrew" video game console made from scratch, using a lot of inspiration from retro consoles and modern projects but




					www.gamasutra.com


----------



## Maissilapsi (Aug 19, 2021)

Blue4130 said:


> If you have to ask these questions, you don't have the skill to build a computer from bare components. There is a reason why people spend years and years going to school for this. It's not meant as a dig on you. 99.9% of the population can't do what you are thinking of.


Yeah I'm well aware of the challenges ahead, but I have enough experience on electronic and mechatronic automation engineering to understand this is doable. I only have uni education mechatronics but drawn electric automation circuit diagrams etc with AutoCAD for foreign and domestic factories since teenager, first as side hustle but which became the main hustle later in life. And as I'm currently retired and as mentioned *I got plenty* *of time* to study & learn. After all, I can read (with reading glasses...) and I'm still able to take in new information when I see it serving some purpose.



TheLostSwede said:


> Maybe what you want, is to use an FPGA, something akin to this project.
> 
> 
> 
> ...


Thanks for the link, look to it soon. It's possible FP gates are pretty much only solution currently too...


----------



## qubit (Aug 19, 2021)

Blue4130 said:


> If you have to ask these questions, you don't have the skill to build a computer from bare components. There is a reason why people spend years and years going to school for this. It's not meant as a dig on you. 99.9% of the population can't do what you are thinking of.


This ^^ There's nothing trivial about building a computer, even the simplest 8-bit one. The fact that you're asking how to do it on a forum tells me that you have no idea how to go about this.

It looks like you want a big challenge, so I recommend studying a course in this field and really knowing your stuff first, then taking on this challenge, which will be very satisfying.

Perhaps building a design based around a 32-bit ARM CPU will be best? Great performance and great support for this platform. I've programmed the ARM2 in assembler on an *Acorn Archimedes* and it's awesome.

Good luck.


----------



## Blue4130 (Aug 19, 2021)

Maissilapsi said:


> Yeah I'm well aware of the challenges ahead, but I have enough experience on electronic and mechatronic automation engineering to understand this is doable. I only have uni education mechatronics but drawn electric automation circuit diagrams etc with AutoCAD for foreign and domestic factories since teenager, first as side hustle but which became the main hustle later in life. And as I'm currently retired and as mentioned *I got plenty* *of time* to study & learn. After all, I can read (with reading glasses...) and I'm still able to take in new information when I see it serving some purpose.
> 
> 
> Thanks for the link, look to it soon. It's possible FP gates are pretty much only solution currently too...


Automation is far far away from designing a computer. But let's say you have to drive to learn what you need... Let's start with the big picture, what do you want this to do? Play simple games like text adventures? Play sprite based games? 

Next how will you interact with it? Will it be os based? Low level language based? Assembly? Basic? Dos? Cp/m? 

What is your input system? Keyboard? Output? Blinking led? Fixed character display like a 16x2lcd? 

What do you want for memory? (skip a harddrive, it's unnecessary complexity) 

Instead of starting with designing your own, I suggest building one from this list... You will gain much more knowledge by understanding one that is already done. 





__





						Thomas Scherrer Z80-Family HomePage
					

Projects Hardware Software Homemade Z80 systems



					z80.info


----------



## adabru (Aug 19, 2021)

If you're interested in a community project, you could take a look at the OpenRISC project (e.g. https://duckduckgo.com/?q=openrisc&iax=videos&ia=videos or https://openrisc.io ) . Though the website suggests it is 32-bit, not 8-bit as you wanted.


----------



## TheLostSwede (Aug 21, 2021)

This might be relevant.








						DIY Silicon: Man Builds Integrated Circuit That's Similar to Intel's 4004 CPU
					

What one man can do in 2021 was only achievable by a whole company in the 1970s




					www.tomshardware.com


----------



## Maissilapsi (Sep 1, 2021)

Ferrum Master said:


> I kinda do not want to spoil the party... but thinking about making something first... and especially with 80ies tech gear.... it is not possible. Someone did it already during 8bit ZX Spectrum DIY clone era etc and not just because of fun, but because they were poor and exhibited even greater spare part deficit than even now. They had to be creative.
> 
> You have to stick to datasheet on most parts... ATMEGA's external RAM has been optional, but it was just dismissed as a cuckoo option, just because of price, device footprint and reliability. As a single project just because you can, you can do it... as this example.
> 
> ...


I was thinking it will be giving signals to actuator parts. Be the "brains" or PID controller of useless servomechanisms, like some... well, control heat of bbq for example, at first and gradually fine tune it as something that may even serve some actual purpose. I don't have purpose driven need for it now, there's R9 5950X for that, but more of a interest on subject driven need...



TheLostSwede said:


> This might be relevant.
> 
> 
> 
> ...


Sure it's interesting but I'm not "quite" in the same league, as a matter of fact we play different game, in different age groups, on other continent...



Blue4130 said:


> Automation is far far away from designing a computer. But let's say you have to drive to learn what you need... Let's start with the big picture, what do you want this to do? Play simple games like text adventures? Play sprite based games?
> 
> Next how will you interact with it? Will it be os based? Low level language based? Assembly? Basic? Dos? Cp/m?
> 
> ...


It will be sending signals that do mechanical work, PID controller sort of, at first. There's million uses I can imagine for one. Leds are fine telling where signals going at first, nothing fancy in mind, likewise some bytes of binary code (big-little endian doesn't matter I suppose at this stage) instructions on a ROM, or several ROM chips, and which bit numbers I know later too, but which I have means to stamp myself. The ROM/'s kind of be RAM except repeating same words every time "a fetch" comes (over e.g. sensory signal) for the processor which release volts to where instructed. Kind of hard to put this in words in English as it's like my 3rd language and have some gaps in technical terms too.

Processor would just keep the system running smoothly, read the situation and act accordingly. Later, once it's going as intented, can start focusing on more sophisticated features....



Blue4130 said:


> If you have to ask these questions, you don't have the skill to build a computer from bare components. There is a reason why people spend years and years going to school for this. It's not meant as a dig on you. 99.9% of the population can't do what you are thinking of.


Well, my introduction doesn't give good specification how I'm doing it,, but it's really not like I could dress it like that on English either necessarily.

But... I'll try: Think of  "Centralised Processing U-Haul" or CPU (the 8 or so bit CPU). It receiving signal from sensor 1. detecting event A. It now needs to know what to do, but it got "address": 1.A. where to ask that from. It'll send the "signal guys x1.1" to "fetch" the information from address 1.A. where a ROM with certain stable, some couple bytes of binary code instruction is found. Once the the sgx1.1 reach the ROM a "capacitor" or such pops off and transforms "sgx1.1" to "sgx1.2" that's carrying those couple words of information of ROM in address 1.A. to CPU for "centralized processing". It then processing transistors on/off as the sgx1.2 instructs which in turn sends signal guys x2.1, x3.1 & x4.1 on move. Sgx2.1 ot instruction to visit address 2.B. which is another ROM where "capacitor" pops sg2.1 -> sgx2.2 with more info for Centralised Processing U-Haul.

Sgx3.1 got an instruction to go tell rotary actuator to act with force ROM at 1.A instructed, but the actuator is lazy and sgx3.1 has to sacrifice itself turning the actuator with force sgx3.1.

Sgx4.1 got instruction to go meet with sensor 2 which had detected an anomaly in movement of the actuator sgx3.1 used itself, and speeds back to CPU as sgx4.2, however no has no clue what's next, if it wasn't for sgx2.2 from address 2.B with a word or two saying that if sgx4.2 is seen around, send sgx5.1 to urn the actuator, sgx2.1 to adress 2.B ROM and sgx4.1 to sensor 2...sgx5.1 pulled it's job perfectly, sgx2.2 returned but sgx4.2 didn't so sgx2.2 instructed everyone on standby for next signal to process...

I have no idea how that makes sense to anyone, but there's the main operational side if it, transistors control electricity in a way it's instructed by ROM's...


----------



## ArdWar (Sep 2, 2021)

I still not exactly sure what you're trying to do.

Do you want to build a CPU from scratch, implement a CPU on a programmable logic or just emulate a instruction set on a microcontroller? I guess making a "DIY SoC" is out of league for most people. There's low volume didactic fabs that might take experimental orders, but they usually not exactly available for general public. Do you mean "DIY SBC" instead, that's several order of magnitude more realistic to do.

If you're trying to create CPU from scratch, how discrete you want it to be? Individual transistors? Individual logic gates? Does using simpler integrated logic like ALU, decoders or shift registers okay for your project? How about using PAL/GAL?

Anyway, the fact that you ask about "RAM" and "Harddrive" gives me impression that you're not exactly aware what you want to do and what it required to implement.

For reference, take a look at Gigatron or this one or this one or this one (DIY CPU from "standard" 74xx chips), or if you want more discrete Megaprocessor (transistor-level CPU project), and decide what you want.


----------



## Hachi_Roku256563 (Sep 2, 2021)

Are you trying to create your own arduino?
if so im intrested


----------



## Maissilapsi (Sep 2, 2021)

ArdWar said:


> Do you want to build a CPU from scratch, implement a CPU on a programmable logic or just emulate a instruction set on a microcontroller? I guess making a "DIY SoC" is out of league for most people. There's low volume didactic fabs that might take experimental orders, but they usually not exactly available for general public. Do you mean "DIY SBC" instead, that's several order of magnitude more realistic to do.


It is what it is. Circuitboard with transistor based processing unit which will in it's first stage use pre-made instructions on ROM's, which controls a mechanical system... just can't decide quite which, but in a way it's not pure logic (or is...) but able to adapt on changes, e.g. environmental. I have some ideas on altering code of ROM once data leaves it etc...



ArdWar said:


> If you're trying to create CPU from scratch, how discrete you want it to be? Individual transistors? Individual logic gates? Does using simpler integrated logic like ALU, decoders or shift registers okay for your project? How about using PAL/GAL?



PAL/GAL comes later. I need to get logics unit and voltages transferred first, with some transistors, and after I've been thinking 8-bit would be just too much. At least for start, considerably less, like 100 transistor system which would be doable with diode-resistor logic units, and would make everything so much simpler. And MOS transistors can be added later once get in the PAL/GAL leagues although it's a giant leap to just building platform for some 5 000- 8 000 transistor operation. So, get to know the system better and add new features as feel safe to do so.  I understand it'll be complete overhaul of it, but sort of practice first what works with what and "go deeper" from there


ArdWar said:


> Anyway, the fact that you ask about "RAM" and "Harddrive" gives me impression that you're not exactly aware what you want to do and what it required to implement.


Yeah I understand how it can look like it but they were genuine question I wondered at the time, although visualised the thing better now, like from usage of it to requirements....



Isaac` said:


> Are you trying to create your own arduino?
> if so im intrested


I guess kind of, just with less sophistication and less respects for anyones intellectual property



ArdWar said:


> For reference, take a look at Gigatron or this one or this one or this one (DIY CPU from "standard" 74xx chips), or if you want more discrete Megaprocessor (transistor-level CPU project), and decide what you want.


The whole project began when came across this, which is also my first computer ever...





__





						Commodore 64 Architecture
					

Commodore 64 Architecture From Compute! Issue 32 / January 1983



					www.atarimagazines.com


----------



## cvaldes (Sep 2, 2021)

Are you willing to write your own operating system?

My guess is that anyone with the right expertise can pump out a bunch of components (at an exorbitant cost). The challenge is to get all those parts to work together. If you want a functional general purpose computer, it's time to revisit what an operating system is.

An operating system is a big complicated program that lets other big complicated programs co-exist peacefully on the same system. This isn't just a word processing program, video player, and a card game. This means things like an audio driver, video driver, network driver, and windowing system.

Even if you relied mostly on a pre-existing OS like Linux/FreeBSD/whatever, you'd still need to write custom code.

A.) Are you capable of this? B.) Do you believe that people who are capable of this would pose this question at TPU?


----------



## eidairaman1 (Sep 2, 2021)

Isaac` said:


> Are you trying to create your own arduino?
> if so im intrested



Should get a Motorolla 6800 lol


----------



## Maissilapsi (Sep 4, 2021)

cvaldes said:


> Are you willing to write your own operating system?
> 
> My guess is that anyone with the right expertise can pump out a bunch of components (at an exorbitant cost). The challenge is to get all those parts to work together. If you want a functional general purpose computer, it's time to revisit what an operating system is.
> 
> ...


I'm not even at the stage of planning where I could see it on anykind of display, yet at least. I've only used C for coding some simple games with x86 but doubt it'll help at that. Although I can "stamp" binary code on crude ROM chips, something picked up decades ago when had to pull stuff from sleeve when things weren't that sophisticated as today and had to complete some conveyor belts etc...

Plan is to use set of those ROM's as ISA that create sort of assembly language, but I've not even planned assembler that could be interacted with more than set on certain modes changing logic instructions. 

But time will tell, my own PC isn't currently even operational after I started to remove CPU cooling radiators from case to make room for... stuff... and use one big 400x400 radiator outside case for both GPU and CPU, instead of just 420x140 one for GPU, but... don't have parts and it's taking forever for couple tube connectors to arrive so I can't get on CAD to work on this thing...


----------



## Hachi_Roku256563 (Sep 4, 2021)

Maissilapsi said:


> I'm not even at the stage of planning where I could see it on anykind of display, yet at least. I've only used C for coding some simple games with x86 but doubt it'll help at that. Although I can "stamp" binary code on crude ROM chips, something picked up decades ago when had to pull stuff from sleeve when things weren't that sophisticated as today and had to complete some conveyor belts etc...
> 
> Plan is to use set of those ROM's as ISA that create sort of assembly language, but I've not even planned assembler that could be interacted with more than set on certain modes changing logic instructions.
> 
> But time will tell, my own PC isn't currently even operational after I started to remove CPU cooling radiators from case to make room for... stuff... and use one big 400x400 radiator outside case for both GPU and CPU, instead of just 420x140 one for GPU, but... don't have parts and it's taking forever for couple tube connectors to arrive so I can't get on CAD to work on this thing...


Honestly dude Im starting to agree with anyone else you seem to be way in over your head
Maybe start with a Arduino and go from there?


----------



## Maissilapsi (Sep 4, 2021)

Isaac` said:


> Honestly dude Im starting to agree with anyone else you seem to be way in over your head
> Maybe start with a Arduino and go from there?


What's wrong with the plan so far? Try being constructive, I won't be able write everything in detail on this platform with language I really don't even have education on either, basically using metaphorical language on most parts...



Isaac` said:


> Honestly dude Im starting to agree with anyone else you seem to be way in over your head
> Maybe start with a Arduino and go from there?


Since you've left it there I take it as you were just trolling, or this is going over your head. Which is understandable since I maybe could be more specific, if I was asked specific questions. 

Look, I don't know what age you guys are but when I was some preteen we didn't even have schools for these things, but if you took x86 as instruction set and not a CPU's somewhere between like Intel's 8080 and 286, I apologise for not being specific enough, also I remembered wrong C+ came later to my life, it was some BASIC with x86 CPU and C+ with 286 - 386. 


Also not sure about this but, in case there's some misunderstanding, hex editors are usually needed for manipulation of binary code CPU is able to read which I can somehow manage, hex editors were common tool to manipulate e.g. games in times before Windows 3 existed. You'll need hex editor and "assembly code" that run the basics of the ISA and which needs to turn into something programs we can interact with on  assembler by "custom code". So there's "some" fundamental to work on first. 

Who's just going to have this all figured out from scrap metal to finished system? 


W1zzard said:


> Look into Atmel AVR microcontrollers, use its SPI bus to add an external DRAM memory chip and interface with an SD Card


I took a good look in to this and realised I'm basically building ancient I²C based system and also I either need to tone down transistor count by some 95% just from 8-bit computing, OR take notes from what you suggested. How about something like these with pmods:


----------



## Hachi_Roku256563 (Sep 4, 2021)

Maissilapsi said:


> Since you've left it there I take it as you were just trolling, or this is going over your head. Which is understandable since I maybe could be more specific, if I was asked specific questions.


Im not trolling 
it just seems that this is the wrong stating point
ima be honest i don't know the first thing about CPU building or even where to start
But my assumption is it takes a Very Specific set of skills 
and not the kind of thing you can just learn off the internet
*My idea would be essentially make a 8088 clone kinda like amd did *
thats still quite a high bar though


----------



## Maissilapsi (Sep 4, 2021)

Isaac` said:


> But my assumption is it takes a Very Specific set of skills
> and not the kind of thing you can just learn off the internet


I got really lucky with set of friends having interest on same subject. All with having access to different resources needed back then: with some having access to software, some hardware and some literature etc. Plus tech was pretty simple and stable... in sense it didn't change like today, I've pretty much dropped off the horse today. 

Switching from life long Intel user to AMD last year and going to BIOS first time, I just threw my hands up and thought: F*** it. Last PC I ever get. And gave 3 cardboard boxes of mobos, GPU's, wires, coolers, RAM's, water cooling blocks, well everything between local PC store and Taiwan to a friends kid who was picking up the habit... although been slowly sinking back to the "bad habits" myself. 

But at least not OC'ing anymore, zero DDR5 or other part anxieties, except need new GPU... and new m... no.

I get an iPad.


----------



## Blue4130 (Sep 5, 2021)

Maissilapsi said:


> to AMD last year and going to BIOS first time, I just threw my hands up and thought: F*** it.


It's statements like this that make people feel that you are in over your head. If you get frustrated or can't figure out a commercial bios, how do you plan to code a low level language like assembly?


----------



## lexluthermiester (Sep 5, 2021)

Blue4130 said:


> It's statements like this that make people feel that you are in over your head. If you get frustrated or can't figure out a commercial bios, how do you plan to code a low level language like assembly?


Everyone has to start somewhere. I think he's got an interesting and fun idea.


----------



## Aquinus (Sep 5, 2021)

lexluthermiester said:


> Everyone has to start somewhere. I think he's got an interesting and fun idea.


I used something like this, except older, back when I was still in school.




__





						EVBplus LLC HCS12 developent board: Dragon12
					





					www.evbplus.com
				




I agree with W1zz though. An Amtel/Microchip microcontroller is probably the best way to go.

Another good option for someone unfamiliar with the microcontroller space would be to get an Arduino. They're pretty cheap and easy to get started with. You can interface with a SRAM DIP or something if you want to really start experimenting.


----------



## Maissilapsi (Sep 5, 2021)

Blue4130 said:


> It's statements like this that make people feel that you are in over your head. If you get frustrated or can't figure out a commercial bios, how do you plan to code a low level language like assembly?



Right... I get it...

I should be more specific since this is a subject with specific attributes and stop ramblings but, *IT IS* annoying to find out you need to relearn quite literally, every term in the BIOS of mobo made by same company and has even same functions and which neither AMD or Intel so aren't happy translate. Apparently so people won't wreck their equipment, which is odd as it's their personal property after they carry them (paid) out of store.

I'm probably not too far off course stating that proper glossaries would prevent damage and neither corporation aren't covering OC damage on their stuff anyway.... which... is... actually a great incentive not to tell in terms of profits...

But still, even with brand new & different tech (switching from i5-9600K to R9 5950X which I wasn't planning of getting but it kind of, came behind blind curve) & with new terminology, dancing the BIOS update rumba with the eras X570 which required a dance partner, some other AMD CPU with integrated graphics, I became much faster than I first imagined, a satisfied owner of stable & chill AMD CPU with all 16 cores behaving unlike I've ever before even dared to dream of. BIOS set with 8 cores on better half at 4,55GHz & 8 cores on lesser at 4,45GHz, setup I chose after got to know more about the CPU and how it operates, 32GB CL 15-15-15-28 3800MHz Neo's, which are now basic "D.O.C.P. 3600MHz 16-16-16-36" (instead of Intel's XMP...) as had to double RAM amount over, things... and finding myself resurrecting a habit I might have even gotten burnout before, aka overclocking and pressure of finding some edge vs others overclockers...

... and now the first short version  has more substance...



Aquinus said:


> I used something like this, except older, back when I was still in school.
> 
> 
> 
> ...


I still have my old simple, white breadboard, although been always calling those as "koekytkentälevy" before, and thanks for the link: always interested on these gadgets. Which also means I have this UM232H development tool that at quick glance seems to be based same system as that Dragon thing which I believe is pretty universal tool? So do I have any need for Arduino, I mean they have their advantages but... well, actually kind of want one now...

(felt to sleep writing this comment waking up in the next morning, so sorry for the delay...)


----------



## Aquinus (Sep 6, 2021)

Maissilapsi said:


> So do I have any need for Arduino, I mean they have their advantages but... well, actually kind of want one now...


I don't really have a need for one either, but for how cheap they are it seems like an easy thing to impulse buy. The Uno Rev.3 is nice though because if you blow the chip, you can replace just the chip and not the board, even though the board plus chip is only something like $20 USD. That's a big plus if you're working with circuits and are running the risk of frying an input or something. Also, something simple like an Arduino that has a half decent IDE for writing and programming the board makes it a nice choice (their IDE works on Linux, OS X, and Windows.)

My main point is that once you commit to trying to do a project, you should be happy with the platform you've decided to implement on. Arduino is cheap and flexible which is why I suggest it. There are a lot of components out there for it as well, kind of like the Raspberry Pi, but that's higher level than I think you want. Also, if you're not used to implementing software in assembly or C without the standard library, you really probably want to start with something simple. Just my 2¢.

Edit: Let me give you an example. I once worked on a project that read a numerical keypad input. It was 4 bits (one for each column,) and another 4 for each row. You would assert a bit high on the row bits to access it to see if a button was pressed. You basically walk through the rows to figure out what the input is, however there is a catch. Due to capacitance on the data lines, if you don't wait long enough, the data line will still be high from a key press on the same column, but the previous row. The solution is to `nop` (no-op) for a cycle or two to let the data line transition. If you're not used to these kind of characteristics, then definitely go with the Arduino to learn.


----------



## ArdWar (Sep 6, 2021)

I'm even more confused with you guys... 

If you're going to brew your own microprocessor, almost definitely you don't need OS, not even BIOS. You're going to write your own code. Probably from scratch in binary/machine code since, depends on your architecture and instruction set design, no one made compiler or assembler for it yet. Forget interfacing with complex peripheral, you're likely going to bit bang your I/O.

If you insist on designing your own microprocessor, you better learn and familiarize how they actually work first. This is usually computer engineering graduate level of study (heck, they probably don't even teach such low-level engineering anymore than passing references, my uni actually teach it in _electronics engineering_).

Using popular simple microcontroller like PIC/AVR usually work best to understand how computer work. Even more basic uP/uC like MCS-51 or 8088 is even better. Try to make a simple program on them barebones without libraries, bootloaders and optimizations so you can relate the resulting binary/assembly code to what you actually write in higher level language. Take a look at the assembly code to figure out how a simple program is actually done at the processor-level. Also take a look at each opcode documentation to figure out how the opcode is actually done at logic level. How many cycles it requires, how it fetch instruction/data between memories/stacks/registers, how (depends on ISA) a complex operation is done using multiple simpler operation, etc. etc. After that you (probably) have a better understanding at what building a completely new processor architecture (and probably ISA too) entails. You probably will have a better question to ask too at that point.... 

IMO using Arduino in this context is kind of counterproductive since it doesn't teach you how to actually set up the peripherals and registers. It's good as *a* stepping stone tho. One other thing is that Arduino teach bad C/C++ programming style, but that's a whole other topic...


----------



## Maissilapsi (Sep 8, 2021)

ArdWar said:


> I'm even more confused with you guys...
> 
> If you're going to brew your own microprocessor, almost definitely you don't need OS, not even BIOS. You're going to write your own code. Probably from scratch in binary/machine code since, depends on your architecture and instruction set design, no one made compiler or assembler for it yet. Forget interfacing with complex peripheral, you're likely going to bit bang your I/O.
> 
> ...


For this exact reason, or the complexity of just 8-bit CPU grows so big, I may want to drop out couple thousand, or couple couple thousand, transistors from it.

Then even the processor units becomes "DIY'able" and could do everything as you want yourself ...which is currently the plan as well. With some number of about 80-100 bytes (that's just a guess as well at this point. Could 10x less or more) ROM chips with logic binary coded on them... Although using 8 or 16-bit mass produced chip would save a lot of work, effort and time, but it's not like there's a deadline or something, and it would increase the dreaded overall complexity even if 99% of capacity was unused.

Using time on one part gives time think through the next and sleeping over night or two after some idea you get idea that's evolved better from original after being critical to it instead of getting committed to half-a**ed one. But those mass produced chips would drive their purpose as ROM's



Aquinus said:


> I don't really have a need for one either, but for how cheap they are it seems like an easy thing to impulse buy. The Uno Rev.3 is nice though because if you blow the chip, you can replace just the chip and not the board, even though the board plus chip is only something like $20 USD. That's a big plus if you're working with circuits and are running the risk of frying an input or something. Also, something simple like an Arduino that has a half decent IDE for writing and programming the board makes it a nice choice (their IDE works on Linux, OS X, and Windows.)
> 
> My main point is that once you commit to trying to do a project, you should be happy with the platform you've decided to implement on. Arduino is cheap and flexible which is why I suggest it. There are a lot of components out there for it as well, kind of like the Raspberry Pi, but that's higher level than I think you want. Also, if you're not used to implementing software in assembly or C without the standard library, you really probably want to start with something simple. Just my 2¢.
> 
> Edit: Let me give you an example. I once worked on a project that read a numerical keypad input. It was 4 bits (one for each column,) and another 4 for each row. You would assert a bit high on the row bits to access it to see if a button was pressed. You basically walk through the rows to figure out what the input is, however there is a catch. Due to capacitance on the data lines, if you don't wait long enough, the data line will still be high from a key press on the same column, but the previous row. The solution is to `nop` (no-op) for a cycle or two to let the data line transition. If you're not used to these kind of characteristics, then definitely go with the Arduino to learn.


Good reminder that slower binary processing speed creates more stable system and need to figure some kind of, most likely partly mechanical, solution for stopping everything from time to time and go through "self repair/searching sequence, or system check up" that lets it know where it's going in terms of, even if binary is big/little-endian actually, to everything like is it reading 0 as 0 and 1 as 1 which isn't technically problematic: just couple words with certain binary order, and if it's not, followed by some rebooting type of scenario.

...In general something that makes sure it can operate more than a 10 sec or so in changing environment and not just only repeating a function or two in precisely timed order


----------



## Aquinus (Sep 8, 2021)

ArdWar said:


> MO using Arduino in this context is kind of counterproductive since it doesn't teach you how to actually set up the peripherals and registers. It's good as *a* stepping stone tho. One other thing is that Arduino teach bad C/C++ programming style, but that's a whole other topic...


It totally does if you're writing your application in assembly, which I would recommend for getting started with a microcontroller with limited memory. In C, it's a bit different since the compiler makes those decisions for you. You also have to deal with the size of the C standard library and the amount of memory on the controller (it's not a lot.) You do still need to set registers to control how the I/O ports are going to behave though, so in that respect, it definitely teaches you how to do all of this stuff from scratch. You need to do these kinds of things if you're going to control clock speed via clock dividers and stuff like that, regardless of the language used to tell the controller what to do.



Maissilapsi said:


> Good reminder that slower binary processing speed creates more stable system and need to figure some kind of, most likely partly mechanical, solution for stopping everything from time to time and go through "self repair/searching sequence, or system check up" that lets it know where it's going in terms of, even if binary is big/little-endian actually, to everything like is it reading 0 as 0 and 1 as 1 which isn't technically problematic: just couple words with certain binary order, and if it's not, followed by some rebooting type of scenario.


The chip that the Arduino uses can give you low power states and lets you divide the input clock to slow down the controller. There are also different power modes that enable and disable different parts of the chip. I think you'd find that the ATMega chip to give you a lot of the things you're looking for, just without a whole lot of resources to work with. Two 8-bit bi-directional ports for digital logic isn't a lot, but it's enough to get going. The controller handles the rest for you and all you need to do is utilize it. So depending on how far you want to go with a project, it might be a nice place to start. Otherwise, you're looking at one of those ARM-based dev kits which are a lot more complicated to work with, have different voltage requirements, and cost more.

All in all, it's easy to throw $20 USD at an Arduino to get started. It's a little harder to justify when that price goes up before you really have a plan for how you want to proceed with this project, otherwise you wouldn't be asking us for guidance and would have began already.


----------



## skizzo (Sep 8, 2021)

this shit is over my head, but I the overall scope of the project sounds a bit like "The 8-Bit Guy" project he called the "Commander X16"








						Commander X16™ Home
					






					www.commanderx16.com


----------



## ArdWar (Sep 8, 2021)

Aquinus said:


> It totally does if you're writing your application in assembly


At that point you're programming an ATMega (which I do recommend), not Arduino.



skizzo said:


> sounds a bit like "The 8-Bit Guy" project he called the "Commander X16"


That's more like system integration.


----------



## Maissilapsi (Sep 8, 2021)

Aquinus said:


> All in all, it's easy to throw $20 USD at an Arduino to get started. It's a little harder to justify when that price goes up before you really have a plan for how you want to proceed with this project, otherwise you wouldn't be asking us for guidance and would have began already.


It is still in planning stage, nothing been decided yet either. I start drawing ISA etc once the cursed tube connectors, kind of ones you can unplug and liquid stays in, arrive (not even in storage yet) and I can put my desktop PC together...



skizzo said:


> this shit is over my head, but I the overall scope of the project sounds a bit like "The 8-Bit Guy" project he called the "Commander X16"
> 
> 
> 
> ...


There's some interesting stuff, like entire specification section and I given zero thoughts for the specs of this "device", well it's definitely going to become an object. (subject to change) When I got this idea I was reading about C64 architecture and felt so simple at the time but there's just stuff piling up on top of each other further this goes it might reach a point I'll really throw my hands up and agree to: "F*** this. I rather build a sandcastle".

But then I see these specs and feel relieved:

Commander X16P Features & Specifications (subject to change)

CPUWDC 65C02S @ 8 MHz40-pin DIP package
Protoype board currently running stable at 8 MHz
RAM40K of "Low RAM":As 39.75K + 256 bytes of IO space
8 IO spaces of 32 bytes each; one for the VERA, one for the VIAs, one for the audio
512K of "High RAM" standard:As 64 banks of 8K
Expandable to 1 MB, 1.5 MB, or 2 MB by adding additional RAM chips to 3 empty sockets
Up to 256 banks of 8KROM
512K of Flash ROMAs 32 banks of 16K (TBD: Could be expanded to 128 banks RAM or ROM)
Standard Commodore Kernal
Microsoft BASIC version 2.0


----------



## Aquinus (Sep 9, 2021)

ArdWar said:


> At that point you're programming an ATMega (which I do recommend), not Arduino.


I'm not following. An Arduino Uno uses an ATMega328P. You're programming that regardless of the language you're using because that's the chip that drives it, so your statement confuses me. If you use that board, you're programming a ATMega chip, period. There is really no difference between using the chip standalone and using the board when it comes to how it's programmed and how it operates.


----------



## ArdWar (Sep 9, 2021)

Aquinus said:


> I'm not following. An Arduino Uno uses an ATMega328P. You're programming that regardless of the language you're using because that's the chip that drives it, so your statement confuses me. If you use that board, you're programming a ATMega chip, period. There is really no difference between using the chip standalone and using the board when it comes to how it's programmed and how it operates.


There's quite a distinction between programming using Arduino compiler/bootloader and programming barebones/using standard C lib. While the result may be same/similar, the former hide a lot of the finer details of setting up the uC and peripherals.


----------



## Ferrum Master (Sep 9, 2021)

ArdWar said:


> There's quite a distinction between programming using Arduino compiler/bootloader and programming barebones/using standard C lib. While the result may be same/similar, the former hide a lot of the finer details of setting up the uC and peripherals.



You can bypass any of the compiler stuff and put your code in assembly... it will produce the same result.

Sometimes it is even needed due to compiler bugs.


----------



## Aquinus (Sep 9, 2021)

ArdWar said:


> There's quite a distinction between programming using Arduino compiler/bootloader and programming barebones/using standard C lib. While the result may be same/similar, the former hide a lot of the finer details of setting up the uC and peripherals.


That's fine for someone who is learning how to do it. We're not talking about an experienced embedded engineer here. You also won't have much memory for your application if you load up the standard C lib. That takes up a lot of space for a controller like that. There are a lot of good reasons to write your application in assembly when your memory constraints are tight.


----------



## ArdWar (Sep 9, 2021)

Aquinus said:


> You also won't have much memory for your application if you load up the standard C lib.


Of course not the entire library (nor the full functionality of the ISO standard C either, I guess). You're not going to do any fancy math or string operation in a MCU like this.



Aquinus said:


> That's fine for someone who is learning how to do it. We're not talking about an experienced embedded engineer here.


I see this as two-stage process here. First is to learn how to program a simple MCU (which programming in Arduino helps), and second is to learn how a MCU work (which programming in barebone helps). I'm referring to the end goal of "building custom SoC" here.



Aquinus said:


> There are a lot of good reasons to write your application in assembly when your memory constraints are tight.


Programming in assembly of course come after you're familiar with the MCU/ISA. For most project, something like avr-gcc is just fine.


----------



## Maissilapsi (Sep 9, 2021)

I was looking model for arithmetic logic unit schematics and simplest I found was this (from Wikimedia Commons). It's from first complete ALU on one chip and used in first PC's, 4-bit *74181* chip has 75 gates packaged on 24 pins DIP. 

It's doable using loose flip-flops etc, "not a big deal" but it's some kind of deal at least...


----------

