Facebook Sharer
选择您要替换的背景颜色:
【农历新年】背景图片:
个性化设定
 注册  找回密码
查看: 844|回复: 0
打印 上一主题 下一主题

有人能帮我解决吗?? assembly language

[复制链接]

30

主题

7

好友

374

积分

超级会员

Rank: 5Rank: 5Rank: 5Rank: 5Rank: 5

跳转到指定楼层
1#
发表于 2014-3-21 05:19 PM |只看该作者 |倒序浏览
我要记录 价钱 然后 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

Untitled33.png (26.96 KB, 下载次数: 0)

Untitled33.png





收藏收藏0
您需要登录后才可以回帖 登录 | 注册

JBTALKS.CC |联系我们 |隐私政策 |Share

GMT+8, 2025-1-28 10:28 AM , Processed in 0.106972 second(s), 25 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

Ultra High-performance Dedicated Server powered by iCore Technology Sdn. Bhd.
Domain Registration | Web Hosting | Email Hosting | Forum Hosting | ECShop Hosting | Dedicated Server | Colocation Services
本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved
合作联盟网站:
JBTALKS 马来西亚中文论坛 | JBTALKS我的空间 | ICORE TECHNOLOGY SDN. BHD.
回顶部