首页 > 试题广场 >

利用汇编语言编写一道程序,不使用乘法以及除法指令,计算(((

[问答题]

利用汇编语言编写一道程序,不使用乘法以及除法指令,计算(((AX*5)+300h)/2-100h)*8的值。

mov bx,ax
shl ax, 2
add ax, bx
add ax, 300h
shr ax, 1
sub ax,100h
shl ax, 3
发表于 2021-03-01 18:05:18 回复(0)
.386
.model flat, stdcall
option casemap: none
 
include windows.inc
include kernel32.inc
include user32.inc
 
includelib kernel32.lib
includelib user32.lib
ExitProcess PROTO,dwexception:dword

.data
szSum dw ?

.code
main PROC
    mov bx,ax
    shl ax,2
    add ax,bx
    add ax,300h
    shr ax,1
    sub ax,100h
    shl ax,3
    mov szSum,ax
    INVOKE ExitProcess,0
main ENDP
END main
发表于 2020-08-21 10:40:04 回复(0)
mov bx,ax
sal ax,1
sal ax,1
add ax,bx
add ax,300
sar ax,2
sub ax,100
sal ax,1
sal ax,1
sal ax,1
发表于 2020-06-27 17:54:39 回复(0)