Hello Jon,
Jon Gentil wrote to James Vahn :
JG> Is there a programming library for X-Windows? I've been kinda
JG> gathering info about Linux, and was wondering.
Below I show you the beginning of my X-Windows-Linux-Asm experiments. It's
just a beginning, and there is a lot that we have to learn. Maybe,
together, we can create some nice macro's to write beautiful
___xwin.s__________________________________________________________________
.include "/home/jan/assembler/include/xwindows.asm"
.globl main
main:
movl $2,blk
movl $3,wht
_openwindow $256,$500
pushl $50
call sleep
addl $4,%esp
ret
.END
___________________________________________________________________________
___/home/jan/assembler/include/xwindows.asm________________________________
#Hier dient nog veel bekeken aangepast, en bestudeert te worden.
#Maar, kom het is al een begin hé ;-)
#OpenWindow : Call OpenWindow
.err_disp:
.string "Cannot open display\n"
OpenWindow:
pushl %ebp
movl %esp,%ebp
subl $100,%esp
pushl $0
call XOpenDisplay
addl $4,%esp
# movl %eax,%eax
movl %eax,disp
cmpl $0,disp
jne .Display_Is_Open
pushl $.err_disp
call printf
addl $4,%esp
pushl $1
call exit
addl $4,%esp
jmp .einde
.Display_Is_Open:
movl disp,%eax
movl disp,%edx
movl 132(%edx),%ecx
movl %ecx,%edx
sall $2,%edx
addl %ecx,%edx
movl %edx,%ecx
sall $4,%ecx
movl 140(%eax),%eax
movl 8(%eax,%ecx),%edx
movl %edx,Root
movl disp,%eax
movl 132(%eax),%edx
movl %edx,scr
movl disp,%eax
movl scr,%ecx
movl %ecx,%edx
sall $2,%edx
addl %ecx,%edx
movl %edx,%ecx
sall $4,%ecx
movl 140(%eax),%eax
movl 56(%eax,%ecx),%edx
movl %edx,blk
movl disp,%eax
movl scr,%ecx
movl %ecx,%edx
sall $2,%edx
addl %ecx,%edx
movl %edx,%ecx
sall $4,%ecx
movl 140(%eax),%eax
movl 52(%eax,%ecx),%edx
movl %edx,wht
movl disp,%eax
movl scr,%ecx
movl %ecx,%edx
sall $2,%edx
addl %ecx,%edx
movl %edx,%ecx
sall $4,%ecx
movl 140(%eax),%eax
movl 40(%eax,%ecx),%edx
movl %edx,vis
movl blk,%eax
pushl %eax
movl blk,%eax
pushl %eax
pushl $0
movl height,%eax
addl $2,%eax
pushl %eax
movl width,%eax
addl $2,%eax
pushl %eax
pushl $0
pushl $0
movl Root,%eax
pushl %eax
movl disp,%eax
pushl %eax
call XCreateSimpleWindow
addl $36,%esp
# movl %eax,%eax
movl %eax,win
# movl win,%eax
pushl %eax
movl disp,%eax
pushl %eax
call XMapWindow
addl $8,%esp
pushl $0
movl disp,%eax
pushl %eax
call XSync
addl $8,%esp
leal -92(%ebp),%eax
pushl %eax
pushl $0
movl win,%eax
pushl %eax
movl disp,%eax
pushl %eax
call XCreateGC
addl $16,%esp
movl %eax,%eax
movl %eax,fg
leal -92(%ebp),%eax
pushl %eax
pushl $0
movl win,%eax
pushl %eax
movl disp,%eax
pushl %eax
call XCreateGC
addl $16,%esp
movl %eax,%eax
movl %eax,bg
movl wht,%eax
pushl %eax
movl fg,%eax
pushl %eax
movl disp,%eax
pushl %eax
call XSetForeground
addl $12,%esp
movl blk,%eax
pushl %eax
movl bg,%eax
pushl %eax
movl disp,%eax
pushl %eax
call XSetBackground
addl $12,%esp
.einde:
movl %ebp,%esp
popl %ebp
ret
.comm disp,4,4
.comm Root,4,4
.comm win,4,4
.comm vis,4,4
.comm scr,4,4
.comm fg,4,4
.comm bg,4,4
.comm blk,4,4
.comm wht,4,4
.comm width,4,4
.comm height,4,4
.MACRO _openwindow x y
# start _openwindow
pushal
movl \x,width
movl \y,height
call OpenWindow
popal
# end _openwindow
.ENDM
___________________________________________________________________________
as xwin.s -o xwin.o
gcc xwin.o -o xwin -lX11 -L/usr/X11/lib
or (less typing-work ;-)
gcc xwin.s -o xwin -lX11 -L/usr/X11/lib
Have a nice day, Jon. - Jan Wagemakers -
.!. Life is short and love is always over in the morning (The Sisters of
Mercy)
--- Terminate 4.00/Pro
(2:292/8133.23)
---------------
* Origin: - Belgi‰/Belgium - Internet : JanW@mail.dma.be
|