+ -
当前位置:首页 → 问答吧 → 汇编语言 无法生成任何文件 list也没有生成

汇编语言 无法生成任何文件 list也没有生成

时间:2011-11-27

来源:互联网

求 商品单价 输入 数量 总价格 但是编译时 没有生成相应文件 求解

代码如下
dseg segment
  prompt1 db 'the quantity of parts:$'
  prompt2 db 'the value of parts:$'
  crlf db 0dh,0ah,'$'
  quantity db 8,?,8 dup(' ') 
  value db 8,?,8 dup(' ') 
  qty dw ?
  price dw ?
dseg ends

stack segment stack
  db 200 dup(?)
stack ends

StrDisp macro message;显示宏
  lea dx, message
  mov ah, 09h
  int 21h
  endm

StrInput macro NumStr;输入
  lea dx,NumStr
  mov ah,0ah
  int 21h
  endm


cseg segment
main proc far
  assume cs:cseg,ds:dseg
start:
  push ds
  sub ax,ax
  push ax
  mov ax,dseg
  mov ds,ax
begin: 

  StrDisp prompt1
  StrInput quantity
  StrDisp crlf
  StrDisp prompt2
  StrInput value
  StrDisp crlf

  call subconv;从键盘输入
  call subcalc
  call subdisp
   
   
  StrDisp crlf

  jmp start
  ret

main endp

subconv proc near

  IRP reg,<ax,bx,cx,si,di>
  push reg
  endm

  lea si,quantity
  mov al,[si+1]
  cbw
  mov cx,ax
  call decbin
  mov qty,bx
  lea si,value
  mov al,[si+1]
  cbw
  mov cx,ax
  call decbin
  mov price,bx

  IRP reg,<di,si,cx,bx,ax>
  pop reg
  endm

  ret
subconv endp


decbin proc near
  mov bx,0
digit: 
  mov al,[si+2]
  inc si
  sub al,30h
  cbw
  xchg ax,bx
  mov di,10
  mul di
  xchg ax,bx
  add bx,ax
  loop digit
  ret
decbin endp


subcalc proc near
  push ax
  push dx
  mov ax,price 
  cwd
  div qty
  mov price,ax
  pop dx
  pop ax
  ret
subcalc endp

GetNumVal macro bit,NamProc
  mov bx,bit
  call NamProc
  endm

subdisp proc near
  push ax
  push bx
  mov ax,price 
  GetNumVal 10000,bindec
  GetNumVal 1000,bindec
  GetNumVal 100,bindec
  GetNumVal 10,bindec
  mov dl,al
  or dl,30h
  mov ah,02h
  int 21h
  pop bx
  pop ax
  ret
subdisp endp


bindec proc near
  mov dx,0
a10:
  cmp ax,bx
  jl a20
  inc dl
  sub ax,bx
  jmp a10
a20:
  push ax
  or dl,30h
  mov ah,02h
  int 21h
  pop ax
  ret
bindec endp
cseg ends
  end start
   

 

作者: wqz521nh   发布时间: 2011-11-27

编译命令贴出来

作者: mydo   发布时间: 2011-11-27