Share your repls and programming experiences

← Back to all posts
TinyComputer, An 8-bit computer with memory segmentation
h
CSharpIsGud (207)

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

Commentshotnewtop
Altarias (46)

Very Cool and good.

nN34398Ff (77)

Uh, is it supposed to do something?

CSharpIsGud (207)

@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

pyelias (1219)

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?

CSharpIsGud (207)

@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

idonteatcats (5)

No Bootable Devices Found.

CSharpIsGud (207)

@idonteatcats look in loader.asm, its a placeholder

JeremyIrwin (33)

all it says is 'no bootable device found'

CSharpIsGud (207)

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

Lethdev2019 (28)

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

Lethdev2019 (28)

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

sugarfi (267)

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.

CSharpIsGud (207)

@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

Lethdev2019 (28)

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

CSharpIsGud (207)

@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)

Lethdev2019 (28)

@CSharpIsGud
what about ADD, STO, MOD, DIV

Lethdev2019 (28)

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

Lethdev2019 (28)

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

CSharpIsGud (207)

@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.

CSharpIsGud (207)

@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

Lethdev2019 (28)

@CSharpIsGud like instructions on the loader/boot sector

Lethdev2019 (28)

@CSharpIsGud try the von neumann architecture.

Lethdev2019 (28)

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

CSharpIsGud (207)

@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

Lethdev2019 (28)

@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?

ripu (3)

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

CSharpIsGud (207)

@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

Lethdev2019 (28)

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

CSharpIsGud (207)

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

Lethdev2019 (28)

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

SqueezyS (0)

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

CSharpIsGud (207)

@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

RobertFurr (42)

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

CSharpIsGud (207)

@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

Foster_Bryant (97)

Nice. What is the computer module?

ronitjunicode (3)

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

CSharpIsGud (207)

@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

Warhawk947 (340)

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

CSharpIsGud (207)

@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

CSharpIsGud (207)

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

JacobMacLeod (11)

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