首页 > 代码库 > 汇编语言 demo1,2,3

汇编语言 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 ends11 12 codesg segment13 start:14         mov ax,data15         mov ds,ax16 17         mov ax,0b800h18         mov es,ax19 20         mov ax,stack21         mov ss,ax22         mov sp,20h23         mov di,024         mov cx,1625    main:26         push cx27         mov al,2ah28         mov ah,ds:[di]29         inc di30         push di31 32         mov dx,133         mov di,7d0h34         mov si,7d0h35         mov cx,0bh36 37    lmain:38         push cx39         push si40         push di41         mov bx,dx42         mov cx,dx43         44    ms:45         push cx46         mov bp,047         mov cx,bx48 49    mA:50         mov es:[bp+di],ax                       51         mov es:[bp+si],ax52         add bp,453         loop mA54 55         add di,09eh56         sub si,0a2h57         inc bx58         pop cx59         loop ms60 61         inc dx62         pop di63         pop si64         sub di,0a2h65         add si,09eh66         call delay67         pop cx68         loop lmain69 70         pop di71         pop cx72         loop main73 ;       jmp main74 75         mov ax,4c00h76         int 21h77 78 79 delay:80         mov cx,08h81    d1:82         push cx83         mov cx,0ffffh84    d2:85         loop d286         pop cx87         loop d188         ret89 90 codesg ends91 end start

技术分享

assume cs:codesgdata 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,1data endsstack segment        dw 32 dup (0)stack endscodesg segmentstart:        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 21hyanhua:        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        retzhanfang:        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        retziti:        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        retdelay:        push cx        mov cx,6h   s1:        push cx        mov cx,0ffffh   s2:        loop s2        pop cx        loop s1        pop cx        retclear_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        retcodesg endsend start

技术分享

assume cs:codesgdata 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,1data endsstack segment        dw 16 dup (0)stack endscodesg segmentstart:        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 21hhou:        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        retqian:        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        retdelay:        push cx        mov cx,6h   ds0:        push cx        mov cx,0ffffh   ds1:        loop ds1        pop cx        loop ds0        pop cx        retclear_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        retcodesg endsend start

 

汇编语言 demo1,2,3