2.asm

来自「This is Hello world!」· 汇编 代码 · 共 286 行

ASM
286
字号
org 100h

mov al, 5       ; bin=00000101b 
mov bl, 10      ; hex=0ah or bin=00001010b 

; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b 
add bl, al

; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b 
sub bl, 1

; print result in binary: 
mov cx, 8
print: mov ah, 2   ; print function. 
       mov dl, '0'
       test bl, 10000000b  ; test first bit. 
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print

; print binary suffix: 
mov dl, 'b'
int 21h

; wait for any key press: 
mov ah, 0
int 16h

ret



org 100h

mov al, 5       ; bin=00000101b 
mov bl, 10      ; hex=0ah or bin=00001010b 

; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b 
add bl, al

; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b 
sub bl, 1

; print result in binary: 
mov cx, 8
print: mov ah, 2   ; print function. 
       mov dl, '0'
       test bl, 10000000b  ; test first bit. 
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print

; print binary suffix: 
mov dl, 'b'
int 21h

; wait for any key press: 
mov ah, 0
int 16h

ret

org 100h

mov al, 5       ; bin=00000101b 
mov bl, 10      ; hex=0ah or bin=00001010b 

; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b 
add bl, al

; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b 
sub bl, 1

; print result in binary: 
mov cx, 8
print: mov ah, 2   ; print function. 
       mov dl, '0'
       test bl, 10000000b  ; test first bit. 
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print

; print binary suffix: 
mov dl, 'b'
int 21h

; wait for any key press: 
mov ah, 0
int 16h

ret






org 100h

mov al, 5       ; bin=00000101b 
mov bl, 10      ; hex=0ah or bin=00001010b 

; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b 
add bl, al

; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b 
sub bl, 1

; print result in binary: 
mov cx, 8
print: mov ah, 2   ; print function. 
       mov dl, '0'
       test bl, 10000000b  ; test first bit. 
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print

; print binary suffix: 
mov dl, 'b'
int 21h

; wait for any key press: 
mov ah, 0
int 16h

ret









org 100h

mov al, 5       ; bin=00000101b 
mov bl, 10      ; hex=0ah or bin=00001010b 

; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b 
add bl, al

; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b 
sub bl, 1

; print result in binary: 
mov cx, 8
print: mov ah, 2   ; print function. 
       mov dl, '0'
       test bl, 10000000b  ; test first bit. 
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print

; print binary suffix: 
mov dl, 'b'
int 21h

; wait for any key press: 
mov ah, 0
int 16h

ret







org 100h

mov al, 5       ; bin=00000101b 
mov bl, 10      ; hex=0ah or bin=00001010b 

; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b 
add bl, al

; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b 
sub bl, 1

; print result in binary: 
mov cx, 8
print: mov ah, 2   ; print function. 
       mov dl, '0'
       test bl, 10000000b  ; test first bit. 
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print

; print binary suffix: 
mov dl, 'b'
int 21h

; wait for any key press: 
mov ah, 0
int 16h

ret



org 100h

mov al, 5       ; bin=00000101b 
mov bl, 10      ; hex=0ah or bin=00001010b 

; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b 
add bl, al

; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b 
sub bl, 1

; print result in binary: 
mov cx, 8
print: mov ah, 2   ; print function. 
       mov dl, '0'
       test bl, 10000000b  ; test first bit. 
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print

; print binary suffix: 
mov dl, 'b'
int 21h

; wait for any key press: 
mov ah, 0
int 16h

ret









org 100h

mov al, 5       ; bin=00000101b 
mov bl, 10      ; hex=0ah or bin=00001010b 

; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b 
add bl, al

; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b 
sub bl, 1

; print result in binary: 
mov cx, 8
print: mov ah, 2   ; print function. 
       mov dl, '0'
       test bl, 10000000b  ; test first bit. 
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print

; print binary suffix: 
mov dl, 'b'
int 21h

; wait for any key press: 
mov ah, 0
int 16h

ret

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?