⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mn.asm

📁 汇编课程设计 图形编辑器
💻 ASM
📖 第 1 页 / 共 2 页
字号:
title Tu Xing Bian Ji
;******************************************************
setcursor macro     page,crow,ccol            ;set cursor
          mov       ah,2
          mov       bh,page                   ;page No
          mov       dh,crow                   ;row
          mov       dl,ccol                   ;column
          int       10h
          endm
zuobiao1  macro  x,y            ;
   mov ah,0ch
   mov dx,x
   mov cx,y
   mov al,4
   int 10h
   endm
renew macro                        ;
    mov ah ,7
    mov al,30
    mov bh,0fh
    mov ch,3
    mov cl,18
    mov dh,27
    mov dl,76
    int 10h
    mov bh,0
    mov dh,8
    mov dl,20
    mov ah,2
    int 10h
    endm
line  macro  x1,y1,x2,y2,color
  local   line1
  mov cx,x1
  mov dx,y1
line1:
  mov  ah,0ch
  mov  al,color
  int 10h
  inc  cx
  cmp  cx,x2
  jne  line1
  endm
row  macro  x1,y1,x2,y2,color
  local  row1
  mov cx,x1
  mov dx,y1
row1:
  mov  ah,0ch
  mov  al,color
  int 10h
  inc  dx
  cmp  dx,y2
  jne  row1
  endm
show_juxing  macro  x1,y1,x2,y2,color
  local  show1
  mov  si,y1
show1:
  line  x1,si,x2,si,color
  inc  si
  cmp  si,y2
  jne  show1
  endm
display_str  macro  str,len,x,y,color
  mov  ah,13h
  mov  al,0
  mov  cx,len
  mov  bp,offset  str
  mov  bl,color
  mov  dh,x
  mov dl,y
  int  10h
  endm
lookmouse1   macro  x1,y1
  local   mouse11
mouse11:
   mov  ax,0003h
   int   33h
   cmp  bx,1
   jne  mouse11
   mov  x1,cx
   mov  y1,dx
   endm
lookmouse2   macro   x,y
  local  mouse21
  local  mouse22
mouse21:
   mov ax,0005h
   mov  bx,0h
   int 33h
   cmp  ax,1
   jne   mouse21
mouse22:
   mov  ax,0006h
   mov  bx,0h
   int 33h
   cmp  ax,0
   jne  mouse22
   mov  x,cx
   mov  y,dx
  endm

write  macro x,y
    mov ah,0ch
    mov al,color
    mov dx,y
    mov cx,x
    int 10h
 endm
;*********************************************************
data segment
      str1  db 'Graphic',0dh,0ah,'$'
      str2  db '  Line   ',0dh,0ah,'$'
      str3  db ' Ploygon ',0dh,0ah,'$'
      str4  db ' Circle  ',0dh,0ah,'$'
      str5  db 'Rectangle',0dh,0ah,'$'
      str6  db '  Other  ',0dh,0ah,'$'
      str7  db 'pen','$'
      str8  db 'Color',0dh,0ah,'$'
      str9  db  'ew','$'
      str10  db 'ove ','$'
      str11  db 'elete','$'
      str12  db 'ave','$'
      str13  db 'uit','$'
     str15   db 'O', '$'
      str16  db 'N','$'
      str17  db 'M','$'
      str18  db 'D','$'
      str19  db 'S','$'
      str20  db 'Q', '$'  
      str14  db 'Xian Shi Zuo Biao:    ','$'
      a      db   '000'
      b      db   '000'
      str22  db  '  $'
      str21  db   ', $'
      x0 dw ?
      y0 dw ?
      x1 dw ?
      y1 dw ?
      x2 dw ?
      y2 dw ?
      yuanx dw ?  ;yuan xin
      yuany dw ?
      i  dw ?
      temp dw ?
      highbity  dw ?
      lowbity  dw ?
      rc  dw  ?
      m   dw  ?
      n   dw  ?
      mx1 dw ?
      my1 dw ?
      k1  dw ?   ; xie lu
      x  dw ?
      y  dw  ?
      svsr    db      0
      color db 0
