Who's right??

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
hgb

Re:Who's right??

Post by hgb »

First declare that Im not a langauge designer profesional or even have such knowledge, but have read a very little.


In fact, in any language you can describe what can be described by the langauge, you will need to proof that the language have some propierties, and knowing the propierties of he language, you should be able to know what type of problems can be solved with the language, by example, you can write a OS with a turing machine... but you will try it?.

Now there exist diference in implementations for the same solution in diferent languages, you know there are some metrics that compare for example how many lines of code in % are for write something for example C, ADA, smaltalk, asm.


Also one thing are the languages, because like I said before a thing is that you can describe any posible description with a certain langauge in certain way, but another one are the translators (compilers/interpreters/.. etc...).


Before continue, first I whant to trow my observations...
seeing as you can now compile PHP into binary form
In wich binary form??, PE, elf, COM, raw binary? or with a displacemnts added to the addresses for example if you load you bootsector to 0x10000, a compressed file... by the way, even doc documents are binary... will doubt it???
you know, you can use Perl for inline commands
Tought dont know this, they can provide access to the offsets or only some like emit thing for some C compilers.. or what you are trying to show?

By the way, say that you can use another language when you say that can be done in PHP, is for example say: yes I can talk portuguese and you answer: sure?, say me how I say "hello there" in that language, and you go with a friend or a traslator that say you how is it. Now say me, you really can talk portuguese???? ::)




By the way, tought even that you for example are proud in manipulating the bin file obtained with PHP.... you will be able to use privileged instructions??? like lgdt, int and others??? I gues you can with workarounds, but will be hard, because the langauge dosent even know that there exist such type of instructions (is designed for other thing).... probably the compiler for PHP only is able to output directly user operation codes like mov, mul, div, perhaps FPU and posibble MMX, SSE1,2,3... perhaps, tought this last ones I doubt.
'morron' is not a word
Like I say before, there are diferent languages designed for diferent things, tought in you language morron is not a word, morron in my language exist, by the way, is used for give flovour to food.


You know?? some languages natural languages are diferent to translate, even that they have near the same porpuose, for example I have listened one time that the poem "the crow" is dificult to translate to other languages, tought it can be translated in a direct way, you should be a master of poems for give the same inpact in a diferent language...



Yes I agree that the majority of languages can be used for solve algorithms (because the majority apart of diferences share some basic propierties). But that not mean that all languages can be used the exact same way, even the paradigms will help you in solve problems and will impact you and the language, with some paradigms certain problems should be easy, with others should be more hard and near to not posible bu that not mean that can not be done... but you will try it?.




By the way, rereading, I see that you say thta you only whant to amuse he/she, remember that all are impactable :), also all we are ignorants of some things, but is bad to take over the ignorance of others for have fun, if a little kid that is ignorant ask you something, and you answer some fun and the guy think that you are right and the little guy do a action (that by some ones by considered a stupid boy), for example try to stop a car like superman tought you can consider the action thtat follow your comments stupid, the guy wasnt thinking that it was stupid.... but he/she is killed or in the mergery now... you see, keep care about what you say, each one is important, even if you dont know them.
hgb

Re:Who's right??

Post by hgb »

By the way, the "can write something", not mean that inmediately will have the impact in the enviroment or run in the enviroment that I whant, for example I can write a love card to my girl friend in asm/C, but that not mean that it will run in the exact context that I whant.. give she in personal.

include <stdio.h>
#define LOVE 0
char * message = "Hello there beantifull girl";
int main(){
printf("%s", message);
return LOVE;
}

I have write it, will have sense to run it?, will have the same impact that I write in real paper with my hand???, the answer is no.

See the diference in posible to write than in easy and with the same impact in the enviroment that will be used or where it will evolve???
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Who's right??

Post by Brendan »

Hi,

I think it's entirely possible to write a boot sector and/or OS in PHP!

The first thing you'd need to do is write a pair of PHP compilers (one for real mode and the other for 32 bit protected mode) with a whole heap of non-standard extensions built into it (for e.g. an inbuilt "go to protected mode" command).

It'd be easier to write it all in assembly though...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Who's right??

Post by Solar »

But if you have to use a specific compiler with specific non-standard extensions, it wouldn't be PHP anymore, but a "lookalike" language.

Just like writing C with inline Assembly isn't "writing in C", it's just that - C with inline Assembly.

And if you write a boot sector in machine language, make those 512 bits into an array of hex numbers and use a PHP script to write them to file, that's still not PHP, that's machine language written by a PHP file.

The discussion - and its continuation in this thread - is rather amusing, if highly childish. I'd recommend you learn to speak to humans correctly before attempting to speak to computers...
Every good solution is obvious once you've found it.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Who's right??

Post by distantvoices »

Hear Hear!

Couldna resist.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Who's right??

Post by Pype.Clicker »

Not esp. a PHP guru, and what i know of PHP makes me doubt you could build an OS with it ... anyway,

* can you invoque code coming from raw data bytes with PHP ? (that'll be mandatory for loading and running programs)
* can you cope with datastructure having a specific bits & bytes arrangement (that will be mandatory for e.g. MMU structures and things alike)
* can you take control of memory allocation/freeing ? or can you at least subdivide a large chunk of memory in smaller chunks that other functions can use transparently ? (that'll be necessary for any sort of memory management)
* are you able to build a self-sufficient run-time library to support language features you'll need ?

if any of those question turns out to "whoops, no. i cannot do that with language XYZ", then chances are that XYZ will be of no help for OS development.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Who's right??

Post by Solar »

I spoke to a pro PHP coder at lunch, and he almost laughed his head off...

His take on the issue:

1) Using PHP for OS related coding is like using a hammer for a screwdriver: The opposite way around, it might actually work in a pinch...

2) In his experience, someone even considering PHP for the job most likely doesn't have either the mindset for OS coding or a basic idea of what he's up to.

His words, not mine. I deeply respect him for what he can do with a database and a webserver, but I still have to debug whatever C code he churns out because he never gets the memory management right. ;)
Every good solution is obvious once you've found it.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Who's right??

Post by Candy »

Solar wrote: 1) Using PHP for OS related coding is like using a hammer for a screwdriver: The opposite way around, it might actually work in a pinch...

2) In his experience, someone even considering PHP for the job most likely doesn't have either the mindset for OS coding or a basic idea of what he's up to.
He is awfully right. Still, on an academic level (as in, you don't care about practical but within reasonable limits of adjustment, IE, you can't include inline assembly in the language but you can change the exact writing of some statements and add an "unless" and such) it is not possible to write a boot sector (which would be like finding a needle in a haystack with a 200 ton truck for looking through it) but it is possible to write something of a boot loader or OS.

I still consider writing a bootsector in C highly wrongly chosen but possible. You need an awful lot of inline code though (still only 10-20%).
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Who's right??

Post by distantvoices »

And right he is. PHP is a really feisty tool to make neat & fine dynamic web sites with database backing and sorta, but for building an OS, PHP is ... too much around the edges and not slim enough. and btw, all the memory allocation is done automatically iirc - and a garbage collector cleans up afterwards.

I daresay, use PHP for what it's designed for and C/C++ (for the daring ones) for OS code churning.

as for that dialogue: Calling an other one a moron (that's how this special word is written - and it means idiot, jfyi) for no reason isn't what I call reasonable. grow up, kids, finish school and stop throwing tantrums no one is interrested in.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Therx

Re:Who's right??

Post by Therx »

by the way, even doc documents are binary...
Interesting thought... would it be possible to write a word document which saved as the equivalent of machine code that actually did something...

Should be possible (except maybe for the standard header)

Pete
Kemp

Re:Who's right??

Post by Kemp »

It would be technically possible with a straight text document, but half of it would be non-standard characters so you'd be using alt combos a lot.
mystran

Re:hi

Post by mystran »

alix wrote: quite frankly, I find it immeasurably amusing that the kid went and actually made this thread like he threatened to, when I was so obviously deliberately talking out of my @$$ in order to annoy him.
Seems I was too late to see this thread. I would have said one word: Troll!
vile

Re:Who's right??

Post by vile »

I believe it isn't possible, unless you completely change the language. Why would anyone even think of coding an OS in PHP? What kind of speed and performance would that give? Not very good. And would it be practical? Definitely not. Plus, PHP code looks so damn annoying ;). It's not even a programming language, it's a scripting language. It's for writing websites... so what exactly could you do with that? Unless you were able to translate the PHP code into opcodes, I doubt it would be possible; and then if you think about it, if you did that it wouldn't be writing an OS in PHP.

I just don't really even see the relevance, or the point to such a dispute.
Kemp

Re:Who's right??

Post by Kemp »

While we're on the subject of stupid ways to make an OS, you'd probably do better with my program than PHP :P

It generates a completely random assembly listing (minus a few instructions that TASM refuses to assemble) up to the number of lines you tell it. I've named it ASM Roulette, taken from Russian Roulette which I'm sure most of you have heard of. I haven't dared actually run anything it has created yet, but it all assembles except for a few occasional bad instructions. This is the sort of completely random thing I write when I get bored.

As for PHP, yes you can compile the code, no I wouldn't try writing an OS in it myself.


Edit:
While I think about it, you'd probably have to mix in your own assembly to the PHP stuff to do quite a few things (device control, most "unusual" instructions like LGDT, etc). Haven't checked out the extent of the stuff supported by the compiler yet but I wouldn't expect the language to be extended too much.
vile

Re:Who's right??

Post by vile »

By the way, Kemp... do you have screenshots of your OS? I'd like to see some.
Post Reply