org 100h
wow dw 1234
wew dw 2424
waw dw 2564
wiw dw 2323
mov ax,wow
mov ax,wew
mov ax,waw
mov ax,wiw
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