data ends
;********************************************************
code segment
main   proc  far
       assume  cs:code,ds:data,es:data
start:
   push ds
   mov ax,0
   push  ax
   mov ax,data
   mov ds,ax
;------------------------
   call init
   call choose
nnnn: 
        push ah
        mov ah,07h
        int 21h
        cmp al,'n'
       jne  nnnn
    call init
    pop  ah
  ret
  main   endp
;-------------------------------------------
init proc near
 mov ah,0
   mov ax,12h
   int 10h
;-----------------------
   mov ah,0bh
   mov bh,0
   mov bl,1
   int 10h
;-----------------------
   line 0,0,639,0,10
   line 0,1,639,1,10
   show_juxing 0,2,639,35,9
   line  0,35,639,35,10
   line 0,36,639,36,10

   line  0,478,639,478,10
   line  0,479,639,479,10

   row 0,0,0,479,10
   row 1,0,1,479,10

   row 637,0,637,479,10
   row 638,0,638,479,10
 
   line 30,40,120,40,10
   row 30,40,30,270,10
   line 30,270,120,270,10
   row 120,40,120,270,10
   show_juxing 31,41,119,269,8
   line 30,280,120,280,10
   line 30,449,120,449,10
   row 30,280,30,449,10
   row 120,280,120,449,10
   show_juxing 31,281,119,448,8
   show_juxing 50,320,100,335,12
   show_juxing 50,345,100,360,13
   show_juxing 50,370,100,385,9
   show_juxing 50,395,100,410,6
   show_juxing 50,420,100,435,17

   line 140,40,620,40,15
   line 140,41,620,41,15
   line 140,448,620,448,15
   line 140,449,620,449,15
   row 140,40,140,449,15
   row 141,40,141,449,15
   row 619,40,619,449,15
   row 620,40,620,449,15
   line 2,452,637, 452,10
   line 2,453,637,452,10
   show_juxing 2,454, 637,478 ,9
   
   call   zuobiao

   line 140,244,620,244,1
   row 380,40,380,449,1
 
;-----------------------
   mov bp,seg str1
   mov es,bp
   display_str     str1,7,3,6,14
   display_str     str2,9,6,5, 14
   display_str     str3,9,8,5, 14
   display_str     str4,9,10,5,14
   display_str     str5,11,12,5,14
   display_str     str6,9,14,5,14
   display_str     str8,5,18,7,14

   display_str     str7,3,1,5,14
   display_str     str9,2,1,11,14
   display_str     str10,4,1,17,14
   display_str     str11,5,1,25,14
   display_str     str12,3,1,33,14
   display_str     str13,3,1,40,14

   display_str     str14,19,1,51,14
   display_str     str21,1,1,73,5

   display_str     str15,1,1,4,10
   display_str     str16,1,1,10,10
   display_str     str17,1,1,16,10
   display_str     str18,1,1,24,10
   display_str     str19,1,1,32,10
   display_str     str20,1,1,39,10
   
;-------------------------------------------
   mov ax,01h
   int 33h
;-------------------------------------------
  
   renew
   call   zuobiao
   line 140,244,620,244,1
   row 380,40,380,449,1
   display_str a,3,1,74,14
   display_str b,3,1,70,14
  ;-------------------------
   mov ah,01h
   mov ch,0
   mov cl,0
   int 10h
   mov ah ,2
   mov bh,0
   mov dh,30
   mov dl,40
   int 10h
ret
init endp
;---------------------------
;chose color ,tu xing 
choose proc near
m1: lookmouse1  mx1,my1
    mov ax,mx1
    mov bx,my1
    cmp bx,320 
    jl  m3
m2:cmp  ax,50
    jl    m1    ;seletecolor
selcolor:
    cmp  ax,100
    jg  m1
    cmp bx,335
    jl   color1
    cmp  bx,360
    jl   color2
    cmp  bx,385
    jl  color3
    cmp bx,410
    jl  color4
    cmp  bx,435
    jl  color5
    jmp other
