2017-03-03 25 views
0

所以我對組裝非常非常新,我們爲學校計算機賦值函數: z = x^2 * y - 16(4 - y )我一直在使用MASM嘗試編譯它,以確定它是否會工作,但我不斷收到一個錯誤組裝錯誤A2071:對於特定尺寸的初始化程度幅度過大

,錯誤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 $' 

我試圖改變dbdwdd但隨後收到的錯誤:

Error A2084: constant value too large

就像我說的,我對這個很陌生,所以無論如何您提供的幫助或信息將非常有幫助! 謝謝!

回答

1

對於db ...使用「...」而不是'...'。