name "loops"
org 100h
mov bx, 0 ; total step counter
mov cx, 1
k1: add bx, 1
mov al, '8'
mov ah, 0eh
int 10h
push cx
mov cx, 1
k2: add bx, 1
mov al, '8'
mov ah, 0eh
int 10h
push cx
mov cx, 1
k3: add bx, 1
mov al, '8'
mov ah, 0eh
int 10h
push cx
mov cx, 1
k4: add bx, 1
mov al, '8'
mov ah, 0eh
int 10h
loop k3 ; internal in internal loop.
pop cx
loop k2 ; internal loop.
pop cx
loop k1 ; external loop.
; wait any key...
mov ah, 1
int 21h
ret
include 'emu8086.inc'
ORG 100h
MOV AL, 1
JA label1
PRINT '8888'
JMP exit
label1:
PRINT '8888'
exit:
RET
Tampilkan postingan dengan label assamble(bahasa rakitan). Tampilkan semua postingan
Tampilkan postingan dengan label assamble(bahasa rakitan). Tampilkan semua postingan
Jumat, 27 April 2012
TAMPILAN "8888" KIRI
5 LOGIKA
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
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
Senin, 19 Maret 2012
tampilan nama sebelah kanan
ORG 100h
MOV AL, VAR1 ; check value of VAR1 by moving it to AL.
MOV BX, OFFSET VAR1 ; get address of VAR1 in BX.
MOV BYTE PTR [BX], 44h ; modify the contents of VAR1.
MOV AL, VAR1 ; check value of VAR1 by moving it to AL.
mulai1: mov al, 1
mov bh, 0
mov bl, 0100_1110b
mov cx, msg1end - offset msg1 ; calculate message size.
mov dl, 79
mov dh, 0
push cs
pop es
mov bp, offset msg1
mov ah, 13h
int 10h
jmp msg1end
msg1 db "m"
msg1end:
jmp mulai2
mulai2: mov al, 1
mov bh, 0
mov bl, 0100_1100b
mov cx, msg2end - offset msg2 ; calculate message size.
mov dl, 79
mov dh, 1
push cs
pop es
mov bp, offset msg2
mov ah, 13h
int 10h
jmp msg2end
msg2 db "e"
msg2end:
jmp mulai3
mulai3: mov al, 1
mov bh, 0
mov bl, 0100_1011b
mov cx, msg3end - offset msg3 ; calculate message size.
mov dl, 79
mov dh, 2
push cs
pop es
mov bp, offset msg3
mov ah, 13h
int 10h
jmp msg3end
msg3 db "u"
msg3end:
jmp mulai4
mulai4: mov al, 1
mov bh, 0
mov bl, 0100_0010b
mov cx, msg4end - offset msg4 ; calculate message size.
mov dl, 79
mov dh, 3
push cs
pop es
mov bp, offset msg4
mov ah, 13h
int 10h
jmp msg4end
msg4 db "t"
msg4end:
jmp mulai5
mulai5: mov al, 1
mov bh, 0
mov bl, 0100_1011b
mov cx, msg5end - offset msg5 ; calculate message size.
mov dl, 79
mov dh, 4
push cs
pop es
mov bp, offset msg5
mov ah, 13h
int 10h
jmp msg5end
msg5 db "i"
msg5end:
jmp mulai6
mulai6: mov al, 1
mov bh, 0
mov bl, 0100_0110b
mov cx, msg6end - offset msg6 ; calculate message size.
mov dl, 79
mov dh, 5
push cs
pop es
mov bp, offset msg6
mov ah, 13h
int 10h
jmp msg6end
msg6 db "a"
msg6end:
RET
VAR1 DB 22h
END
MOV AL, VAR1 ; check value of VAR1 by moving it to AL.
MOV BX, OFFSET VAR1 ; get address of VAR1 in BX.
MOV BYTE PTR [BX], 44h ; modify the contents of VAR1.
MOV AL, VAR1 ; check value of VAR1 by moving it to AL.
mulai1: mov al, 1
mov bh, 0
mov bl, 0100_1110b
mov cx, msg1end - offset msg1 ; calculate message size.
mov dl, 79
mov dh, 0
push cs
pop es
mov bp, offset msg1
mov ah, 13h
int 10h
jmp msg1end
msg1 db "m"
msg1end:
jmp mulai2
mulai2: mov al, 1
mov bh, 0
mov bl, 0100_1100b
mov cx, msg2end - offset msg2 ; calculate message size.
mov dl, 79
mov dh, 1
push cs
pop es
mov bp, offset msg2
mov ah, 13h
int 10h
jmp msg2end
msg2 db "e"
msg2end:
jmp mulai3
mulai3: mov al, 1
mov bh, 0
mov bl, 0100_1011b
mov cx, msg3end - offset msg3 ; calculate message size.
mov dl, 79
mov dh, 2
push cs
pop es
mov bp, offset msg3
mov ah, 13h
int 10h
jmp msg3end
msg3 db "u"
msg3end:
jmp mulai4
mulai4: mov al, 1
mov bh, 0
mov bl, 0100_0010b
mov cx, msg4end - offset msg4 ; calculate message size.
mov dl, 79
mov dh, 3
push cs
pop es
mov bp, offset msg4
mov ah, 13h
int 10h
jmp msg4end
msg4 db "t"
msg4end:
jmp mulai5
mulai5: mov al, 1
mov bh, 0
mov bl, 0100_1011b
mov cx, msg5end - offset msg5 ; calculate message size.
mov dl, 79
mov dh, 4
push cs
pop es
mov bp, offset msg5
mov ah, 13h
int 10h
jmp msg5end
msg5 db "i"
msg5end:
jmp mulai6
mulai6: mov al, 1
mov bh, 0
mov bl, 0100_0110b
mov cx, msg6end - offset msg6 ; calculate message size.
mov dl, 79
mov dh, 5
push cs
pop es
mov bp, offset msg6
mov ah, 13h
int 10h
jmp msg6end
msg6 db "a"
msg6end:
RET
VAR1 DB 22h
END
Langganan:
Postingan (Atom)