본문 바로가기

전체

[Assembly] 어셈블리 Test7 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 양의 정수를 입력한 후 짝수면 "even number" 홀수면 "odd number" 출력 test7.asmsection .datafirst db 'Input : 'len1 equ $ -firstodd db 'odd number!'len2 equ $ -oddeven db 'even number!'len3 equ $ -evennewLine db 0x0a section .bsschar1 r.. 더보기
[Assembly] 어셈블리 Test6 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 변수 x가 영문자(대문자 또는 소문자)일 때 true 출력 test6.asmsection .data first db 'Input : ' len1 equ $ -first true db 'true!' len2 equ $ -true false db 'false!' len3 equ $ -false newLine db 0x0a section .bss char1 resb 1 temp resb 1 .. 더보기
[Assembly] 어셈블리 Test5 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 변수 x가 문자타입 숫자(‘0’~‘9’)일 때 true 출력 test5.asmsection .data first db 'Input : ' len1 equ $ -first true db 'true!' len2 equ $ -true false db 'false!' len3 equ $ -false newLine db 0x0a section .bss char1 resb 1 temp resb 1.. 더보기
[Assembly] 어셈블리 Test4 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 변수 x가 ‘x' 또는 ’X'일 때 true 출력 test4.asmsection .datafirst db 'Input : 'len1 equ $ -firsttrue db 'true!'len2 equ $ -truefalse db 'false!'len3 equ $ -falsenewLine db 0x0asection .bsschar1 resb 1temp resb 1section .textglo.. 더보기
[Assembly] 어셈블리 Test3 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 변수 x가 1보다 크고 5보다 작을 때 true 출력 test3.asmsection .data first db 'num : ' len1 equ $ -first true db 'true!' len2 equ $ -true false db 'false!' len3 equ $ -false newLine db 0x0a section .bss num1 resb 1 temp resb 1 sectio.. 더보기
[Assembly] 어셈블리 Test2 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 세 개의 값을 입력한 후 합계와 몫과 나머지 몫을 출력하시오. test2.asmsection .data first db "frist : " len1 equ $ -first second db "second : " len2 equ $ -second third db "third : " len3 equ $ -third newLine db 0x0a total db "total : " len4 e.. 더보기
[Assembly] 어셈블리 Test1 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 두 개의 값을 두 개의 변수에 입력한 후 내용을 서로 교환하여 출력 num1 = 1, num2 = 2 num1 = 2, num2 = 1 test1.asmsection .data first db "first : " len1 equ $ -first second db "second : " len2 equ $ -second tab db 0x20 newline db 0x0a section .bs.. 더보기
[Assembly] 매크로를 이용한 구구단 출력 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. row_loop_macro.asmsection .dataend db 0x0Astar db '*'len1 equ $ -starequl db '='len2 equ $ -equlspace db 0x09len3 equ $ -space section .bssnum1 resb 1num2 resb 1res resb 1 section .textglobal _start %macro write 2mov eax, .. 더보기
[Assembly] 구구단 출력 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. row_loop.asm;반복문인 loop를 배운다section .dataend db 0x0Astar db '*'len1 equ $ -starequl db '='len2 equ $ -equlspace db 0x09len3 equ $ -space section .bssnum1 resb 1num2 resb 1res resb 1 section .textglobal _start _start:;loop에서.. 더보기
[Assembly] 재귀함수 구현 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 3! 구해보기 , 4!이상은 결과값이 10이상이므로 따로 처리를 해줘야 된다.reclusive.asmsection .bssonum resb 2result resb 5section .datainum db "Input num : "len equ $ -inumend db 0x0asection .textglobal _start %macro write 2mov eax,4mov ebx,1mov e.. 더보기