Hey, heres my pong code, of course its half-pseudo because i dont know how the screen and simple inputs behave...
And please tell me how conditional branching works, so I can edit the pseudo-ifs.. thank you
The total amount of bytes used by this prog is: 127
Please tell me what you think of it, and point out any mistakes, I'm sure there are some... Take your time to understand the code ^^
Anyways its like:
-Set initial variables(like balls pos etc.)
-Load and show initial screen
-"repeat"
-Load values
-"Delete screen"
-Calculate new values
-Store values
-"Set screen"
-Show screen (really update the screen)
-"until 0=1" meaning never
Things still missing are:
-The if-code things
-The collision with the player
-The user input has to get an update function
-Winning^^ and points...
Wow, thats it, wrote this in notepad Oo I think about making a !PascalLikeLanguage!-!ThisLanguage! converter to simplify the coding process...
--BopMeExtreme
PS: Phew that took some time^^
oh god.. please include some assembly WORDS. my eyes died staring at all dec numbers.
i dunno how laz is doing the screen exactly, but it'll probably be easier to edit a couple of bytes in memory that are directly tied to the screen instead of sending CPU commands that interact with the screen, so no need to make new opcodes just for the screen.
with that note.. i'm guessing the input will be DMA as well..
oh god.. please include some assembly WORDS. my eyes died staring at all dec numbers.
This is code -.- It's meant to be written in numbers -.-
The "assembly words" you're looking for are the comments -.-
code is in words.. numbers is what happens after it gets interpreted and the CPU reads it..
i'm talking assembly words, so i don't have to look at the chart of opcodes to figure out what 04 or 07 is.
that and no line numbers/memory locations either..
edit: yes i'm lazy... :sad.gif: sorry. but it'll help eliminate error and such if you give us the asm instead of us deinterpreting it
edit2: in your beginning comments you have
" //with "08 constant" you can"
and it just cuts off.
edit3: looks like "08" is to set which pixel is being.. pointed at?
I r confuse.. after each "08" you store the value of A to memory locations (that overwrite already executed code, intentional to save space?) but the value of A doesn't change (unless "08" changes that)
Quote from BopMeExtreme »
Quote from otakudjr »
i dunno how laz is doing the screen exactly, but it'll probably be easier to edit a couple of bytes in memory that are directly tied to the screen instead of sending CPU commands that interact with the screen, so no need to make new opcodes just for the screen.
Possible. That's the risk i took and he doesn't have to alter his screen to fit, of course.
I will alter my prog as soon as he has finished the screen and all necessary components.
One question remains, how do conditional branches work?
they're just like ifs, cept you can't pick what the condition is, only where to take the program after the condition is met.
so BranchifZero is like
if(A == 0) then goto 'memory address'
branchalways is
if(1 == 1) then goto 'memory address'
except goto isn't a JUMP, its a 'move' (of the PC, [Program Counter])
so you have to give it the number of bytes to move (positive or negative)
make sure you go down to the next byte FIRST before you count.
for example
0x00: random code
0x02: more code
0x04: yay code
0x06: BranchAlways -08 (takes you to 0x00, because the PC is at 0x08 after it reads the line)
0x08: stuff and stuff
UNLESS... laz has this set to exec code THEN inc the PC...
Quote from BopMeExtreme »
//Edit:
Updating the screen has the advantage of all pixels beeing updated at once.
as this pc is, understandable, slow(maybe theres a mod to increase redstone-speed?), the ball would disappear, from the screen before appearing eventually. updating the screen causes the ball to "move"!
Thats, why I invented new codes.
They are also an indicator on what exactly is needed to run pong. (the loop for example)
it would be better to have a bit that turns the screen on and off, or a bit that enables the screen to change or not (more DMA vs. CPU) the screen change bit would require essentially VRAM... ew.
I know how to make a button that can turn the screen off :biggrin.gif:,
Simple AND all the pixels to a Enable line.
Simple on off switch for the monitor.
Lol I can see it now.
*Turn on the clock*
*Turn on the monitor*
*Load program "Pong" from Memory bank X*
*walk over to the keyboard*
*play pong*
X is self explanatory :tongue.gif:
Amazing work there. Its interesting to see the work done on the 16bit CPU and the 8bit CPU with RAM Lol.
Absolutely Epic work. I really should be studying for my Electronics exam >.> but I read about it instead.
Hey, heres my pong code, of course its half-pseudo because i dont know how the screen and simple inputs behave...
Looks good! I haven't read through all the code yet, but I'll make sure I have a look once I've gotten through this pile of notifications that has been growing all day...
Quote from otakudjr »
i dunno how laz is doing the screen exactly, but it'll probably be easier to edit a couple of bytes in memory that are directly tied to the screen instead of sending CPU commands that interact with the screen, so no need to make new opcodes just for the screen.
I'll explain how the screen works when I've started it so that everyone's prepared :smile.gif:
Quote from otakudjr »
edit: yes i'm lazy... :sad.gif: sorry. but it'll help eliminate error and such if you give us the asm instead of us deinterpreting it
I've updated the OP with some mnemonics in brackets. Everyone's free to use whatever syntax they want as long as it makes sense, but it might be helpful if we stuck to using the same ones. It might be best for now to post stuff in words until I can finalize any changes to the instructions. :smile.gif:
they're just like ifs, cept you can't pick what the condition is, only where to take the program after the condition is met.
so BranchifZero is like
if(A == 0) then goto 'memory address'
branchalways is
if(1 == 1) then goto 'memory address'
except goto isn't a JUMP, its a 'move' (of the PC, [Program Counter])
so you have to give it the number of bytes to move (positive or negative)
make sure you go down to the next byte FIRST before you count.
for example
0x00: random code
0x02: more code
0x04: yay code
0x06: BranchAlways -08 (takes you to 0x00, because the PC is at 0x08 after it reads the line)
0x08: stuff and stuff
Almost. I don't think I explained it properly, so I updated the OP to show it better. It should be BranchAlways -07, since the PC is at 0x07 when it has loaded that instruction and location, and instead of incrementing to 0x08, it branches.
Almost. I don't think I explained it properly, so I updated the OP to show it better. It should be BranchAlways -07, since the PC is at 0x07 when it has loaded that instruction and location, and instead of incrementing to 0x08, it branches.
so no pre-inc :tongue.gif:
glad i added that note.
PS: I hope, thats the way you wanted the code...
And as you can see I used 3-digit numbers, because the program needs more than 99 bytes to work.
I just realized that it's probably bad that I started referring to everything in decimal, when I should probably have been doing it all in hex from the beginning. I did it to make things easier to understand for people who don't know much about binary/hex.
Quote from BopMeExtreme »
PS: It would be very cool, if laz could say something, so I know hes still there.. :tongue.gif:
Exam today! Then I jumped on my computer to discover that I had a pile of notifications on everything! Tumblr, twitter, here, youtube. Seems like people look at notch's twitter or something...
I say "I believe," because I work with assembly code approximately never, and so I very well may have screwed something up.
Also, I don't know how you're doing negative numbers, so no binary translation for that line.
If you made a more powerful computer (don't take this as an insult your's is amazing work) say, 64 bits? Would it be theoretically possible to play minecraft on it? You would need a display and a method of control but would it be possible?
NO
Minecraft takes atleast 25MB of ram and data transfer would be so slow, it would take ages to move your char + you would need 800*600 block screen and you would only be able to see 2 colors, black or red.
unless notch changed the data transfer rate and you could store more data it would be imposable.
ok, i haven't yet implemented the collision-code but I made this prog, for your REAL pc^^.
Basically it is just an editor with a function to "compile" the code to numbers.
It also counts used memory etc, and can autocreate a post nad so on.
By coloring the source-code you can find out where your mistakes are # are comments.
Try it if you want. I think it's making programming easier.
ok, i haven't yet implemented the collision-code but I made this prog, for your REAL pc^^.
Basically it is just an editor with a function to "compile" the code to numbers.
It also counts used memory etc, and can autocreate a post nad so on.
By coloring the source-code you can find out where your mistakes are # are comments.
Try it if you want. I think it's making programming easier.
ok, i haven't yet implemented the collision-code but I made this prog, for your REAL pc^^.
Basically it is just an editor with a function to "compile" the code to numbers.
It also counts used memory etc, and can autocreate a post nad so on.
By coloring the source-code you can find out where your mistakes are # are comments.
Try it if you want. I think it's making programming easier.
I just realized that it's probably bad that I started referring to everything in decimal, when I should probably have been doing it all in hex from the beginning. I did it to make things easier to understand for people who don't know much about binary/hex.
No offense here, but I do not think people who can understand the coding in decimal (or words, for that matter) would understand binary/hex good enough to use that aswell.
I tried explaning this form of binary programming to somebody and found that I could have explained it in chinese with the same end result.
Yeah, I think it's best to leave things as they are, let people code in binary, decimal, hex or words, whatever they want. This is programming a CPU in minecraft, not the next build of some RL operating system. :S
Nope, not me. I'm this guy:
The screen will have to be black and white. Or, well, red and grey. :tongue.gif:
I have designed a way of making a colour screen in minecraft, maybe I'll make it after I'm done with the computer. :wink.gif:
oh god.. please include some assembly WORDS. my eyes died staring at all dec numbers.
i dunno how laz is doing the screen exactly, but it'll probably be easier to edit a couple of bytes in memory that are directly tied to the screen instead of sending CPU commands that interact with the screen, so no need to make new opcodes just for the screen.
with that note.. i'm guessing the input will be DMA as well..
This thread is now [Diamond]
code is in words.. numbers is what happens after it gets interpreted and the CPU reads it..
i'm talking assembly words, so i don't have to look at the chart of opcodes to figure out what 04 or 07 is.
that and no line numbers/memory locations either..
edit: yes i'm lazy... :sad.gif: sorry. but it'll help eliminate error and such if you give us the asm instead of us deinterpreting it
edit2: in your beginning comments you have
" //with "08 constant" you can"
and it just cuts off.
edit3: looks like "08" is to set which pixel is being.. pointed at?
I r confuse.. after each "08" you store the value of A to memory locations (that overwrite already executed code, intentional to save space?) but the value of A doesn't change (unless "08" changes that)
they're just like ifs, cept you can't pick what the condition is, only where to take the program after the condition is met.
so BranchifZero is like
if(A == 0) then goto 'memory address'
branchalways is
if(1 == 1) then goto 'memory address'
except goto isn't a JUMP, its a 'move' (of the PC, [Program Counter])
so you have to give it the number of bytes to move (positive or negative)
make sure you go down to the next byte FIRST before you count.
for example
0x00: random code
0x02: more code
0x04: yay code
0x06: BranchAlways -08 (takes you to 0x00, because the PC is at 0x08 after it reads the line)
0x08: stuff and stuff
UNLESS... laz has this set to exec code THEN inc the PC...
it would be better to have a bit that turns the screen on and off, or a bit that enables the screen to change or not (more DMA vs. CPU) the screen change bit would require essentially VRAM... ew.
This thread is now [Diamond]
Simple AND all the pixels to a Enable line.
Simple on off switch for the monitor.
Lol I can see it now.
*Turn on the clock*
*Turn on the monitor*
*Load program "Pong" from Memory bank X*
*walk over to the keyboard*
*play pong*
X is self explanatory :tongue.gif:
Amazing work there. Its interesting to see the work done on the 16bit CPU and the 8bit CPU with RAM Lol.
Absolutely Epic work. I really should be studying for my Electronics exam >.> but I read about it instead.
Just, y'know, saying,
Looks good! I haven't read through all the code yet, but I'll make sure I have a look once I've gotten through this pile of notifications that has been growing all day...
I'll explain how the screen works when I've started it so that everyone's prepared :smile.gif:
I've updated the OP with some mnemonics in brackets. Everyone's free to use whatever syntax they want as long as it makes sense, but it might be helpful if we stuck to using the same ones. It might be best for now to post stuff in words until I can finalize any changes to the instructions. :smile.gif:
Almost. I don't think I explained it properly, so I updated the OP to show it better. It should be BranchAlways -07, since the PC is at 0x07 when it has loaded that instruction and location, and instead of incrementing to 0x08, it branches.
so no pre-inc :tongue.gif:
glad i added that note.
edit: inb4 BEQ confuses people
This thread is now [Diamond]
I just realized that it's probably bad that I started referring to everything in decimal, when I should probably have been doing it all in hex from the beginning. I did it to make things easier to understand for people who don't know much about binary/hex.
Exam today! Then I jumped on my computer to discover that I had a pile of notifications on everything! Tumblr, twitter, here, youtube. Seems like people look at notch's twitter or something...
why not fit CE in there too? its probably 2 more classes.
This thread is now [Diamond]
I say "I believe," because I work with assembly code approximately never, and so I very well may have screwed something up.
Also, I don't know how you're doing negative numbers, so no binary translation for that line.
Also also, first post. Hi!
NO
Minecraft takes atleast 25MB of ram and data transfer would be so slow, it would take ages to move your char + you would need 800*600 block screen and you would only be able to see 2 colors, black or red.
unless notch changed the data transfer rate and you could store more data it would be imposable.
Cool! I've quoted that post in the OP so that everyone can find it easily. :smile.gif:
Cool! I've quoted that post in the OP so that everyone can find it easily. :smile.gif:
an interpreter!!!
+1000 to you (this is the correct reward system on this forum right? lol)
This thread is now [Diamond]
Yeah, I think it's best to leave things as they are, let people code in binary, decimal, hex or words, whatever they want. This is programming a CPU in minecraft, not the next build of some RL operating system. :S
This thread is now [Diamond]