View Full Version: M:Pipes - a new game for menuet

meos32 >>Programs >>M:Pipes - a new game for menuet


cYfleXX- 03-30-2006
M:Pipes - a new game for menuet
Hi! Try it out on a real menuet machine. It doesn't work correctly with MeosDebug. http://www.geocities.com/cfx_ebits/menuet/pipes.zip Have Fun!

Mario79- 03-30-2006

cYfleXX The interesting game! You can make choice of a level of complexity at the expense of change of time allocated up to water or speed of water? Good luck.

hidnplayr- 03-30-2006

Nice game! you can make it even smaller by compressing files into gif files. a little example: use32 org 0x0 db 'MENUET01' ; 8 byte id dd 0x01 ; header version dd START ; start of code dd IM_END ; size of image dd I_END ; memory for app dd I_END ; esp dd 0x0 , 0x0 ; I_Param , I_Icon include 'gif.inc' START: giftoimg file_area,header ; decompress the gif file in 'file_area' to 'header' draw_window: mov eax,12 ; function 12:tell os about windowdraw mov ebx,1 ; 1, start of draw int 0x40 ; DRAW WINDOW mov eax,0 ; function 0 : define and draw window mov ebx,100*65536+32 ; [x start] *65536 + [x size] mov ecx,100*65536+32 ; [y start] *65536 + [y size] mov edx,0x00000000 ; color of work area RRGGBB,8->color gl mov esi,0x00000000 ; color of grab bar RRGGBB,8->color gl mov edi,0x00000000 ; color of frames RRGGBB int 0x40 ; CLOSE BUTTON mov eax,8 ; function 8 : define and draw button mov ebx,0*65536+32 ; [x start] *65536 + [x size] mov ecx,0*65536+32 ; [y start] *65536 + [y size] mov edx,1 ; button id mov esi,0x0ffffff ; button color RRGGBB int 0x40 call drawicon mov eax,12 ; function 12:tell os about windowdraw mov ebx,2 ; 2, end of draw int 0x40 still: mov eax,10 ; wait here for event int 0x40 cmp eax,1 ; redraw request ? je red cmp eax,2 ; key in buffer ? je key cmp eax,3 ; button in buffer ? je button jmp still red: ; redraw call draw_window jmp still key: ; key mov eax,2 ; read it int 0x40 jmp still button: ; button mov eax,17 ; get id int 0x40 mov eax,-1 ; close this program int 0x40 jmp still drawicon: mov eax,7 mov ebx,icon mov ecx,32*65536+32 mov edx,1*65536+1 int 0x40 ret file_area: file 'fasm.gif' ; include the file rb 10 IM_END: ; header; 8 bytes containing size etc header: rb 8 ; the RAW image icon: rb 32*32*3 gif_hash_offset: rd 4096+1 ;hash area size for unpacking I_END: this is gif.inc: COLOR_ORDER equ MENUETOS macro giftoimg gifsrc,imgsrc { local hasharea, ReadGIF, nextblock,_null local globalColor, img_count, cur_info, img_start local codesize, compsize, bit_count, CC, EOI, Palette local block_ofs, table_ptr, gifmacend local no_gc, block_skip, no_comm, noextblock, uselocal local setPal, filltable, reinit, cycle, zadd, noinc local notintable, er, zend, nxt, continue, ex, Gif_skipmap local Gif_get_sym, shift, nextbl, noblock, loop1, exx local Gif_output, next, loop2 _null fix 0x1000 ; 0x1000 mov esi,gifsrc ;“ª § â¥«ì ­ ƒˆ” ä ¨« ¢ ¯ ¬ï⨠mov edi,imgsrc ;“ª § â¥«ì ­ ᯨ᮪ ª à⨭®ª mov eax,gif_hash_offset ; ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â call ReadGIF jmp gifmacend ReadGIF: push esi edi mov [table_ptr],eax mov [cur_info],edi xor eax,eax mov [globalColor],eax mov [img_count],eax inc eax cmp dword[esi],'GIF8' jne er ; signature mov ecx,[esi+0xa] inc eax add esi,0xd mov edi,esi bt ecx,7 jnc nextblock mov [globalColor],esi call Gif_skipmap nextblock: cmp byte[edi],0x21 jne noextblock inc edi cmp byte[edi],0xf9 ; Graphic Control Ext jne no_gc add edi,7 jmp nextblock no_gc: cmp byte[edi],0xfe ; Comment Ext jne no_comm inc edi block_skip: movzx eax,byte[edi] lea edi,[edi+eax+1] cmp byte[edi],0 jnz block_skip inc edi jmp nextblock no_comm: cmp byte[edi],0xff ; Application Ext jne nextblock add edi,13 jmp block_skip noextblock: cmp byte[edi],0x2c ; image beginning jne er inc [img_count] inc edi mov esi,[cur_info] xchg esi,edi ; movsd ; movsd mov bp,word[esi+4] movzx ebx,bp mov [edi],ebx mov bp,word[esi+6] movzx ebx,bp mov [edi+4],ebx add edi,8 add esi,8 push edi movzx ecx,word[esi] inc esi bt ecx,7 jc uselocal push [globalColor] mov edi,esi jmp setPal uselocal: call Gif_skipmap push esi setPal: movzx ecx,byte[edi] inc ecx mov [codesize],ecx dec ecx pop [Palette] lea esi,[edi+1] mov edi,[table_ptr] xor eax,eax cld lodsb ; eax - block_count add eax,esi mov [block_ofs],eax mov [bit_count],8 mov eax,1 shl eax,cl mov [CC],eax inc eax mov [EOI],eax lea ecx,[eax-1] mov eax, _null shl 16 filltable: stosd inc eax loop filltable pop edi mov [img_start],edi reinit: mov edx,[EOI] inc edx push [codesize] pop [compsize] call Gif_get_sym cmp eax,[CC] je reinit call Gif_output cycle: movzx ebx,ax call Gif_get_sym cmp eax,edx jae notintable cmp eax,[CC] je reinit cmp eax,[EOI] je zend call Gif_output zadd: push eax mov eax,[table_ptr] mov [eax+edx*4],ebx pop eax cmp edx,0xFFF jae cycle inc edx bsr ebx,edx cmp ebx,[compsize] jne noinc inc [compsize] noinc: jmp cycle notintable: push eax mov eax,ebx call Gif_output push ebx movzx eax,bx call Gif_output pop ebx eax jmp zadd er: pop edi jmp ex zend: ; mov eax,[.cur_info] ; skip offset to next frame ; mov [eax],edi mov [cur_info],edi add esi,2 xchg esi,edi nxt: cmp byte[edi],0 jnz continue inc edi jmp nxt continue: ; cmp byte[edi],0x3b ;read next frame ; jne nextblock xor eax,eax stosd mov ecx,[img_count] ex: pop edi esi ret Gif_skipmap: ; in: ecx - image descriptor, esi - pointer to colormap ; out: edi - pointer to area after colormap and ecx,111b inc ecx ; color map size mov ebx,1 shl ebx,cl lea ebx,[ebx*2+ebx] lea edi,[esi+ebx] ret Gif_get_sym: mov ecx,[compsize] push ecx xor eax,eax shift: ror byte[esi],1 rcr eax,1 dec [bit_count] jnz loop1 inc esi cmp esi,[block_ofs] jb noblock push eax xor eax,eax lodsb test eax,eax jnz nextbl mov eax,[EOI] sub esi,2 add esp,8 jmp exx nextbl: add eax,esi mov [block_ofs],eax pop eax noblock: mov [bit_count],8 loop1: loop shift pop ecx rol eax,cl exx: xor ecx,ecx ret Gif_output: push esi eax edx mov edx,[table_ptr] next: push word[edx+eax*4] mov ax,word[edx+eax*4+2] inc ecx cmp ax,_null jnz next shl ebx,16 mov bx,[esp] loop2: pop ax lea esi,[eax+eax*2] add esi,[Palette] if COLOR_ORDER eq MENUETOS mov esi,[esi] bswap esi shr esi,8 mov [edi],esi add edi,3 else movsw movsb end if loop loop2 pop edx eax esi ret globalColor dd 1 img_count dd 1 cur_info dd 1 ; image table pointer img_start dd 1 codesize dd 1 compsize dd 1 bit_count dd 1 CC dd 1 EOI dd 1 Palette dd 1 block_ofs dd 1 table_ptr dd 1 gifmacend: }

