首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 嵌入开发 > 汇编语言 >

End of file encountered on input file解决办法

2012-03-28 
End of file encountered on input fileMENU MACROcall clearmov ah,13hmov dx,seg str1mov es,dxmov dx,o

End of file encountered on input file
MENU MACRO
  call clear
  mov ah,13h
  mov dx,seg str1
  mov es,dx
  mov dx,offset str1
  mov bp,dx
  mov cx,count1
  mov dh,5
  mov dl,20
  mov bh,0
  mov al,0
  mov bl,1
  int 10h
  mov ah,2
  mov bh,0
  mov dh,10
  mov dl,20
  int 10h  
ENDM

CLEAR MACRO
  push ax
  push bx
  push cx
  push dx
  mov ah,6
  mov al,0
  mov ch,0
  mov cl,0
  mov dh,24
  mov dl,79
  mov bh,0
  int 10h
  pop dx
  pop cx
  pop bx
  pop ax
  ret
ENDM

get_input MACRO
  mov ah,2
  mov bh,0
  mov dh,10
  mov dl,20
  int 10h
  mov ah,1
  int 21h
ENDM 

input_str MACRO OPR1,OPR2
  mov ah,13h
  mov dx,seg OPR1
  mov es,dx
  mov dx,offset OPR1
  mov bp,dx
  mov cx,OPR2
  mov dh,5
  mov dl,20
  mov bh,0
  mov al,0
  mov bl,1
  int 10h
ENDM

exit MACRO
  mov ah,4ch  
  int 21h
ENDM

DATA SEGMENT
  str1 db '1 Upper and lower case letters conversion',0dh,0ah
  db ' 2 Binary and hex conversion',0dh,0ah
  db ' 3 Exit', 0dh,0ah,0ah
  db ' Please enter 1 or 2 or 3:'
  count1 equ $-str1
  str11 db '1 Big to small conversion',0dh,0ah
  db ' 2 Small to big conversion',0dh,0ah
  db ' 3 Return to the main menu',0dh,0ah,0ah
  db ' Please enter 1 or 2 or 3:'
  count2 equ $-str11
  str21 db '1 Binary to hex',0dh,0ah
  db ' 2 Hex to binary',0dh,0ah
  db ' 3 Return to the main menu',0dh,0ah,0ah
  db ' Please enter 1 or 2 or 3:'
  count3 equ $-str21
DATA ENDS

CODE SEGMENT
  ASSUME CS:CODE,DS:DATA


START:
  mov ax,data
  mov ds,ax
   
wait_input:  
  mov ah,1
  int 21h

  cmp al,'1' ;first panduan
  je pro1
  cmp al,'2'
  je pro1  
  cmp al,'3'
  je exit1  
  jmp wait_input
exit1:
  ; mov ah,4ch
  ; int 21h
  ret
pro1:
  clear
  input_str MACRO str11,count2  
  get_input
  cmp al,'1' ;jin ru er ji cai dan
  je L_S ;kai shi zhuan huan cheng xu
  cmp al,'2'
  je S_L
  cmp al,'3'
  menu
  jmp pro1

L_S: 
  get_input
  cmp al,1bh
  je exit1
  sub al,20h
  mov ah,9h
  mov bh,0
  mov bl,41h
  int 10h
  jmp pro1
S_L:
  get_input
  cmp al,1bh
  je exit1
  add al,20h
  mov ah,9h
  mov bh,0
  mov bl,41h
  int 10h
  jmp pro1


 
pro2:
  clear
  input_str MACRO str21,count3
  get_input
  cmp al,'1'
  je E_S
  cmp al,'2'
  je S_E
  cmp al,'3'
  menu 
  jmp pro2  

E_S:
  get_input
  cmp al,1bh
  je exit1
  add al,20h
  mov ah,9h
  mov bh,0
  mov bl,41h
  int 10h
  jmp pro2
  
S_E:
  get_input
  cmp al,1bh
  je exit1
  add al,20h
  mov ah,9h
  mov bh,0
  mov bl,41h
  int 10h
  jmp pro2

CODE ENDS  
END START




End of file encountered on input file
warning A4085:End of file,no END directive
open segments :code
end of file encountered on input file


我对过程定义理解不透彻,不知道这个END到底应该怎么修改?在线等待


