+ handle properly inline asm segment constants different than word:

o 'DB SEG symbol' produces an error
  o 'DD SEG symbol' (and anything larger than DW, like DQ) adds extra high zeros
    to the segment constant (this is Turbo Pascal 7 compatible)

git-svn-id: trunk@32283 -
This commit is contained in:
nickysn 2015-11-10 21:18:34 +00:00
parent 606b64a7f1
commit a553b15a1c
4 changed files with 343 additions and 328 deletions

View File

@ -2457,7 +2457,7 @@ cg_f_max_units_reached=06057_F_Maximum number of units ($1) reached for the curr
#
# Assembler reader
#
# 07127 is the last used one
# 07128 is the last used one
#
asmr_d_start_reading=07000_DL_Starting $1 styled assembler parsing
% This informs you that an assembler block is being parsed
@ -2763,6 +2763,10 @@ asmr_e_seg_without_identifier=07126_E_SEG used without identifier
% supported
asmr_e_CODE_or_DATA_without_SEG=07127_E_@CODE and @DATA can only be used with the SEG operator
% You can only use @CODE and @DATA symbols together with the SEG operator
asmr_e_const16bit_for_segment=07128_E_Not enough space (16 bits required) for the segment constant of symbol $1
% Specifying a segment constant for a symbol via the SEG operator requires at
% least 16 bits of space for the segment. This error occurs, if you specify
% less, for example, if you use 'DB SEG symbol' instead of 'DW SEG symbol'.
#
# Assembler/binary writers

View File

@ -800,6 +800,7 @@ const
asmr_e_invalid_ref_register=07125;
asmr_e_seg_without_identifier=07126;
asmr_e_CODE_or_DATA_without_SEG=07127;
asmr_e_const16bit_for_segment=07128;
asmw_f_too_many_asm_files=08000;
asmw_f_assembler_output_not_supported=08001;
asmw_f_comp_not_supported=08002;
@ -1022,9 +1023,9 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 76379;
MsgTxtSize = 76461;
MsgIdxMax : array[1..20] of longint=(
27,99,344,124,96,58,128,32,208,64,
27,99,344,124,96,58,129,32,208,64,
58,20,1,1,1,1,1,1,1,1
);

File diff suppressed because it is too large Load Diff

View File

@ -2351,26 +2351,40 @@ Unit Rax86int;
BuildConstSymbolExpression(false,false,false,value,asmsym,asmsymtyp,isseg,is_farproc_entry);
if asmsym<>'' then
begin
if constsize<>sizeof(pint) then
if (not isseg) and (constsize<>sizeof(pint)) then
Message1(asmr_w_const32bit_for_address,asmsym);
{$ifdef i8086}
if asmsym='@DATA' then
begin
if not isseg then
Message(asmr_e_CODE_or_DATA_without_SEG);
if constsize<2 then
Message1(asmr_e_const16bit_for_segment,asmsym);
if current_settings.x86memorymodel=mm_huge then
curlist.concat(Tai_const.Create_fardataseg)
else
curlist.concat(Tai_const.Create_dgroup);
if constsize>2 then
ConcatConstant(curlist,0,constsize-2);
end
else if asmsym='@CODE' then
begin
if not isseg then
Message(asmr_e_CODE_or_DATA_without_SEG);
if constsize<2 then
Message1(asmr_e_const16bit_for_segment,asmsym);
curlist.concat(Tai_const.Create_seg_name(current_procinfo.procdef.mangledname));
if constsize>2 then
ConcatConstant(curlist,0,constsize-2);
end
else if isseg then
curlist.concat(Tai_const.Create_seg_name(asmsym))
begin
if constsize<2 then
Message1(asmr_e_const16bit_for_segment,asmsym);
curlist.concat(Tai_const.Create_seg_name(asmsym));
if constsize>2 then
ConcatConstant(curlist,0,constsize-2);
end
else
{$endif i8086}
ConcatConstSymbol(curlist,asmsym,asmsymtyp,value);