Well, that time has come. Midterms have come, they have gone, and now I'm left with projects.
I wrote an old program 2-3 years ago that did three things. It tested to see if a number was prime. It was able to break down a number into it's factors (think quadratics), as well as its prime factors (for taking the root of a number).
When the project came down my first idea was to make a PC boot block, after some discussion with my teacher I decided that this was far too complex of a task to take on given the time constraints, so I settled on re-writing some parts of this program in Assembly.
I wrote this program in Java, so I have some additional work too. Anything external I decide to use from the program I need to port to c code first. I don't know C, so this has potential to be a pretty interesting project as it is.
Tuesday, October 26, 2010
Friday, September 17, 2010
0xb0, 0xea7beef, 0xc3
My CS301 (Assembly Programming Language) teacher has a brilliant style of teaching. In actuality he's a pretty amazing guy all around. Nice guy, always willing to talk shop about Computer Science, and extremely sharp. Sometimes I need to remind myself that he's still just a man. like me.
Our lesson today started out talking about a cat. We have an array of commands. What if we want it to eat, and what if we want to specify what it eats? We have two options. We can have an array of parameters to go with these commands. But what if some commands don't have parameters? What do we do?
Or, and this is a slightly better solution. What if we have one array, and if we want parameters after a command, put them after the command to be processed, and then go on? Now we have one array, and now we have commands and parameters as needed if we know what commands need parameters.
Well, this is still a little bit confusing. How about an example (in my own handrolled pseudocode here)
let cat_cmds be an array of words
initialize cat_cmds to "sleep", "wake", "eat", "Friskies", "Meow", "sleep", "exit"
From here, we can loop through the array, and knowing that the command "eat" will take a parameter, we can step through the array and process the command, and then we can move on. When we reach the exit command, we close down the program.
Why do this convoluted example? Well...
If you change these commands to byte codes, make a function pointer to that array, and then call the function, you have a function out of machine code, because this is how computers are coded.
It was pretty beautiful. I don't think that, if he had simply launched into a lecture about bytecodes without first drawing a parallel that we could have understood a lot easier. It was interesting to learn that this is how computers work under the hood. I think I'm starting to see the big picture. Computers don't really understand anything. They just process information into human readable formats.
Yeah, that's right.
They're dumb as rocks.
Our lesson today started out talking about a cat. We have an array of commands. What if we want it to eat, and what if we want to specify what it eats? We have two options. We can have an array of parameters to go with these commands. But what if some commands don't have parameters? What do we do?
Or, and this is a slightly better solution. What if we have one array, and if we want parameters after a command, put them after the command to be processed, and then go on? Now we have one array, and now we have commands and parameters as needed if we know what commands need parameters.
Well, this is still a little bit confusing. How about an example (in my own handrolled pseudocode here)
let cat_cmds be an array of words
initialize cat_cmds to "sleep", "wake", "eat", "Friskies", "Meow", "sleep", "exit"
From here, we can loop through the array, and knowing that the command "eat" will take a parameter, we can step through the array and process the command, and then we can move on. When we reach the exit command, we close down the program.
Why do this convoluted example? Well...
If you change these commands to byte codes, make a function pointer to that array, and then call the function, you have a function out of machine code, because this is how computers are coded.
It was pretty beautiful. I don't think that, if he had simply launched into a lecture about bytecodes without first drawing a parallel that we could have understood a lot easier. It was interesting to learn that this is how computers work under the hood. I think I'm starting to see the big picture. Computers don't really understand anything. They just process information into human readable formats.
Yeah, that's right.
They're dumb as rocks.
Subscribe to:
Comments (Atom)