Tutorials Opinions Please
Tutorials Opinions Please
I Have started to write a series of tutorials and would like the opinion of the group weather they are any use or not
They are available at
http://doyle.id.au/html/pkd_s_osdev.html
PMode Part1 & 2 take you through initial boot sector, to loading a Second stage as well as setting up exceptions,Enabling A20,programming the PIC, I have only tested these on local machines but believe they should work for most, Please let me know your results
VBE_test I am still working on and I know there are bugs on some machines but you are still welcome to test it out.
bye
pkd.
They are available at
http://doyle.id.au/html/pkd_s_osdev.html
PMode Part1 & 2 take you through initial boot sector, to loading a Second stage as well as setting up exceptions,Enabling A20,programming the PIC, I have only tested these on local machines but believe they should work for most, Please let me know your results
VBE_test I am still working on and I know there are bugs on some machines but you are still welcome to test it out.
bye
pkd.
Re:Tutorials Opinions Please
i wish there were tuts like this, when i started.
My addvice would be keep it simple and to the point, and do tuts on things that are not available.
eg: theres loads of stuff on keyboards,a20,pic.
But what is needed is tut on pmode floppy drivers, atapi drivers, vesa, usb, sound and graphic driver making.
gui making.
Also layoff the C, stick to asm.
\\\\||////
(@@)
ASHLEY4.
My addvice would be keep it simple and to the point, and do tuts on things that are not available.
eg: theres loads of stuff on keyboards,a20,pic.
But what is needed is tut on pmode floppy drivers, atapi drivers, vesa, usb, sound and graphic driver making.
gui making.
Also layoff the C, stick to asm.
\\\\||////
(@@)
ASHLEY4.
Re:Tutorials Opinions Please
Erm... if it's a nail...ASHLEY4 wrote:
Also layoff the C, stick to asm.
Every good solution is obvious once you've found it.
Re:Tutorials Opinions Please
What Solar said.ASHLEY4 wrote: Also layoff the C, stick to asm.
Plus, if you're going to use C for the examples, they're more readable (higher level language) so the idea comes across more easy. If you're going to use asm, you got the AT&T vs Intel conflict and you got the unreadability of most assembly with that.
Stick with C for explaining things, or if you like, even pseudocode. You don't have to give them half their code, just give them an idea how to do it.
Re:Tutorials Opinions Please
More readable has in
C words:
floor()
fseek()
strcat()
pow()
ASM words:
mov
add
sub
inc
I have asked people, who do not know any programming, what they think the above words mean no one got the C words right, but most got 3 of the ASM right.
The point of a higher level language is it closer to human.
C fails this test.
\\\\||////
(@@)
ASHLEY4.
C words:
floor()
fseek()
strcat()
pow()
ASM words:
mov
add
sub
inc
I have asked people, who do not know any programming, what they think the above words mean no one got the C words right, but most got 3 of the ASM right.
The point of a higher level language is it closer to human.
C fails this test.
\\\\||////
(@@)
ASHLEY4.
Re:Tutorials Opinions Please
Oh, come on, Ashley. That's hardly a fair test. You are poising the operators =, +, - and ++ against complex mathematic, file-access or string handling functions.
I'd like to see how many people could make sense out of an assembly fseek() implementation if you don't happen to liberally comment it or call it _fseek by chance.
I'd like to see how many people could make sense out of an assembly fseek() implementation if you don't happen to liberally comment it or call it _fseek by chance.
Every good solution is obvious once you've found it.
Re:Tutorials Opinions Please
Do not get me wrong Solar, i am not saying asm is very readable, i am saying C is no more readable.
As asm is not a higher level language, it is not supposed to be much like human language, but C is.
\\\\||////
(@@)
ASHLEY4.
As asm is not a higher level language, it is not supposed to be much like human language, but C is.
\\\\||////
(@@)
ASHLEY4.
Re:Tutorials Opinions Please
Just because C is a higher-level language doesn't mean that it should be like a human language. It just means that it doesn't have a 1-to-1 correlation between its instructions and the generated machine instructions.
As far as readability, it is much more readable than asm.
vs.
first one looks a lot more readable to me. Sure, if you heavily comment your assembly code you can make up for it a little bit, but the nice thing about c is that by using good names for things its a lot more self-documenting and someone can look at that C code without any comments and at least get an idea of whats going on (if two of the members of a structure are equal, increment the third one), which maybe you can do looking at the second one but i sure can't.
As far as readability, it is much more readable than asm.
Code: Select all
someStruct *s = function_arg;
if (s->val1 == s->val2)
s->val3++;
Code: Select all
sub $0x8,%esp
and $0xfffffff0,%esp
mov $0x0,%eax
sub %eax,%esp
mov 0xc(%ebp),%eax
mov %eax,0xfffffffc(%ebp)
mov 0xfffffffc(%ebp),%eax
mov 0xfffffffc(%ebp),%edx
mov (%eax),%eax
cmp 0x4(%edx),%eax
jne someOffset
mov 0xfffffffc(%ebp),%eax
incl 0x8(%eax)
someOffset:
first one looks a lot more readable to me. Sure, if you heavily comment your assembly code you can make up for it a little bit, but the nice thing about c is that by using good names for things its a lot more self-documenting and someone can look at that C code without any comments and at least get an idea of whats going on (if two of the members of a structure are equal, increment the third one), which maybe you can do looking at the second one but i sure can't.
Re:Tutorials Opinions Please
if (x && y && !(z || b)) {
while(bx+by<200) {
do_something();
}
}
I could translate this to assembly, but you probably get the point. You get a lot more code, and the code is less legible in nearly all cases. The point behind a highlevel language as opposed to a lowlevel language is that a lowlevel language only does jmp's and a highlevel langauge knows a lot of more complex things such as if/while/do/switch and stuff like that.
Also, compare:
next_value = array;
and
mov array, %ebx
mov i, %eax
mov %eax, %ebx(%eax, 4)
mov next_value, %eax
You can probably see where this is going. For a single assembly-optimized thing the assembly is going to come out slightly better, where in any general or common case C is going to come out better (shorter, more legible, more structured).
while(bx+by<200) {
do_something();
}
}
I could translate this to assembly, but you probably get the point. You get a lot more code, and the code is less legible in nearly all cases. The point behind a highlevel language as opposed to a lowlevel language is that a lowlevel language only does jmp's and a highlevel langauge knows a lot of more complex things such as if/while/do/switch and stuff like that.
Also, compare:
next_value = array;
and
mov array, %ebx
mov i, %eax
mov %eax, %ebx(%eax, 4)
mov next_value, %eax
You can probably see where this is going. For a single assembly-optimized thing the assembly is going to come out slightly better, where in any general or common case C is going to come out better (shorter, more legible, more structured).
Re:Tutorials Opinions Please
My ISPs been down so you mightnt of been able to get to the site it should be right now.
As for the ASM vs C argument most of the stuff that i will be writing will be in ASM at this stage because it is mainly going to be low-level hardware access etc.
But for the GUI (in my Machine Dependant OS) C++ Objects are perfect for controls, such as EditBoxes,Buttons etc.
bye
pkd
As for the ASM vs C argument most of the stuff that i will be writing will be in ASM at this stage because it is mainly going to be low-level hardware access etc.
But for the GUI (in my Machine Dependant OS) C++ Objects are perfect for controls, such as EditBoxes,Buttons etc.
bye
pkd
Re:Tutorials Opinions Please
We will agree to disagree.
You can lead a horse to water, but you can not make it drink it, (but you can have a good try, if there more than 5 fo you) .
\\\\||////
(@@)
ASHLEY4.
You can lead a horse to water, but you can not make it drink it, (but you can have a good try, if there more than 5 fo you) .
\\\\||////
(@@)
ASHLEY4.
Re:Tutorials Opinions Please
No problem with ending a discussion in disagreement, but I have to congratulate you - you are the first person in my ~20 years of programming that claims Assembler to be more readable to the layman.
I've heard claims for efficiency, flexibility, and for "not being harder to read if you know it as well as the other language. But as for readability for the layman, you're a first.
There's no such thing as a "cannot be" among geeks.
I've heard claims for efficiency, flexibility, and for "not being harder to read if you know it as well as the other language. But as for readability for the layman, you're a first.
There's no such thing as a "cannot be" among geeks.
Every good solution is obvious once you've found it.
Re:Tutorials Opinions Please
Solar , i just give you the results of the above test .
Y do you get differant results ?, if you ask nonprogrammer
to do the test ?.
\\\\||////
(@@)
ASHLEY4.
Y do you get differant results ?, if you ask nonprogrammer
to do the test ?.
\\\\||////
(@@)
ASHLEY4.
Re:Tutorials Opinions Please
You can easily pack 10-20 lines of ASM on one line of C without causing any trouble to readability. You can actually do much more when you are calling functions, but got the point. Sure you can no longer do manual register allocation, but unless you have to, why bother?
Similarly, you can pack 10-20 lines of C on one line by writing Lisp. Sometimes you can do more here too. Sure, you can no longer mess up with your memory freely, and bit-level manipulation is quite hard, but if you don't need those things, why bother?
Finally, if your problem domain is well specified, you can often cheat even more: If you simply want to manipulate data in a few relations, you can usually do in one line of SQL what you would need a LOT of lines if you were trying to do it manually. Sure, you need an RDBMS which speaks SQL, but if that's not a problem, then why not? It's probably better written anyway.
The point of all these language is to be shorter. Because they are shorter, you have less things to understand. Sure, you have to compile your stuff futher to get to machine code. Shorter doesn't need to mean less characters, but simply less syntactic units.
For example: pow2(x + y); contains units pow, function call, x, +, y and end of statement. After you understand these 6 units and their relations to each other, you understand the code.
Another nice thing with high-level languages is that you have (practically) unlimited amounts of local variables, which means you never have to move them around it register. This has the advantage that you can expect that certain variable contains certain values based on how it's named. Sure, once the code is compiled, all variables should be mapped to registers, but then again, good compilers do surprisingly good job in this.
I think C is a local optimum for describing low-level oprations, hence it's continuing success. There are other such local optimums. Perl might be one, Lisp another. Each of them are great for just the kind of things that they are great.
That said, if you use something like NASM or GAS in writing your assembler code, you are actually expecting people not only to understand assembler language, but your tools internal language as well. I constantly find it easier to follow objdump's disassembly than some people's assembler sources, but that's simply because I don't know the assembler macro-language they are using.
Similarly, you can pack 10-20 lines of C on one line by writing Lisp. Sometimes you can do more here too. Sure, you can no longer mess up with your memory freely, and bit-level manipulation is quite hard, but if you don't need those things, why bother?
Finally, if your problem domain is well specified, you can often cheat even more: If you simply want to manipulate data in a few relations, you can usually do in one line of SQL what you would need a LOT of lines if you were trying to do it manually. Sure, you need an RDBMS which speaks SQL, but if that's not a problem, then why not? It's probably better written anyway.
The point of all these language is to be shorter. Because they are shorter, you have less things to understand. Sure, you have to compile your stuff futher to get to machine code. Shorter doesn't need to mean less characters, but simply less syntactic units.
For example: pow2(x + y); contains units pow, function call, x, +, y and end of statement. After you understand these 6 units and their relations to each other, you understand the code.
Another nice thing with high-level languages is that you have (practically) unlimited amounts of local variables, which means you never have to move them around it register. This has the advantage that you can expect that certain variable contains certain values based on how it's named. Sure, once the code is compiled, all variables should be mapped to registers, but then again, good compilers do surprisingly good job in this.
I think C is a local optimum for describing low-level oprations, hence it's continuing success. There are other such local optimums. Perl might be one, Lisp another. Each of them are great for just the kind of things that they are great.
That said, if you use something like NASM or GAS in writing your assembler code, you are actually expecting people not only to understand assembler language, but your tools internal language as well. I constantly find it easier to follow objdump's disassembly than some people's assembler sources, but that's simply because I don't know the assembler macro-language they are using.
Re:Tutorials Opinions Please
I'm not Solar, but I do know some nonprogrammers, so I decided to try your test. I couldn't remember the exact set of functions and operators you used, though, so I devised my own equally valid test:ASHLEY4 wrote: Solar , i just give you the results of the above test .
Y do you get differant results ?, if you ask nonprogrammer
to do the test ?.
Code: Select all
C:
a = 3 + 4;
b = time(NULL);
exit(EXIT_SUCCESS);
ASM:
mov ax,cr0
or ax,1
mov cr0,ax
mov ax,0x4F02
mov bx,0x4118
int 0x10
mov dx,3
mov ax,0xFFC00000
mov [ax],dx
invlpg [dx]
I just give you results of the above test.
Now, if you want a meaningful test of the relative readability of the two languages, take the C source for some function (say, strcpy), the ASM source for the same function, and ask a freshman Computer Science student what they do. (Since anyone writing an operating system is ipso facto a programmer; asking the opinions of nonprogrammers about any of this is pointless.)