回 帖 发 新 帖 刷新版面

主题:救助高手

看看这个能不能把他改成简单的记事本
     要求有保存和删除 和新建就可以red_chr macro    mov ah,0                          ;读取字符宏定义
                 int 16h
                 endm
;---------------------------------------------------------------------------
string macro p1  mov ah,9                        ;输入字符光标
                 lea dx,p1
                 int 21h
                 endm

win macro opr1,opr2,opr3,opr4,opr5,opr6    ;建立窗口
 mov ah,06h
 mov al,opr1
 mov bh,opr2
 mov ch,opr3
 mov cl,opr4
 mov dh,opr5
 mov dl,opr6
 int 10h
endm
pos_curse macro op1,op2,op3               ;定义光标位置
 mov ah,2
 mov bh,op1
 mov dh,op2
 mov dl,op3
 int 10h
endm
pos_get  macro                             ;显示光标位置
 mov ah,03h
 mov bh,0
 int 10h
endm
data     segment                           ;定义数据段
 menu     db 'File  Edit  Help $'

 mass_1   db 'F1 Active file     F10 Active help','$'
 manu_1   db ' New      ',13,10,'$'
 manu_2   db ' Open     ',13,10,'$'
 manu_3   db ' Save     ',13,10,'$'
 manu_4   db ' Save as  ',13,10,'$'
 manu_5   db ' Exit     ','$'
 handle   dw ?
 message1 db ' Please input file name:','$'
 message2 db ' Please input save file name:','$'
 message3 db ' Please input open file name:','$'
 message4 db ' ***The file is not save! Save it now? (Y/N)***: ','$'
 path     db 50 dup(0),'$'
 buffer   db 2000 dup(?)
 bak      db 3850 dup(0)
 line     db ?
 row      db ?
 char     db ?
help_mas1 db ' welcome use editor! $'       ;帮助内容
help_mas2 db 'please the first active help! $'
help_mas3 db 'good lucky!! $'
help_mas4 db '==========================================================$'
help_mas5 db 'Press F1 to active file. $'
help_mas6 db 'You can use DOWN cursor key to choose the fuction $'
help_mas7 db 'Press F10 to show the help massage.Press Esc To Quit$'
date  db  'today ??/??/','$'   ;调用日期
hanglie db '???//???','$'      ;行//列
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
 call wind 
 call edit                               
 ret
main     endp
wind proc near                               ;创建窗口子程序
 win 0,3eh,1,0,24,79                 ;定义窗口背景
 win 1,1fh,0,0,0,79
 win 0,1fh,24,0,24,79
show:                        ;显示菜单位置及内容
 pos_curse 0,0,1   
 mov ah,9
 lea dx,menu
 int 21h
show_2:         ;显示状态栏位置及内容
 pos_curse 0,24,1
 mov ah,9
 lea dx,mass_1
 int 21h
 call win3
 call win4
 pos_curse  0,1,0
 mov row,dh
 mov line,dl
wind endp
edit proc near
char_get:                             ;读字符
call com
com proc near                         ;定义功能鍵
pos_get
mov  row,dh
mov  line,dl
first:
pos_curse 0,row,line
j00:    mov ah,0
int 16h                        ;从键盘读字符 ah=扫描码 al=字符码
push ax
lea dx,buffer
mov buffer[bx],al
inc bx
cmp  ah,48h                    ;上
jz   up_1
cmp  ah,50h                    ;下
jz   down_1
cmp  ah,4bh                    ;左
jz   left
cmp  ah,4dh                    ;右
jz   right
cmp  ah,1ch                    ;回车
jz   enter_1
call fuc_key
mov ah,2
mov dl,al
int 21h
pop ax
call  menu_show
jmp   j6
down_1:
jmp down
enter_1:
jmp enter_2
up_1:   jmp up
left:                                   ;光标左移
pos_get
mov row,dh
mov dl,line
cmp line,0
jnz direct
mov line,79
dec row
cmp row,0
je  stop2                                           
jmp first
stop2:
mov row,1
jmp first
direct:  
dec line
call win4                      ;显示光标位置
jmp first
right:                                 ;光标右移
pos_get
mov row,dh
mov dl,line
cmp line,79
jnz direct2
mov line,0
inc row
cmp row,24
je  returns1      
jmp first
direct2:
inc  line
call win4
jmp first
enter_2:
jmp enter
up:                                     ;上移光标
pos_get
mov row,dh
mov dl,line
dec row
cmp row,0
je  stop1
call win4
jmp first
stop1: 
mov row,1
jmp first
down:                                    ;下移光标
pos_get
mov row,dh
mov dl,line  
inc row
cmp row,24
je  stop3
call win4
jmp first
stop3: 
mov row,23
jmp first
returns1:
jmp returns
enter:                                   ;回车换行
pos_get
                    ;保存文件

回复列表 (共1个回复)

沙发

强,老朽那么大年纪了,还没有写过那么大的程序.

我来回复

您尚未登录,请登录后再回复。点此登录或注册