gpt4 book ai didi

assembly - 组装错误A2071 : initializer magnitude too large for specific size

转载 作者:行者123 更新时间:2023-12-02 10:54:05 24 4
gpt4 key购买 nike

因此,我对组装非常陌生,我们为学校分配了计算机功能:
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更改为 dwdd,但随后收到错误消息:

Error A2084: constant value too large



就像我说的那样,我对此很陌生,因此无论您提供什么帮助或信息都会有很大帮助!
谢谢!

最佳答案

对于db ...使用“...”代替'...'。

关于assembly - 组装错误A2071 : initializer magnitude too large for specific size,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42587684/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com