• 汇编语言 demo1,2,3


     1 assume cs:codesg
     2 
     3 data segment
     4 ;yellow
     5         db 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1
     6 data ends
     7 
     8 stack segment
     9         dw 16 dup (0)
    10 stack ends
    11 
    12 codesg segment
    13 start:
    14         mov ax,data
    15         mov ds,ax
    16 
    17         mov ax,0b800h
    18         mov es,ax
    19 
    20         mov ax,stack
    21         mov ss,ax
    22         mov sp,20h
    23         mov di,0
    24         mov cx,16
    25    main:
    26         push cx
    27         mov al,2ah
    28         mov ah,ds:[di]
    29         inc di
    30         push di
    31 
    32         mov dx,1
    33         mov di,7d0h
    34         mov si,7d0h
    35         mov cx,0bh
    36 
    37    lmain:
    38         push cx
    39         push si
    40         push di
    41         mov bx,dx
    42         mov cx,dx
    43         
    44    ms:
    45         push cx
    46         mov bp,0
    47         mov cx,bx
    48 
    49    mA:
    50         mov es:[bp+di],ax                       
    51         mov es:[bp+si],ax
    52         add bp,4
    53         loop mA
    54 
    55         add di,09eh
    56         sub si,0a2h
    57         inc bx
    58         pop cx
    59         loop ms
    60 
    61         inc dx
    62         pop di
    63         pop si
    64         sub di,0a2h
    65         add si,09eh
    66         call delay
    67         pop cx
    68         loop lmain
    69 
    70         pop di
    71         pop cx
    72         loop main
    73 ;       jmp main
    74 
    75         mov ax,4c00h
    76         int 21h
    77 
    78 
    79 delay:
    80         mov cx,08h
    81    d1:
    82         push cx
    83         mov cx,0ffffh
    84    d2:
    85         loop d2
    86         pop cx
    87         loop d1
    88         ret
    89 
    90 codesg ends
    91 end start

    assume cs:codesg
    data segment
    ;zi
            db 'Welcome to the world assembly ! '
    ;ziti_color
            db 1,2,3,4,5,6,7,8
    ;yanhua
            db 4,52,23,8,66,38,56,64
            db 19,15,20,21,18,21,15,17
            db 8,7,6,5,4,3,2,1
    data ends
    
    stack segment
            dw 32 dup (0)
    stack ends
    
    codesg segment
    start:
            mov ax,data
            mov ds,ax
    
            mov ax,0b800h
            mov es,ax
            
            mov ax,stack
            mov ss,ax
            mov sp,40h
    
       again:
            call clear_screen
            mov bp,0
            mov cx,8
       main:
            call ziti
            call yanhua
            call delay
    
            inc bp
            loop main
    
          ;  jmp again
    
            mov ax,4c00h
            int 21h
    
    yanhua:
            push cx
            push si
            push di
            mov si,0
            mov di,0f00h
            mov al,ds:[bp+40]
            mov ah,0
            add ax,ax
            add di,ax
            mov al,2ah
            mov ah,ds:[bp+56]
            mov cl,ds:[bp+48]
            mov ch,0
    
       yh_s:
            mov es:[di],ax
            call ziti
            call delay
            mov word ptr es:[di],0
            sub di,0a0h
            loop yh_s
    
            call zhanfang
    
            pop di
            pop si
            pop cx
            ret
    
    zhanfang:
            push ax
            push di
            mov es:[di],ax
            call ziti
            call delay
            mov es:[di-2],ax
            mov es:[di+2],ax
            mov es:[di-9eh],ax
            mov es:[di+9eh],ax
            mov es:[di-0a2h],ax
            mov es:[di+0a2h],ax
            call ziti
            call delay
            mov es:[di-4],ax
            mov es:[di+4],ax
            mov es:[di-13ch],ax
            mov es:[di+13ch],ax
            mov es:[di-144h],ax
            mov es:[di+144h],ax
            call ziti
            call delay
            mov es:[di-6],ax
            mov es:[di+6],ax
            mov es:[di-1dah],ax
            mov es:[di+1dah],ax
            mov es:[di-1e6h],ax
            mov es:[di+1e6h],ax
    
            call ziti
            call delay
            push cx
            sub di,1e6h
            mov cx,7
       zs1:
            push cx
            push di
            mov cx,7
       zs2:
            mov word ptr es:[di],0
            add di,2
            loop zs2
    
            pop di
            add di,0a0h
            pop cx
            loop zs1
            call ziti
            pop cx
    
            pop di
            pop ax
            ret
    
    ziti:
            push ax
            push cx
            push si
            push di
            mov ah,ds:[bp+32]
            mov si,0
            mov di,710h
            mov cx,32
       s:
            mov al,ds:[si]
            mov es:[di],ax
            add di,2
            inc si
            loop s
    
            pop di
            pop si
            pop cx
            pop ax
            ret
    
    delay:
            push cx
            mov cx,6h
       s1:
            push cx
            mov cx,0ffffh
       s2:
            loop s2
            pop cx
            loop s1
            pop cx
            ret
    
    clear_screen:
            push cx
            push di
            mov di,0
            mov cx,7d0h
       clear:
            mov word ptr es:[di],0
            add di,2
            loop clear
    
            pop di
            pop cx
            ret
    
    codesg ends
    end start

    assume cs:codesg
    data segment
            db 'a','b','c','d','e','f','g','h'
            db 11,19,27,35,43,51,59,67
            db 5,9,13,17,21,25,29,33
            db 1,2,3,4,5,6,7,8
            db 8,7,6,5,4,3,2,1
    data ends
    
    stack segment
            dw 16 dup (0)
    stack ends
    
    codesg segment
    start:
            mov ax,0b800h
            mov es,ax
    
            mov ax,data
            mov ds,ax
    
            mov ax,stack
            mov ss,ax
            mov sp,20h
    
       agian:
            call clear_screen
            mov bp,0
    
            mov cx,8
       main:
            push cx
            call hou
            call qian
            inc bp
            pop cx
            loop main
    
    ;       jmp agian
    
            mov ax,4c00h
            int 21h
    
    hou:
            push ax
            push bx
            push cx
            push di
            push si
            mov di,50h
            mov si,0f50h
            mov al,ds:[bp+16]
            mov ah,0
            add ax,ax
            sub di,ax
            add si,ax
    
            mov bx,25
    
            mov cx,12
       s02:
            push cx
            push di
            push si
    
            mov cx,bx
       s12:
            mov al,'/'
            mov ah,ds:[bp+32]
            mov es:[si],ax
            mov al,''
            mov ah,ds:[bp+24]
            mov es:[di],ax
            add di,0a0h
            sub si,0a0h
            loop s12
    
            sub bx,2
            pop si
            pop di
            push si
            push di
    
            mov cl,ds:[bp+8]
            mov ch,0
       s22:
            mov al,ds:[bp]
            mov ah,ds:[bp+24]
            mov es:[di],ax
            add di,2
            loop s22
    
            mov cl,ds:[bp+8]
            mov ch,0
       s32:
            mov al,ds:[bp]
            mov ah,ds:[bp+32]
            mov es:[si],ax
            sub si,2
            loop s32
    
            pop di
            pop si
            add di,0a0h
            sub si,0a0h
            call delay
            call clear_screen
            pop cx
            loop s02
    
            pop si
            pop di
            pop cx
            pop bx
            pop ax
            ret
    
    qian:
            push ax
            push bx
            push cx
            push di
            push si
            mov di,07d0h
            mov si,07d0h
            mov al,ds:[bp+16]
            mov ah,0
            add ax,ax
            sub di,ax
            add si,ax
    
            mov bx,1
    
            mov cx,13
       s01:
            push cx
            push di
            push si
    
            mov cx,bx
       s11:
            mov al,'/'
            mov ah,ds:[bp+32]
            mov es:[si],ax
            mov al,''
            mov ah,ds:[bp+24]
            mov es:[di],ax
            sub di,0a0h
            add si,0a0h
            loop s11
    
            add bx,2
            pop si
            pop di
            push si
            push di
    
            mov cl,ds:[bp+8]
            mov ch,0
       s21:
            mov al,ds:[bp]
            mov ah,ds:[bp+24]
            mov es:[di],ax
            add di,2
            loop s21
    
            mov cl,ds:[bp+8]
            mov ch,0
       s31:
            mov al,ds:[bp]
            mov ah,ds:[bp+32]
            mov es:[si],ax
            sub si,2
            loop s31
    
            pop di
            pop si
            add di,0a0h
            sub si,0a0h
            call delay
            call clear_screen
            pop cx
            loop s01
    
            pop si
            pop di
            pop cx
            pop bx
            pop ax
            ret
    
    delay:
            push cx
            mov cx,6h
       ds0:
            push cx
            mov cx,0ffffh
       ds1:
            loop ds1
            pop cx
            loop ds0
            pop cx
            ret
    
    clear_screen:
            push cx
            push di
            mov di,0
            mov cx,2000
       sc0:
            mov word ptr es:[di],0
            add di,2
            loop sc0
            pop di
            pop cx
            ret
    
    codesg ends
    end start
  • 相关阅读:
    二叉树的镜像(剑指offer-18)
    树的子结构(剑指offer-17)
    合并两个有序链表(剑指offer-16)
    OutOfMemory相关问题(内存溢出异常OOM)
    Java内存区域
    招银网络(一面06.29)
    反转链表(剑指offer-15)
    链表中倒数第k个节点(剑指offer-14)
    调整数组顺序使奇数位于偶数前面(剑指offer-13)
    数值的整数次方(剑指offer-12)
  • 原文地址:https://www.cnblogs.com/regconfi/p/4187560.html
Copyright © 2020-2023  润新知