Java和汇编语言的关系_在汇编语言中使用跳转和比较

我在下面有这个计算器代码,它工作正常,但它不会跳到“分裂”..我仍然在学习汇编编程的过程...需要帮助解决这个问题...

.model small

.stack 100h

.data

msg1 db 13,10,13,10, "Enter 1st Number : $"

msg2 db 13,10, "Enter 2nd Number : $"

msgEr db 13,10, "Error $"

msgCh db 13,10, "Press A to ADD , S to SUBTRACT ,D to MULTIPLY, F to DIVIDE, X to EXIT : $ "

msgSum db 13,10,13,10, "Sum is : $"

msgDif db 13,10,13,10, "Difference is : $"

msgDiv db 13,10,13,10, "Quotient is : $"

msgMul db 13,10,13,10, "Product is : $"

tmp db ?

.code

start:

mov ax, @data

mov ds, ax

lea dx, msg1

mov ah, 09h

int 21h

mov bx, 0

start1:

mov ah, 01h

int 21h

cmp al,0dh

je next1

mov ah,0

sub al,30h

push ax

mov ax,10d

mul bx

pop bx

add bx,ax

jmp start1

next1:

push bx

lea dx,msg2

mov ah,09h

int 21h

mov bx,0

start2:

mov ah,01h

int 21h

cmp al,0dh

je choice

mov ah,0

sub al,30h

push ax

mov ax,10d

mul bx

pop bx

add bx,ax

jmp start2

choice:

lea dx, msgCh

mov ah, 09h

int 21h

mov ah, 01h

mov answer, al

int 21h

cmp al,'f'

je dividing

cmp al,'a'

je adding

cmp al,'s'

je subtracting

cmp al,'d'

je multiplying

cmp al,'x'

mov ah, 4ch

int 21h

error:

lea dx,msgEr

mov ah,09h

int 21h

jmp start

dividing:

pop ax

div bx

push ax

lea dx,msgDiv

mov ah,09h

int 21h

pop ax

mov cx,0

mov dx,0

mov bx,10d

jmp break

adding:

pop ax

add ax,bx

push ax

lea dx,msgSum

mov ah,09h

int 21h

pop ax

mov cx,0

mov dx,0

mov bx,10d

jmp break

multiplying:

pop ax

mul bx

push ax

lea dx,msgMul

mov ah,09h

int 21h

pop ax

mov cx,0

mov dx,0

mov bx,10d

jmp break

subtracting:

pop ax

sub ax,bx

push ax

lea dx,msgDif

mov ah,09h

int 21h

pop ax

mov cx,0

mov dx,0

mov bx,10d

break:

div bx

push dx

mov dx,0

inc cx

or ax,ax

jne break

ans:

pop dx

add dl,30h

mov ah,02h

int 21h

loop ans

jmp start

end start

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值