User loginNavigation |
On creating an ad hoc assembly interpreter to aid studying&Hello Folks, I am a CS student on my first year. I've been reading LtU for some years already and obviously most of the topics here are way beyond my current knowledge. This is my first post detailing something I did which I am kinda proud of. At my university we have a chair called "computer architecture;, in this class they teach us some assembly language for a non-existant x86 machine. We use the SIMx86 simulator for our exercises. In this university we have two examinations per chair and one extra final examination in case you failed passing with the previous two. The second examination was composed only of assembly language questions. My problem was that I skipped (yes, true) the assembly language classes trusting I could learn it later but when I went to study, I discovered that SIMx86 would only run on windows machines and I have a mac. It was the night before the examination and I decided on a bold course of action, I decided to code my own assembler interpreter, an ad hoc solution, just good enough to run the exercises we learned. In about five hours, I ended with this design: I've called it CuteX86 and implemented only the subset of assembly I needed for my exercises. I've added a debugger that allowed me to run my source step by step inspecting the "memory". It is not a solution or a product, it is just a tool that I built to aid myself studying. I've created it using Runtime Revolution language which is a "successor" of old Apple HyperCard. The implementation is really easy, the code is stored in memory as a string and is executed line by line, instead of parsing the whole source and doing a real job, I analyze each executing line converting it to the appropriate Runtime Revolution code to be executed in runtime. This code calls a big switch statement where all the instructions are implemented. There are four register and minimal memory access. I know this is not the proper way of building interpreters but this was not a general purpose tool, it was a way for me to learn assembly so I could pass the examination and not waste my tuition. I've finished it 2:00 AM and studied till 7:00 AM, took the examination at 8:00 AM and actually passed the thing! (thats why I am happy). By building my own interpreter, I had a deeper knowledge of what was actually happening than my peers, in the end, I could do the examination just by thinking how my code would process something. Now I am sharing this interpreter with the other students, and even integrated a simple "source code hosting" portal into it so that we can share code. I always loved computer languages, just bought myself the dragon book, SICP and The Art of Computer Programming Vol 1. Someday I may just be able to write real languages :-) PS: I am specially proud of my jumping routines! Andre By soapdog at 2007-09-17 14:58 | LtU Forum | previous forum topic | next forum topic | other blogs | 7297 reads
|
Browse archives
Active forum topics |
Recent comments
27 weeks 1 day ago
27 weeks 2 days ago
27 weeks 2 days ago
49 weeks 3 days ago
1 year 1 week ago
1 year 3 weeks ago
1 year 3 weeks ago
1 year 5 weeks ago
1 year 10 weeks ago
1 year 10 weeks ago