Lets see if you can do it!
1
Name:
Mc. Pants
2007-05-20 22:37
ID:NB2e5KHf
Hey guys, write an assembly language program that will allow the user to input 2 values, store them in declared variables, and display the smaller of the 2 values. Winner will get whatever they want on request, but to win it, provide the evidence by a screencap. Answers are fine too... (but screencap is the way to win!)
2
Name:
Anonymous
2007-05-20 22:40
ID:NB2e5KHf
How can you screencap through here, unless if you mean a link to it. Quick, provide links to the answer!
3
Name:
Anonymous
2007-05-20 22:46
ID:NB2e5KHf
input: fail, aids
if fail > aids then
fail = "You fail!"
ifelse
aids = "You got aids!"
so, did I win?
4
Name:
Anonymous
2007-05-20 22:57
ID:uKCy02kK
same person is same person
5
Name:
Anonymous
2007-05-20 22:58
ID:bvDibvxK
.section .rodata.str1.4,"aMS",%progbits,1
.align 2
.LC0:
.ascii "%d%d\000"
.align 2
.LC1:
.ascii "%d\012\000"
.text
.align 2
.global main
.type main, %function
main:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
str lr, [sp, #-4]!
sub sp, sp, #8
add r1, sp, #4
mov r2, sp
ldr r0, .L3
bl scanf
ldr r3, [sp, #0]
ldr r1, [sp, #4]
ldr r0, .L3+4
cmp r3, r1
movlt r1, r3
bl printf
mov r0, #0
add sp, sp, #8
ldmfd sp!, {pc}
.L4:
.align 2
.L3:
.word .LC0
.word .LC1
.size main, .-main
screens:
$ ./test
34
8
8
$ ./test
68758
456347
68758
$
6
Name:
Anonymous
2007-05-20 23:00
ID:mUtK74Yq
.section .ctors,"aw",@progbits
.align 8
.quad _GLOBAL__I_main
.text
.align 2
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB1408:
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
subq $16, %rsp
.LCFI2:
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
cmpl $1, -4(%rbp)
jne .L5
cmpl $65535, -8(%rbp)
jne .L5
movl $_ZSt8__ioinit, %edi
call _ZNSt8ios_base4InitC1Ev
movl $__dso_handle, %edx
movl $0, %esi
movl $__tcf_0, %edi
call __cxa_atexit
.L5:
leave
ret
.LFE1408:
.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
.globl __gxx_personality_v0
.align 2
.type _GLOBAL__I_main, @function
_GLOBAL__I_main:
.LFB1410:
pushq %rbp
.LCFI3:
movq %rsp, %rbp
.LCFI4:
movl $65535, %esi
movl $1, %edi
call _Z41__static_initialization_and_destruction_0ii
leave
ret
.LFE1410:
.size _GLOBAL__I_main, .-_GLOBAL__I_main
.align 2
.type __tcf_0, @function
__tcf_0:
.LFB1409:
pushq %rbp
.LCFI5:
movq %rsp, %rbp
.LCFI6:
subq $16, %rsp
.LCFI7:
movq %rdi, -8(%rbp)
movl $_ZSt8__ioinit, %edi
call _ZNSt8ios_base4InitD1Ev
leave
ret
.LFE1409:
.size __tcf_0, .-__tcf_0
.section .rodata
.LC0:
.string "ur doin it rong"
.text
.align 2
.globl main
.type main, @function
main:
.LFB1401:
pushq %rbp
.LCFI8:
movq %rsp, %rbp
.LCFI9:
subq $16, %rsp
.LCFI10:
leaq -4(%rbp), %rsi
movl $_ZSt3cin, %edi
call _ZNSirsERi
leaq -8(%rbp), %rsi
movl $_ZSt3cin, %edi
call _ZNSirsERi
movl -4(%rbp), %edx
movl -8(%rbp), %eax
cmpl %eax, %edx
jge .L11
movl -8(%rbp), %esi
movl $_ZSt4cout, %edi
call _ZNSolsEi
.L11:
movl -8(%rbp), %edx
movl -4(%rbp), %eax
cmpl %eax, %edx
jge .L13
movl -4(%rbp), %esi
movl $_ZSt4cout, %edi
call _ZNSolsEi
.L13:
movl -4(%rbp), %edx
movl -8(%rbp), %eax
cmpl %eax, %edx
jne .L15
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.L15:
movl $0, %eax
leave
ret
7
Name:
Anonymous
2007-05-20 23:01
ID:mUtK74Yq
>>6 continued...
.LFE1401:
.size main, .-main
.local _ZSt8__ioinit
.comm _ZSt8__ioinit,1,1
.weakref _Z20__gthrw_pthread_oncePiPFvvE,pthread_once
.weakref _Z27__gthrw_pthread_getspecificj,pthread_getspecific
.weakref _Z27__gthrw_pthread_setspecificjPKv,pthread_setspecific
.weakref _Z22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_,pthread_create
.weakref _Z22__gthrw_pthread_cancelm,pthread_cancel
.weakref _Z26__gthrw_pthread_mutex_lockP15pthread_mutex_t,pthread_mutex_lock
.weakref _Z29__gthrw_pthread_mutex_trylockP15pthread_mutex_t,pthread_mutex_trylock
.weakref _Z28__gthrw_pthread_mutex_unlockP15pthread_mutex_t,pthread_mutex_unlock
.weakref _Z26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t,pthread_mutex_init
.weakref _Z26__gthrw_pthread_key_createPjPFvPvE,pthread_key_create
.weakref _Z26__gthrw_pthread_key_deletej,pthread_key_delete
.weakref _Z30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t,pthread_mutexattr_init
.weakref _Z33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti,pthread_mutexattr_settype
.weakref _Z33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t,pthread_mutexattr_destroy
.section .eh_frame,"a",@progbits
.Lframe1:
.long .LECIE1-.LSCIE1
.LSCIE1:
.long 0x0
.byte 0x1
.string "zPR"
.uleb128 0x1
.sleb128 -8
.byte 0x10
.uleb128 0x6
.byte 0x3
.long __gxx_personality_v0
.byte 0x3
.byte 0xc
.uleb128 0x7
.uleb128 0x8
.byte 0x90
.uleb128 0x1
.align 8
.LECIE1:
.LSFDE1:
.long .LEFDE1-.LASFDE1
.LASFDE1:
.long .LASFDE1-.Lframe1
.long .LFB1408
.long .LFE1408-.LFB1408
.uleb128 0x0
.byte 0x4
.long .LCFI0-.LFB1408
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI1-.LCFI0
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE1:
.LSFDE3:
.long .LEFDE3-.LASFDE3
.LASFDE3:
.long .LASFDE3-.Lframe1
.long .LFB1410
.long .LFE1410-.LFB1410
.uleb128 0x0
.byte 0x4
.long .LCFI3-.LFB1410
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI4-.LCFI3
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE3:
.LSFDE5:
.long .LEFDE5-.LASFDE5
.LASFDE5:
.long .LASFDE5-.Lframe1
.long .LFB1409
.long .LFE1409-.LFB1409
.uleb128 0x0
.byte 0x4
.long .LCFI5-.LFB1409
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI6-.LCFI5
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE5:
.LSFDE7:
.long .LEFDE7-.LASFDE7
.LASFDE7:
.long .LASFDE7-.Lframe1
.long .LFB1401
.long .LFE1401-.LFB1401
.uleb128 0x0
.byte 0x4
.long .LCFI8-.LFB1401
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI9-.LCFI8
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE7:
.ident ""
.section .note.GNU-stack,"",@progbits
8
Name:
Anonymous
2007-05-20 23:20
ID:bvDibvxK
you won't be able to assemble them anyway
9
Name:
Anonymous
2007-05-21 4:07
ID:XeZl9pfr
Just compile C to asm;
.file "comp.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d"
.LC1:
.string "%i"
.text
.p2align 4,,15
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
subl $40, %esp
leal -16(%ebp), %eax
movl %ecx, -8(%ebp)
movl %ebx, -4(%ebp)
movl %eax, 4(%esp)
movl $.LC0, (%esp)
call scanf
leal -12(%ebp), %eax
movl -16(%ebp), %ebx
movl %eax, 4(%esp)
movl $.LC0, (%esp)
call scanf
movl -12(%ebp), %edx
movl %ebx, %eax
cmpl %edx, %ebx
jge .L2
movl %edx, %eax
.L2:
movl %eax, 4(%esp)
movl $.LC1, (%esp)
call printf
movl -8(%ebp), %ecx
xorl %eax, %eax
movl -4(%ebp), %ebx
movl %ebp, %esp
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.ident "GCC: (GNU) 4.1.3 20070514 (prerelease) (Ubuntu 4.1.2-7ubuntu2)"
.section .note.GNU-stack,"",@progbits
10
Name:
Anonymous
2007-05-21 4:10
ID:WvZpq1Ym
compare
>>5 to
>>10
ARM > x86
Also ubanto sucks
11
Name:
Anonymous
2007-05-21 4:34
ID:XeZl9pfr
>>10
x86-64 is slightly better.
.file "comp.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d"
.LC1:
.string "%i"
.text
.p2align 4,,15
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
subl $40, %esp
leal -16(%ebp), %eax
movl %ecx, -8(%ebp)
movl %ebx, -4(%ebp)
movl $.LC0, (%esp)
movl %eax, 4(%esp)
call scanf
leal -12(%ebp), %eax
movl -16(%ebp), %ebx
movl $.LC0, (%esp)
movl %eax, 4(%esp)
call scanf
movl -12(%ebp), %eax
movl $.LC1, (%esp)
cmpl %eax, %ebx
cmovge %ebx, %eax
movl %eax, 4(%esp)
call printf
movl -8(%ebp), %ecx
movl -4(%ebp), %ebx
xorl %eax, %eax
leave
leal -4(%ecx), %esp
ret
.size main, .-main
.ident "GCC: (GNU) 4.1.3 20070514 (prerelease) (Ubuntu 4.1.2-7ubuntu2)"
.section .note.GNU-stack,"",@progbits
12
Name:
Anonymous
2007-05-21 6:23
ID:WvZpq1Ym
>>11
add r1, sp, #4
mov r2, sp
ldr r0, .L3
bl scanf
ldr r3, [sp, #0]
ldr r1, [sp, #4]
ldr r0, .L3+4
cmp r3, r1
movlt r1, r3
bl printf
leal -16(%ebp), %eax
movl %ecx, -8(%ebp)
movl %ebx, -4(%ebp)
movl $.LC0, (%esp)
movl %eax, 4(%esp)
call scanf
leal -12(%ebp), %eax
movl -16(%ebp), %ebx
movl $.LC0, (%esp)
movl %eax, 4(%esp)
call scanf
movl -12(%ebp), %eax
movl $.LC1, (%esp)
cmpl %eax, %ebx
cmovge %ebx, %eax
movl %eax, 4(%esp)
call printf
way easier to read
13
Name:
Anonymous
2007-05-21 6:33
ID:XeZl9pfr
14
Name:
Anonymous
2007-05-21 7:25
ID:5cWB3HnU
>>13
We the people of the United States, in order to form a more perfect union, establish justice, insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessings of liberty to ourselves and our posterity, do ordain and establish this Constitution for the United States of America.
15
Name:
Anonymous
2007-05-21 9:08
ID:KAWYI6uf
>>14
We are the people of the United States, in order to form a more lucrative business, establish monopolies, insure unfair use, provide for the media associations, promote the general consumerism, and secure the interests of lawyer corporations such as ourselves and our dominance, do ordain and establish this Digital Millennium Corporate Act for the United Corporation of America.
Fixed.
16
Name:
Anonymous
2007-05-21 13:02
ID:Heaven
>>12
I don't see you passing arguments to scanf properly.
17
Name:
Anonymous
2009-01-14 12:36
LISP
18
Name:
Anonymous
2009-08-16 23:55
Lain.
19
Name:
2010-10-22 8:34