2017-03-03 1 views
0

Donc, je suis très, très nouveau à l'assemblage, et nous avons une affectation pour l'école à l'ordinateur la fonction: z = x^2 * y - 16 (4 - yErreur d'assemblage A2071: magnitude d'initialisation trop grande pour une taille spécifique

J'ai été utilisé MASM pour essayer de le compiler pour déterminer si cela fonctionnera, mais je continue à recevoir une erreur, erreur 2071: magnitude de l'initialiseur trop grande pour la taille spécifiée.

Mon code est:

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 

L'erreur est rapide à:

 pntequ  db  cr, lf, 'The point (', x, ', ', y, ') is $' 

J'ai essayé de changer db-dw ou dd mais recevoir l'erreur:

Error A2084: constant value too large

Comme je l'ai dit, je suis très nouveau à cela, donc peu importe l'aide ou les informations que vous fournissez seraient d'une grande aide! Merci!

Répondre

1

Pour db ..., utilisez "..." au lieu de "...".