在windows下面为什么要用汇编编程序呢?

解决方案 »

  1.   

    请高手修改一下我的程序,图形老是出现段层
    message macro mess
            lea dx,mess
            mov ah,9
            int 21h
    endm
    showcolor macro color1,loop1,loop2,loop3
            mov ax,13h
            int 10h
            mov ax,0a000h
            mov es,ax
            cld
            mov ch,0h
            mov cl,0h
            mov dh,0h
            mov bx,80h
            mov ax,1010h
            mov dl,64
      loop2:
            int 10h
            inc color1
            inc bx
            dec dl
            jnz loop2
            mov al,0bfh
            mov dx,200
            mov si,location
      loop3:
            mov bx,4
      loop1:
            mov di,si
            mov cx,wide
            rep stosb
            add si,320
            dec bx
            jnz loop1
            dec al
            sub dx,4
            cmp dx,4
            jge loop3
            mov ah,0
            int 16h
            mov ax,3
            int 10h
    endm
    data segment
            mess1 db 13,10,'Please input the first corner row1(1-200):$'
            mess2 db 13,10,'Please input the first corner column1(1-320):$'
            mess3 db 13,10,'Please input the second corner row2(1-200):$'
            mess4 db 13,10,'Please input the second corner column2(1-320):$'
            mess5 db 13,10,'Your input is invalid,input again!',13,10,'$'
            mess6 db 13,10,'*************',13,10
                  db       'F1------RED',13,10
                  db       'F2------GREEN',13,10            
                  db       'F3------BLUE',13,10
                  db       'F4------EXIT',13,10
                  db       '*************',13,10
                  db       'Please select color:$'
            flag db ?
            row1 dw ?
            row2 dw ?
            column1 dw ?
            column2 dw ?
            height dw ?
            wide dw ?
            increment dw ?
            location dw ?
            initial dw 320
            ten db 10
    data ends
    code segment
      main proc far
            assume cs:code,ds:data
      start:
            push ds
            sub ax,ax
            push ax
            mov ax,data
            mov ds,ax
      again1:
            message mess1
            call input
            cmp bx,200
            jbe next1
            message mess5
            jmp again1
      next1:
            mov row1,bx
      again2:
            message mess2
            call input
            cmp bx,320
            jbe next2
            message mess5
            jmp again2
      next2:
            mov column1,bx
      again3:
            message mess3
            call input
            cmp bx,200
            jbe next3
            message mess5
            jmp again3
      next3:
            cmp bx,row1
            jae continue1
            xchg bx,row1
      continue1:
            mov row2,bx
            sub bx,row1
            mov height,bx
            cmp bx,64
            jg continue3
            mov increment,1
            jmp again4
      continue3:
            cmp bx,128
            jg continue4
            mov increment,2
            jmp again4
      continue4:
            cmp bx,192
            jg continue5
            mov increment,3
            jmp again4
      continue5:
            mov increment,4
      again4:
            message mess4
            call input
            cmp bx,320
            jbe next4
            message mess5
            jmp again4
      next4:
            cmp bx,column1
            jae continue2
            xchg bx,column1
      continue2:
            mov column2,bx
            sub bx,column1
            mov wide,bx
            dec row1
      again5:
            mov ax,row1
            mul initial
            add ax,column1
            mov location,ax
      
      again6:      
            message mess6
            mov ah,0
            int 16h
            cmp ah,3eh
            jne continue50
            jmp exit1
      continue50:
            cmp ah,3bh
            jne continue30
            showcolor dh,loop11,loop12,loop13
            jmp again5
      continue30:
            cmp ah,3ch
            jne continue40
            showcolor ch,loop21,loop22,loop23
            jmp again5
      continue40:
            cmp ah,3dh
            je continue60
            jmp again5
      continue60:
            showcolor cl,loop31,loop32,loop33
            jmp again5 
      exit1:
            ret
     main endp
     input proc near
      again:
            mov bx,0
            mov flag,0
      newchar:
            mov ah,1
            int 21h
            test flag,1
            je check
            cmp al,0dh
            je exit2
      check:
            mov flag,1
            sub al,30h
            jl error
            cmp al,9
            jg error
            cbw
            xchg ax,bx
            mul ten
            xchg ax,bx
            add bx,ax
            jmp newchar
      error:
            message mess5
            jmp again
      exit2:
            ret
     input endp
    code ends
            end start