본문 바로가기

Programming Language

[Assembly] 어셈블리 Test10 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 한 문자를 입력한 후 숫자이면 "number", 알파벳 대문자이면 "capital letter" 소문자이면 "small letter", 기호이면 "symbol" 출력 ex) 6 ->number test10.asmsection .data x db 'x :' lx equ $ -x n db 'number',0x0A ln equ $ -n b db 'capital letter',0x0A lb e.. 더보기
[Assembly] 어셈블리 Test9 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 알파벳 한 글자를 입력한 후 소문자이면 대문자로, 대문자이면 소문자로 변환하여 출력 ex) a -> A test9.asmsection .data x db 'x :'len equ $ -xent db 0x0A section .bss xn resb 2 section .text global _start %macro write 2 mov eax,4 mov ebx,1 mov ecx,%1 mov e.. 더보기
[Assembly] 파일입출력 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. fileio.asmsection .data file_name db 'testio',0 len equ $ -file_name file_text db 'my name is jung' len1 equ $ -file_text newLine db 0x0a section .bss file_out resb 1;내가 열어본 파일의 정보의 디스크립트를 가지고 있는 변수 file_in resb 1 data res.. 더보기
[Assembly] 어셈블리 Test8 실행환경- cpu : 인텔계열(64bit)- 컴파일러 : nasm- 리눅스 : ubuntu 16.04 LTS 설치방법- sudo apt-get install nasm 컴파일- nasm -f elf64 파일명.asm -o 파일명.o --> 목적파일을 만든다.- ld 파일명.o -o 파일명 --> 실행파일을 만든다. 문제 : 0~24 수를 입력한 후 오전 혹은 오후 몇 시의 형태로 출력 ex) 15 --> 오후 : 3 test8.asmsection .datax db 'x :'len equ $ -x a db '오전 : 'la equ $ -a p db '오후 : 'lp equ $ -p e db 'error'le equ $ -e ent db 0x0A section .bssnum resb 3t resb 3 sect.. 더보기
[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.. 더보기