;1. x AND y ;2. x OR y ;3. x NOT y ;4. x XOR y ;5. EXIT INCLUDE Irvine32.inc .data strAND BYTE "1. X AND Y",0 strOR BYTE "2. X OR Y",0 strNOT BYTE "3. X NOT Y",0 strXOR BYTE "4. X XOR Y",0 strEXIT BYTE "5. EXIT",0 strX BYTE "Enter value X : ",0 strY BYTE "Enter value Y : ",0 num DWORD ? valX DWORD ? valY DWORD ? .code MAIN PROC call Clrscr mov edx,OFFSET strAND call WriteString call Crlf mov edx,OFFSET strOR call WriteString call Crlf mov edx,OFFSET strNOT call WriteString call Crlf mov edx,OFFSET strXOR call WriteString call Crlf mov edx,OFFSET strEXIT call WriteString call Crlf call ReadInt mov num,eax cmp num,1 je calland cmp num,2 je callor cmp num,3 je callnot cmp num,4 je callxor jmp quitprogram calland: call EnterX call EnterY call ANDProc jmp quitprogram callor: call EnterX call EnterY call ORProc jmp quitprogram callnot: call EnterX call NOTProc jmp quitprogram callxor: call EnterX call EnterY call XORProc jmp quitprogram quitprogram: exit MAIN ENDP ANDProc PROC mov eax,valX and eax,valY call WriteInt call Crlf call WriteBin ret ANDProc ENDP ORProc PROC mov eax,valX or eax,valY call WriteInt call Crlf call WriteBin ret ORProc ENDP NOTProc PROC mov eax,valX not eax call WriteInt call Crlf call WriteBin ret ret NOTProc ENDP XorProc PROC mov eax,valX xor eax,valY call WriteInt call Crlf call WriteBin ret XORProc ENDP EnterX PROC mov edx,OFFSET strX call WriteString call ReadInt mov valX,eax ret EnterX ENDP EnterY PROC mov edx,OFFSET strY call WriteString call ReadInt mov ValY,eax ret EnterY ENDP END main
bool 연산 결과를 10진수와 2진수로 화면에 출력합니다.
점심 먹고 소화시킬 겸 간단히 풀이 연습~♪
'노트정리 > 어셈블리 책 스터디 공간' 카테고리의 다른 글
chapter 6. 마무리 노트 11.메시지 암호화 (0) | 2010.11.29 |
---|---|
6.9.11 메세지 암호화 (0) | 2010.07.26 |
6.9.10 오버플로까지 피보나치 출력 (0) | 2010.07.14 |
6.9.9가중확률 (0) | 2010.07.13 |
6.9.5. 6.9.6 대학등록(1)(2) (0) | 2010.07.12 |
6.9.4 시험성적계산2 (어셈블리어) (0) | 2010.06.30 |
6.9.3 시험성적계산 (0) | 2010.06.30 |
6.9.2 루프 구현 (0) | 2010.06.30 |