_ _:. :$$$$$ _ . - +. :l$³³$$ s¿¿,,_ +:@QSSS$$$$$ `` $$$$$$$$bs¿.`"Ù?$$$l [ MeOs or ] 'ÀÀ?$$³$$$$b¿_ . [ Another one "Toy story".. ] `"À$³$b. . [ Mr.Clumsy ] `À?b. `. [ clumsy@ngs.ru ] `Ù. + `$ _. ` First,I planed to make detailed overview of this OS,but since there are enough published info, I was limited by little description. The history of MeOS goes into distant 2000 year, when the idea about creating an own OS came into head and realized by hands of some finish student Ville Turjanmaa. MenuetOS (MeOS next...) has fully written in 32-bits assembler, works in protected mode, has good developed and kinda simple graphic API (MFC sucks), support VESA v.1.0 and v.2.0. The kernel already has ethernet drivers (rtl mostly), mouse drivers, sound etc...in other words MeOS has enough facilities for software developing. It's damn tiny, and with most applications it could reside on single 3.5 floppy disk. In spite of the fact that it written in assembler, it is possible to develop soft with other programming languages. As primary file system MeOS using FAT32. Minimal development environment: TinyPad - text editor and FASM - Flat Assembler [3]. It's enough to code full-fledged program. The applications work based on events, i.e. on scheme: 1) awaiting for event 2) reading type of event 3) reacting on it (or do not reacting) All much simply. The typical program should have 3 base events handlers: window redrawing, buttons pressing, "pressing" onto buttons of application. I.e. the structure of minimal application: +-->---->---+ | | | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ³ wait until event ³ | ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ^ | | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ³ is redraw event? ³ -- true --> ³ redraw screen ³ -+ | ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | | | | | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | | ³ is key pressed? ³ -- true --> ³ process keys ³ -+ | ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | | | | | ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ^ ³is button pressed?³ -- true --> ³ process buttons ³ -+ | ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | | | | +----<---<--+--------------------<-------------------<----+ process keys - processing of button's pressing on keyboard. process buttons - processing of button's pressing in application's window.most simple "reaction" - application's closing. System calls in MeOS realized via 0x40 interrupt. "Hello world" examples makes me vomits, so as example i did port my "3D stars", that was written for MS-DOS ages ago. Easy and more interesting :). In principle, there is nothing hard in programming for MeOS, especialy for those, who ever coded for MS-DOS and alike OS's in asm. For C++ lovers and other HLL stuff it would be a bit hard (just on first steps), but wtf we don't look for easy ways hehe 8). At first time of my acquaintance with MeOS, I was wonder by fact, that applications like FASM, TinyPad and others, looks kinda strange ;), but only when you try to resize it on full screen. Those "bugz" ain't critical, but leaves bad impression. Button "Close", that reside in the upper-right corner, stay on the same distance from upper-left corner. It looks ugly, when initial width of window was 300 pixels and after "resizing" button "close" reside in the middle of the title bar. Since it's annoyed me, I've fixed it. There is example of redrawing of "close" button from standart applications in MeOS: ; CLOSE BUTTON mov eax,8 ; function 8 : define and draw button mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size] mov ecx,5*65536+12 ; [y start] *65536 + [y size] mov edx,1 ; button id mov esi,0x6677cc ; button color RRGGBB int 0x40 This piece is from example.asm by Ville. As we could see, x-coordinate of button is fixed - (300-19)=281 pixel from start of window. While changing the width from 300 to 600 the button "close" would draw on the same place (281,5). Indeed, realization of normal window without described visual bugs isn't a hard task. I don't know why authors of other programs didn't fix this defect. Probably because of laziness, or because example.asm hasn't it. Well, to get the width of window we need information about current process: get_process_info: mov eax,9 ; get information about process mov ebx,PInfo ; pointer to buffer, where the data ; where the data would be stored ; (1024 bytes) mov ecx,-1 ; get info about current process int 0x40 Btw, an official description of that function has a little misprint. Find by your own 8). Now with information about process, we can create window without worry about visual bugs: draw_window: mov eax,12 ; function 12: mean, that we would draw ; the window. mov ebx,1 ; 1, start of drawing int 0x40 mov eax,0 ; function 0 : define and draw the window mov ebx,100*65536 ; [x start] * 65536 add ebx,[process_window_width] ; add the width mov ecx,100*65536 ; [y start] * 65536 add ecx,[process_window_height] ; add height mov edx,0x02000000 ; define color mov esi,0x805080d0 ; title bar mov edi,0x005080d0 ; border int 0x40 ; header mov eax,4 ; function 4 : write a text in window mov ebx,8*65536+8 ; [x start] * 65536 + [y start] mov ecx,0x00ddeeff ; font 0 and color ( 0xF0RRGGBB ) mov edx,labelt ; adress of text mov esi,labellen-labelt ; length of text int 0x40 ; button "close" mov eax,8 ; function 8: define and draw button mov ebx,[process_window_width] ; width sub ebx,19 ; -19 shl ebx,16 ; * 65536 add ebx,12 ; + width of button mov ecx,5*65536+12 ; [y start] *65536 + [y size] mov edx,1 ; button's identifier mov esi,0x6688dd ; button's color RRGGBB int 0x40 ... ; Here is information about process PInfo: processor_use: dd 0 stack_pos: dw 0 stack_value: dd 0 process_name: db 0,0,0,0,0,0,0,0,0,0,0,0 process_address: dd 0 used_memory: dd 0 process_id: dd 0 process_x_coord: dd 0 process_y_coord: dd 0 process_window_width: dd 320 process_window_height: dd 240 So, we have a nice window with "close" button in upper-right corner ;) source code in bonus (coolapp.asm). Time to turn into network. Documentation tell us, that tcp\ip stack has: IP layer. ICMP. TCP layer. UDP layer. + complete: local loopback. Realtek 8029 PCI ethernet interface. Realtek 8139 PCI ethernet interface. Intel i8255x PCI ethernet interface. Dynamic ARP table. PPP dialer And still in process: The IP layer process header options. The IP layer support routing. Packet fragmentation. Interaction between hosts in network under management of MeOS, realized by sockets (as in many other OS's). The bonus has 2 files: client.asm/server.asm Server open socket on 83 port: mov eax,53 ; open tcp socket mov ebx,5 ; mov ecx,[local_port] ; 83rd port mov edx,0 ; remote port 0, because it's not necessary for us mov esi,0 ; remote ip address also are not necessary mov edi,0 ; mode: SOCKET_PASSIVE int 0x40 , listen and write input data: mov eax,53 ; poll socket mov ebx,2 mov ecx,[socket] int 0x40 ; cmp eax,0 ; in EAX - number of bytes in socket buffer je no_data mov eax,53 ; read data from socket mov ebx,3 mov ecx,[socket] int 0x40 ; in BL after this - data byte mov byte [text+ebp],bl <...> And so on... (full src in bonus). Accordingly, client connects to port and send data, that is typed from keyboard. Most pleasantly, is that it is possible to transfer data even by single byte (what is done in example): key: ; key pressed mov eax,2 ; just read it int 0x40 cmp al,0 ; al = 0 - key pressed jne still ; in AH - code of a key <...> mov eax,53 ; write symbol to socket mov ebx,7 ; mov ecx,[socket] mov edx,1 ; bytes to write mov esi,text ; address to data add esi,ebp int 0x40 Leading the total to this short narrative, we can say, that MeOS is kinda raw and far away from modern operation systems, but it has good beginning... references: [1] http://www.menuetos.org [2] http://www.flatassembler.net [3] http://www.menuet.narod.ru