- 分享
- 0
- 人气
- 0
- 主题
- 30
- 帖子
- 178
- UID
- 577491
- 积分
- 374
- 阅读权限
- 15
- 注册时间
- 2013-12-20
- 最后登录
- 2016-3-22
- 在线时间
- 1281 小时
|
我要记录 价钱 然后 display 出来
.MODEL SMALL
.STACK
.DATA
IDmsg DB " Please enter ID: $"
WrongIDmsg DB 0ah,0dh," Invalid Login ID, Please Try Again !!!! $"
Welcomemsg DB 0ah,0dh," Welcome To System.... ",0ah,0dh
DB " -------------------------------------------------------- $",0ah,0dh
CustNamemsg DB 0ah,0dh," Enter customer name : $"
Contactmsg DB 0ah,0dh," Enter customer contact number : $"
Choicemsg DB 0ah,0dh," Enter Your Choice : $"
Quantitymsg DB 0ah,0dh," Enter Quantity : $"
choice DB ?
price DB ?
quantity DB ?
ProdDetailsMsg DB 0ah,0dh," Product Details .... ",0ah,0dh
DB " -------------------------------------------------------- ",0ah,0dh
DB " | Product Description | Price | ",0ah,0dh
DB " -------------------------------------------------------- ",0ah,0dh
DB " | (1) Washing Machine RM 500.00 | ",0ah,0dh
DB " | (2) Refrigrator RM 700.00 | ",0ah,0dh
DB " | (3) LED Samsung TV RM 1000.00 | ",0ah,0dh
DB " -------------------------------------------------------- $",0ah,0dh
AnymoreMsg DB 0ah,0dh," Anymore item to order?? (Y/N) : $",0ah,0dh
ErrorMsg DB 0ah,0dh,"Please Enter Y or N only.. $",0ah,0dh
TotalPriceMsg DB 0ah,0dh," Total Price : $",0ah,0dh
Id DB 5 DUP(?)
defaultID DB 'a','d','m','i','n'
validID DB 0
newline db " ",0ah,0dh,"$"
CustName Label Byte
Max_Len DB 30
ACT_Len DB ?
KB_Data DB 30 Dup(' ')
contact Label Byte
Max_Len1 DB 15
ACT_Len1 DB ?
KB_Data1 DB 15 Dup(' ')
.CODE
MAIN PROC FAR
MOV AX,@data
MOV DS,AX
;-----------------Enter ID --------------------
EnterID:
mov validID,0
Mov AH,09H
LEA DX,IDmsg
INT 21H
Mov Ah,07H
INT 21H
Mov id[0],AL
Mov Ah,02H
Mov DL,'#'
INT 21H
Mov Ah,07H
INT 21H
Mov id[1],AL
Mov Ah,02H
Mov DL,'#'
INT 21H
Mov Ah,07H
INT 21H
Mov id[2],AL
Mov Ah,02H
Mov DL,'#'
INT 21H
Mov Ah,07H
INT 21H
Mov id[3],AL
Mov Ah,02H
Mov DL,'#'
INT 21H
Mov Ah,07H
INT 21H
Mov id[4],AL
Mov Ah,02H
Mov DL,'#'
INT 21H
;-----------------Veridy ID --------------------
mov si,offset id
mov cx,5
mov DI,offset defaultID
mov AL,[SI]
Cmp AL,[DI]
JE ChkID1
JMP WrongID
ChkID1:
mov AL,[SI]+1
Cmp AL,[DI]+1
JE ChkID2
JMP WrongID
ChkID2:
mov AL,[SI]+2
Cmp AL,[DI]+2
JE ChkID3
JMP WrongID
ChkID3:
mov AL,[SI]+3
Cmp AL,[DI]+3
JE ChkID4
JMP WrongID
ChkID4:
mov AL,[SI]+4
Cmp AL,[DI]+4
JE CorrectID
JMP WrongID
WrongID:
Mov AH,09H
LEA DX,WrongIDmsg
INT 21H
mov ah,09h ;display newline
lea dx,newline
int 21h
JMP EnterID
CorrectID:
mov ah,09h ;display newline
lea dx,newline
int 21h
Mov AH,09H
LEA DX,Welcomemsg
INT 21H
;-----------------Enter customer details --------------------
Mov AH,09H
LEA DX,CustNamemsg
INT 21H
Mov AH,0AH
LEA DX,CustName
int 21H
Mov AH,09H
LEA DX,Contactmsg
INT 21H
Mov AH,0AH
LEA DX,contact
int 21H
mov ah,09h ;display newline
lea dx,newline
int 21h
;-----------------Display product details --------------------
Mov AH,09H
LEA DX,ProdDetailsMsg
INT 21H
mov ah,09h ;display newline
lea dx,newline
int 21h
;-----------------Enter choices --------------------
ContOrder:
Mov AH,09H
LEA DX,Choicemsg
INT 21H
Mov Ah,01H
INT 21H
Mov Choice,AL
;-----------------enter quantity --------------------
Mov AH,09H
LEA DX,Quantitymsg
INT 21H
Mov Ah,01H
INT 21H
Mov quantity,AL
mov ah,09h ;display newline
lea dx,newline
int 21h
;-----------asking for anymore item to order ----------
AskContOrder:
Mov AH,09H
LEA DX,AnymoreMsg
INT 21H
MOV AH,01H
INT 21H
CMP AL, 79H
JE ContOrder
CMP AL,59H
JE ContOrder
CMP AL, 4EH
JE CountPrice
CMP AL, 6EH
JE CountPrice
JNE Error
Error:
MOV AH,09H
LEA DX, ErrorMsg
INT 21H
JMP AskContOrder
CountPrice:
mov ah,09h ;display newline
lea dx,newline
int 21h
MOV AH,09H
LEA DX, TotalPriceMsg
INT 21H
;-----------------retrieve price --------------------
; Mov AL,choice
; CMP choice,1
; JE First
; CMP choice,2
; JE Second
; CMP choice,3
; JE third
; CMP choice,4
; JE Fourth
;First:
; mov price,100
; Second:
; mov price,200
;
;third:
;mov price,300
;Fourth:
;mov price,400
; mov Ah,02H
; mov DL,price
; Add DL,30H
; int 21H
mov ah,09h ;display newline
lea dx,newline
int 21h
MOV AX, 4C00H
INT 21H
MAIN ENDP
END MAIN |
|