作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
因此,我对组装非常陌生,我们为学校分配了计算机功能:
z = x ^ 2 * y-16(4-y)
我已经使用MASM尝试对其进行编译,以确定它是否可以工作,但是我一直收到错误消息,错误2071:初始化器大小对于指定的大小而言太大。
我的代码是:
title Assignment3_JoelCatterall.asm
.model small
.stack 100h
.data
include const.inc
x dw ?
y dw ?
z dw ?
ntrfir db 'Enter first number $'
ntrsec db cr, lf, 'Enter second number $'
pntequ db cr, lf, 'The point (', x, ', ', y, ') is $'
.code
extrn getint: proc, putint: proc
main proc
; -- initalize DS
mov ax, @data
mov ds, ax
;write "Enter first number"
mov ah, dispstr
mov dx, offset ntrfir
int dosfunc
; read x
call getint
mov x, ax
;write cr, lf, 'Enter second number'
mov ah, dispstr
mov dx, offset ntrfir
int dosfunc
; read y
call getint
mov y, ax;
; z (x,y) = x^2 * y - 16 * (4 - y)
mov ax, x
imul x
imul y
mov cx, ax
mov ax, 16
mov bx, 4
sub bx, y
imul ax
sub cx, bx
mov z, cx
; write cr, lf, 'The point(x, y) is :'
mov ah, dispstr
mov dx, offset pntequ
int dosfunc
mov ax, z
call putint
; return -- to DOS
mov ah, ret2dos
int dosfunc
main endp
end main
pntequ db cr, lf, 'The point (', x, ', ', y, ') is $'
db
更改为
dw
或
dd
,但随后收到错误消息:
Error A2084: constant value too large
最佳答案
对于db ...使用“...”代替'...'。
关于assembly - 组装错误A2071 : initializer magnitude too large for specific size,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42587684/
我是一名优秀的程序员,十分优秀!