assembly - 运行我的汇编代码时在 DOSBox 上没有得到任何输出?
问题描述
我试图在 DOXBox 上运行我的代码,但我没有得到任何类型的输出。使用 tasm 然后 tlink 文件并尝试运行它我没有得到输出?我需要清除注册表吗?会不会是内存问题?我有点卡住了,我花了最后一个小时试图找出问题所在。我远非汇编语言代码专家。
.model small ;small supports one data segment and one code segment
.stack 100h ;used to push and pop registers/store return address when subroutine called
.386
.data ;creates near data segment for frequently used data
welcome db ' Welcome to the store!!!$'
menu1 db 10,13,'Please select an item: ','$'
menu2 db 10,13, '1.Apples 100/- 2.Blueberrys 50/- 3.Carrots 20/-$'
menu3 db 10,13, 'Select an option: $'
menu4 db 10,13, 'Sorry need more than 3 option$'
menu5 db 10,13, 'Add grocery option:$'
menu6 db 10,13, 'Price:$'
menu7 db 10,13, 'Press 1 to confirm new item or press 2 to return to menu:$'
menu8 db 10,13, 'Enter quantity:$'
menu9 db 10,13, 'Total price: $'
menu10 db 10,13, '*****Order has been processed. Thank you*****$'
menu11 db 10,13, '4.$'
menu12 db 10,13, '/-$'
menu13 db 10,13, 'To reorder: Press <1>$'
menu14 db 10,13, 'Exit: press any key$'
q dw 0
r dw 0
v db 0
s dw 0
rprice dw 100
vprice dw 50
sprice dw 20
nprice dw 0
var1 db 100 dup('$')
.code ;start of assembly code segment
;extrn indec: proc
;extrn outdec: proc
include indec.asm
include outdec.asm
main proc
mov ax,@data
mov dx,ax
mov ah,9
lea dx,welcome
int 21h
start:
cmp v,0
jg start1
mov ah,9
lea dx,menu1
int 21h
menu:
mov ah,9
lea dx,menu2
int 21h
mov ah,9
lea dx,menu3
int 21h
mov ah,1
int 21h
cmp al,31h
je apples_
cmp al,32h
je blueberrys_
cmp al,33h
je carrots_
menuadd:
inc v
mov ah,9
lea dx,menu4
mov ah,9
lea dx,menu7
int 21h
mov ah,1
int 21h
cmp al,32h
je menu
mov ah,9
lea dx,menu5
int 21h
mov si,offset var1
L1:
mov ah,1
int 21h
cmp al,13
je print
mov [si],al
inc si
jmp L1
print:
call price
start1:
mov ah,9
lea dx,menu2
int 21h
mov ah,9
lea dx,menu11
int 21h
mov dx,offset var1
mov ah,9
int 21h
xor ax,ax
mov ax,nprice
call outdec
mov ah,9
lea dx,menu12
int 21h
mov ah,9
lea dx,menu3
int 21h
mov ah,1
int 21h
cmp al,31h
je apples_
cmp al,32h
je blueberrys_
cmp al,33h
je carrots_
additem:
mov ah,9
lea dx,menu8
int 21h
xor ax,ax
call indec
mul nprice
mov bx,ax
jmp totalprice
apples_:
mov ah,9
lea dx,menu8
int 21h
xor ax,ax
call indec
mul vprice
mov bx,ax
jmp totalprice
blueberrys_:
mov ah,9
lea dx, menu8
int 21h
xor ax,ax
call indec
mul rprice
mov bx,ax
jmp totalprice
carrots_:
mov ah,9
lea dx,menu8
int 21h
xor ax,ax
call indec
mul sprice
mov bx,ax
jmp totalprice
price:
mov ah,9
lea dx,menu6
int 21h
mov ax,0
mov bx,0
mov cx,0
mov dx,0
input:
and ax,000fh
push ax
mov ax,10
mul bx
mov bx,ax
pop ax
add bx,ax
mov ah,1
int 21h
cmp al,0Dh
jne input
add nprice,bx
ret
totalprice:
mov ah,9
lea dx,menu9
int 21h
xor ax,ax
mov ax,bx
call outdec
mov ah,9
lea dx,menu13
int 21h
mov ah,9
lea dx,menu14
int 21h
mov ah,1
int 21h
cmp al,31h
je start
mov ah,9
lea dx,menu10
int 21h
mov ah,4ch
int 21h
main endp
end main
解决方案
推荐阅读
- javascript - Webpack Dev Server Live 仅重新加载一次 - 不接受更改
- amazon-web-services - 如何使用 Transform AWS::CodeDeployBlueGreen 为 CloudFormation 模板创建更改集
- php - 在 Laravel 的一家工厂中计算一张桌子的数量
- c# - 如何自定义 SOLine InventoryID 选择器?
- javascript - Javascript切换不适用于元素的孩子和孩子的兄弟姐妹
- javascript - 合并两个对象而不覆盖相同的属性
- javascript - 如何计算 div 标签内的文本行数
- python - 如何检查某人是否有管理员权限 on_message discord.py
- mysql - 哪个 AWS 服务用于我的大型 MySQL 表?
- sql - 如何使用正则表达式作为 CSV 分隔符创建将 CSV 值转换为表格的函数?