org 100h
MOV AL, 'a' ; AL = 01100001b
AND AL, 11011111b ; AL = 01000001b ('A')
MOV AL, 00011011b
NOT AL ; AL = 11100100b
MOV AL, 'A' ; AL = 01000001b
OR AL, 00100000b ; AL = 01100001b ('a')
MOV AL, 00000111b
XOR AL, 00000010b ; AL = 00000101b
MOV AL, 00000101b
TEST AL, 1 ; ZF = 0.
TEST AL, 10b ; ZF = 1.
MOV CH, 1101_1111b ; set CH to binary value.
MOV BX, 15Eh ; set BX to 15Eh.
MOV [BX], CX ; copy contents of CX to memory at B800:015E RET ; returns to operating system.
call print_ax_bin
int 20h
print_ax_bin proc
pusha
; print result value in binary:
mov cx, 16
mov bx, ax
print: mov ah, 2 ; print function.
mov dl, '0'
test bx, 1000000000000000b ; test first bit.
jz zero
mov dl, '1'
zero: int 21h
shl bx, 1
loop print
; print binary suffix:
mov dl, 'b'
int 21h
popa
ret
endp
print_nl proc
push ax
push dx
mov ah, 2
mov dl, 0Dh
int 21h
mov dl, 0Ah
int 21h
pop dx
pop ax
ret
endp
Tidak ada komentar:
Posting Komentar