I'm actually more interested in how your cpu works, than in trying to use it for anything
How does the memory map relate (if at all) to the /scoreboard player list output ?
It looks like some parts of the memory map are exposed to the /scoreboard interface, while others are not?
I'm particularly interested in the internal registers and boot / instruction fetch process.
Is it possible to single step the cpu ?
Mike
You cannot single step, unfortunately. The memory map is reasonably simple, and is explained in the included HTML file. Here's it in picture form:
The first 10 memory addresses are registers, the next 10 are non-volatile and the rest is is used by the program for whatever it wants. From address 21 and up, the compiler assigns global variables and arrays to these fixed addresses.
Starting from address 63 and below is local memory space. This is probably the most confusing part. The computer has a hardware accelerated local memory pointer system, which allows for recursive programming. Whenever a function is entered, the address is noted on the function stack (separate, dedicated memory, not in RAM) and the local variable pointer is incremented depending on how much local memory the new function needs. When a function is done and it needs to jump back to the calling function, the reverse happens: the address is recalled and the local memory pointer is decremented to what it was before the function was called, allowing the calling functions to continue using it's own local variables as usual.
It seems there is no scoreboard command to list players by objective, which would be VERY handy for this application.
The only work around I'm using at the moment is to parse out the log file from the scoreboard player.
Have you by any chance written a scoreboard mod that does that?
It doesn't look like MCP has been updated yet for mc 1.8, has it ?
A search through the forums has not turned up anything, maybe I'll make a request for it.
Mike
I'm not sure what you mean, but you can see what's going on in the RAM by activating the memory debug feature found in the control room. This will show you a scoreboard of all memory addresses and their respective values. Due to Minecraft limitations, if you use too many variables they won't all fit on the screen though. It's good enough for reverse engineering though, because you don't need to see all components in use at the same time.
If you really want to learn how this computer works, I recommend you learn the assembly language. That way you get complete control over the instructions the computer runs, and you can execute a single instruction if you wanted to so you can learn how just that specific thing is executed. Learning assembly helps greatly in understanding how the CPU works in general too, even without observing what's going on. To learn what assembly instructions do what, you could also use the compiler's built in generate assembly function, which lets you generate assembly from high level code, so you can learn how the compiler manages memory and branch flags to further learn how stuff works.
Prog #1 takes about 15 seconds on my "ancient" Pentium D / 2g / Win Xp for a cycle.
Prog #2 (chat output) takes about 30 secs
Pretty cool! If you want suggestions on where to go from here, here are some:
you probably noticed while you were testing your program that lights don't stay in the correct state for very long and the user gets to watch as the next number appears. This can be pretty confusing. Unfortunately, the indicators are designed to give a live status update to the user and are designed to work as fast as possible, not as many features as possible. Therefore, it doesn't feature buffering or setting multiple lamps at once, which is what you could use.
However, the GPU does have double buffering, meaning if you used the GPU and had white pixels represent 1's and black represent 0's you could get the instant changing effect. You could also display multiple binary numbers in a sort of table.
Secondly, your program's binary counting system is completely hardcoded. To be honest, this is required if you want to use the indicator lights like you did, as you can't set a specific light based on a variable (again, it wasn't designed for this purpose). If you switch to using the screen, perhaps you could make it calculate the binary numbers using division and modulus.
I tried to add a new instruction code (27), but it's getting the above error.
I changed -28 56 116 to a comand block :
scoreboard players test rombuffA system 27 27
Added two comand blocks at
-23 56 118 setblock -28 56 60 minecraft:redstone_block
-22 56 116 say code27
Ran this program :
24 21 0 loop DEB 21
5 1 21 CHA 1,21
27 0 0 *code27*
10 16 0 IFF buttonA,loop
1 0 0 END
The Core system error happens when the pipeline comes to a stop. The computer doesn't have a "real" clock, and relies on the instruction to tell the program loader when it's done executing so it can load the next instruction. If this doesn't happen, it means the instruction didn't run correctly for some reason. This can be because the instruction doesn't exist, it's bugged or there are too many redstone updates (e.g. drawing a rectangle the size of the entire screen) which causes the redstone update buffer to mess up and some things aren't updated correctly Sometimes it isn't even the instruction where it goes wrong, and it's the system in charge of loading the instruction that fails. Since it doesn't know where the problem is, and since it's in low level space, it's a core system error.
It determines if it's frozen by means of a simple counter, which is reset whenever a new instruction is loaded and constantly counts while the computer is on. Hence, it's a timeout problem.
If you're having a problem running your custom instruction, chances are your custom instruction wasn't implemented correctly. Check for the command found at the end of all other instructions, and execute it at least 3 (or was it 4?) ticks after the signal comes from the instruction decoder.
Unfortunately it seems like Redstone-circuitry / computers is of interest to only a minority of Minecraft users.
Unfortunately, dropbox doesn't provide download statistics and adf.ly can't show total clicks at this time, so I'm afraid I can't give you an accurate number.
[quote]You probably noticed while you were testing your program that lights don't stay in the correct state for very long and the user gets to watch as the next number appears. Heh, well my machine is so slow, the lights stay on for ~1 second for each state. I guess I could also put a "wait-for-buttonA" in between each state.
Not a super useful program, though it does demonstrate basic binary counting.
[quote]Check for the command found at the end of all other instructions, and execute it at least 3 (or was it 4?) ticks after the signal comes from the instruction decoder.
So it might be that it's actually "getting" the "end-of-instruction" ins too-quickly.
I've tried adding some repeaters before the "setblock -28 56 60 minecraft:redstone_block" (end-instr-block), and am getting "random" results.
Seems like it's either too long / too short a delay until that block is executed.
What's the best way to debug it? I've tried adding 'Say' commands attached to the end-instr-block (28-56-60), to see what's going on.
I found a couple of "oscilliscope" circuits, but they will probably add delays of their own.
What's the best way to debug it? I've tried adding 'Say' commands attached to the end-instr-block (28-56-60), to see what's going on.
That's pretty much how I debugged when I built it. Well, I used tellraw specifically, so I could output the state of the scoreboards at certain times to see if they contained the right value. The system is incredibly timing sensitive: wait 1 tick too long and the data in ROMBuffA/B/C will be cleared as the pipeline prepares the next instruction for execution. That, and many other registers change based on very specific timing parameters, so it's pretty important to not mess up the order.
The Fibonacci program included with the download doesn't work for me. Here's my version; It's smaller and faster too.
STO 1 0
DEB 0
:loop0
MT1 1 1
MT2 1 0
DEB 1
DEB 0
IFF 16 loop0
:exit2
That's pretty nice. Want me to include it on the OP? Crediting you of course. If you want to give the program a name, e.g. fastfib, let me know.
Also, I've finally started work on the "how it works" series once again! Due to popular demand, I'm explaining the compiler first, but don't worry, I'll get to how the computer works afterwards. Through recording this video, I found some serious issues with the compiler, some fixing bugs I didn't think were fixable because they were caused by black magic. I believe this is called rubber duck debugging, where you tell someone or something (rubber duck recommended) how your program works, and in the process you find things that don't work as they should. So I accidentally fixed some bugs!
I probably made some mistakes in this video, if you spot anything weird, please tell me! Also, when I say "a real compiler", this is either how I think a real one does, or how SOME real ones do it (others could of course use different strategies. a BASIC compiler works in a completely different way to a C++ compiler, for example, and most of this probably wouldn't apply to BASIC at all)
I guess I'll release a new version fixing the bugs later, but I want to first record my Commandore how it works videos so I can find bugs in that one as well.
The first time I uploaded a program into the computer, I forgot that I already typed a "t" into chat (but did not hit enter).
So now every time I upload, that "t" is added at the beginning of every line (eg. "t/scoreboard ...", making them chat messages instead of commands).
It even adds it when I switch to Notepad++.
I've tried exiting and re-opening Minecraft and the SDK, deleting and re-extracting the world and SDK, even rebooting my laptop. None of these has fixed the issue.
Versions:
Computer: 1.1.1
SDK: 1.1.2
Any ideas on how to resolve this would be much appreciated.
The first time I uploaded a program into the computer, I forgot that I already typed a "t" into chat (but did not hit enter).
So now every time I upload, that "t" is added at the beginning of every line (eg. "t/scoreboard ...", making them chat messages instead of commands).
It even adds it when I switch to Notepad++.
I've tried exiting and re-opening Minecraft and the SDK, deleting and re-extracting the world and SDK, even rebooting my laptop. None of these has fixed the issue.
Versions:
Computer: 1.1.1
SDK: 1.1.2
Any ideas on how to resolve this would be much appreciated.
I think what you might be doing is opening the chat menu manually before the upload starts, by pressing T. The uploader assumes the chat menu isn't open when it starts, so it presses T, which would of course type the letter T into chat.
If that is what you're doing wrong, when you click upload, unpause minecraft and don't press anything, leaving the chat menu closed. After the 3 seconds, it will start automatically opening the chat menu.
If that isn't what you are doing wrong, I might need more information, like if you changed/re-mapped the controls or are using OSX/Linux, what framerate you are getting in minecraft, and what version of Java you have.
I forgot that i had remapped the chat to ENTER. I've reset that to default (T) and it works fine.
Other MMOs I play have ENTER as the default for chat, so I didn't think of that the other day.
Thank you for your help.
PS: I was wondering if there was a way to get the remapped controls from outside the game (ie. your SDK program) and I found this:
In %userprofile%/AppData/Roaming/.minecraft/options.txt
when set to T:
This is easily the best computer i've seen in minecraft! Who knew that computers in minecraft also developed technological advances at an exponential rate (did that make sense?)
I'm very impressed, I thought bluestone on youtube was good but this may just out class it.
Going to stay updated, but go out and get some fresh air every now and then! Just saying! I subscribed on youtube.
I think what you might be doing is opening the chat menu manually before the upload starts, by pressing T. The uploader assumes the chat menu isn't open when it starts, so it presses T, which would of course type the letter T into chat.
If that is what you're doing wrong, when you click upload, unpause minecraft and don't press anything, leaving the chat menu closed. After the 3 seconds, it will start automatically opening the chat menu.
If that isn't what you are doing wrong, I might need more information, like if you changed/re-mapped the controls or are using OSX/Linux, what framerate you are getting in minecraft, and what version of Java you have.
I see your uplouder has come back to hunt you :).
Well its nice to see you and your successes. My computer project has been delayed, so yea. PS You remember me right?
1. I can't figure out how to use Paint. I assumed you had to use the D-Pad, but I can't seem to get the screen to change to anything except a white dot in the middle of the screen. EDIT: Looking at the tutorial video, I see that my render distance was much too low. I'll try it in 17 chunks and see how that works out.
2. The program installer doesn't work. I follow the instructions correctly, but the program enters the commands too fast, causing not all of the commands to work, since enter and T are being pressed too fast, causing a "Core system error" whenever I try to boot up the computer. I'm using Linux, but I can get a Windows result if you need one, since my computer has both installed.
I have been reading through that html file.
I'm actually more interested in how your cpu works, than in trying to use it for anything
How does the memory map relate (if at all) to the /scoreboard player list output ?
It looks like some parts of the memory map are exposed to the /scoreboard interface, while others are not?
I'm particularly interested in the internal registers and boot / instruction fetch process.
Is it possible to single step the cpu ?
Mike
It seems there is no scoreboard command to list players by objective, which would be VERY handy for this application.
The only work around I'm using at the moment is to parse out the log file from the scoreboard player.
Have you by any chance written a scoreboard mod that does that?
It doesn't look like MCP has been updated yet for mc 1.8, has it ?
A search through the forums has not turned up anything, maybe I'll make a request for it.
Mike
You cannot single step, unfortunately. The memory map is reasonably simple, and is explained in the included HTML file. Here's it in picture form:
The first 10 memory addresses are registers, the next 10 are non-volatile and the rest is is used by the program for whatever it wants. From address 21 and up, the compiler assigns global variables and arrays to these fixed addresses.
Starting from address 63 and below is local memory space. This is probably the most confusing part. The computer has a hardware accelerated local memory pointer system, which allows for recursive programming. Whenever a function is entered, the address is noted on the function stack (separate, dedicated memory, not in RAM) and the local variable pointer is incremented depending on how much local memory the new function needs. When a function is done and it needs to jump back to the calling function, the reverse happens: the address is recalled and the local memory pointer is decremented to what it was before the function was called, allowing the calling functions to continue using it's own local variables as usual.
I'm not sure what you mean, but you can see what's going on in the RAM by activating the memory debug feature found in the control room. This will show you a scoreboard of all memory addresses and their respective values. Due to Minecraft limitations, if you use too many variables they won't all fit on the screen though. It's good enough for reverse engineering though, because you don't need to see all components in use at the same time.
If you really want to learn how this computer works, I recommend you learn the assembly language. That way you get complete control over the instructions the computer runs, and you can execute a single instruction if you wanted to so you can learn how just that specific thing is executed. Learning assembly helps greatly in understanding how the CPU works in general too, even without observing what's going on. To learn what assembly instructions do what, you could also use the compiler's built in generate assembly function, which lets you generate assembly from high level code, so you can learn how the compiler manages memory and branch flags to further learn how stuff works.
{
until(buttonA)
{
lampOff(1);
lampOff(2);
lampOff(3);
lampOn(3); // 1
lampOff(3);
lampOn(2); // 2
lampOn(3); // 3
lampOff(3); // 4
lampOff(2);
lampOn(1);
lampOn(3); // 5
lampOff(3); // 6
lampOn(2);
lampOn(3); // 7
}
}
x
function main:
{
until(buttonA)
{
x=0;
print(x);
lampOff(1);
lampOff(2);
lampOff(3);
x++;
print(x);
lampOn(3); // 1
lampOff(3);
x++;
print(x);
lampOn(2); // 2
x++;
print(x);
lampOn(3); // 3
x++;
print(x);
lampOff(3); // 4
lampOff(2);
lampOn(1);
x++;
print(x);
lampOn(3); // 5
x++;
print(x);
lampOff(3); // 6
lampOn(2);
x++;
print(x);
lampOn(3); // 7
}
}
Prog #1 takes about 15 seconds on my "ancient" Pentium D / 2g / Win Xp for a cycle.
Prog #2 (chat output) takes about 30 secs
"Hey! He just pulled a dudearent006!"
Can we all work together to make this a thing? lol
Check out innovative redstone and command block concepts with The Redstone Scientist!
I tried to add a new instruction code (27), but it's getting the above error.
I changed -28 56 116 to a comand block :
scoreboard players test rombuffA system 27 27
Added two comand blocks at
-23 56 118 setblock -28 56 60 minecraft:redstone_block
-22 56 116 say code27
Ran this program :
24 21 0 loop DEB 21
5 1 21 CHA 1,21
27 0 0 *code27*
10 16 0 IFF buttonA,loop
1 0 0 END
*** EDIT **
Hmm, it seems it depends on what the program is.
This runs ok:
adr A B C
---- ------
0 ### 27 0 0
1 ### 27 0 0
2 ### 27 0 0
3 ### 1 0 0 0 END
>---- ------
>0 27 0 0 0
>1 27 0 0 0
>2 27 0 0 0
>3 1 0 0 0 END
Oops.
s.b.
This runs ok:
adr A B C
---- ------
0 ### 27 0 0
1 ### 27 0 0
2 ### 27 0 0
3 ### 1 0 0 END
Unfortunately it seems like Redstone-circuitry / computers is of interest to only a minority of Minecraft users.
Dude. how many downloads have there been ?
Pretty cool! If you want suggestions on where to go from here, here are some:
you probably noticed while you were testing your program that lights don't stay in the correct state for very long and the user gets to watch as the next number appears. This can be pretty confusing. Unfortunately, the indicators are designed to give a live status update to the user and are designed to work as fast as possible, not as many features as possible. Therefore, it doesn't feature buffering or setting multiple lamps at once, which is what you could use.
However, the GPU does have double buffering, meaning if you used the GPU and had white pixels represent 1's and black represent 0's you could get the instant changing effect. You could also display multiple binary numbers in a sort of table.
Secondly, your program's binary counting system is completely hardcoded. To be honest, this is required if you want to use the indicator lights like you did, as you can't set a specific light based on a variable (again, it wasn't designed for this purpose). If you switch to using the screen, perhaps you could make it calculate the binary numbers using division and modulus.
The Core system error happens when the pipeline comes to a stop. The computer doesn't have a "real" clock, and relies on the instruction to tell the program loader when it's done executing so it can load the next instruction. If this doesn't happen, it means the instruction didn't run correctly for some reason. This can be because the instruction doesn't exist, it's bugged or there are too many redstone updates (e.g. drawing a rectangle the size of the entire screen) which causes the redstone update buffer to mess up and some things aren't updated correctly Sometimes it isn't even the instruction where it goes wrong, and it's the system in charge of loading the instruction that fails. Since it doesn't know where the problem is, and since it's in low level space, it's a core system error.
It determines if it's frozen by means of a simple counter, which is reset whenever a new instruction is loaded and constantly counts while the computer is on. Hence, it's a timeout problem.
If you're having a problem running your custom instruction, chances are your custom instruction wasn't implemented correctly. Check for the command found at the end of all other instructions, and execute it at least 3 (or was it 4?) ticks after the signal comes from the instruction decoder.
Unfortunately, dropbox doesn't provide download statistics and adf.ly can't show total clicks at this time, so I'm afraid I can't give you an accurate number.
Not a super useful program, though it does demonstrate basic binary counting.
[quote]Check for the command found at the end of all other instructions, and execute it at least 3 (or was it 4?) ticks after the signal comes from the instruction decoder.
So it might be that it's actually "getting" the "end-of-instruction" ins too-quickly.
I've tried adding some repeaters before the "setblock -28 56 60 minecraft:redstone_block" (end-instr-block), and am getting "random" results.
Seems like it's either too long / too short a delay until that block is executed.
What's the best way to debug it? I've tried adding 'Say' commands attached to the end-instr-block (28-56-60), to see what's going on.
I found a couple of "oscilliscope" circuits, but they will probably add delays of their own.
Mike
https://www.youtube....EN8PxT5KYO4X0Ow
That's pretty much how I debugged when I built it. Well, I used tellraw specifically, so I could output the state of the scoreboards at certain times to see if they contained the right value. The system is incredibly timing sensitive: wait 1 tick too long and the data in ROMBuffA/B/C will be cleared as the pipeline prepares the next instruction for execution. That, and many other registers change based on very specific timing parameters, so it's pretty important to not mess up the order.
That's pretty nice. Want me to include it on the OP? Crediting you of course. If you want to give the program a name, e.g. fastfib, let me know.
Also, I've finally started work on the "how it works" series once again! Due to popular demand, I'm explaining the compiler first, but don't worry, I'll get to how the computer works afterwards. Through recording this video, I found some serious issues with the compiler, some fixing bugs I didn't think were fixable because they were caused by black magic. I believe this is called rubber duck debugging, where you tell someone or something (rubber duck recommended) how your program works, and in the process you find things that don't work as they should. So I accidentally fixed some bugs!
I probably made some mistakes in this video, if you spot anything weird, please tell me! Also, when I say "a real compiler", this is either how I think a real one does, or how SOME real ones do it (others could of course use different strategies. a BASIC compiler works in a completely different way to a C++ compiler, for example, and most of this probably wouldn't apply to BASIC at all)
I guess I'll release a new version fixing the bugs later, but I want to first record my Commandore how it works videos so I can find bugs in that one as well.
The first time I uploaded a program into the computer, I forgot that I already typed a "t" into chat (but did not hit enter).
So now every time I upload, that "t" is added at the beginning of every line (eg. "t/scoreboard ...", making them chat messages instead of commands).
It even adds it when I switch to Notepad++.
I've tried exiting and re-opening Minecraft and the SDK, deleting and re-extracting the world and SDK, even rebooting my laptop. None of these has fixed the issue.
Versions:
Computer: 1.1.1
SDK: 1.1.2
Any ideas on how to resolve this would be much appreciated.
I think what you might be doing is opening the chat menu manually before the upload starts, by pressing T. The uploader assumes the chat menu isn't open when it starts, so it presses T, which would of course type the letter T into chat.
If that is what you're doing wrong, when you click upload, unpause minecraft and don't press anything, leaving the chat menu closed. After the 3 seconds, it will start automatically opening the chat menu.
If that isn't what you are doing wrong, I might need more information, like if you changed/re-mapped the controls or are using OSX/Linux, what framerate you are getting in minecraft, and what version of Java you have.
Other MMOs I play have ENTER as the default for chat, so I didn't think of that the other day.
Thank you for your help.
PS: I was wondering if there was a way to get the remapped controls from outside the game (ie. your SDK program) and I found this:
In %userprofile%/AppData/Roaming/.minecraft/options.txt
when set to T:
when set to ENTER:
I'm very impressed, I thought bluestone on youtube was good but this may just out class it.
Going to stay updated, but go out and get some fresh air every now and then! Just saying! I subscribed on youtube.
I see your uplouder has come back to hunt you :).
Well its nice to see you and your successes. My computer project has been delayed, so yea. PS You remember me right?
THE MICRO$OFT APOCALYPSE IS ON!!!
32 bit redstone computer with 64*64 pixel 16 color gpu:
http://www.minecraftforum.net/forums/minecraft-discussion/redstone-discussion-and/2116999-computer-command-block-computer-now-running-with
(giant banner removed out of modesty).
GJ
1. I can't figure out how to use Paint. I assumed you had to use the D-Pad, but I can't seem to get the screen to change to anything except a white dot in the middle of the screen. EDIT: Looking at the tutorial video, I see that my render distance was much too low. I'll try it in 17 chunks and see how that works out.
2. The program installer doesn't work. I follow the instructions correctly, but the program enters the commands too fast, causing not all of the commands to work, since enter and T are being pressed too fast, causing a "Core system error" whenever I try to boot up the computer. I'm using Linux, but I can get a Windows result if you need one, since my computer has both installed.
If I helped in any way, feel free to drop me an Internet:
Or some Blue XP:
A test to see what number is most thought of when a 1-10 choice is given: strawpoll.me/4012187
Don't think about it, just click on the first one that comes to you!