'problem with a code "initializer magnitude too large for specified size" on assembler
code works in the following way:it solves the following problem "2d/a-21bd". then it should open a message box, where the result is shown. here is the code:
;include \masm64\include64\masm64rt.inc
.data ;data for the code
a dq 1 ;operand a
b dq 0 ;operand b
c dq 21 ;number 21
d dq 5 ;operand d
q dq 2 ;number 2
res dq 0 ;result
title1 db "Решение уравнения. masm64",0 ;title for the message box
txt1 db "Уравнение 2d/a-21bd",10,
"Результат: %d",10,"Адрес переменной в памяти: %ph",10,10,
"Автор:Тарадай Святослав",0 ;text for the message box
buf1 dq 3 dup(0),0 ;sorry, i don't know what does this code do. if you can say, i'll be happy
.code ;code area. solving a problem 2d/a-21bd
entry_point proc
mov rax ,b ;moving operand b to rax to make a second part of a problem
mul c ;multiplying on 21
mul d ;multiplying on d, or 5
mov rsi, rax ;moving the result to rsi
mov rax,d ;moving operand d, or 5 to rax, making a first part of the problem
mul q ;multiplying on 2
xor rdx,rdx ;preparing rdx to division
div a ;division on a, or 1
sub rax,rsi ;substraction of rsi(21bd) from rax(2d/a)
mov res,rax ;moving result on res
invoke wsprintf,ADDR buf1,ADDR txt1,res, ADDR res1 ;transform function
invoke MessageBox,0,ADDR buf1,ADDR title1,MB_ICONINFORMATION ;output function
invoke ExitProcess,0
entry_point endp
end
but i've got following errors with the invoke thing:
Assembling: C:\masm64\bin64\a1.asm
C:\masm64\bin64\a1.asm(27) : error A2071:initializer magnitude too large for specified size
C:\masm64\bin64\a1.asm(27) : error A2008:syntax error : invokeC:\masm64\bin64\a1.asm(28) : error A2071:initializer magnitude too large for specified size
C:\masm64\bin64\a1.asm(28) : error A2008:syntax error : invokeC:\masm64\bin64\a1.asm(29) : error A2071:initializer magnitude too large for specified size
C:\masm64\bin64\a1.asm(29) : error A2008:syntax error : invokeLINK : fatal error LNK1181: cannot open input file 'C:\masm64\bin64\a1.obj'
if you can help me with this one, because i'm a new one in assembler, i'll be very happy
Solution 1:[1]
The problem was with the compilation.i used the makeit.bat wit RC. just changing it to simple makeit.bat solves the problem
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |