8086 어셈블리 - HelloWorld

1568 단어
  • 1종
  • assume cs:code, ds:data   
    
    ;------     ------
    data segment       
        string db 'Hello World!$'
    data ends
    
    ;------     ------
    code segment 
    start:  
        mov ax, data
        mov ds, ax
    
        mov ah, 9h
        mov dx, offset string
        int 21h
    
        mov ah, 4ch ; mov ax, 4c00h
        int 21h                
    code ends
        end start 
    
  • 두 번째
  • assume cs:code, ds:data   
    
    ;------     ------
    data segment       
        db "Hello World!",0
    data ends
    
    ;------     ------
    code segment 
    start:  
        mov ax, data
        mov ds, ax      
        
        mov ax, 0b800h  ;         
        mov es, ax
        
        mov bx, 0
        mov si, 0
        mov ch, 0
        
    print:
        mov cl, ds:[si] ;      
        jcxz exit   ;  cx 0,       
        
        mov es:[bx], cl ;          
        mov es:[bx+1], 11101111b    ;     :    
        
        inc si
        add bx, 2
        loop print
                
    exit:
        mov ah, 4ch
        int 21h                
    code ends
        end start 
    
  • 세 번째
  • assume cs:code, ds:data   
    
    ;------     ------
    data segment       
        db "Hello World!",1
    data ends
    
    ;------     ------
    code segment 
    start:  
        mov ax, data
        mov ds, ax      
        
        mov ax, 0b800h  ;         
        mov es, ax
        
        mov bx, 0
        mov si, 0
        mov ch, 0
        
    print:
        mov al, ds:[si] ;      
        mov es:[bx], al ;          
        mov es:[bx+1], 11001111b    ;     :    
        
        inc si
        add bx, 2
        mov cl, ds:[si] ;       
        loop print
    
        mov ah, 4ch
        int 21h                
    code ends
        end start 
    

    좋은 웹페이지 즐겨찾기