Skip to content
Sign upLog in
← Back to Community

TinyComputer, An 8-bit computer with memory segmentation

Profile icon
CSharpIsGud

This is an 8-bit computer capable of addressing up to 4080 bytes of RAM (Limited address bus to 8 bits instead of 16 bits to make segmentation more useful)

Also comes with its own assembler!

This isn't really a full blown computer yet, but im thinking of emulating some hardware for it as well

UPDATES:
Removed segmentation and replaced it with a form of paging (Even more memory can be addressed with it)
Added a bios (Loads whats in loader.asm into page 2 and executes it, for now it just writes No bootable device found. but doesn't actually check for bootable devices

Voters
Profile icon
llamaking136
Profile icon
programmeruser
Profile icon
z80
Profile icon
LoganSpong
Profile icon
RohilPatel
Profile icon
TheForArkLD
Profile icon
CodeSalvageON
Profile icon
rediar
Profile icon
daysant1144
Profile icon
BenjaminOBrien
Comments
hotnewtop
Profile icon
SqueezyS

@CSharpIsGud
What about adding a few game commands
i'll be glad to make some

Profile icon
CSharpIsGud

@SqueezyS
Theoretically all it needs are some input methods and you could make a game.

But it would be really difficult since what you use to program it is very similar to just ordinary assembly

Profile icon
conspicous

@CSharpIsGud
MS Basic? Pascal?(nobody ever uses that anymore)

list of assembly instructions --> https://en.wikipedia.org/wiki/X86_instruction_listings#Original_8086/8088_instructions

Profile icon
CyanideREPL

Very Cool and good.

Profile icon
LoganSpong

this is amazing! why does it not have more upvotes?

Profile icon
TheForArkLD

Running 8Bit Computer in 64Bit Computer.

Profile icon
nN34398Ff

Uh, is it supposed to do something?

Profile icon
CSharpIsGud

@nN34398Ff
This was like practice for an emulation project.
It wont do anything special unless you program it to do so.
However it is pretty broken because I couldn't get jump instructions to work properly

Profile icon
pyelias

A few questions:

  1. Is it intentional that you can overflow registers to access more RAM without segmentation? Like here.
  2. Why do all the [REGISTER] mov instructions take a segment except for 0x14?
  3. Is there any easy way to compare numbers (less than, greater than, etc)? If not, can you add one?
  4. Why are pages only 255 bytes, instead of 256?
Profile icon
CSharpIsGud

@pyelias

  1. Not really, but I never checked for any kind of overflows which I probably will in the future.
  2. Oops
  3. Ill try adding a jump if less than and jump if greater than instructions
  4. I should fix that too
Profile icon
idonteatcats

No Bootable Devices Found.

Profile icon
CSharpIsGud

@idonteatcats
look in loader.asm, its a placeholder

Profile icon
JeremyIrwin

all it says is 'no bootable device found'

Profile icon
CSharpIsGud

@JeremyIrwin
Fork it and change whats in loader.asm, its a placeholder

Profile icon
conspicous

@CSharpIsGud
you can't i've tried changing the placeholder and that did not work.

Profile icon
CSharpIsGud

@Lethdev2019
It lets me change it fine

Profile icon
conspicous

could you impove the docs like making multiple mov 0x1:0 "print statements"

Profile icon
[deleted]

Nice! You should implement an assembler for it, though. Most computers, rather than running assembly text, convert the assembly to an executable and run that.

Profile icon
CSharpIsGud

@sugarfi
It converts it to opcodes first but I was too lazy to read them back from the file so I just made it directly get the bytes after the custom assembler is done

Profile icon
conspicous

Wow, with this, you could port ms-dos over
(i know the image loc for it, it's in copy.sh)

Profile icon
CSharpIsGud

@Lethdev2019
Oh, it doesn't run actual assembly. I made up the instruction set myself (Implementing an actual instruction set would take a while, each instruction usually has many different opcodes for different scenarios. For example mov eax, 1 and mov [eax], 1 are totally different opcodes)

Profile icon
conspicous

@CSharpIsGud

what about ADD, STO, MOD, DIV

Profile icon
conspicous

@CSharpIsGud
could you add a statement of what it's doing

Profile icon
conspicous

@CSharpIsGud
because i am interested, and i can code python pretty well ((3rd/4th) year), will I be able to help?

Profile icon
CSharpIsGud

@Lethdev2019
Its a fairly overcomplicated project, if you can make sense of the mess of code you should be able to help, however most of my recent time spent on this project has been working around problems and limitations.

Profile icon
CSharpIsGud

@Lethdev2019
add sub mul and div in mine simply uses a and b registers and puts the result back in a, I need to add more registers because with only 2 it takes more instructions to do tasks

Profile icon
conspicous

@CSharpIsGud
like instructions on the loader/boot sector

Profile icon
conspicous

@CSharpIsGud
try the von neumann architecture.

Profile icon
conspicous

@CSharpIsGud
Sure!
(also you forgot mod (% in python) which is the remainder of a divided by b.

Profile icon
CSharpIsGud

@Lethdev2019
yeah, right now im working on a small language compiler so I don't have to confuse myself so much with doing all the instructions directly

Profile icon
conspicous

@CSharpIsGud
if you allow me to help, will you please add me (not via link, because then someone might join and clear the project) to the multiplayer?

Profile icon
ripu

Great job... but whats the point of some of the classes like MemoryRange or MMU or RAM

Profile icon
CSharpIsGud

@ripu
I didn't want it to just be a cpu. Im working on making a full computer out of it. (Im working on a bios right now!)
So I tried to stick as close as possible to how real hardware does it.
MMU for memory management etc
I just used memoryrange as a representation of ranges like 0x0-0xFF (0-255, the maximum addressing of a single page)
in the next update im going to be removing segmentation and replacing it with some weird form of paging instead

Profile icon
ripu

@CSharpIsGud
ok that makes sense

Profile icon
conspicous

i can give you a log of my c drive from my antivirus of mems it scanned (or 'blocks'/'sectors'/'clusters'.)

noticed they all tend to start with 0x0xxxxxx


@CSharpIsGud

Profile icon
CSharpIsGud

@Lethdev2019
Yeah its pretty much like a convention for hexadecimal numbers.

Profile icon
conspicous

@CSharpIsGud

please hold on! issues with files.stringy.software, i'll result to dropbox.

Profile icon
conspicous
Profile icon
RobertFurr

beef it up to 64 bits and we could really do something! XD

Profile icon
CSharpIsGud

@RobertFurr
All thats really needed is for me to add some more registers so you can do things in less instructions.
While I kept addressing at 8 bits you can still address more than 255 bytes if you turn paging on

Profile icon
Foster_Bryant

Nice. What is the computer module?

Profile icon
ronitjunicode

it just prints hello world help i cant figure out how it it is a computer

Profile icon
CSharpIsGud

@ronitjunicode
Hello world is the example program, look in cpu.asm
The output is a memory mapping from 0x80-0XA0

there is a bios now so what is run is now in loader.asm

Profile icon
Navinor

image

great project btw
I need to level up my own os now XD

Profile icon
tgmella

@Warhawk947
What OS?

Profile icon
Navinor
Profile icon
CSharpIsGud

@tgmella
But here is a real OS written in assembly and C Note that you have to download it and use an emulator like qemu or bochs to run it Not anymore

Profile icon
Navinor

@CSharpIsGud
:O (it doesn't work tho)

Profile icon
CSharpIsGud

@Warhawk947
It does, its a REAL OS, it cant be run on repl.it it can now

Profile icon
JacobMacLeod

This is cool... incredible you can do this kind of thing just inside a web browser!