Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
Ive finally finished a working version of a switch computer in EE
This is a fully working, turing complete computer (apart from it having very limited amounts of memory), that can run simple programs in a simple form of machine code.
Currently it doesnt have a good way to input or output things, or create your own code, so its just running a simple prime number program, that outputs prime numbers in binary (in switches to the left of where it stops)
(Dont press any arrow keys while it is running, otherwise it breaks)
Specs:
672 bytes of ROM (256 lines of code, 21 bits each)
64 bytes of RAM
16 registers (1 byte each)
A somewhere between 0.03 and 0.1 Hz processor (depending on what the command is)
Assembly code for the program:
00. MOV #1 -> R1
01. GOTO New Prime
Output Prime
02. HALT
New Prime
03. ADD R1 #1 -> R1
04. LSR R1 -> R2
05. ADD R2 #1 -> R2
Check Divisible
06. SUB R2 #1 -> R2
07. CMP R2 #1
08. BEQ Output Prime
09. MOV R1 -> R3
Subtract
10. SUB R3 R2 -> R3
11. BEQ New Prime
12. BLT Check Divisible
13. GOTO Subtract
Notes:
R1 = Number to test
R2 = Divisor
R3 = Number
# = literal number (rather than register)
MOV R1 -> R2 = move value in R1 to R2
GOTO place = go to place in code
HALT = stop program (until player presses space to continue)
ADD R1 R2 -> R3 = add R1 and R2 and store in R3
SUB R1 R2 -> R3 = subtract R2 from R1 and store in R3
CMP R1 R2 = compare R1 and R2 (result used later) (SUB can be used instead)
BEQ place = go to place if ^ were equal
BLT place = go to place if R1 was less than R2 were equal
^ I have tested this up to 11, and all primes were outputted correctly, it does take a while to calculate them though
This was mostly built using my bot (FastBuilder), so it didnt take 50+ hours to build the ROM and RAM, but other than building it, no bot or anything is needed
P.S. this is a proof of concept, not something I expect to actually be useful for anything
Offline
destroyer123 making computers in EE and whenever i try to make a tree i get angry and have to do deep breathing exercises
Offline
Once we get infinity-sized worlds we're going to have people recreating an actual computer in-game.
we need more switch IDs too. then we can actually let people make their own programs
suddenly random sig change
Offline
N1KF wrote:Once we get infinity-sized worlds we're going to have people recreating an actual computer in-game.
we need more switch IDs too. then we can actually let people make their own programs
That's definitely not what Everybody Edits was meant for, but the more possibilities, the better!
Offline
N1KF wrote:Once we get infinity-sized worlds we're going to have people recreating an actual computer in-game.
we need more switch IDs too. then we can actually let people make their own programs
We really need this
Offline
Just added a 7 segment display, and some code to display numbers on it (to the far right of the program memory), its very slow, but if you dont know binary, and nobody is on who does, you will need it to see what it outputs. (There is a switch to toggle it off for those who do know binary, and just want to quickly test the main program)
Just thought I should add a quick explanation of how it works and the assembly pseudo-code:
display:
MOV #0 -> r11
MOV #10 -> r13
digit:
MOV r12 -> r14
ADD r0 #1 -> r15
GOTO mod
LSL r14 -> r14
ADD r0 r14 -> r0
MOV #119 -> r15 // 0 (0)1110111
GOTO endLookup
MOV #18 -> r15 // 1 (0)0010010
GOTO endLookup
MOV #93 -> r15 // 2 (0)1101011
GOTO endLookup
MOV #91 -> r15 // 3 (0)1011011
GOTO endLookup
MOV #58 -> r15 // 4 (0)0111010
GOTO endLookup
MOV #107 -> r15 // 5 (0)1011101
GOTO endLookup
MOV #111 -> r15 // 6 (0)1101111
GOTO endLookup
MOV #82 -> r15 // 7 (0)1010010
GOTO endLookup
MOV #127 -> r15 // 8 (0)1111111
GOTO endLookup
MOV #123 -> r15 // 9 (0)1111011
endLookup:
SAVE r15 r11
MOV r12 -> r14
ADD r0 #1 -> r15
GOTO divide
CMP r11 #2
BNLT r10
ADD r11 #1 -> r11
GOTO digit
divide:
MOV #0 -> r12
next:
SUB r14 r13 -> r14
BGT r15
ADD r12 #1 -> r12
GOTO next
mod:
SUB r14 r13 -> r14
BNGT mod
ADD r14 r13 -> r14
GOTO r15
This repeatedly divides by 10, and finds the remainder, and then enters a lookup table, which contains all of the 7 segment digits, which are then written to a location in memory, which contains the switches for the display. This way no changes to the hardware are needed, other than placing some switches next to the halt so you can see them.
Offline
Pages: 1
[ Started around 1732959814.5429 - Generated in 0.081 seconds, 12 queries executed - Memory usage: 1.48 MiB (Peak: 1.62 MiB) ]