Designing a "calculator" "kernel"

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
avcado
Member
Member
Posts: 27
Joined: Wed Jan 20, 2021 11:32 am
Contact:

Designing a "calculator" "kernel"

Post by avcado »

Some notable calculator models, like the TI-84 Plus and other models like it, according to Texas Instruments, run their own operating system. Additionally, there is https://github.com/numworks/epsilon, which is a C++ operating system for a calculator.

My questions are:

1. What architecture should I target? ARM or x86?

I know that ARM doesn't have a DIV instruction (but can be done with shifts, just like x86)

2. Is there anything else one should know before taking on a feat like this?
thewrongchristian
Member
Member
Posts: 422
Joined: Tue Apr 03, 2018 2:44 am

Re: Designing a "calculator" "kernel"

Post by thewrongchristian »

avcado wrote: Mon Aug 12, 2024 4:16 pm Some notable calculator models, like the TI-84 Plus and other models like it, according to Texas Instruments, run their own operating system. Additionally, there is https://github.com/numworks/epsilon, which is a C++ operating system for a calculator.

My questions are:

1. What architecture should I target? ARM or x86?

I know that ARM doesn't have a DIV instruction (but can be done with shifts, just like x86)

2. Is there anything else one should know before taking on a feat like this?
I don't understand.

Are you intending to write a calculator OS that will run on general purpose hardware , or an OS for a specific type of calculator?

If the former, then you can target whatever architecture makes sense given the platforms you intend to support.

QEMU can support both, as well as others such as RISC-V or MIPS. You're more likely to get help with x86 here, as more people are familiar with that.

If you're targetting specific hardware, then the CPU will depend on what that hardware uses. The TI-84 Plus uses z80 CPUs. PCs use x86. Raspberry Pi uses ARM.

If you intend to use C or C++ or RUST or another high level language, then that language will do the heavy work of implementing multiplication and division in the runtime. Also, as a calculator, you may want to use an arbitrary precision math library (such as GMP) anyway.
avcado
Member
Member
Posts: 27
Joined: Wed Jan 20, 2021 11:32 am
Contact:

Re: Designing a "calculator" "kernel"

Post by avcado »

thewrongchristian wrote: Mon Aug 12, 2024 5:50 pm I don't understand.

Are you intending to write a calculator OS that will run on general purpose hardware , or an OS for a specific type of calculator?

If the former, then you can target whatever architecture makes sense given the platforms you intend to support.

QEMU can support both, as well as others such as RISC-V or MIPS. You're more likely to get help with x86 here, as more people are familiar with that.

If you're targetting specific hardware, then the CPU will depend on what that hardware uses. The TI-84 Plus uses z80 CPUs. PCs use x86. Raspberry Pi uses ARM.

If you intend to use C or C++ or RUST or another high level language, then that language will do the heavy work of implementing multiplication and division in the runtime. Also, as a calculator, you may want to use an arbitrary precision math library (such as GMP) anyway.
I see. What I'm trying to do is write a calculator OS that runs on general purpose hardware. I get your point when you say I can use any architecture I want. Ideally I'd use some high level language like C/C++. Don't know which CPU I'd like to target, but x86 seems like a good contender.

I'll have to look into different architectures and see which one is the best for me -- I did not know the TI-84s used z80s! Always thought it was some variation of ARM. Thanks for the advice:) :D
StudlyCaps
Member
Member
Posts: 232
Joined: Mon Jul 25, 2016 6:54 pm
Location: Adelaide, Australia

Re: Designing a "calculator" "kernel"

Post by StudlyCaps »

Any reason you're writing a calculator OS and not just a calculator application? Even if you wanted a dedicated "calculator" device you could always run an existing kernel with the calculator functionality deployed as a custom shell or desktop environment.
Lots of embedded devices run a Linux kernel. You'd save a massive amount of time, I suspect the only reason TI has a custom OS is to make the most of their extremely limited hardware and it doesn't seem like you're targeting a platform like theirs.
avcado
Member
Member
Posts: 27
Joined: Wed Jan 20, 2021 11:32 am
Contact:

Re: Designing a "calculator" "kernel"

Post by avcado »

StudlyCaps wrote: Mon Aug 12, 2024 10:04 pm Any reason you're writing a calculator OS and not just a calculator application? Even if you wanted a dedicated "calculator" device you could always run an existing kernel with the calculator functionality deployed as a custom shell or desktop environment.
Lots of embedded devices run a Linux kernel. You'd save a massive amount of time, I suspect the only reason TI has a custom OS is to make the most of their extremely limited hardware and it doesn't seem like you're targeting a platform like theirs.
I know that it's kind of a waste of time to make a calculator OS opposed to a calculator application. To be honest, I feel like it'll be fun. I know it's not going to be as "good" as something like a TI operating system or the Epsilon operating system I mentioned earlier, but I feel like it'll be a fun endeavor to take on, if that makes sense.
StudlyCaps
Member
Member
Posts: 232
Joined: Mon Jul 25, 2016 6:54 pm
Location: Adelaide, Australia

Re: Designing a "calculator" "kernel"

Post by StudlyCaps »

avcado wrote: Mon Aug 12, 2024 10:50 pm I know that it's kind of a waste of time to make a calculator OS opposed to a calculator application. To be honest, I feel like it'll be fun. I know it's not going to be as "good" as something like a TI operating system or the Epsilon operating system I mentioned earlier, but I feel like it'll be a fun endeavor to take on, if that makes sense.
Totally understand, I very much agree that if a project seems fun it's worth it on that basis alone.
Just wanted to make sure you had considered your other options.
ajxs
Member
Member
Posts: 27
Joined: Mon Jun 13, 2016 2:25 am
Libera.chat IRC: ajxs
Location: Sydney

