1 Star 0 Fork 1

fengxueygr/asm_fragment

forked from 西边/asm_fragment 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
a19.s 14.60 KB
一键复制 编辑 原始数据 按行查看 历史
西边 提交于 2021-09-20 11:11 . comit
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
.text
.data
.comm window,8,32
.comm pixmap,8,32
.comm x,4,32
.comm y,4,32
.comm direct,4,32
.comm ybak,4,32
x:
.long 0
y:
.long 0
direct:
.long 1
ybak:
.long 0
.section .rodata
.LC0:
.string "绘图软件"
.LC1:
.long 0x0
.long 0x40080000 /* 3 */
.LC2:
.long 0x0
.long 0x40180000 /* 6 */
.LC3:
.string "delete_event"
.LC4:
.string "<u>绘图区域</u>"
.LC5:
.string "expose_event"
.LC6:
.string "configure_event"
.LC7:
.string "motion_notify_event"
.LC8:
.string "button_press_event"
.text
.globl main
scribble_configure_event:
pushq %rbp
movq %rsp,%rbp
subq $0x1000,%rsp
movq %fs:40,%rax
movq %rax,-0x1000(%rbp)
movq %rdi,-0xff8(%rbp) /* widget */
movq %rsi,-0xff0(%rbp) /* event */
movq %rdx,-0xfe8(%rbp) /* data */
movq pixmap(%rip),%rax
testq %rax,%rax
je .Lscribble_configure_event_400
movl $80,%esi
movq pixmap(%rip),%rdi
movl $0,%eax
call g_type_check_instance_cast
movq %rax,%rdi
movl $0,%eax
call g_object_unref
.Lscribble_configure_event_400:
movl $-1,%ecx
movq -0xff8(%rbp),%rdi /* widget */
leaq 72(%rdi),%rdi /* widget->allocation */
movl 4(%rdi),%edx /* widget->allocation.height */
movl 0(%rdi),%esi /* widget->allocation.width */
movq -0xff8(%rbp),%rdi /* widget */
movq 80(%rdi),%rdi /* widget->window */
movl $0,%eax
call gdk_pixmap_new
movq %rax,pixmap(%rip)
movq -0xff8(%rbp),%rdi /* widget */
leaq 72(%rdi),%rdi /* widget->allocation */
movl 4(%rdi),%eax /* widget->allocation.height */
movslq %eax,%rax
pushq %rax
movl 0(%rdi),%r9d /* widget->allocation.width */
movl $0,%r8d
movl $0,%ecx
movl $1,%edx
movq -0xff8(%rbp),%rdi /* widget */
movq 48(%rdi),%rdi
movq 872(%rdi),%rsi /* widget->style->white_gc */
movq pixmap(%rip),%rdi
movl $0,%eax
call gdk_draw_rectangle
movl $1,%eax
movq -0x1000(%rbp),%rcx
xorq %fs:40,%rcx
je .Lscribble_configure_event_0
movl $0,%eax
call __stack_chk_fail
.Lscribble_configure_event_0:
leave
ret
scribble_expose_event:
pushq %rbp
movq %rsp,%rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1000,%rsp
movq %rdi,-0x1000(%rbp) /* widget */
movq %rsi,-0xff8(%rbp) /* event */
movq %rdx,-0xff0(%rbp) /* data */
movq -0xff8(%rbp),%rdi /* event */
leaq 20(%rdi),%rdi /* event->area */
movl 12(%rdi),%eax /* event->area.height */
movl %eax,%r15d
movl 8(%rdi),%eax /* event->area.width */
movl %eax,%r14d
movl 4(%rdi),%eax /* event->area.y*/
movl %eax,%r13d
movl 0(%rdi),%eax /* event->area.x */
movl %eax,%r12d
movl 0(%rdi),%r9d /* event->area.x */
movl 4(%rdi),%r8d /* event->area.y */
movl 0(%rdi),%ecx /* event->area.x */
movq pixmap(%rip),%rbx
call gtk_widget_get_type
movq %rax,%rsi
movq -0x1000(%rbp),%rdi /* widget */
call g_type_check_instance_cast
movq -0xff8(%rbp),%rdi /* event */
leaq 20(%rdi),%rdi /* event->area */
pushq %r15
pushq %r14
pushq %r13
movl 0(%rdi),%r9d /* event->area.x */
movl 4(%rdi),%r8d /* event->area.y */
movl 0(%rdi),%ecx /* event->area.x */
movq pixmap(%rip),%rdx
movq %rax,%rdi
movl 34(%rdi),%eax
sall $3,%eax
movslq %eax,%rax
movq -0x1000(%rbp),%rdi /* widget */
movq 48(%rdi),%rdi /* widget->style */
leaq 544(%rdi),%rdi /* widget->style->fg_gc */
movq 0(%rdi,%rax,1),%rsi /* widget->style->fg_gc[GTK_WIDGET_STATE(widget)] */
movq -0x1000(%rbp),%rdi /* widget */
movq 80(%rdi),%rdi /* widget->window */
call gdk_draw_drawable
addq $24,%rsp
movl $0, %eax
leaq -40(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
leave
ret
draw_brush:
pushq %rbp
movq %rsp,%rbp
subq $0x1000,%rsp
movq %rdi,-0x1000(%rbp) /* widget */
movsd %xmm0,-0xff8(%rbp) /* x */
movsd %xmm1,-0xff0(%rbp) /* y */
movl $0,-0xfe0(%rbp) /* update_rect */
movsd -0xff8(%rbp),%xmm0 /* x */
subsd .LC1(%rip),%xmm0 /* 3 */
cvtsd2si %xmm0,%eax
leaq -0xfe0(%rbp),%rdi /* */
movl %eax,0(%rdi) /* update_rect.x */
movsd -0xff0(%rbp),%xmm0 /* y */
subsd .LC1(%rip),%xmm0 /* 3 */
cvtsd2si %xmm0,%eax
movl %eax,4(%rdi) /* update_rect.y */
// movl $6,8(%rdi) /* update_rect.width */
movl $36,8(%rdi) /* update_rect.width */
// movl $6,12(%rdi) /* update_rect.height */
movl $36,12(%rdi) /* update_rect.height */
leaq -0xfe0(%rbp),%rdi /* update_rect */
movl 12(%rdi),%eax /*update_rect.height */
movslq %eax,%rax
pushq %rax
movl 8(%rdi),%r9d /* update_rect.width */
movl 4(%rdi),%r8d /* update_rect.y */
movl 0(%rdi),%ecx /* update_rect.x */
movl $1,%edx
movq -0x1000(%rbp),%rdi /* widget */
movq 48(%rdi),%rdi /* widget->style */
movq 864(%rdi),%rsi /* widget->style->black_gc */
movq pixmap(%rip),%rdi
movl $0,%eax
call gdk_draw_rectangle
movl $0,%edx
leaq -0xfe0(%rbp),%rsi /* update_rect */
movq -0x1000(%rbp),%rdi /* widget */
movq 80(%rdi),%rdi /* widget->window */
movl $0,%eax
call gdk_window_invalidate_rect
movl $0,%eax
leave
ret
scribble_button_press_event:
pushq %rbp
movq %rsp,%rbp
subq $0x1000,%rsp
movq %rdi,-0x1000(%rbp) /* widget */
movq %rsi,-0xff8(%rbp) /* event */
movq %rdx,-0xff0(%rbp) /* data */
movq pixmap(%rip),%rax /* */
cmpq $0,%rax
jne .Lscribble_button_press_event_400
movl $0,%eax
jmp .Lscribble_button_press_event_0
.Lscribble_button_press_event_400:
movq -0xff8(%rbp),%rdi /* event */
cmpl $1,52(%rdi) /* event->button */
jne .Lscribble_button_press_event_390
movq -0xff8(%rbp),%rdi /* event */
movsd 32(%rdi),%xmm1 /* event->y */
movsd 24(%rdi),%xmm0 /* event->x */
movq -0x1000(%rbp),%rdi /* widget */
movl $0,%eax
call draw_brush
.Lscribble_button_press_event_390:
movl $1,%eax
.Lscribble_button_press_event_0:
leave
ret
scribble_motion_notify_event:
pushq %rbp
movq %rsp,%rbp
subq $0x1000,%rsp
movq %rdi,-0x1000(%rbp) /* widget */
movq %rsi,-0xff8(%rbp) /* event */
movq %rdx,-0xff0(%rbp) /* data */
movl $0,-0xfe0(%rbp) /* x */
movl $0,-0xfdc(%rbp) /* y */
movl $0,-0xfd8(%rbp) /* state */
cmpq $0,pixmap(%rip)
jne .Lscribble_motion_notify_event_400
movl $0,%eax
jmp .Lscribble_motion_notify_event_0
.Lscribble_motion_notify_event_400:
leaq -0xfd8(%rbp),%rcx /* state */
leaq -0xfdc(%rbp),%rdx /* y */
leaq -0xfe0(%rbp),%rsi /* x */
movq -0xff8(%rbp),%rdi /* event */
movq 8(%rdi),%rdi /* event->window */
movl $0,%eax
call gdk_window_get_pointer
movl -0xfd8(%rbp),%eax /* state */
andl $256,%eax
testl %eax,%eax
je .Lscribble_motion_notify_event_1
movl -0xfdc(%rbp),%edx /* y */
movl -0xfe0(%rbp),%esi /* x */
movq -0x1000(%rbp),%rdi /* widget */
movl $0,%eax
call draw_brush
.Lscribble_motion_notify_event_1:
movl $1,%eax
.Lscribble_motion_notify_event_0:
leave
ret
checkerboard_expose:
pushq %rbp
movq %rsp,%rbp
subq $0x1000,%rsp
movq %rdi,-0x1000(%rbp) /* da */
movq %rsi,-0xff8(%rbp) /* event */
movq %rdx,-0xff0(%rbp) /* data */
movl $0,-0xfe0(%rbp) /* i */
movl $0,-0xfdc(%rbp) /* j */
movl $0,-0xfd8(%rbp) /* xcount */
movl $0,-0xfd4(%rbp) /* ycount */
movq $0,-0xfd0(%rbp) /* gc1 */
movq $0,-0xfc8(%rbp) /* gc2 */
movl $0,-0xfc0(%rbp) /* color */
movq $0,-0xf80(%rbp) /* gc */
movq -0x1000(%rbp),%rdi /* da */
movq 80(%rdi),%rdi /* da->window */
movl $0,%eax
call gdk_gc_new
movq %rax,-0xfd0(%rbp) /* gc1 */
leaq -0xfc0(%rbp),%rdi /* color */
movw $30000,0(%rdi) /* color.red */
movw $0,2(%rdi) /* color.green */
movw $30000,4(%rdi) /* color.blue */
leaq -0xfc0(%rbp),%rsi /* color */
movq -0xfd0(%rbp),%rdi /* gc1 */
movl $0,%eax
call gdk_gc_set_rgb_fg_color
movq -0x1000(%rbp),%rdi /* da */
movq 80(%rdi),%rdi /* da->window */
movl $0,%eax
call gdk_gc_new
movq %rax,-0xfc8(%rbp) /* gc2 */
leaq -0xfc0(%rbp),%rdi /* color */
movw $65535,0(%rdi) /* color.red */
movw $65535,2(%rdi) /* color.green */
movw $65535,4(%rdi) /* color.blue */
leaq -0xfc0(%rbp),%rsi /* color */
movq -0xfc8(%rbp),%rdi /* gc2 */
call gdk_gc_set_rgb_fg_color
movl $0,-0xfd8(%rbp) /* xcount */
movl $2,-0xfe0(%rbp) /* i */
jmp .Lcheckerboard_expose_400
.Lcheckerboard_expose_500:
movl $2,-0xfdc(%rbp) /* j */
movl -0xfd8(%rbp),%eax /* xcount */
movl $2,%ebx
xorq %rdx,%rdx
idivl %ebx
movl %edx,-0xfd4(%rbp) /* ycount */
jmp .Lcheckerboard_expose_410
.Lcheckerboard_expose_490:
// movq $0,-0xf80(%rbp) /* gc */
movl -0xfd4(%rbp),%eax /* ycount */
movl $2,%ebx
xorq %rdx,%rdx
idivl %ebx
testl %edx,%edx
je .Lcheckerboard_expose_485
movq -0xfd0(%rbp),%rax /* gc1 */
movq %rax,-0xf80(%rbp) /* gc */
jmp .Lcheckerboard_expose_480
.Lcheckerboard_expose_485:
movq -0xfc8(%rbp),%rax /* gc2 */
movq %rax,-0xf80(%rbp) /* gc */
.Lcheckerboard_expose_480:
pushq $10
movl $10,%r9d
movl -0xfdc(%rbp),%r8d /* j */
movl -0xfe0(%rbp),%ecx /* i */
movl $1,%edx
movq -0xf80(%rbp),%rsi /* gc */
movq -0x1000(%rbp),%rdi /* da */
movq 80(%rdi),%rdi /* da->window */
movl $0,%eax
call gdk_draw_rectangle
movl -0xfdc(%rbp),%eax /* j */
addl $10,%eax
addl $2,%eax
movl %eax,-0xfdc(%rbp) /* j */
addl $1,-0xfd4(%rbp) /* ycount */
.Lcheckerboard_expose_410:
movq -0x1000(%rbp),%rdi /* da */
leaq 64(%rdi),%rdi /* da->allocation */
movl 12(%rdi),%eax /*da->allocation.height */
cmpl -0xfdc(%rbp),%eax /* j */
jg .Lcheckerboard_expose_490
addl $12,-0xfe0(%rbp) /* i */
addl $1,-0xfd8(%rbp) /* xcount */
.Lcheckerboard_expose_400:
movq -0x1000(%rbp),%rdi /* da */
leaq 64(%rdi),%rdi /* da->allocation */
movl 8(%rdi),%eax /* da->allocation.width */
cmpl -0xfe0(%rbp),%eax /* i */
jg .Lcheckerboard_expose_500
movl $80,%esi
movq -0xfd0(%rbp),%rdi /* gc1 */
call g_type_check_instance_cast
movq %rax,%rdi
call g_object_unref
movl $80,%esi
movq -0xfc8(%rbp),%rdi /* gc2 */
call g_type_check_instance_cast
movq %rax,%rdi
call g_object_unref
movl $1,%eax
leave
ret
time_handler:
pushq %rbp
movq %rsp,%rbp
subq $0x1000,%rsp
movq %rdi,-0x1000(%rbp) /* widget */
movq -0x1000(%rbp),%rdi /* widget */
cmpq $0,80(%rdi) /* widget->window */
jne .Ltime_handler_400
movl $0,%eax
jmp .Ltime_handler_0
.Ltime_handler_400:
cvtsi2sd y(%rip),%xmm1
cvtsi2sd x(%rip),%xmm0
movq -0x1000(%rbp),%rdi /* widget */
movl $0,%eax
call draw_brush
/*************************************/
// cmpl $1,direct(%rip)
// jne .Ltime_handler_390
//
// addl $3,x(%rip)
// cmpl $700,x(%rip)
// jle .Ltime_handler_391
// movl $2,direct(%rip)
// movl y(%rip),%eax
// movl %eax,ybak(%rip)
//.Ltime_handler_391:
// jmp .Ltime_handler_1
//
//.Ltime_handler_390:
// cmpl $2,direct(%rip)
// jne .Ltime_handler_380
// addl $3,y(%rip)
// movl ybak(%rip),%eax
// addl $40,%eax
// cmpl y(%rip),%eax
// jge .Ltime_handler_381
//
// movl $3,direct(%rip)
//
//.Ltime_handler_381:
// jmp .Ltime_handler_1
//
//.Ltime_handler_380:
// cmpl $3,direct(%rip)
// jne .Ltime_handler_370
//
// subl $3,x(%rip)
// cmpl $20,x(%rip)
// jge .Ltime_handler_371
// movl $4,direct(%rip)
// movl y(%rip),%eax
// movl %eax,ybak(%rip)
//
//.Ltime_handler_371:
// jmp .Ltime_handler_1
//.Ltime_handler_370:
// cmpl $4,direct(%rip)
// jne .Ltime_handler_1
//
// addl $3,y(%rip)
// movl ybak(%rip),%eax
// addl $40,%eax
// cmpl y(%rip),%eax
// jge .Ltime_handler_1
// movl $1,direct(%rip)
/*************************************/
.Ltime_handler_1:
movl $1,%eax
.Ltime_handler_0:
leave
ret
main:
pushq %rbp
movq %rsp,%rbp
subq $0x1000,%rsp
movl %edi,-0x1000(%rbp) /* argc */
movq %rsi,-0xff8(%rbp) /* argv */
movq $0,-0xff0(%rbp) /* frame */
movq $0,-0xfe8(%rbp) /* vbox */
movq $0,-0xfe0(%rbp) /* da */
movq $0,-0xfd8(%rbp) /* label */
leaq -0xff8(%rbp),%rsi /* argv */
leaq -0x1000(%rbp),%rdi /* argc */
movl $0,%eax
call gtk_init
movl $0,%edi
movl $0,%eax
call gtk_window_new
movq %rax,window(%rip)
call gtk_window_get_type
movq %rax,%rsi
movq window(%rip),%rdi
call g_type_check_instance_cast
leaq .LC0(%rip),%rsi
movq %rax,%rdi
movl $0,%eax
call gtk_window_set_title
movl $80,%esi
movq window(%rip),%rdi
call g_type_check_instance_cast
movl $0,%r9d
movl $0,%r8d
movl $0,%ecx
movq gtk_main_quit@GOTPCREL(%rip),%rdx
leaq .LC3(%rip),%rsi
movq %rax,%rdi
call g_signal_connect_data
call gtk_container_get_type
movq %rax,%rsi
movq window(%rip),%rdi
call g_type_check_instance_cast
movl $10,%esi
movq %rax,%rdi
movl $0,%eax
call gtk_container_set_border_width
movl $8,%esi
movl $0,%edi
call gtk_vbox_new
movq %rax,-0xfe8(%rbp) /* vbox */
call gtk_container_get_type
movq %rax,%rsi
movq -0xfe8(%rbp),%rdi /* vbox */
call g_type_check_instance_cast
movl $8,%esi
movq %rax,%rdi
call gtk_container_set_border_width
call gtk_container_get_type
movq %rax,%rsi
movq window(%rip),%rdi
call g_type_check_instance_cast
movq -0xfe8(%rbp),%rsi /* vbox */
movq %rax,%rdi
call gtk_container_add
movl $0,%edi
call gtk_label_new
movq %rax,-0xfd8(%rbp) /* label */
call gtk_label_get_type
movq %rax,%rsi
movq -0xfd8(%rbp),%rdi
call g_type_check_instance_cast
leaq .LC4(%rip),%rsi
movq %rax,%rdi
call gtk_label_set_markup
movl $0,%edi
call gtk_frame_new
movq %rax,-0xff0(%rbp) /* frame */
call gtk_frame_get_type
movq %rax,%rsi
movq -0xff0(%rbp),%rdi /* frame */
call g_type_check_instance_cast
movl $1,%esi
movq %rax,%rdi
call gtk_frame_set_shadow_type
call gtk_box_get_type
movq %rax,%rsi
movq -0xfe8(%rbp),%rdi /* vbox */
call g_type_check_instance_cast
movl $0,%r8d
movl $1,%ecx
movl $1,%edx
movq -0xff0(%rbp),%rsi /* frame */
movq %rax,%rdi
call gtk_box_pack_start
call gtk_drawing_area_new
movq %rax,-0xfe0(%rbp) /* da */
movl $800,%edx
movl $800,%esi
movq -0xfe0(%rbp),%rdi /* da */
call gtk_widget_set_size_request
call gtk_container_get_type
movq %rax,%rsi
movq -0xff0(%rbp),%rdi /* frame */
call g_type_check_instance_cast
movq -0xfe0(%rbp),%rsi /* da */
movq %rax,%rdi
call gtk_container_add
movl $0,%r9d
movl $0,%r8d
movl $0,%ecx
leaq scribble_expose_event(%rip),%rdx
leaq .LC5(%rip),%rsi
movq -0xfe0(%rbp),%rdi /* da */
call g_signal_connect_data
movl $0,%r9d
movl $0,%r8d
movl $0,%ecx
leaq scribble_configure_event(%rip),%rdx
leaq .LC6(%rip),%rsi
movq -0xfe0(%rbp),%rdi /* da */
call g_signal_connect_data
movl $0,%r9d
movl $0,%r8d
movl $0,%ecx
leaq scribble_motion_notify_event(%rip),%rdx
leaq .LC7(%rip),%rsi
movq -0xfe0(%rbp),%rdi /* da */
call g_signal_connect_data
movl $0,%r9d
movl $0,%r8d
movl $0,%ecx
leaq scribble_button_press_event(%rip),%rdx
leaq .LC8(%rip),%rsi
movq -0xfe0(%rbp),%rdi /* da */
call g_signal_connect_data
movq -0xfe0(%rbp),%rdi /* da */
call gtk_widget_get_events
orl $8192,%eax /* GDK_LEAVE_NOTIFY_MASK*/
orl $256,%eax /*GDK_BUTTON_PRESS_MASK */
orl $4,%eax /*GDK_POINTER_MOTION_MASK */
orl $8,%eax /*GDK_POINTER_MOTION_HINT_MASK */
movl %eax,%esi
movq -0xfe0(%rbp),%rdi /* da */
call gtk_widget_set_events
movq -0xfe0(%rbp),%rdx /* da */
leaq time_handler(%rip),%rsi
movl $100,%edi
call g_timeout_add
movq window(%rip),%rdi
call gtk_widget_show_all
call gtk_main
movl $0,%eax
leave
ret
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fengxueygr/asm_fragment.git
git@gitee.com:fengxueygr/asm_fragment.git
fengxueygr
asm_fragment
asm_fragment
master

搜索帮助