color1:
    cmp  bx,320
    jl  m1
    mov color,12
    jmp  other
color2:
    cmp  bx,345
    jl m1
    mov color,13
    jmp  other
color3:
    cmp  bx,370
    jl m1
    mov color,9
    jmp  other
color4: cmp  bx,395
    jl  m1
    mov  color,6
    jmp   other
color5:
    cmp   bx,420
    jl    col
    mov   color,17
col:
    jmp  other
m3:
    cmp  bx,31
    jl m5
    cmp  ax,31
    jg  m4
    jmp  m5
m4:
   cmp  ax,100
   jl zyl1
   jmp other
zyl1:
   cmp  bx,112
   jl  lin
   cmp  bx,145
   jl  zhexian
   cmp  bx,177
   jl  yuan
   cmp  bx,208
   jl  juxing
   ;cmp  bx,240
   ;jl  tuo
   ;jmp   other
m5:
   cmp  ax,31
   jg  sos
   jmp other
sos:
   ;cmp  ax,32
   ;jl   open1
   cmp ax,107
   jl  new1
   ;cmp  ax,44
   ;jl  yd
   cmp  ax,242
   jl  dele
   ;cmp  ax,160
   ;jl  sav
   cmp  ax,345
   jg   help
   jmp  quit
help:
   jmp other
lin:
   cmp   bx,94
   jg  w1
   jmp  other
w1:
   call  draw_line
   jmp  other
zhexian:
   cmp   bx,127
   jg  w2
   jmp  other
w2:
   call draw_zhexian
   jmp  other
yuan:
   cmp  bx,159
   jg  w3
   jmp  other
w3:
   call  draw_circle
   jmp  other
juxing:
   cmp  bx,191
   jg  w4
   jmp  other
w4:
   call   draw_juxing
   jmp  other

;tuo:
   ;cmp  bx,222
   ;jg  w5
   ;jmp   other
w5:call  other
   jmp   other
;open1:
   ;cmp  ax,0
   ;jg  G1
   ;jmp  other
;G1:
   ;call  openproce
   ;jmp  other
new1:
   cmp  ax,80
   jg  G2
   jmp other
G2:
call aa
jmp other
;yd
 ;cmp  ax,64
   ;jg  G3
   ;jmp  other
;G3:
   ;call  ydproce
   ;jmp   other
dele:
   cmp  ax,188
   jg  G4
   jmp  other
G4:
   call   bb
   call   zuobiao

   line 140,244,620,244,1
   row 380,40,380,449,1
   jmp  other
;sav:cmp  ax,128                                                             1
    ;jg  G5
    ;jmp   other
;G5:
    ;call   savproce
    ;jmp  other
quit:
    cmp  ax,310
    jg  G6
    jmp  other
G6:
    jmp tui
    
other:
  mov ax,01h
  int 33h
  jmp m1

tui:
  mov ah,0
  mov al,3h
  int 10h
ret
choose endp

;--------------------------------------
aa proc near
 mov ah,0
   mov ax,12h
   int 10h
;-----------------------
   mov ah,0bh
   mov bh,0
   mov bl,1
   int 10h
 line 0,0,639,0,10
   line 0,1,639,1,10
   show_juxing 0,2,639,35,9
   line  0,35,639,35,10
   line 0,36,639,36,10

   line  0,478,639,478,10
   line  0,479,639,479,10

   row 0,0,0,479,10
   row 1,0,1,479,10

   row 637,0,637,479,10
   row 638,0,638,479,10
 
   line 30,40,120,40,10
   row 30,40,30,270,10
   line 30,270,120,270,10
   row 120,40,120,270,10

   show_juxing 31,41,119,269,8
   line 30,280,120,280,10
   line 30,449,120,449,10
   row 30,280,30,449,10
   row 120,280,120,449,10
   show_juxing 31,281,119,448,8
   show_juxing 50,320,100,335,12
   show_juxing 50,345,100,360,13
   show_juxing 50,370,100,385,9
   show_juxing 50,395,100,410,6
   show_juxing 50,420,100,435,17

   line 140,40,620,40,15
   line 140,41,620,41,15
   line 140,448,620,448,15
   line 140,449,620,449,15
   row 140,40,140,449,15
   row 141,40,141,449,15
   row 619,40,619,449,15
   row 620,40,620,449,15
   line 2,452,637, 452,10
   line 2,453,637,452,10
   show_juxing 2,454, 637,478 ,9
   
   call   zuobiao

   line 140,244,620,244,1
   row 380,40,380,449,1
 ;-------------------------
   mov ah,01h
   mov ch,10
   mov cl,10
   int 10h
