flat assembler
Message board for the users of flat assembler.

Index > OS Construction > rewrite linux in asm with fasm

Goto page Previous  1, 2, 3, 4  Next
Author
Thread Post new topic Reply to topic
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 24 Oct 2010, 11:52
Fanael wrote:
ManOfSteel wrote:
No, really, this is way too much. *nix shell scripting is far superior to any other.
No, really, this is way too much. Have you ever heard about PowerShell?

Oh, look mommy, I recreated the wheel.

(35 years later)

ROFLMAO
Post 24 Oct 2010, 11:52
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 24 Oct 2010, 12:08
There are so many different shells in Unix... Did you mean any particular of them? bash is only 23 years old. And 4DOS is 21 (yes, DOS also had more than one shell, imagine that).
Post 24 Oct 2010, 12:08
View user's profile Send private message Visit poster's website Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 24 Oct 2010, 12:20
I use the C shell t/csh (1978) as an interactive shell and the Almquist shell a/sh, a clone of the Bourne shell (1977), for shell scripting.
Post 24 Oct 2010, 12:20
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 24 Oct 2010, 12:30
ManOfSteel wrote:
the Almquist shell a/sh, a clone of the Bourne shell (1977)
Even though a "clone", it was itself introduced in 1989. Wink
Post 24 Oct 2010, 12:30
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 24 Oct 2010, 14:26
REXX, anyone? Wink
Post 24 Oct 2010, 14:26
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 24 Oct 2010, 14:30
I regret I didn't have a chance to get to know OS/2 better. I always wanted to, but in fact had just a single opportunity to do a little clickety-click on one machine running it at university - nothing more.
Post 24 Oct 2010, 14:30
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 24 Oct 2010, 14:43
speaking shell, each command should start with the program name followed by parameters.

for example:

dir /P /W
fasm input.asm -m43223

then, what can be done is simple, as msdos, a command/ folder containing all valid commands.

knowing that, it simplify a lot the way to execute commands.

and to add a command, just add it to command/ folder.

in linux, i don't feel it like that. it appear to be far more complicated.
but it can be possible to do it that way... if only it was simple to understand...


for example, how to lowcase all files names under linux?
it is very hard, the command is very long.

under dos, no matter, it doesn't make distinctions between up and low case names. and even if it is needed, just compile a .com code and it is ok.

the more logic os beetwen DOS and UNIX is DOS.
an that's why microsoft is the king, just because they did it the simple way. linux had choosen the hard way to work, something like an experimental brainfuck logic.

if something should be made around linux is to simplify it a lot, just in order to be able ot run drivers. but no more.

i strongly believe it can be possible to use asm to process command line.
assuming everything is in memory, or accesible via memory, and that macros can be used.

something like a multi line comand line can be cool.
it can let write little asm code, with labels, and execute it as is.

Code:
root/folder/ASM=\ 
mov esi,[%path] ;load current folder adress
mov ecx,[esi.size] ;load folder size
@@:
call upcase
loop @b
RUN
    

somethin like dos debug...but far more cool
Post 24 Oct 2010, 14:43
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 24 Oct 2010, 15:58
Tomasz Grysztar wrote:
There are so many different shells in Unix... Did you mean any particular of them? bash is only 23 years old. And 4DOS is 21 (yes, DOS also had more than one shell, imagine that).
On my 486-dx4/100MHz I used to run a heavily stripped down Win95 (think I got it down to ~25 megs or so?) with "shell=4dos" - just to get decent multitasking and disk caching, didn't use any Windows apps back then Smile

_________________
Image - carpe noctem
Post 24 Oct 2010, 15:58
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 24 Oct 2010, 17:39
> then, what can be done is simple, as msdos, a command/ folder containing all valid commands.
Put it in "/usr/local/bin". Although, you will have to be root to do so.
Post 24 Oct 2010, 17:39
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 24 Oct 2010, 20:19
edfed wrote:
each command should start with the program name followed by parameters.

for example:

dir /P /W
fasm input.asm -m43223

I have never seen any command starting with parameters and ending with the binary name, or something. So why are you bringing this up?

edfed wrote:
then, what can be done is simple, as msdos, a command/ folder containing all valid commands.

Don't *all* systems have specific locations where applications are stored and accessed from?
MS-DOS is primitive. This is why it can list all available commands. There are exactly 869 binaries on my system, not counting third-party applications installed by the administrator/user. What good would a list that long do? I can have a list by listing the (s)bin directory contents, duh. I can also search by keywords: apropos "list directory" returns ls(1) - list directory contents. Now a simple man ls, and I know all I needed to know about that command.

edfed wrote:
and to add a command, just add it to command/ folder.

Or even simpler, add it to the bin (< again) directory in your home directory. No need to ask the administrator (if this is not your machine) or to increase your privilege and add the binary to a system directory. But you are always free to do so if you like.

edfed wrote:
if only it was simple to understand

You can get help online. The number of tutorials and introductory documents is just incredible and you have no excuse. I just searched for "basic Unix" and "basic Linux" on Google and got thousands of pages in 0.13 seconds.

edfed wrote:

for example, how to lowcase all files names under linux?
it is very hard, the command is very long.

So hard a 4-line shell script would be enough. But the question is why would you even need to do that to begin with? I have already asked you this question before and you did not reply.
Code:
for old in *; do
new=`echo $old | tr [:upper:] [:lower:]`
mv "$old" "$new"
done
    


edfed wrote:
under dos, no matter, it doesn't make distinctions between up and low case names.

And? Why is this such a big deal to you?

edfed wrote:
and even if it is needed, just compile a .com code and it is ok.

I don't follow. Could you explain what you mean here?

edfed wrote:
the more logic os beetwen DOS and UNIX is DOS.

How so?

edfed wrote:
an that's why microsoft is the king, just because they did it the simple way.

Nope, just better marketers. And most *nix systems that are heavily developed by corporations (that have financial resources) are targeted to corporations and won't bother with or care about desktop users.

MS-DOS is so primitive only (assembly?) programmers still use it. People stopped using it 15 years ago when they stopped having to type win.com to start Windows. Most people today have never heard of it or of the command interpreter under Windows.
On the other hand, *nix shells and text-based applications can still be used in 2010 as they were in 1970 for every single task not requiring graphics.

Why are you even comparing the two is beyond me.

edfed wrote:
linux had choosen the hard way to work, something like an experimental brainfuck logic.

Or maybe you are just not used to it. Many people can't understand the logic of Windows either, even with its supposedly user-friendly mouse-oriented interface.
A powerful, primarily text-based OS is not for the faint-hearted, but it doesn't mean you can't learn it if you are willing to.
And please expose the "experimental brainfuck logic" of *nix systems. I'm listening...

edfed wrote:
if something should be made around linux is to simplify it a lot, just in order to be able ot run drivers. but no more.

Why? What do you think is useless? What should be removed? Have you actually tried a lightweight distro?

edfed wrote:
something like a multi line comand line can be cool.

It is called shell scripting. But unfortunately you must store the commands in a file and execute the file, which is a very tedious and difficult thing to do, I know. Razz
Post 24 Oct 2010, 20:19
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 30 Oct 2010, 05:28
edfed, Linus agrees.

Maybe you should try a BSD. I tried FreeBSD once and removed it in less time than it took to install, but PC-BSD sounds like it might be easier to use. I'm installing it in a VM right now. I'll let you know whether it's worth messing with after I've tried it a little. ManofSteel, any input here?
Post 30 Oct 2010, 05:28
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 30 Oct 2010, 10:57
Tyler wrote:
edfed, Linus agrees.

But I doubt he does with the rest of edfed's criticism though. Wink

Tyler wrote:
ManofSteel, any input here?

I can't say much since I've never tried it. I don't particularly like KDE or PBIs as I am a minimalist and prefer vanilla FreeBSD. But PC-BSD must be a good choice for newcomers to BSD precisely because of these, i.e. KDE's Windows-like look and "feel", the great number of ready-to-use desktop applications and the PBI system that spares the user some dependency trouble later on.
Post 30 Oct 2010, 10:57
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 30 Oct 2010, 13:58
let's go for the linux kernel in asm.

but only the kernel for the moment.

only means:

read and understand the last linux kernel 2.6.36, 340 MB of source.
34299 files in 2084 folders. Shocked
Post 30 Oct 2010, 13:58
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 30 Oct 2010, 14:19
I think it would be better to write your own OS from scratch. Don't go the Linux way.

