flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > AFS |
Author |
|
edfed 03 Dec 2009, 13:20
a sort of debugger, based on source code, that will explain step by step the code.
the code can be simulated (animation). and then explain what is doing the single instruction. can do the same with funcitons like printf, IO, int9 the main problem with asm is to explain the memory mapping, access to address, address computation, result of xor eax,eax, etc each step of code will be explained by a little text: example: Code: mov eax,[eax*4+4] -> eax*4 in temp -> eax+4 in temp -> temp as a pointer ->[temp] in eax show as eax have the value that was at [eax*4+4] the Q is how to code this program? |
|||
03 Dec 2009, 13:20 |
|
ManOfSteel 03 Dec 2009, 13:49
From the title I thought it was going to be about a new filesystem project.
To add to edfed's example, maybe you could make something like a very simple OllyDbg (HelloWorld! example), but with some more details and more user-friendly texts/descriptions inside round or rectangular callouts like in comics, that appear gradually as you trace through the code. |
|||
03 Dec 2009, 13:49 |
|
edfed 03 Dec 2009, 14:08
yep
for example: 'inc eax' instruction Code: scenario0: .0: show the ram, 'cs:ip' and an arrow to the ram location .1: show the content of the location, a rectangle, and hex value '40h' or a binary value for crazy explanation .2: arrow to source code line,text of code= 'inc eax' .3: arrow to the 'ALU', one to 'A', one to 'function select' .4: text value '1' in 'A' text 'inc' in function select .5: highlight 'eax' .6: arrow to 'reg eax' .7: show eax 'value' .8: arrow to ALU, 'B' .9: execution in 'alu' .10: ALU output in 'C' .11: arrow to 'reg eax' C to REG eax 11 steps, and a lot of basic events, inculding transparent events, like hide a signal, a line or something. |
|||
03 Dec 2009, 14:08 |
|
kohlrak 03 Dec 2009, 14:41
Quote: a sort of debugger, based on source code, that will explain step by step the code. Not sure exactly what you mean? I was thinking of doing all the lessons as source code so that the results could be explained step by step until the result is predicted, then the reader could do an assemble and run and find that the result is indeed as predicted, then the reader could change the code themselves and try to predict the result, and then test their conclusion. Quote: the code can be simulated (animation). and then explain what is doing the single instruction. Well, unless someone here is actually willing to do all that drawing, it might be a bit extreeme. Flowcharts and other graphical media would be a bit excessive for some things. I'm sure i could explain these things sufficiently in words. I'm mostly worried about what topics to cover aside from the usual topics covered with HLLs (conditionals, variables, loops, etc) and computer architecture. As for additional topics, so far i've come up with input sanitation. Quote: the main problem with asm is to explain the memory mapping, access to address, address computation, result of xor eax,eax, etc Well, I figure to explain things in a way that things like memory mapping are explained when the topics that concern them are introduced (memory mapping is especially practical of a topic when explaining where to put data, for example), and things like "xor eax, eax" are to become inherently obvious when that family of instructions is introduced. I actually plan on spending a whole couple of lessons on bitwise and bitshift instructions in general, where i might rip out a multiply by 2 and comment how a bitshift by one manages to accomplish that, so the beginner starts thinking in a way that if they don't understand something, and if it's not commented, they should be able to figure it out with execution by hand. Quote: the Q is how to code this program? Well, doing things like adding and mulling within brackets, i'll explain my usual policy. Order of operations applies, and if the situation actually calls for something like that, try it, and if the assembler complains that that sort of combination doesn't work, just figure out the value of the register outside of the memory access. It's a safe policy, really, and it'll save me (and the reader) the trouble of having to remember what all instructions I can and can't do things like that with. Quote: From the title I thought it was going to be about a new filesystem project. Smile One read of the ISO file format and you'll never want to do. Quote: To add to edfed's example, maybe you could make something like a very simple OllyDbg (HelloWorld! example), but with some more details and more user-friendly texts/descriptions inside round or rectangular callouts like in comics, that appear gradually as you trace through the code. Pretty much what I'm doing, just with comments instead of pretty images. edfed wrote: yep I was even scared when trying to read that. Anyway, that would be doing what I'm trying to avoid, describing every single instruction. This would be rather pointless and make for a very boring read. I'll explain that the add instruction (by the time i mention it, i'll have already covered memory mapping and the mov instruction, and naturally memory oprands) takes 2 oprands, where it add both oprands together and stores the result in the destination oprand. Then to describe inc, i will say that it's a smaller opcode that essentually does the same as "add oprand, 1." |
|||
03 Dec 2009, 14:41 |
|
Dex4u 03 Dec 2009, 17:52
Great project , i am always being asked for a good tut on fasm, but the biggest thing that is missing is a 32bit mode asm programming tut (not window as we have them).
99% of the asm tuts are based on 16bit realmode, the best thing to do is to take a good asm dos tut and convert it to 32bit mode with the same examples etc, so newbees can learn and compare the two. The best one i found, was Adams asm tut http://www.programmersheaven.com/download/15526/download.aspx I also think your tut should be based around a fasm hobby OS's, maybe MenuetOS/KolibriOS As i am making a MenuetOS/KolibriOS functiom wrap, so the same code will work on DexOS too. |
|||
03 Dec 2009, 17:52 |
|
hopcode 03 Dec 2009, 22:52
very nice idea
I started my vCalculator some months ago. The concept is something like edfed says in his example/explanation, but related only to calculations that will be showed regarding flags and partial results. For example setting a variable in eax and ecx 1) xor eax,eax ;<--- show flags / result of eax 2) and eax,ecx ;<--- show flags /results for eax /ecx ... and so on Also, it is possible to study flags and partial results at each single step , for the common logical/arithm operations. In this way it may become more accessible task that of start coding a simple xor engine, or a decompression module, for example. At the moment i have no time to dedicate myself to this nice idea. I am releasing fasmlab (with code hihlight/block commenting/verticals selection etc..) in few days, it is to say, before Christmas fasmlab before Christmas .... but pehraps the new year will bring something really cool from this thread, or i hope so... Regards, hopcode |
|||
03 Dec 2009, 22:52 |
|
kohlrak 03 Dec 2009, 23:53
Quote: Great project Smile, i am always being asked for a good tut on fasm, but the biggest thing that is missing is a 32bit mode asm programming tut (not window as we have them). I figure the best way for people to learn is to learn as i have learned. Even into the days of 128 bit, 32bit mode stuff will still be a good starting place. 16bit mode is complicatedwith trying to explain the whole memory setup. I figure, one can learn 64bit stuff just by reading the 64bit section of the fasm manual. My goal is to get a small tutorial, that gets someone basically far enough that they don't have to fear the intel docs and they have at least a basic idea on how to code and why some people do some things like "xor rax, rax" or jump tables over a massive chain of compare statements, etc. People simply can't learn assembly in general, or assembly from scratch, only from the fasm examples. This is to get people ready for the fasm examples. Quote: 99% of the asm tuts are based on 16bit realmode, the best thing to do is to take a good asm dos tut and convert it to 32bit mode with the same examples etc, so newbees can learn and compare the two. Well, i might do that and i might not. I want to avoid possibly scaring people, and doing DOS stuff will. I might just add an extra lesson for 16bit code. Quote: I also think your tut should be based around a fasm hobby OS's, maybe MenuetOS/KolibriOS Well, i'm trying to be practical with my expectation of my audience. You might be able to convince them to run another OS, but once again, that'll require them to figure out how to burn it and such. This wouldn't be a problem for people who learned other languages first, because they wouldn't be afraid of "blowing up" their computer. If i can get some kind of cross platform wrapper started to work with windows, linux, and potentially mac, i surely won't shy away from one for a hobby OS either. All i'm looking for in my basic setup is a "print string" and "get string" macro. hopcode wrote: very nice idea I'll do something like that. Basically, to save myself all the writing and them all the reading, i'll explain flags when i go into conditional jumps. I'll tell them to stay on the lookout for such things, and i'll give them a basic program to help them check if a particular instruction changes that flag or not, etc. After the first couple lessons, y'all'll know exactly where i'm going with this. At this point, i think i'm gonna make a wrapper function for printf that simply uses a "%s" format string. But, i'll get to that after i finish this ethics lesson and post it here for corrections and comments. EDIT: Here is my first draft. I'll be posting the first couple lessons regularly while creating them so that i can get an extra pair of eyes making sure i don't make things too scary and to make sure i'm thorough. I'm sure this first draft will have lots of comments and corrections, since i stopped in the middle of writing it after looking at the URL i referenced, as i thought that it would suffice for alot of things. Quote: The first and most important thing to learn is ethics. Most textbooks leave this until a late section, which often makes tempting situations before revealing the seriousness of having decent ethics. As a programmer, you will take on both the fames and burdens of other programmers. Just like joining a religion, if you do bad things, you make everyone else look bad. However, unlike a religion, there are only a few simple guidelines to follow (though, many would love to make more). These are mostly rules accepted by programmers to insure that only good things happen (much like the ethics followed in a scientific community), but unfortunately, not everyone follows the rules (like people in the scientific community with an agenda). |
|||
03 Dec 2009, 23:53 |
|
bitshifter 04 Dec 2009, 04:09
I think for it to really stick and keep their attention
it has to have a certain WOW factor in its display. Now a graphical tutorial would get their attention and keep it. I myself had thought an OpenGL::Win32 tutorial would be popular... But i guess there was not so much interest in it these days... I also thing an OS for beginners tutorial would be a good one. And i do like the idea of building a debugger to follow the code |
|||
04 Dec 2009, 04:09 |
|
kohlrak 04 Dec 2009, 04:53
Well, i figured to do what most languages today do. Regular console mode stuff with only a few functions, but mostly using some sort of routine for printing and getting strings and numbers. Going into GUI and all of that would probably result in so much work and time going into the project that it'll be obsolete before it's finished (because people stopped using that GUI system for some reason). Plus then, using something like making our own visual basic for the purpose of learning would probably require a bunch of extra DLLs and SOs and stuff and just add to the process of getting the user ready for coding. As it stands right now, i'm writing it so that the tutorial can be copied into the fasm directory and be worked with from there, modifying a wrapper file to change which lesson the assembler tries to compile.
Certainly, though, if anyone is willing to do the work, i won't stop anyone from forking it. the wrapper code itself is based on code Tomasz wrote, and i'm just adding a little extra to it. Other than that, i'm releasing it all public domain, really. You have my permission to utterly destroy whatever i come up with. I'm just looking for advice on where to go with what i have right now (despite not having anything to show for it at the time of posting this) lesson plan wise. EDIT: First binary making lesson doesn't exist yet, but the framework testing the macro are. I tested for windows using wine, but anyone using various versions of windows (XP through 7), testing would be recommended. EDIT2: First three lessons complete, in the process of writing lesson 03 (fourth lesson). Comments and testing still required...
|
|||||||||||
04 Dec 2009, 04:53 |
|
TmX 04 Dec 2009, 12:31
Would this be something like PC Assembly Tutorial ?
|
|||
04 Dec 2009, 12:31 |
|
kohlrak 04 Dec 2009, 12:54
Dang, someone beat me to it. Either way, I'm hoping to be as verbose, but teaching a few other things along the way and to teach in a relatively different order. You know though, that would've been really nice to have when i started learning assembly... I will say though, i'm just glancing over it and it's using words that someone might not be familiar with unless they already know a programming language, which is not what my project does.
|
|||
04 Dec 2009, 12:54 |
|
masonswanson 23 Dec 2010, 20:59
Well i am working on A Small assembler in python, python is usually hailed as the best for teaching newbies, so with the power of python and the ease of assembly... or whatever... I have plans in the work for the assembler to create verbose documentation on the source code it compiles, or translates between dialects, that way with the addition of a command line switch you can have it output documentation for third party users of the code. i also plan on having some sort of inline documentation, so it can extract the comments from the code for inclusion in the output documentation, but it's primary purpose would be in creating a verbose description of each instruction. as far as interrupts go, i am trying to work on a parser for Ralf Brown's interrupt list
|
|||
23 Dec 2010, 20:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.