;-----------------------
   mov bp,seg str1
   mov es,bp
   display_str     str1,7,3,6,14
   display_str     str2,9,6,5, 14
   display_str     str3,9,8,5, 14
   display_str     str4,9,10,5,14
   display_str     str5,11,12,5,14
   display_str     str6,9,14,5,14
   display_str     str8,5,18,7,14

   display_str     str7,3,1,5,14
   display_str     str9,2,1,11,14
   display_str     str10,4,1,17,14
   display_str     str11,5,1,25,14
   display_str     str12,3,1,33,14
   display_str     str13,3,1,40,14

   display_str     str14,19,1,51,14
   display_str     str21,1,1,73,5

   display_str     str15,1,1,4,10
   display_str     str16,1,1,10,10
   display_str     str17,1,1,16,10
   display_str     str18,1,1,24,10
   display_str     str19,1,1,32,10
   display_str     str20,1,1,39,10
   
;-------------------------------------------
   mov ax,01h
   int 33h

;-------------------------------------------
   display_str b,3,1,73,14
  display_str a,3,1,70,14
   renew
   call   zuobiao
   line 140,244,620,244,1
   row 380,40,380,449,1
ret
aa endp
bb proc near
mov ah ,7
    mov al,30
    mov bh,0fh
    mov ch,3
    mov cl,18
    mov dh,27
    mov dl,76
    int 10h
    mov bh,0
    mov dh,8
    mov dl,20
    mov ah,2
    int 10h
ret
bb endp
draw_line  proc  near
  push  ax
  push  bx
  push  cx
  push  dx
next1p:
  ;mov  ax,1
  ;int 33h
ky:
  lookmouse2  x1,y1
  mov  ax,x1
  cmp  ax,143
  jl next1p
  lookmouse2  x2,y2
  mov  ax,2
   int 33h
next2:
  call  linem
  mov  ax,1
  int  33h
  pop  dx
  pop   cx
  pop  bx
  pop   ax
jj:
 ;   mov ax,1
  ;  int 33h
    ret
draw_line  endp
;.........................................
linem  proc  near
  mov  ax,x2
  cmp  ax, x1
  je  equ1
  cmp  ax,x1
  jg  big
  jmp  small
  big:  sub  ax,x1
  cmp  ax,10h
  jle  equ1
  jmp   xl
small:
  mov bx,x1
  sub bx,x2
  cmp   bx,10h
  jle  equ1
xl:
  call   jsxl
  mov  ax, k1
  cmp  ax,0
  je  spx

  call   linex
  jmp   exitp
equ1:
   mov  ax,y2
   cmp  ax,y1

   jg  af
   call  lineb
   jmp  exitp
af:call   linea
   jmp   exitp
spx:
   mov  ax,x2
   cmp  ax,x1
   jg  cd
   call  lined
   jmp  exitp
cd:
   call   linec

exitp:
   ret
linem  endp
;..........................................
linea  proc  near
    mov  cx, x1
    mov   dx, y1
kk:
    mov  ah,0ch
    mov  al,color
    int 10h
    cmp  dx,y2
    je   exit11
    inc  dx
   jmp  kk
exit11:
    ret
linea  endp
;..........................................
lineb  proc  near
   mov  cx,x2
   mov  dx,y2
k2k:
   mov   ah,0ch
   mov  al,color
   int 10h
   cmp  dx,y1
   je   exit2
   inc  dx
   jmp   k2k
exit2:
   ret
lineb   endp
;..........................................
linec proc  near

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -