【发布时间】:2017-07-24 01:59:56
【问题描述】:
所以我对组装非常非常陌生,我们有一个学校任务来计算功能: 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:常数值太大
就像我说的,我对此很陌生,所以您提供的任何帮助或信息都会有很大帮助! 谢谢!
【问题讨论】:
标签: assembly compiler-errors masm