所以我对组装很陌生,我们学校有一项任务是计算机: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,但随后收到错误:
错误A2084:常量值过大
就像我说的,我对此非常陌生,所以无论你提供什么帮助或信息,都会有很大的帮助!谢谢!
发布于 2017-03-03 20:27:32
为了分贝..。用“.”而不是“.”
https://stackoverflow.com/questions/42587684
复制相似问题