没有mul和div的大会8086问题 [英] Assembly 8086 questions without mul and div

查看:100
本文介绍了没有mul和div的大会8086问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对程序集8086(无mul/div)有疑问:

I have some question of assembly 8086 (without mul/div):

如何在不使用mul和div的情况下进行此练习:

how to do this exercises without mul and div:

1)bx←bx×32C(1行)

1) bx←bx×32C (1 line)

2)bx←bx×41(5行)

2) bx←bx×41 (5 lines)

3)bx←bx×63

3) bx←bx×63

4)bx←bx/16

4) bx←bx/16

感谢您的帮助!

推荐答案

它们都是许多相当简单的移位/算术运算,下面实现了两个(未经测试)并带有其余提示;

They're all a number of fairly simple shift/arithmetic operations, two (untested) implemented below with hints for the rest;

1)bx←bx×32C(1行)

1) bx←bx×32C (1 line)

# A left shift by 5 positions is a multiplication by 32
shl $5, %ebx

2)bx←bx×41(5行,破坏了eax)

2) bx←bx×41 (5 lines, clobbering eax)

# Add ebx + 8*ebx + 32*ebx = 41*ebx
mov %eax, %ebx
shl $3,   %ebx
add %eax, %ebx
shl $2,   %ebx
add %ebx, %eax

3)bx←bx×63

3) bx←bx×63

# Calculate 64*ebx - ebx = 63*ebx

4)bx←bx/16

4) bx←bx/16

# A shift right by 4 is a division by 16

这篇关于没有mul和div的大会8086问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