[解决办法]
使用宏时,应该直接写宏名称,如果有参数,在名称后面加个空格然后写参数,各参数之间用逗号分隔。
call clear —— 这样的写法是调用函数,而clear是一个宏不是函数,应该把call去掉。
input_str MACRO str21,count3 —— 这样的写法是定义宏,在程序中使用时应该把MACRO去掉。
[解决办法]
宏定义是由一对宏汇编伪指令MACRO/ENDM来完成:其中宏名是符合语法的标识符,同一源程序中该名字定义惟一,宏可以带显式参数表:可选的参形表给出了宏定义中用到的形式参数,每个形式参数(哑元)之间用逗号分隔.
MENU MACRO 
call clear 
mov ah,13h 
mov dx,seg str1 
mov es,dx 
mov dx,offset str1 
mov bp,dx 
mov cx,count1 
mov dh,5 
mov dl,20 
mov bh,0 
mov al,0 
mov bl,1 
int 10h 
mov ah,2 
mov bh,0 
mov dh,10 
mov dl,20 
int 10h
ENDM 

CLEAR MACRO 
push ax 
push bx 
push cx 
push dx 
mov ah,6 
mov al,0 
mov ch,0 
mov cl,0 
mov dh,24 
mov dl,79 
mov bh,0 
int 10h 
pop dx 
pop cx 
pop bx 
pop ax 
ret 
ENDM 

get_input MACRO 
mov ah,2 
mov bh,0 
mov dh,10 
mov dl,20 
int 10h 
mov ah,1 
int 21h 
ENDM 

input_str MACRO OPR1,OPR2 
mov ah,13h 
mov dx,seg OPR1 
mov es,dx 
mov dx,offset OPR1 
mov bp,dx 
mov cx,OPR2 
mov dh,5 
mov dl,20 
mov bh,0 
mov al,0 
mov bl,1 
int 10h 
ENDM 

exit MACRO 
mov ah,4ch
int 21h 
ENDM 

DATA SEGMENT 
str1 db '1 Upper and lower case letters conversion',0dh,0ah 
db ' 2 Binary and hex conversion',0dh,0ah 
db ' 3 Exit', 0dh,0ah,0ah 
db ' Please enter 1 or 2 or 3:' 
count1 equ $-str1 
str11 db '1 Big to small conversion',0dh,0ah 
db ' 2 Small to big conversion',0dh,0ah 
db ' 3 Return to the main menu',0dh,0ah,0ah 
db ' Please enter 1 or 2 or 3:' 
count2 equ $-str11 
str21 db '1 Binary to hex',0dh,0ah 
db ' 2 Hex to binary',0dh,0ah 
db ' 3 Return to the main menu',0dh,0ah,0ah 


db ' Please enter 1 or 2 or 3:' 
count3 equ $-str21 
DATA ENDS 

CODE SEGMENT 
ASSUME CS:CODE,DS:DATA 


START: 
mov ax,data 
mov ds,ax 

wait_input:
mov ah,1 
int 21h 

cmp al,'1' ;first panduan 
je pro1 
cmp al,'2' 
je pro1
cmp al,'3' 
je exit1
jmp wait_input 
exit1: 
; mov ah,4ch 
; int 21h 
ret 
pro1: 
clear 
input_str MACRO str11,count2
get_input 
cmp al,'1' ;jin ru er ji cai dan 
je L_S ;kai shi zhuan huan cheng xu 
cmp al,'2' 
je S_L 
cmp al,'3' 
endm ;这条指令
jmp pro1 

L_S: 
get_input 
cmp al,1bh 
je exit1 
sub al,20h 
mov ah,9h 
mov bh,0 
mov bl,41h 
int 10h 
jmp pro1 
S_L: 
get_input 
cmp al,1bh 
je exit1 
add al,20h 
mov ah,9h 
mov bh,0 
mov bl,41h 
int 10h 
jmp pro1 

pro2: 
clear 
input_str MACRO str21,count3 
get_input 
cmp al,'1' 
je E_S 
cmp al,'2' 
je S_E 
cmp al,'3' 
medm ;这条指令
jmp pro2

E_S: 
get_input 
cmp al,1bh 
je exit1 
add al,20h 
mov ah,9h 
mov bh,0 
mov bl,41h 
int 10h 
jmp pro2 
S_E: 
get_input 
cmp al,1bh 
je exit1 
add al,20h 
mov ah,9h 
mov bh,0 
mov bl,41h 
int 10h 
jmp pro2 
endm;缺少关键指令
CODE ENDS
END START 

热点排行