Dedicated ASM OS: Boots in <0.1s, batteries last four weeks, response time is <50us.
Linux bloated OS: Boots in >40s, batteries last three days, response time is >10ms.

Those results are for ARM. X86 results may differ
Post 30 Oct 2010, 14:19
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 30 Oct 2010, 22:40
mindcooler wrote:
I compiled Openoffice.org on a Pentium-166. Took a week.


Yikes! That's dedication! You win teh internetz. Wink
Post 30 Oct 2010, 22:40
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 30 Oct 2010, 23:00
Tomasz Grysztar wrote:
I regret I didn't have a chance to get to know OS/2 better. I always wanted to, but in fact had just a single opportunity to do a little clickety-click on one machine running it at university - nothing more.


Is this in response to REXX? (Doubt it, there are several implementations for non-OS/2 OSes, e.g. Regina, BRexx, r4 or roo, ooRexx). Besides, eCS 2.0 was just released not too long ago, so OS/2 still lives.
Post 30 Oct 2010, 23:00
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 30 Oct 2010, 23:32
ManOfSteel wrote:

Don't *all* systems have specific locations where applications are stored and accessed from?
MS-DOS is primitive.


... by default, but you can extend it (like anything) as per original design. Original Linux was primitive too.

Quote:

This is why it can list all available commands. There are exactly 869 binaries on my system, not counting third-party applications installed by the administrator/user.


The smallest Linux mini distros seem to use Busybox to combine C lib usage or use a scripting language to duplicate common functionality (tomsrtbt, ETlinux).

Quote:
edfed wrote:
if only it was simple to understand

You can get help online. The number of tutorials and introductory documents is just incredible and you have no excuse. I just searched for "basic Unix" and "basic Linux" on Google and got thousands of pages in 0.13 seconds.


You need to learn POSIX tools, Linux ABI, C, AT&T asm, sh, awk, m4, Autotools, Perl, Python, pthreads, X11, ncurses, and a myriad of other things, not to mention distro-specific package managers, etc.

Quote:
edfed wrote:
an that's why microsoft is the king, just because they did it the simple way.

Nope, just better marketers.


Nope, just cheaper and first to market (since CP/M-86 was delayed and too expensive). It was based upon a "quick and dirty" CP/M clone (only the API, not binary compatible) for 16-bit machines, esp. IBM's 5150 PC (8088). It had to be minimal to run in minimum 16 kb of RAM!! You think Linux ever did that?? Yet even they used to run in 2 MB of RAM, heh. Not anymore. Wink (Okay, ELKS can, but it's only a subset and fairly frozen.)

Quote:

MS-DOS is so primitive only (assembly?) programmers still use it.


I think we can all agree that assembly isn't evil, it's quite nice. You can't really write an OS in C anyways without lots of extensions (says Linus, which is why they rely so heavily on GCC).

But obviously it's not totally true since 90% of DOS apps are written in HLLs, esp. the FreeDOS kernel (almost entirely C-based, even if using 16-bit compiler extensions). The original DOS/NT (commercial predecessor) ran on 68000 cpus.

Quote:

People stopped using it 15 years ago when they stopped having to type win.com to start Windows.


No, MS just (intentionally) stopped selling it separately. Part of that was strategic / marketing, part of that was because they were (early on) thinking that anything without a GUI was obsolete.

DOS (and BIOS) was still heavily used under the hood until NT was pushed out (XP for home consumers, 2k before that for businesses).

Quote:

Most people today have never heard of it or of the command interpreter under Windows.


You cannot do some things in the CLI. That's a design decision, they want you to (mostly) use the GUI.

Quote:

On the other hand, *nix shells and text-based applications can still be used in 2010 as they were in 1970 for every single task not requiring graphics.


The "original" 1970 *nix is not supported anymore, nor by GNU. Most projects only target POSIX, and the original Bourne shell is not POSIX compliant (ironically enough).

Quote:

A powerful, primarily text-based OS is not for the faint-hearted, but it doesn't mean you can't learn it if you are willing to.


You can learn anything ... and will have to! Everybody does things in completely new, incompatible ways. Very frustrating. You can't even know whether to single-click or double-click, whether case sensitivity matters, what standards are supported, what bugs exist, etc. It's a big mess, one big minefield. Just saying "learn it!" is a weak excuse because that gets tiring after being on the (forced) upgrade treadmill for so many years.

Quote:
edfed wrote:
if something should be made around linux is to simplify it a lot, just in order to be able ot run drivers. but no more.

Why? What do you think is useless? What should be removed? Have you actually tried a lightweight distro?


Slitaz is 30 MB .ISO w/ X11, Midori www. Of course, BlueFlops is even slimmer (links, IRC) in two floppies. Both of those are Linux. I know the former has DOSBox 0.73 in their online repo (so grab it via tazpkg). Still, even then, I think the former needs at least 100+ MB of RAM. I know, it's easy to say, "Who cares these days?", but you do realize that the whole constant upgrade process is laborious and painful and should be avoided. Honestly, I blame bad compilers (and linkers), maybe even C libs, not necessarily the languages themselves. But it's harder when nobody even will acknowledge that there's a problem.

Quote:
edfed wrote:
something like a multi line comand line can be cool.

It is called shell scripting. But unfortunately you must store the commands in a file and execute the file, which is a very tedious and difficult thing to do, I know. Razz


To be fair, shell scripting can be useful, but anybody who tells me it isn't horribly arcane is lying. Autoconf is just ridiculous, and the configure script often outweighs the binary itself!!! You want to know why things are so big? Because they try to align everything and use less than compact encodings for (hopefully) faster speed. GNU Emacs includes ten copies of COPYING, full eLisp manuals and sources, both source AND byte-compiled .el / .elc files (way too tedious to do manually for most people), not to mention extremely huge Changelog.* files (and the aforementioned configure bloat). Face it, Tomasz' FASM IDEs can edit text too. Heck, I've seen several < 4 KB text editors (unsurprisingly written in x86 asm). Bloat is all in the name of POSIX portability and the confusion that is C/C++. Sadly, sometimes their "portable" code is no more portable than FASM itself!!

EDIT: minor corrections.
Post 30 Oct 2010, 23:32
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 31 Oct 2010, 04:43
rugxulo wrote:
Tomasz Grysztar wrote:
I regret I didn't have a chance to get to know OS/2 better. I always wanted to, but in fact had just a single opportunity to do a little clickety-click on one machine running it at university - nothing more.


Is this in response to REXX?
Yes, it is. Those two terms remain closely connected in my mind and I thought of it as a good opportunity to menion this system.
Post 31 Oct 2010, 04:43
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 31 Oct 2010, 11:33
Tomasz Grysztar,

My REXX reference was about russian VM/CMS analogue running on russian IBM System/360 analogue («СВМ» and «ЕС-1022» in russian, respectively). I remember striking similarity of it with PL/I which I was learning using pen-and-paper method several years earlier. Wink
Post 31 Oct 2010, 11:33
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 01 Nov 2010, 05:16
baldr wrote:
Tomasz Grysztar,

My REXX reference was about russian VM/CMS analogue running on russian IBM System/360 analogue («СВМ» and «ЕС-1022» in russian, respectively). I remember striking similarity of it with PL/I which I was learning using pen-and-paper method several years earlier. Wink


REXX existed well before OS/2, beginning since at least 1980 or so (in various forms). TRL2 was finalized in 1990, ANSI in 1996, ooREXX and NetRexx are separate, mostly later. (IBM did include Rexx since OS/2 1.3 and PC-DOS 7 had it too I think, but Amiga had its own clone too.)

REXX originated on mainframes as both an easier PL/I and as a more advanced / cleaner / simpler EXEC replacement.

I've only weakly dabbled in it off and on for a few months, so I'm no expert. But everything's a string, arbitrary precision arithmetic, minimal sigil usage, no reserved words, nested comments, and obviously tightly bound to the system shell (aka glue or macro), can be embedded in apps (e.g. THE editor), etc. Oh, and built-in debugger. Oh, almost forgot, INTERPRET keyword for fancy stuff. Wink

But yeah, I'm sure somebody will marginalize it as "yet another" scripting langauge (Awk, Perl, Python, Ruby, Scheme). Oh well, they all have their uses, I guess.
Post 01 Nov 2010, 05:16
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.