Madis731- 03-31-2006

Works under MeOSEmul too ;) Fun game - reminds me of...the Old Times :$

cYfleXX- 03-31-2006

It's rather been made for our coffee break, while we're working on this really nice os! It's my second game after the small "pong for menuet" in 2001 @Mario79 @hidnplayr Thanks for the suggestions! I'm working on it! I used palletized bitmap images, drawn with tinypad <- really! really big!! :D cYfleXX

Dex- 03-31-2006

I have made a program that converts bmp/gif image to hex suitable for putting them strait into fasm programs as a inc file, save you hand coding it. You can get it here: http://jas2o.forthworks.com/dexforum/index.php?topic=54.0 Runs on Dex4U. Example of converted file: ;***************************************; ; ____ ____ __ __ ; ; | __ ) _ __ ___ _ __|___ \\ \/ / ; ; | _ \| '_ ` _ \| '_ \ __) |\ / ; ; | |_) | | | | | | |_) / __/ / \ ; ; |____/|_| |_| |_| .__/_____/_/\_\ ; ; |_| ; ; ; ; First dword = X size. ; ; Second dword = Y size. ; ; Rest of bytes = Converted image. ; ; Converted image = 3BPP. (Dex4U) ; ;***************************************; Image: db 0x30,0x00,0x00,0x00,0x30,0x00,0x00,0x00 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04 db 0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04,0x04,0x02,0x04

hidnplayr- 04-01-2006

in fasm, you can just use the following code and leave the files in same directory as source code.. image: file 'image.gif'

Madis731- 04-01-2006

I was just going to suggest that. Is there any problems that arise out of use on the MenuetOSs?

diamond- 04-17-2006

cYfleXX For making program smaller, it is not necessary to realize gif reading (gif code is relatively big). You can simply use executable packer mtappack, available at http://shade.msu.ru/~msu-se/mtappack.exe (Windows version, cross-platform) http://shade.msu.ru/~msu-se/mtappack (Menuet/Kolibri version, native) Compare: original executable is 12244 bytes long, zip-archive - 1845 bytes (and for work you need to unpack archive with some other program), mtappack'ed - 1854 bytes (and is valid executable, which can run directly). I think that in many cases it is better to use raw graphics data (or bmp-files) and compress with mtappack rather than use gif data, because compression methods aPLib and LZMA (used by mtappack) are not much worse than gif-pack and for gif method there is overhead for gif-reading code.

cYfleXX- 08-27-2006
new version available!
A new version of M:pipes is available! Now, with better graphics and three difficulties. http://www.geocities.com/cfx_ebits/menuet/pipes.zip ZIP includes sources, binaries and of course an icon-file for your desktop! binary is mtappack'ed - the easiest and most efficiently way, i think. The TODO-file is big - but time is money! 8) Have Fun! cYfleXX

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.