/programs/develop/fasm/trunk/assemble.inc |
---|
618,14 → 618,17 |
load_from_code: |
cmp byte [esi],'.' |
je invalid_value |
call get_relative_offset |
neg eax |
call get_qword_value |
call calculate_relative_offset |
push esi edi |
cmp [next_pass_needed],0 |
jne load_address_ok |
jne load_address_type_ok |
cmp [value_type],0 |
jne invalid_use_of_symbol |
load_address_ok: |
push esi edi |
load_address_type_ok: |
cmp edx,-1 |
jne bad_load_address |
neg eax |
mov esi,edi |
sub esi,eax |
jc bad_load_address |
673,14 → 676,17 |
jne invalid_argument |
cmp byte [esi],'.' |
je invalid_value |
call get_relative_offset |
neg eax |
call get_qword_value |
call calculate_relative_offset |
push esi edi |
cmp [next_pass_needed],0 |
jne store_address_ok |
jne store_address_type_ok |
cmp [value_type],0 |
jne invalid_use_of_symbol |
store_address_ok: |
push esi edi |
store_address_type_ok: |
cmp edx,-1 |
jne bad_store_address |
neg eax |
sub edi,eax |
jc bad_store_address |
cmp edi,[org_start] |
/programs/develop/fasm/trunk/expressi.inc |
---|
841,6 → 841,8 |
sub ebx,14h |
cmp al,0E0h |
je calculate_rva |
cmp al,0E1h |
je calculate_plt |
cmp al,0D0h |
je calculate_not |
cmp al,083h |
1145,12 → 1147,7 |
xor ah,ah |
mov ecx,[edi+16] |
cmp ecx,[ebx+16] |
je sub_values |
cmp ecx,[org_symbol] |
jne invalid_sub |
test byte [ebx+12],1 |
jnz invalid_sub |
mov ah,3 |
sub_values: |
mov [ebx+12],ah |
mov eax,[edi] |
1556,17 → 1553,41 |
calculate_gotoff: |
test [format_flags],8+1 |
jnz invalid_expression |
mov dl,5 |
cmp byte [edi+12],2 |
je gotoff_ok |
je change_value_type |
incorrect_change_of_value_type: |
cmp [error_line],0 |
jne pe64_rva_ok |
jne change_value_type |
mov eax,[current_line] |
mov [error_line],eax |
mov [error],invalid_use_of_symbol |
gotoff_ok: |
mov byte [edi+12],5 |
change_value_type: |
mov byte [edi+12],dl |
add edi,14h |
jmp calculation_loop |
calculate_plt: |
cmp word [edi+8],0 |
jne invalid_expression |
cmp [output_format],5 |
jne invalid_expression |
test [format_flags],1 |
jnz invalid_expression |
mov dl,6 |
mov dh,2 |
test [format_flags],8 |
jz check_value_for_plt |
mov dh,4 |
check_value_for_plt: |
mov eax,[edi] |
or eax,[edi+4] |
jnz incorrect_change_of_value_type |
cmp byte [edi+12],dh |
jne incorrect_change_of_value_type |
mov eax,[edi+16] |
cmp byte [eax],81h |
jne incorrect_change_of_value_type |
jmp change_value_type |
div_64: |
xor ebx,ebx |
cmp dword [edi],0 |
1955,6 → 1976,7 |
mov [value_type],al |
cmp al,5 |
je gotoff_address |
ja invalid_use_of_symbol |
test al,1 |
jnz invalid_use_of_symbol |
or al,al |
1984,8 → 2006,10 |
mov [error_line],ecx |
mov [error],value_out_of_range |
address_size_ok: |
xor bx,bx |
xor cl,cl |
xor ebx,ebx |
xor ecx,ecx |
mov cl,[value_type] |
shl ecx,16 |
mov ch,[address_size] |
cmp word [edi+8],0 |
je check_immediate_address |
2071,42 → 2095,31 |
cmp [address_size],4 |
je check_dword_value |
jmp check_qword_value |
get_relative_offset: |
mov [value_size],4 |
mov [size_override],-1 |
call calculate_expression |
calculate_relative_offset: |
push esi |
add edi,14h |
mov esi,[display_buffer] |
sub esi,7 |
lea eax,[esi-14h] |
cmp eax,edi |
jb out_of_memory |
mov byte [esi],11h |
xor eax,eax |
mov dword [esi+1],eax |
mov word [esi+5],')' shl 8 + 81h |
call calculation_loop |
pop esi |
cmp word [edi+8],0 |
jne invalid_value |
mov al,[edi+12] |
mov [value_type],al |
mov eax,[edi+16] |
mov [symbol_identifier],eax |
mov eax,[edi] |
mov edx,[edi+4] |
or edx,edx |
jz offset_positive |
cmp edx,-1 |
jne range_exceeded |
bt eax,31 |
jnc range_exceeded |
cmp [value_undefined],0 |
jne relative_offset_ok |
add eax,dword [org_origin] |
adc edx,dword [org_origin+4] |
sub eax,edi |
sbb edx,0 |
mov bl,[value_type] |
or bl,bl |
je relative_offset_ok |
test bl,1 |
jnz invalid_use_of_symbol |
cmp bl,6 |
je plt_relative_offset |
cmp bl,[labels_type] |
jne invalid_use_of_symbol |
mov [value_type],0 |
mov ecx,[symbol_identifier] |
cmp ecx,[org_symbol] |
je relative_offset_ok |
mov [value_type],3 |
relative_offset_ok: |
ret |
offset_positive: |
bt eax,31 |
jc range_exceeded |
plt_relative_offset: |
mov [value_type],7 |
ret |
preevaluate_logical_expression: |
/programs/develop/fasm/trunk/fasm.asm |
---|
11,11 → 11,11 |
NORMAL_MODE = 8 |
CONSOLE_MODE = 32 |
MAGIC1 = 6*(text.line_size-1)+6*2+2 |
MAGIC1 = 6*(text.line_size-1)+14 |
MAGIC2 = 14 |
MAGIC3 = 1 |
MAGIC4 = 7 |
OUTPUTXY = (5+MAGIC4) shl 16 + MAGIC2*3+MAGIC3+MAGIC4+1+2 |
OUTPUTXY = 7 shl 16 + 53 |
MAX_PATH = 100 |
APP_MEMORY = 0x00800000 |
22,6 → 22,9 |
;; Menuet header |
appname equ "FASM " |
version equ "1.67.11" |
use32 |
org 0x0 |
41,7 → 44,7 |
START: ; Start of execution |
cmp [params],0 |
jz noparams |
jz red |
mov ecx,10 |
mov al,' ' |
81,35 → 84,35 |
mov [_mode],CONSOLE_MODE |
jmp start |
noparams: |
red: ; Redraw |
call draw_window |
still: |
push 10 ; Wait here for event |
pop eax |
int 40h |
dec eax |
je red ; Redraw request |
dec eax |
jne button ; Button in buffer |
mcall 10 ; Wait here for event |
dec eax ; Redraw request |
jz red |
dec eax ; Key in buffer |
jz key |
dec eax ; Button in buffer |
jz button |
jmp still |
red: ; Redraw |
call draw_window |
jmp still |
key: ; Key |
mcall 2 ; Read it and ignore |
mov al,2 ; Read it and ignore |
int 0x40 |
jmp still |
button: ; Button in Window |
mcall 17 |
mov al,17 |
int 0x40 |
cmp ah,1 |
jne noclose |
or eax,-1 |
int 0x40 |
noclose: |
cmp ah,2 ; Start compiling |
je start |
cmp ah,3 ; Start compiled file |
117,13 → 120,12 |
mov edx,outfile |
call make_fullpaths |
mcall 58,file_info_start |
mcall 70,file_info_start |
; xor ecx,ecx |
jmp still |
norunout: |
mov ecx,[skinh] |
add ecx,MAGIC3+MAGIC2/2-3 |
mov ecx,5 |
mov [ya],ecx |
cmp ah,11 ; Infile |
133,13 → 135,9 |
cmp ah,13 ; Path |
je f3 |
dec ah ; Close application |
jnz still |
jmp still |
mcall -1 |
skinh dd ? |
draw_window: |
pusha |
148,15 → 146,19 |
get_sys_colors 1,0 |
mcall 0,<50,280>,<50,250>,[sc.work] ; Draw Window |
mov eax,0 |
mov ebx,50*65536+280 |
mov ecx,50*65536+250 |
mov edx,[sc.work] |
or edx,0x33000000 |
mov edi,header ; Draw Window Label Text |
int 0x40 |
draw_caption header,header.size ; Draw Window Label Text |
mcall 9,PROCESSINFO,-1 |
mov ecx,[skinh-2] |
mov cx,word[skinh] |
madd ecx,MAGIC3,MAGIC3 |
mpack ecx,1,1 |
mov ebx,[pinfo.x_size] |
madd ebx,5,-5 |
sub ebx,10 |
push ecx |
madd ecx,MAGIC2*3+2,MAGIC2*3+2 |
164,7 → 166,6 |
pop ecx |
sub ebx,MAGIC1+3 |
mcall |
madd ecx,MAGIC2,MAGIC2 |
mcall |
173,8 → 174,8 |
madd ecx,MAGIC2,MAGIC2 |
mcall |
push ebx |
mpack ebx,MAGIC1+5,MAGIC1+5 |
sub cx,MAGIC2*3 |
mpack ebx,MAGIC1,MAGIC1 |
sub ecx,MAGIC2*3 |
mcall |
mov ebx,[esp-2] |
pop bx |
181,9 → 182,8 |
mcall |
add esp,2 |
mpack ebx,5,MAGIC1-1 |
mpack ecx,[skinh],MAGIC2-2 |
madd ecx,MAGIC3+1,0 |
mpack ebx,0,MAGIC1-1 |
mpack ecx,MAGIC3+1,MAGIC2-2 |
mcall 8,,,0x4000000B ; Button: Enter Infile |
madd ecx,MAGIC2,0 |
mcall ,,,0x4000000C ; Button: Enter Outfile |
191,21 → 191,21 |
mcall ,,,0x4000000D ; Button: Enter Path |
mpack ebx,[pinfo.x_size],MAGIC1 |
msub ebx,MAGIC1+5+1,0 |
mpack ecx,[skinh],MAGIC2*3/2-1 |
msub ebx,MAGIC1+10+1,0 |
mpack ecx,0,MAGIC2*3/2-1 |
madd ecx,MAGIC3,0 |
mcall ,,,0x00000002,[sc.work_button] |
madd ecx,MAGIC2*3/2+1,0 |
mcall ,,,0x00000003 |
mpack ebx,5+6,[skinh] ; Draw Window Text |
add bx,MAGIC3+MAGIC2/2-3 |
mpack ebx,6,0 ; Draw Window Text |
add ebx,MAGIC3+MAGIC2/2-3 |
mov ecx,[sc.work_text] |
mov edx,text |
mov esi,text.line_size |
mov eax,4 |
newline: |
mcall |
int 0x40 |
add ebx,MAGIC2 |
add edx,text.line_size |
cmp byte[edx],'x' |
212,15 → 212,14 |
jne newline |
mov ebx,[pinfo.x_size] |
sub ebx,MAGIC1+5+1-9 |
sub ebx,MAGIC1+10+1-9 |
shl ebx,16 |
mov bx,word[skinh] |
add bx,MAGIC3+(MAGIC2*3/2-1)/2-3 |
add ebx,MAGIC3+(MAGIC2*3/2-1)/2-3 |
mcall ,,[sc.work_button_text],s_compile,7 |
add ebx,MAGIC2*3/2+1 |
mcall ,,,s_run |
mpack ebx,MAGIC1+5+6,[skinh] |
mpack ebx,MAGIC1+6,0 |
add ebx,MAGIC3+MAGIC2/2-3+MAGIC2*0 |
mov esi,[pinfo.x_size] |
sub esi,MAGIC1*2+5*2+6+3 |
248,15 → 247,14 |
draw_messages: |
mov eax,13 ; clear work area |
mpack ebx,5+MAGIC4-2,[pinfo.x_size] |
mpack ebx,MAGIC4-2,[pinfo.x_size] |
sub ebx,5*2+MAGIC4*2-1-2*2 |
mpack ecx,[skinh],[pinfo.y_size] |
madd ecx,MAGIC2*3+MAGIC3+MAGIC4+1,-(MAGIC2*3+MAGIC3+MAGIC4*2+5)+2 |
mpack ecx,0,[pinfo.y_size] |
madd ecx,MAGIC2*3+MAGIC3+MAGIC4+1,-(MAGIC2*3+MAGIC3+MAGIC4*2+25) |
mov word[bottom_right+2],bx |
mov word[bottom_right],cx |
msub [bottom_right],7,11 |
add [bottom_right],OUTPUTXY |
sub ecx,[skinh] |
mov edx,[sc.work] |
int 0x40 |
_cy = 0 |
264,7 → 262,7 |
_cx = 4 |
_sx = 6 |
push ebx ecx |
mpack ebx,5+MAGIC4-3,5+MAGIC4-2 |
mpack ebx,MAGIC4-3,MAGIC4-2 |
add bx,[esp+_cx] |
mov ecx,[esp+_sy-2] |
mov cx,[esp+_sy] |
276,7 → 274,7 |
add ecx,esi |
madd ecx,1,1 |
mcall |
mpack ebx,5+MAGIC4-3,5+MAGIC4-3 |
mpack ebx,MAGIC4-3,MAGIC4-3 |
mov esi,[esp+_sy-2] |
mov si,cx |
mov ecx,esi |
363,7 → 361,7 |
print_text: |
mpack ebx,MAGIC1+5+6,[pinfo.x_size] |
mpack ebx,MAGIC1+6,[pinfo.x_size] |
sub ebx,MAGIC1*2+5*2+6+3 |
movzx esi,bx |
mov ecx,[ya-2] |
370,7 → 368,7 |
mov cx,8 |
mcall 13,,,[sc.work] |
mpack ebx,MAGIC1+5+6,[ya] |
mpack ebx,MAGIC1+6,[ya] |
mov eax,esi |
mov cl,6 |
div cl |
385,7 → 383,7 |
; DATA |
sz header,'FASM FOR MENUET' |
header db appname,version,0 |
text: |
db ' INFILE:' |
430,7 → 428,7 |
cmp [_mode],NORMAL_MODE |
jne @f |
call draw_messages |
push [skinh] |
push 0 |
pop [textxy] |
add [textxy],OUTPUTXY |
@@: |
489,7 → 487,7 |
je @f |
mov edx,outfile |
call make_fullpaths |
mov eax,58 |
mov eax,70 |
mov ebx,file_info_start |
xor ecx,ecx |
int 0x40 |
/programs/develop/fasm/trunk/formats.inc |
---|
2887,18 → 2887,23 |
mark_elf_relocation: |
cmp [value_type],3 |
je elf_relocation_relative |
cmp [value_type],7 |
je elf_relocation_relative |
push ebx eax |
cmp [value_type],3 |
cmp [value_type],5 |
je elf_gotoff_relocation |
mov al,1 |
ja invalid_use_of_symbol |
mov al,1 ; R_386_32 / R_AMD64_64 |
test [format_flags],8 |
jz coff_relocation |
cmp [value_type],4 |
je coff_relocation |
mov al,11 |
mov al,11 ; R_AMD64_32S |
jmp coff_relocation |
elf_gotoff_relocation: |
mov al,9 |
test [format_flags],8 |
jnz invalid_use_of_symbol |
mov al,9 ; R_386_GOTOFF |
jmp coff_relocation |
elf_relocation_relative: |
cmp [labels_type],0 |
2909,7 → 2914,10 |
sub ebx,edi |
sub eax,ebx |
push eax |
mov al,2 |
mov al,2 ; R_386_PC32 / R_AMD64_PC32 |
cmp [value_type],3 |
je coff_relocation |
mov al,4 ; R_386_PLT32 / R_AMD64_PLT32 |
jmp coff_relocation |
close_elf: |
bt [format_flags],0 |
/programs/develop/fasm/trunk/system.inc |
---|
5,15 → 5,21 |
; MenuetOS system.inc by VT |
file_info_open: dd 0,0,0xffffff,0x20000,0xf0000 |
fullpath_open:; db '/HD/1/EXAMPLE.ASM' |
fullpath_open: ; db '/RD/1/EXAMPLE.ASM' |
times MAX_PATH db 0 |
file_info_write: dd 1,0,0,0,0xf0000 |
fullpath_write:; db '/HD/1/EXAMPLE' |
fullpath_write:; db '/RD/1/EXAMPLE' |
times MAX_PATH db 0 |
file_info_start: dd 16,0,0,0,0xf0000 |
fullpath_start:; db '/HD/1/EXAMPLE' |
file_info_start: ;this part is already rewrited to 70th function |
dd 7 |
dd 0 |
dd 0 |
dd 0 |
dd 0 |
fullpath_start: ; db '/RD/1/EXAMPLE' |
times MAX_PATH db 0 |
_ramdisk db '/RD/1/' |
212,9 → 218,11 |
jnz dc1 |
and [textxy],0x0000FFFF |
add [textxy],OUTPUTXY and 0xFFFF0000 + 10 |
dc2: popa |
dc2: |
popa |
ret |
dc1: mov eax,[textxy] |
dc1: |
mov eax,[textxy] |
cmp ax,word[bottom_right] |
ja dc2 |
shr eax,16 |
225,7 → 233,8 |
add [textxy],0x00060000 |
popa |
ret |
@@: mov eax,63 |
@@: |
mov eax,63 |
mov ebx,1 |
mov cl,dl |
int 0x40 |
233,16 → 242,17 |
ret |
display_string: |
pusha |
@@: cmp byte[esi],0 |
@@: |
cmp byte[esi],0 |
je @f |
mov dl,[esi] |
call display_character |
add esi,1 |
jmp @b |
@@: popa |
@@: |
popa |
ret |
display_number: |
416,33 → 426,7 |
call display_string |
jmp exit_program |
__draw_caption: |
; mcall 48,4 |
; mov [skinh],eax |
; mov ebx,eax |
; shr ebx,1 |
; adc ebx,1+0x000A0000-4 |
; mcall 4,,[sc.grab_text],s_title,[s_title.size] |
mcall 48,4 |
mov [skinh],eax |
shr eax,1 |
adc eax,0 |
add eax,1-4 |
push ax |
if center eq true |
mcall 9,PROCESSINFO,-1 |
mov ebx,[PROCESSINFO+process_information.x_size] |
shr ebx,1 |
sub ebx,header.size*6/2 + 8 |
else |
mov ebx,8 |
end if |
shl ebx,16 |
pop bx |
mcall 4,,[SYSTEMCOLORS+system_colors.grab_text] |
ret |
character db ?,0 |
bytes_count dd ? |
/programs/develop/fasm/trunk/tables.inc |
---|
61,6 → 61,7 |
db 1,'+',0 |
db 1,'-',083h |
db 3,'not',0D0h |
db 3,'plt',0E1h |
db 3,'rva',0E0h |
db 0 |
513,8 → 514,8 |
dw single_operand_instruction-assembler |
db 'neg',3 |
dw single_operand_instruction-assembler |
db 'nop',90h |
dw simple_instruction-assembler |
;db 'nop',90h |
;dw nop_instruction-assembler |
db 'not',2 |
dw single_operand_instruction-assembler |
db 'org',0 |
524,7 → 525,7 |
db 'pop',0 |
dw pop_instruction-assembler |
db 'por',0EBh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'rcl',2 |
dw sh_instruction-assembler |
db 'rcr',3 |
687,7 → 688,7 |
db 'outs',6Eh |
dw outs_instruction-assembler |
db 'pand',0DBh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'popa',61h |
dw simple_instruction_except64-assembler |
db 'popd',4 |
701,7 → 702,7 |
db 'push',0 |
dw push_instruction-assembler |
db 'pxor',0EFh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'repe',0F3h |
dw prefix_instruction-assembler |
db 'repz',0F3h |
991,22 → 992,28 |
dw simple_instruction_32bit-assembler |
db 'outsw',6Fh |
dw simple_instruction_16bit-assembler |
db 'pabsb',1Ch |
dw ssse3_instruction-assembler |
db 'pabsd',1Eh |
dw ssse3_instruction-assembler |
db 'pabsw',1Dh |
dw ssse3_instruction-assembler |
db 'paddb',0FCh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'paddd',0FEh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'paddq',0D4h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'paddw',0FDh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pandn',0DFh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pause',0 |
dw pause_instruction-assembler |
db 'pavgb',0E0h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pavgw',0E3h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pf2id',1Dh |
dw amd3dnow_instruction-assembler |
db 'pf2iw',1Ch |
1056,13 → 1063,13 |
db 'psrlw',0D1h |
dw mmx_ps_instruction-assembler |
db 'psubb',0F8h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'psubd',0FAh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'psubq',0FBh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'psubw',0F9h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pusha',60h |
dw simple_instruction_except64-assembler |
db 'pushd',4 |
1341,9 → 1348,9 |
db 'movups',10h |
dw movps_instruction-assembler |
db 'paddsb',0ECh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'paddsw',0EDh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pextrw',0C5h |
dw pextrw_instruction-assembler |
db 'pfnacc',8Ah |
1350,34 → 1357,50 |
dw amd3dnow_instruction-assembler |
db 'pfsubr',0AAh |
dw amd3dnow_instruction-assembler |
db 'phaddd',2 |
dw ssse3_instruction-assembler |
db 'phaddw',1 |
dw ssse3_instruction-assembler |
db 'phsubd',6 |
dw ssse3_instruction-assembler |
db 'phsubw',5 |
dw ssse3_instruction-assembler |
db 'pinsrw',0C4h |
dw pinsrw_instruction-assembler |
db 'pmaxsw',0EEh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pmaxub',0DEh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pminsw',0EAh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pminub',0DAh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pmulhw',0E5h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pmullw',0D5h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'psadbw',0F6h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pshufb',0 |
dw ssse3_instruction-assembler |
db 'pshufd',66h |
dw pshufd_instruction-assembler |
db 'pshufw',0 |
dw pshufw_instruction-assembler |
db 'psignb',8 |
dw ssse3_instruction-assembler |
db 'psignd',0Ah |
dw ssse3_instruction-assembler |
db 'psignw',9 |
dw ssse3_instruction-assembler |
db 'pslldq',111b |
dw ps_dq_instruction-assembler |
db 'psrldq',011b |
dw ps_dq_instruction-assembler |
db 'psubsb',0E8h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'psubsw',0E9h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pswapd',0BBh |
dw amd3dnow_instruction-assembler |
db 'public',0 |
1544,23 → 1567,25 |
db 'movq2dq',0 |
dw movq2dq_instruction-assembler |
db 'paddusb',0DCh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'paddusw',0DDh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'palignr',0 |
dw palignr_instruction-assembler |
db 'pavgusb',0BFh |
dw amd3dnow_instruction-assembler |
db 'pcmpeqb',74h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pcmpeqd',76h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pcmpeqw',75h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pcmpgtb',64h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pcmpgtd',66h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pcmpgtw',65h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pfcmpeq',0B0h |
dw amd3dnow_instruction-assembler |
db 'pfcmpge',90h |
1571,22 → 1596,26 |
dw amd3dnow_instruction-assembler |
db 'pfrsqrt',97h |
dw amd3dnow_instruction-assembler |
db 'phaddsw',3 |
dw ssse3_instruction-assembler |
db 'phsubsw',7 |
dw ssse3_instruction-assembler |
db 'pmaddwd',0F5h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pmulhrw',0B7h |
dw amd3dnow_instruction-assembler |
db 'pmulhuw',0E4h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pmuludq',0F4h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pshufhw',0F3h |
dw pshufd_instruction-assembler |
db 'pshuflw',0F2h |
dw pshufd_instruction-assembler |
db 'psubusb',0D8h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'psubusw',0D9h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'rsqrtps',52h |
dw sse_ps_instruction-assembler |
db 'rsqrtss',52h |
1701,11 → 1730,11 |
db 'movsldup',12h |
dw cvtdq2pd_instruction-assembler |
db 'packssdw',6Bh |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'packsswb',63h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'packuswb',67h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'pfrcpit1',0A6h |
dw amd3dnow_instruction-assembler |
db 'pfrcpit2',0B6h |
1714,6 → 1743,8 |
dw amd3dnow_instruction-assembler |
db 'pmovmskb',0D7h |
dw pextrw_instruction-assembler |
db 'pmulhrsw',0Bh |
dw ssse3_instruction-assembler |
db 'prefetch',0 |
dw amd_prefetch_instruction-assembler |
db 'sysenter',34h |
1747,20 → 1778,22 |
dw cvtsd2si_instruction-assembler |
db 'cvttss2si',2Ch |
dw cvtss2si_instruction-assembler |
db 'pmaddubsw',4 |
dw ssse3_instruction-assembler |
db 'prefetchw',1 |
dw amd_prefetch_instruction-assembler |
db 'punpckhbw',68h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'punpckhdq',6Ah |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'punpckhwd',69h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'punpcklbw',60h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'punpckldq',62h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
db 'punpcklwd',61h |
dw mmx_instruction-assembler |
dw basic_mmx_instruction-assembler |
instructions_10: |
db 'cmpunordpd',3 |
dw cmp_pd_instruction-assembler |
/programs/develop/fasm/trunk/variable.inc |
---|
106,6 → 106,7 |
compare_type db ? |
base_code db ? |
extended_code db ? |
supplemental_code db ? |
postbyte_register db ? |
segment_register db ? |
mmx_size db ? |
/programs/develop/fasm/trunk/version.inc |
---|
33,7 → 33,7 |
; cannot simply be copied and put under another distribution licence |
; (including the GNU Public Licence). |
VERSION_STRING equ "1.67.9" |
VERSION_STRING equ "1.67.11" |
VERSION_MAJOR = 1 |
VERSION_MINOR = 67 |
/programs/develop/fasm/trunk/x86_64.inc |
---|
114,7 → 114,7 |
jne invalid_operand |
basic_mem: |
call get_address |
push edx bx cx |
push edx ebx ecx |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
128,7 → 128,7 |
lods byte [esi] |
call convert_register |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
mov al,ah |
cmp al,1 |
je basic_mem_reg_8bit |
160,7 → 160,7 |
mov al,[base_code] |
shr al,3 |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
mov [base_code],80h |
call store_instruction_with_imm8 |
jmp instruction_assembled |
171,7 → 171,7 |
mov al,[base_code] |
shr al,3 |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
cmp [value_type],0 |
jne basic_mem_imm_16bit_store |
cmp [size_declared],0 |
196,7 → 196,7 |
mov al,[base_code] |
shr al,3 |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
cmp [value_type],0 |
jne basic_mem_imm_32bit_store |
cmp [size_declared],0 |
430,7 → 430,7 |
jne invalid_operand |
mov_mem: |
call get_address |
push edx bx cx |
push edx ebx ecx |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
449,7 → 449,7 |
mov_mem_general_reg: |
call convert_register |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
cmp ah,1 |
je mov_mem_reg_8bit |
mov al,ah |
542,7 → 542,7 |
mov_mem_sreg: |
sub al,61h |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
mov ah,[operand_size] |
or ah,ah |
jz mov_mem_sreg_store |
575,7 → 575,7 |
mov byte [value],al |
mov [postbyte_register],0 |
mov [base_code],0C6h |
pop cx bx edx |
pop ecx ebx edx |
call store_instruction_with_imm8 |
jmp instruction_assembled |
mov_mem_imm_16bit: |
584,7 → 584,7 |
mov word [value],ax |
mov [postbyte_register],0 |
mov [base_code],0C7h |
pop cx bx edx |
pop ecx ebx edx |
call store_instruction_with_imm16 |
jmp instruction_assembled |
mov_mem_imm_32bit: |
594,7 → 594,7 |
mov dword [value],eax |
mov [postbyte_register],0 |
mov [base_code],0C7h |
pop cx bx edx |
pop ecx ebx edx |
call store_instruction_with_imm32 |
jmp instruction_assembled |
mov_mem_imm_64bit: |
998,7 → 998,7 |
jne invalid_operand |
test_mem: |
call get_address |
push edx bx cx |
push edx ebx ecx |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
1012,7 → 1012,7 |
lods byte [esi] |
call convert_register |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
mov al,ah |
cmp al,1 |
je test_mem_reg_8bit |
1044,7 → 1044,7 |
mov byte [value],al |
mov [postbyte_register],0 |
mov [base_code],0F6h |
pop cx bx edx |
pop ecx ebx edx |
call store_instruction_with_imm8 |
jmp instruction_assembled |
test_mem_imm_16bit: |
1053,7 → 1053,7 |
mov word [value],ax |
mov [postbyte_register],0 |
mov [base_code],0F7h |
pop cx bx edx |
pop ecx ebx edx |
call store_instruction_with_imm16 |
jmp instruction_assembled |
test_mem_imm_32bit: |
1063,7 → 1063,7 |
mov dword [value],eax |
mov [postbyte_register],0 |
mov [base_code],0F7h |
pop cx bx edx |
pop ecx ebx edx |
call store_instruction_with_imm32 |
jmp instruction_assembled |
test_mem_imm_64bit: |
1200,7 → 1200,7 |
jne invalid_operand |
xchg_mem: |
call get_address |
push edx bx cx |
push edx ebx ecx |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
2055,7 → 2055,7 |
jne invalid_operand |
sh_mem: |
call get_address |
push edx bx cx |
push edx ebx ecx |
mov al,[operand_size] |
push eax |
mov [operand_size],0 |
2072,7 → 2072,7 |
lods byte [esi] |
cmp al,11h |
jne invalid_operand |
pop eax cx bx edx |
pop eax ecx ebx edx |
cmp al,1 |
je sh_mem_cl_8bit |
jb sh_mem_cl_nosize |
2099,7 → 2099,7 |
sh_mem_imm_size_ok: |
call get_byte_value |
mov byte [value],al |
pop eax cx bx edx |
pop eax ecx ebx edx |
cmp al,1 |
je sh_mem_imm_8bit |
jb sh_mem_imm_nosize |
2207,7 → 2207,7 |
jne invalid_operand |
shd_mem: |
call get_address |
push edx bx cx |
push edx ebx ecx |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
2233,7 → 2233,7 |
lods byte [esi] |
cmp al,11h |
jne invalid_operand |
pop eax cx bx edx |
pop eax ecx ebx edx |
call operand_autodetect |
inc [extended_code] |
call store_instruction |
2247,7 → 2247,7 |
shd_mem_reg_imm_size_ok: |
call get_byte_value |
mov byte [value],al |
pop eax cx bx edx |
pop eax ecx ebx edx |
call operand_autodetect |
call store_instruction_with_imm8 |
jmp instruction_assembled |
2422,7 → 2422,7 |
cmp al,'[' |
jne invalid_operand |
call get_address |
push eax bx cx |
push eax ebx ecx |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
2440,7 → 2440,7 |
lods byte [esi] |
call convert_register |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
mov al,ah |
call operand_autodetect |
call store_instruction |
2466,7 → 2466,7 |
jz bt_mem_imm_nosize |
call operand_autodetect |
bt_mem_imm_store: |
pop cx bx edx |
pop ecx ebx edx |
mov [extended_code],0BAh |
call store_instruction_with_imm8 |
jmp instruction_assembled |
2620,12 → 2620,12 |
jne invalid_operand |
imul_reg_mem: |
call get_address |
push edx bx cx |
push edx ebx ecx |
cmp byte [esi],',' |
je imul_reg_mem_imm |
mov al,[operand_size] |
call operand_autodetect |
pop cx bx edx |
pop ecx ebx edx |
mov [base_code],0Fh |
mov [extended_code],0AFh |
call store_instruction |
2657,7 → 2657,7 |
cmp ax,80h |
jl imul_reg_mem_imm_8bit_store |
imul_reg_mem_imm_16bit_store: |
pop cx bx edx |
pop ecx ebx edx |
mov [base_code],69h |
call store_instruction_with_imm16 |
jmp instruction_assembled |
2675,7 → 2675,7 |
cmp eax,80h |
jl imul_reg_mem_imm_8bit_store |
imul_reg_mem_imm_32bit_store: |
pop cx bx edx |
pop ecx ebx edx |
mov [base_code],69h |
call store_instruction_with_imm32 |
jmp instruction_assembled |
2688,7 → 2688,7 |
jae long_immediate_not_encodable |
jmp imul_reg_mem_imm_32bit_ok |
imul_reg_mem_imm_8bit_store: |
pop cx bx edx |
pop ecx ebx edx |
mov [base_code],6Bh |
call store_instruction_with_imm8 |
jmp instruction_assembled |
3168,26 → 3168,9 |
stos word [edi] |
jmp instruction_assembled |
calculate_jump_offset: |
cmp [value_undefined],0 |
jne jump_offset_ok |
add eax,dword [org_origin] |
adc edx,dword [org_origin+4] |
lea ebx,[edi+2] |
sub eax,ebx |
sbb edx,0 |
mov bl,[value_type] |
or bl,bl |
je jump_offset_ok |
test bl,1 |
jnz invalid_use_of_symbol |
cmp bl,[labels_type] |
jne invalid_use_of_symbol |
mov [value_type],0 |
mov ecx,[symbol_identifier] |
cmp ecx,[org_symbol] |
je jump_offset_ok |
mov [value_type],3 |
jump_offset_ok: |
add edi,2 |
call calculate_relative_offset |
sub edi,2 |
ret |
check_for_short_jump: |
cmp [jump_type],1 |
3610,7 → 3593,7 |
or bl,ch |
jnz invalid_address |
mov al,[segment_register] |
push ax bx |
push eax ebx |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
3623,7 → 3606,7 |
jnz invalid_address |
or bl,ch |
jnz invalid_address |
pop dx ax |
pop edx eax |
cmp [segment_register],1 |
ja invalid_address |
mov [segment_register],al |
3954,7 → 3937,7 |
cmp al,'[' |
jne invalid_operand |
call get_address |
push edx bx cx |
push edx ebx ecx |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
3965,7 → 3948,7 |
lods byte [esi] |
call convert_register |
mov [postbyte_register],al |
pop cx bx edx |
pop ecx ebx edx |
mov al,ah |
cmp al,1 |
je basic_486_mem_reg_8bit |
4046,6 → 4029,49 |
cmpxchgx_store: |
call store_instruction |
jmp instruction_assembled |
nop_instruction: |
mov ah,[esi] |
cmp ah,10h |
je extended_nop |
cmp ah,11h |
je extended_nop |
cmp ah,'[' |
je extended_nop |
stos byte [edi] |
jmp instruction_assembled |
extended_nop: |
mov [base_code],0Fh |
mov [extended_code],1Fh |
mov [postbyte_register],0 |
lods byte [esi] |
call get_size_operator |
cmp al,10h |
je extended_nop_reg |
cmp al,'[' |
jne invalid_operand |
call get_address |
mov al,[operand_size] |
or al,al |
jz extended_nop_nosize |
call operand_autodetect |
extended_nop_store: |
call store_instruction |
jmp instruction_assembled |
extended_nop_nosize: |
cmp [error_line],0 |
jne extended_nop_store |
mov eax,[current_line] |
mov [error_line],eax |
mov [error],operand_size_not_specified |
jmp extended_nop_store |
extended_nop_reg: |
lods byte [esi] |
call convert_register |
mov bl,al |
mov al,ah |
call operand_autodetect |
call store_nomem_instruction |
jmp instruction_assembled |
basic_fpu_instruction: |
mov [postbyte_register],al |
4472,9 → 4498,10 |
stos word [edi] |
jmp instruction_assembled |
mmx_instruction: |
basic_mmx_instruction: |
mov [base_code],0Fh |
mov [extended_code],al |
mmx_instruction: |
lods byte [esi] |
call get_size_operator |
cmp al,10h |
4573,7 → 4600,7 |
call store_nomem_instruction |
jmp instruction_assembled |
mmx_imm8: |
push bx cx edx |
push ebx ecx edx |
mov [operand_size],0 |
lods byte [esi] |
cmp al,',' |
4586,7 → 4613,7 |
jne invalid_operand |
call get_byte_value |
mov byte [value],al |
pop edx cx bx |
pop edx ecx ebx |
call store_instruction_with_imm8 |
jmp instruction_assembled |
mmx_nomem_imm8: |
5318,9 → 5345,9 |
cmp al,[mmx_size] |
jne invalid_operand_size |
sse_cmp_size_ok: |
push bx cx edx |
push ebx ecx edx |
call get_nextbyte |
pop edx cx bx |
pop edx ecx ebx |
call store_instruction_with_imm8 |
jmp instruction_assembled |
sse_cmp_xmmreg_xmmreg: |
5482,6 → 5509,40 |
jne invalid_operand_size |
call operand_64bit |
jmp sse_reg |
ssse3_instruction: |
mov [base_code],0Fh |
mov [extended_code],38h |
mov [supplemental_code],al |
jmp mmx_instruction |
palignr_instruction: |
mov [base_code],0Fh |
mov [extended_code],3Ah |
mov [supplemental_code],0Fh |
lods byte [esi] |
call get_size_operator |
cmp al,10h |
jne invalid_operand |
lods byte [esi] |
call convert_mmx_register |
call make_mmx_prefix |
mov [postbyte_register],al |
lods byte [esi] |
cmp al,',' |
jne invalid_operand |
lods byte [esi] |
call get_size_operator |
cmp al,10h |
je palignr_mmreg_mmreg |
cmp al,'[' |
jne invalid_operand |
call get_address |
jmp mmx_imm8 |
palignr_mmreg_mmreg: |
lods byte [esi] |
call convert_mmx_register |
mov bl,al |
jmp mmx_nomem_imm8 |
amd3dnow_instruction: |
mov [base_code],0Fh |
mov [extended_code],0Fh |
5948,15 → 6009,11 |
jnz address_ok |
calculate_relative_address: |
call calculate_relative_offset |
cmp byte [esi-1],']' |
jne invalid_address |
mov [address_high],edx |
mov edx,[symbol_identifier] |
mov [address_symbol],edx |
mov edx,eax |
mov ch,[value_type] |
mov bx,0FF00h |
xor cl,cl |
address_ok: |
ret |
6051,8 → 6108,16 |
store_extended_code: |
mov al,[extended_code] |
stos byte [edi] |
cmp al,38h |
je store_supplemental_code |
cmp al,3Ah |
je store_supplemental_code |
instruction_code_ok: |
ret |
store_supplemental_code: |
mov al,[supplemental_code] |
stos byte [edi] |
ret |
store_nomem_instruction: |
test [postbyte_register],1000b |
jz nomem_reg_code_ok |
6373,7 → 6438,8 |
store_address_32bit_value: |
test ch,0F0h |
jz address_32bit_relocation_ok |
mov al,2 |
mov eax,ecx |
shr eax,16 |
xchg [value_type],al |
mov ebx,[address_symbol] |
xchg ebx,[symbol_identifier] |
6387,7 → 6453,8 |
store_address_64bit_value: |
test ch,0F0h |
jz address_64bit_relocation_ok |
mov al,4 |
mov eax,ecx |
shr eax,16 |
xchg [value_type],al |
mov ebx,[address_symbol] |
xchg ebx,[symbol_identifier] |
6403,8 → 6470,8 |
address_immediate_sib: |
test ch,not 44h |
jnz invalid_address_size |
cmp [value_type],0 |
jne address_immediate_sib_nosignextend |
test ecx,0FF0000h |
jnz address_immediate_sib_nosignextend |
test edx,80000000h |
jz address_immediate_sib_prefix_ok |
address_immediate_sib_nosignextend: |
6436,12 → 6503,13 |
shl cl,3 |
or al,cl |
stos byte [edi] |
xchg [value_type],ch |
shr ecx,16 |
xchg [value_type],cl |
mov ebx,[address_symbol] |
xchg ebx,[symbol_identifier] |
mov eax,edx |
call mark_relocation |
mov [value_type],ch |
mov [value_type],cl |
mov [symbol_identifier],ebx |
stos dword [edi] |
ret |