Re: Designing a "calculator" "kernel"

Post by ajxs »

I agree that if it seems like a fun idea, then it's worth exploring!

Have you explored embedded software development? Writing a calculator OS sounds like a perfect project for a microcontroller. You could start with developing your OS on a simple SBC (Single Board Computer) like an Arduino, and eventually move on to building your own hardware system. Writing bare-metal code for 8-bit architectures like avr, 8051, z80, etc is way more straightforward than low-level programming for a general purpose architecture like x86 or aarch64. I personally love embedded development, and 8-bit programming. I think it can be super rewarding. It has a lot of the same fun challenges as modern osdev, but without a lot of the difficulty.
thewrongchristian
Member
Member
Posts: 422
Joined: Tue Apr 03, 2018 2:44 am

Re: Designing a "calculator" "kernel"

Post by thewrongchristian »

avcado wrote: Mon Aug 12, 2024 10:50 pm I know that it's kind of a waste of time to make a calculator OS opposed to a calculator application. To be honest, I feel like it'll be fun. I know it's not going to be as "good" as something like a TI operating system or the Epsilon operating system I mentioned earlier, but I feel like it'll be a fun endeavor to take on, if that makes sense.
My OS project is primarily a POSIX like kernel for x86 hardware.

Totally redundent, not at all close to matching the functionality of something like Linux, though perhaps lighter weight, and like 99% of the projects on here, probably will only ever be used by a handful of people at most.

And it is fantastic fun, as well as mentally engaging.

That's why we do it! I've never had to justify why I do it. When people ask, it's usually (certainly in my case) to get more context to help answer questions.

And you never know, you might come up with something that is indeed as "good" as existing Calculator OS. Fresh eyes, new perspectives.
avcado
Member
Member
Posts: 27
Joined: Wed Jan 20, 2021 11:32 am
Contact:

Re: Designing a "calculator" "kernel"

Post by avcado »

ajxs wrote: Tue Aug 13, 2024 7:05 pm I agree that if it seems like a fun idea, then it's worth exploring!

Have you explored embedded software development? Writing a calculator OS sounds like a perfect project for a microcontroller. You could start with developing your OS on a simple SBC (Single Board Computer) like an Arduino, and eventually move on to building your own hardware system. Writing bare-metal code for 8-bit architectures like avr, 8051, z80, etc is way more straightforward than low-level programming for a general purpose architecture like x86 or aarch64. I personally love embedded development, and 8-bit programming. I think it can be super rewarding. It has a lot of the same fun challenges as modern osdev, but without a lot of the difficulty.
I've love to actually do, y'know OSDev on a real non-x86 system. The only thing I actually have that comes close to that is a Raspberry Pi 3b from years ago. I'll be honest -- I'm really used to x86 (because that's all I've been coding for). I'd like to learn how to code stuff for ARM/AArch64 but I know it'll take a long time to be able to understand how ARM/AArch64 works. :roll:
ajxs
Member
Member
Posts: 27
Joined: Mon Jun 13, 2016 2:25 am
Libera.chat IRC: ajxs
Location: Sydney

Re: Designing a "calculator" "kernel"

Post by ajxs »

avcado wrote: Wed Aug 14, 2024 2:52 pm I've love to actually do, y'know OSDev on a real non-x86 system. The only thing I actually have that comes close to that is a Raspberry Pi 3b from years ago. I'll be honest -- I'm really used to x86 (because that's all I've been coding for). I'd like to learn how to code stuff for ARM/AArch64 but I know it'll take a long time to be able to understand how ARM/AArch64 works. :roll:
I think you should look at simple 8-bit architectures like AVR, 8051, or z80. Unlike more complicated architectures designed for general purpose computing, these architectures have simple integrated peripherals, a flat memory model, and require very little boilerplate to initialise. You could definitely accomplish building your own actual physical calculator on one of these systems. Up until quite recently, real calculators were built on architectures like this.
Also, I think that other modern architectures like RISC-V are much simpler than x86_64. The official RISC-V documentation might not be as good as Intel's, but there's much less that you need to understand to develop a simple kernel.
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Designing a "calculator" "kernel"

Post by eekee »

I recall a little 8086 hobby box was released in 2018. Whether it's still for sale after the chaos of recent years, I don't know. It was based on an 8086-compatible SoC, had some ports including VGA, and a breadboard on top. At the same time, a range of wall mount panels were released with the same SoC and a touchscreen. These were intended for industry where DOS is still used as an embedded OS. I guess I'm saying you can have the benefits of embedded hardware with the familiar 8086 platform. :) I'm sorry I can't find the names of these products now, nor the SoC's part code other than that it begins with V.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
thewrongchristian
Member
Member
Posts: 422
Joined: Tue Apr 03, 2018 2:44 am

Re: Designing a "calculator" "kernel"

Post by thewrongchristian »

eekee wrote: Sun Aug 18, 2024 9:10 am I recall a little 8086 hobby box was released in 2018. Whether it's still for sale after the chaos of recent years, I don't know. It was based on an 8086-compatible SoC, had some ports including VGA, and a breadboard on top. At the same time, a range of wall mount panels were released with the same SoC and a touchscreen. These were intended for industry where DOS is still used as an embedded OS. I guess I'm saying you can have the benefits of embedded hardware with the familiar 8086 platform. :) I'm sorry I can't find the names of these products now, nor the SoC's part code other than that it begins with V.
One of these - Vi Microsystem?

https://www.vimicrosystems.com/assets/p ... oller&pr=3

https://www.youtube.com/watch?v=GZibA34SU0c
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Designing a "calculator" "kernel"

Post by eekee »

Wow! That's even closer to traditional calculator hardware, and still 8086. :)
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Post Reply