Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- architecture
- epoll
- REDIS
- iptables
- NAPT
- BOF
- packet flow
- edge trigger
- DOCKER-USER
- doupdate
- wrefresh
- packet filter
- LOB
- ioctl
- .net core 7
- 어셈블리어
- ncurses
- Docker
- Compiler
- vtable
- cbpf
- C언어
- wnourefresh
- 풀이
- level trigger
- rfc5508
- 취약점
- mvwin
- .nret core 배포
- epoll_wait
Archives
- Today
- Total
Tuuna Computer Science
[어셈블리어] 구구단 출력하기 본문
물론 형편없는 코드지만 공부용으로 작성 ~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | %include "asm_io.inc" extern printf segment .data format db "%d x %d = %d", 0 hello db "Hello this is a group of game", 0 segment .bss input resd 0; 합을 저장할 변수 segment.text global asm_main asm_main : enter 4, 0 pusha push hello call printf add esp, 4 call print_nl mov eax, 1; i mov ebx, 1; j gugu_eax_loop : mov ebx, 1 cmp eax, 10 jg gugu_loop_end gugu_ebx_loop : cmp ebx, 10 jg setting_eax push eax imul eax, ebx mov [input], eax; backup output pop eax mov[ebp - 4], eax push dword[input] push ebx push eax push format call printf; 반환값이 eax에 쌓이넹 mov eax, [ebp - 4] add esp, 16 call print_nl inc ebx jmp gugu_ebx_loop setting_eax : inc eax call print_nl jmp gugu_eax_loop gugu_loop_end : popa leave ret | cs |
코드 작성하면서 gdb는 gdb인것 같다. 또 어셈블리로 코드를 작성하다보니 gdb에서 보니 편하기도 하고...
작성하면서 bss영역에 초기화중 store변수와 input변수의 주소가 겹치던데 왜 그런걸까
'Assembly' 카테고리의 다른 글
[어셈블리어] 10진수 배열을 통해 이진수로 출력하기 (0) | 2018.08.31 |
---|---|
[어셈블리어] 최소공배수 구하기 (0) | 2018.08.30 |
[어셈블리] 파일 다루기 ( 소문자를 대문자로 바꾸기 ) (0) | 2018.08.06 |
재귀함수 호출시 스택프레임상황 (0) | 2018.06.12 |
C 언어 문자열 관련 함수 (strcpy) 분석 (0) | 2018.06.11 |
Comments