汇编语言 王爽(第三版)实验十六

assume cs:code
stack segment
    db 128 dup(0)
stack ends
code segment

    start:  
        mov ax,stack
        mov ss,ax
        mov sp,128

        push cs
        pop ds
        mov si,offset int7cstart
        mov ax,0
        mov es,ax
        mov di,200h

        mov cx, offset int7cend - offset int7cstart
        cld
        rep movsb

        mov word ptr es:[4*7ch],200h
        mov word ptr es:[4*7ch+2],0

        mov ax,4c00h
        int 21h

    int7cstart:
            jmp short codestart
            table dw offset sh0 - offset int7cstart + 200h, 
                     offset sh1 - offset int7cstart + 200h,
                     offset sh2 - offset int7cstart + 200h, 
                     offset sh3 - offset int7cstart + 200h
        codestart:
            cmp ah,3
            ja ok
            push bx
            push si
            mov bl,ah
            mov bh,0
            add bx,bx
            mov si,offset start - offset int7cstart
            call word ptr table[bx+si+200h]
            pop si
            pop bx
            jmp ok
        sh0:
            push cx
            push es
            push di
            mov cx,0b800h
            mov es,cx
            mov di,0
            mov cx,2000
            sclear:
                mov byte ptr es:[di],' '
                add di,2
                loop sclear
            pop di
            pop es
            pop cx
            ret

        sh1:
            push cx
            push es
            push di
            mov cx,0b800h
            mov es,cx
            mov di,1
            mov cx,2000
            sfrontcolor:
                and byte ptr es:[di],11111000b
                or es:[di],al
                add di,2
                loop sfrontcolor
            pop di
            pop es
            pop cx
            ret

        sh2:
            push cx
            push es
            push di
            mov cx,0b800h
            mov es,cx
            mov di,1
            mov cx,2000
            sbackcolor:
                and byte ptr es:[di],10001111b
                or es:[di],al
                add di,2
                loop sbackcolor
            pop di
            pop es
            pop cx
            ret

        sh3:
            push cx
            push es
            push di
            push ds
            push si
            mov cx,0b800h
            mov es,cx
            mov ds,cx
            mov di,0
            mov si,160
            cld
            mov cx,24
            sremove:
                push cx
                mov cx,160
                rep movsb
                pop cx
                loop sremove
            mov cx,80
            sclearlast:
                mov byte ptr es:[di],' '
                add di,2
                loop sclearlast
            pop si
            pop ds
            pop di
            pop es
            pop cx
            ret

        ok: 
            iret

    int7cend:
        nop

code ends
end start
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值