Skip to content
Snippets Groups Projects
Commit a24dd28c authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Zeichnungen: Pull-Up- und Pull-Down-Widerstände 14.1.2021

Beispiel-Programme 21.1.2021
parent e6f50a47
Branches
No related tags found
No related merge requests found
20210114/pull-down-widerstand.png

36.4 KiB

20210114/pull-up-kurzschluss.png

30.6 KiB

File added
20210114/pull-up-widerstand-intern.png

29 KiB

20210114/pull-up-widerstand.png

34.3 KiB

#include <stdio.h>
#include <stdint.h>
int main (void)
{
uint8_t a = 42;
uint16_t b = 1117;
uint8_t c = 23;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
}
#include <stdio.h>
#include <stdint.h>
int main (void)
{
uint8_t a = 42;
uint16_t b = 1117;
uint8_t c = 23;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
a = 0;
b = 0;
c = 0;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
}
#include <stdio.h>
#include <stdint.h>
int main (void)
{
uint8_t a = 42;
uint16_t b = 1117;
uint8_t c = 23;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
uint32_t *p = &a;
*p = 0;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
}
#include <stdio.h>
#include <stdint.h>
int main (void)
{
uint8_t a = 42;
uint16_t b = 1117;
uint8_t c = 23;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
uint32_t *p = (uint32_t *) &a;
*p = 0;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
}
.file "alignment-5.c"
.text
.section .rodata
.LC0:
.string "a = %d, b = %d, c = %d\n"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
leal 4(%esp), %ecx
.cfi_def_cfa 1, 0
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
.cfi_escape 0x10,0x5,0x2,0x75,0
movl %esp, %ebp
pushl %ebx
pushl %ecx
.cfi_escape 0xf,0x3,0x75,0x78,0x6
.cfi_escape 0x10,0x3,0x2,0x75,0x7c
subl $16, %esp
call __x86.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
movb $42, -17(%ebp) # #include <stdio.h>
movw $1117, -10(%ebp) # #include <stdint.h>
movb $23, -11(%ebp) #
movzbl -11(%ebp), %ecx # int main (void)
movzwl -10(%ebp), %edx # {
movzbl -17(%ebp), %eax # uint8_t a = 42;
movzbl %al, %eax # uint16_t b = 1117;
pushl %ecx # uint8_t c = 23;
pushl %edx # printf ("a = %d, b = %d, c = %d\n", a, b, c);
pushl %eax # uint64_t *p = (uint64_t *) &a;
leal .LC0@GOTOFF(%ebx), %eax # *p = 0;
pushl %eax # printf ("a = %d, b = %d, c = %d\n", a, b, c);
call printf@PLT # }
addl $16, %esp
leal -17(%ebp), %eax
movl %eax, -16(%ebp)
movl -16(%ebp), %eax
movl $0, (%eax)
movl $0, 4(%eax) # -9 \ b
movzbl -11(%ebp), %ecx # -10 / -.
movzwl -10(%ebp), %edx # -11 - c |
movzbl -17(%ebp), %eax # -12 |
movzbl %al, %eax # -13 } auf 0 gesetzt
pushl %ecx # -14 |
pushl %edx # -15 |
pushl %eax # -16 |
leal .LC0@GOTOFF(%ebx), %eax # -17 - a -'
pushl %eax
call printf@PLT
addl $16, %esp
movl $0, %eax
leal -8(%ebp), %esp
popl %ecx
.cfi_restore 1
.cfi_def_cfa 1, 0
popl %ebx
.cfi_restore 3
popl %ebp
.cfi_restore 5
leal -4(%ecx), %esp
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE0:
.size main, .-main
.section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
.type __x86.get_pc_thunk.bx, @function
__x86.get_pc_thunk.bx:
.LFB1:
.cfi_startproc
movl (%esp), %ebx
ret
.cfi_endproc
.LFE1:
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
#include <stdint.h>
int main (void)
{
uint8_t a = 42;
uint16_t b = 1117;
uint8_t c = 23;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
uint64_t *p = (uint64_t *) &a;
*p = 0;
printf ("a = %d, b = %d, c = %d\n", a, b, c);
}
.file "answer.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
leal 4(%esp), %ecx
.cfi_def_cfa 1, 0
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
.cfi_escape 0x10,0x5,0x2,0x75,0 # #include <stdio.h>
movl %esp, %ebp #
pushl %ebx # int answer = 23;
pushl %ecx #
.cfi_escape 0xf,0x3,0x75,0x78,0x6 # int main (void)
.cfi_escape 0x10,0x3,0x2,0x75,0x7c # {
call __x86.get_pc_thunk.bx # answer += 19;
addl $_GLOBAL_OFFSET_TABLE_, %ebx # printf ("%d\n", answer);
movl answer@GOTOFF(%ebx), %eax # return 0;
addl $19, %eax # }
movl %eax, answer@GOTOFF(%ebx)
subl $8, %esp
pushl %eax
leal .LC0@GOTOFF(%ebx), %eax
pushl %eax
call printf@PLT
addl $16, %esp
movl $0, %eax
leal -8(%ebp), %esp
popl %ecx
.cfi_restore 1
.cfi_def_cfa 1, 0
popl %ebx
.cfi_restore 3
popl %ebp
.cfi_restore 5
leal -4(%ecx), %esp
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE11:
.size main, .-main
.globl answer
.data
.align 4
.type answer, @object
.size answer, 4
answer:
.long 23
.section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
.type __x86.get_pc_thunk.bx, @function
__x86.get_pc_thunk.bx:
.LFB12:
.cfi_startproc
movl (%esp), %ebx
ret
.cfi_endproc
.LFE12:
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int answer = 23;
int main (void)
{
answer += 19;
printf ("%d\n", answer);
return 0;
}
(gdb) disassemble /r main
Dump of assembler code for function main:
0x0000000000001135 <+0>: 48 83 ec 08 sub $0x8,%rsp
0x0000000000001139 <+4>: 8b 05 f1 2e 00 00 mov 0x2ef1(%rip),%eax # 0x4030 <answer>
0x000000000000113f <+10>: 8d 70 13 lea 0x13(%rax),%esi
0x0000000000001142 <+13>: 89 35 e8 2e 00 00 mov %esi,0x2ee8(%rip) # 0x4030 <answer>
0x0000000000001148 <+19>: 48 8d 3d b5 0e 00 00 lea 0xeb5(%rip),%rdi # 0x2004
0x000000000000114f <+26>: b8 00 00 00 00 mov $0x0,%eax
0x0000000000001154 <+31>: e8 d7 fe ff ff callq 0x1030 <printf@plt>
0x0000000000001159 <+36>: b8 00 00 00 00 mov $0x0,%eax
0x000000000000115e <+41>: 48 83 c4 08 add $0x8,%rsp
0x0000000000001162 <+45>: c3 retq
End of assembler dump.
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
Maschinensprache Assembler
.file "answer.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16 # #include <stdio.h>
movl answer(%rip), %eax #
leal 19(%rax), %esi # int answer = 23;
movl %esi, answer(%rip) #
leaq .LC0(%rip), %rdi # int main (void)
movl $0, %eax # {
call printf@PLT # answer += 19;
movl $0, %eax # printf ("%d\n", answer);
addq $8, %rsp # return 0;
.cfi_def_cfa_offset 8 # }
ret
.cfi_endproc
.LFE11:
.size main, .-main
.globl answer
.data
.align 4
.type answer, @object
.size answer, 4
answer:
.long 23
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment