flat assembler
Message board for the users of flat assembler.
Index
> Linux > Trying to make Linux GUI executables |
Author |
|
ProMiNick 22 Apr 2018, 21:49
Can anyone share fasm sources of Linux GUI based on different graphic *so (glut,xlib,..)? (maybe glut & xlib of them is enough, because others are appendix over xlib?)
or maybe so: Can anyone compile examples from source and than share link to binaries? http://rus-linux.net/MyLDP/BOOKS/Linux-tools/GUI_01.html I will disassemle them and than place here fasm sources thanks in advance. _________________ I don`t like to refer by "you" to one person. My soul requires acronim "thou" instead. Last edited by ProMiNick on 29 Apr 2018, 23:41; edited 1 time in total |
|||
22 Apr 2018, 21:49 |
|
ProMiNick 29 Apr 2018, 23:40
This is not work GUI example but ideas around of it
Code: format ELF executable 3 entry start include 'format\format.inc' include 'FUNDAMENTALS\MACROS\struct.inc' include 'ABI\LINUX\x86\import.inc' include 'ABI\x86\proc.inc' struct _Xdisplay ext_data dd ? free_funcs dd ? fd dd ? conn_checker dd ? proto_major_version dd ? proto_minor_version dd ? vendor dd ? resource_base dd ? resource_mask dd ? resource_id dd ? resource_shift dd ? resource_alloc dd ? byte_order dd ? bitmap_unit dd ? bitmap_pad dd ? bitmap_bit_order dd ? nformats dd ? pixmap_format dd ? vnumber dd ? release dd ? headqEvent dd ? tailqEvent dd ? qEventlen dd ? last_request_read dd ? request dd ? last_req dd ? buffer dd ? bufptr dd ? bufmax dd ? max_request_size dd ? XrmHashBucketRec dd ? synchandler dd ? display_name dd ? default_screen dd ? nscreens dd ? screens dd ? motion_buffer dd ? flags dd ? min_keycode dd ? max_keycode dd ? keysyms dd ? modifiermap dd ? keysyms_per_keycode dd ? xdefaults dd ? scratch_buffer dd ? scratch_length dd ? ext_number dd ? ext_procs dd ? event_vec dd ? wire_vec dd ? lock_meaning dd ? lock dd ? async_handlers dd ? bigreq_size dd ? lock_fns dd ? idlist_alloc dd ? ;things above this line should not move, for binary compatibility key_bindings dd ? cursor_font dd ? atoms dd ? mode_switch dd ? num_lock dd ? context_db dd ? error_vec dd ? defaultCCCs dd ? clientCmaps dd ? perVisualIntensityMaps dd ? im_filters dd ? qfree dd ? next_event_serial_num dd ? flushes dd ? im_fd_info dd ? im_fd_length dd ? conn_watchers dd ? watcher_count dd ? filedes dd ? savedsynchandler dd ? resource_max dd ? xcmisc_opcode dd ? xkb_info dd ? trans_conn dd ? ends interpreter '/lib/ld-linux.so.2' needed 'libX11.so.6' needed 'libc.so.6' import libX11.XOpendisplay,'XOpendisplay',\ libX11.XCreateSimpleWindow,'XCreateSimpleWindow',\ libX11.XSelectInput,'XSelectInput',\ libX11.XMapWindow,'XMapWindow',\ libX11.XNextEvent,'XNextEvent',\ libX11.XFillRectangle,'XFillRectangle',\ libX11.XDrawString,'XDrawString',\ libX11.XClosedisplay,'XClosedisplay',\ \; libc.getenv,'getenv',\ libc.printf,'printf',\ libc.exit,'exit' segment readable executable start: xor eax,eax; cinvoke libc.getenv, envstr cinvoke libX11.XOpendisplay, eax mov [displ],eax test eax,eax ; jnz @F ; @@: virtual at eax _eax _Xdisplay end virtual mov edx,[_eax.default_screen] mov ecx,[_eax.nscreens] lea edx,[edx*4+edx] shl edx,4 add edx,ecx mov ebx,[edx+34h] ;WhitePixel mov ecx,[edx+38h] ;BlackPixel mov eax,[edx+8h] ;RootWindow cinvoke libX11.XCreateSimpleWindow, [displ],eax,10,10,200,200,1,ecx,ebx mov [hwnd],eax invoke libX11.XSelectInput, [displ],eax,$8001 ; ExposureMask | KeyPressMask = $8001 call [libX11.XMapWindow] ;, [displ],[hwnd] already in stack add esp,12 ;restore stack for libX11.XSelectInput ; jmp @f ; nop @B: cinvoke libX11.XNextEvent,[displ],XEvent cmp [XEvent],2 ; KeyPress jnz @F cmp [XEvent],$C ; Expose jnz @B mov ebx,[edx+2Ch] ;DefaultGC cinvoke libX11.XFillRectangle, [displ],[hwnd], ebx, 20, 20, 10, 10 cinvoke libX11.XDrawString, [displ],[hwnd], ebx, 50, 50, msg, msgsize @F: cinvoke libX11.XClosedisplay, [displ] cinvoke libc.exit segment readable writeable msg db 'Hello world!',0 msgsize = $-msg ;envstr db 'DISPLAY',0 displ dd ? hwnd dd ? XEvent dd ? previously i replace display with displ in too many places. fixed. (in source & in archive) now it looks like it should work. still not tested. I have only x64 Linux VM for now. Soon download x32, & will make fixies if they needed.
_________________ I don`t like to refer by "you" to one person. My soul requires acronim "thou" instead. |
|||||||||||
29 Apr 2018, 23:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.