diff --git a/programs/develop/fasm/trunk/fasm.asm b/programs/develop/fasm/trunk/fasm.asm index 0a625e37c9..677533b041 100644 --- a/programs/develop/fasm/trunk/fasm.asm +++ b/programs/develop/fasm/trunk/fasm.asm @@ -12,10 +12,6 @@ NORMAL_MODE = 8 CONSOLE_MODE = 32 MAGIC1 = 6*(text.line_size-1)+14 -MAGIC2 = 14 -MAGIC3 = 1 -MAGIC4 = 7 -OUTPUTXY = 7 shl 16 + 53 MAX_PATH = 100 APP_MEMORY = 0x00800000 @@ -164,21 +160,21 @@ draw_window: sub ebx,10 push ecx - madd ecx,MAGIC2*3+2,MAGIC2*3+2 + madd ecx, 14*3+2, 14*3+2 mcall 38,,,[sc.work_graph] pop ecx sub ebx,MAGIC1+3 mcall - madd ecx,MAGIC2,MAGIC2 + madd ecx, 14, 14 mcall - madd ecx,MAGIC2,MAGIC2 + madd ecx, 14, 14 mcall - madd ecx,MAGIC2,MAGIC2 + madd ecx, 14, 14 mcall push ebx mpack ebx,MAGIC1,MAGIC1 - sub ecx,MAGIC2*3 + sub ecx, 14*3 mcall mov ebx,[esp-2] pop bx @@ -186,30 +182,30 @@ draw_window: add esp,2 mpack ebx,0,MAGIC1-1 - mpack ecx,MAGIC3+1,MAGIC2-2 + mpack ecx,1+1, 14-2 mcall 8,,,0x4000000B ; Button: Enter Infile - madd ecx,MAGIC2,0 + madd ecx, 14,0 mcall ,,,0x4000000C ; Button: Enter Outfile - madd ecx,MAGIC2,0 + madd ecx, 14,0 mcall ,,,0x4000000D ; Button: Enter Path mpack ebx,[pinfo.x_size],MAGIC1 msub ebx,MAGIC1+10+1,0 - mpack ecx,0,MAGIC2*3/2-1 - madd ecx,MAGIC3,0 + mpack ecx,0, 14*3/2-1 + madd ecx,1,0 mcall ,,,0x00000002,[sc.work_button] - madd ecx,MAGIC2*3/2+1,0 + madd ecx, 14*3/2+1,0 mcall ,,,0x00000003 mpack ebx,6,0 ; Draw Window Text - add ebx,MAGIC3+MAGIC2/2-3 + add ebx,1+ 14/2-3 mov ecx,[sc.work_text] mov edx,text mov esi,text.line_size mov eax,4 newline: int 0x40 - add ebx,MAGIC2 + add ebx, 14 add edx,text.line_size cmp byte[edx],'x' jne newline @@ -217,13 +213,13 @@ draw_window: mov ebx,[pinfo.x_size] sub ebx,MAGIC1+10+1-9 shl ebx,16 - add ebx,MAGIC3+(MAGIC2*3/2-1)/2-3 + add ebx,1+( 14*3/2-1)/2-3 mcall ,,[sc.work_button_text],s_compile,7 - add ebx,MAGIC2*3/2+1 + add ebx,14*3/2+1 mcall ,,,s_run mpack ebx,MAGIC1+6,0 - add ebx,MAGIC3+MAGIC2/2-3+MAGIC2*0 + add ebx,1+ 14/2-3+ 14*0 mov esi,[pinfo.x_size] sub esi,MAGIC1*2+5*2+6+3 mov eax,esi @@ -234,9 +230,9 @@ draw_window: mov al,MAX_PATH @@: movzx esi,al mcall 4,,[sc.work_text],infile - add ebx,MAGIC2 + add ebx,14 mcall ,,,outfile - add ebx,MAGIC2 + add ebx,14 mcall ,,,path call draw_messages @@ -250,14 +246,14 @@ bottom_right dd ? draw_messages: mov eax,13 ; clear work area - mpack ebx,MAGIC4-2,[pinfo.x_size] - sub ebx,5*2+MAGIC4*2-1-2*2 + mpack ebx,7-2,[pinfo.x_size] + sub ebx,5*2+7*2-1-2*2 mpack ecx,0,[pinfo.y_size] - madd ecx,MAGIC2*3+MAGIC3+MAGIC4+1,-(MAGIC2*3+MAGIC3+MAGIC4*2+25) + madd ecx, 14*3+1+7+1,-( 14*3+1+7*2+25) mov word[bottom_right+2],bx mov word[bottom_right],cx msub [bottom_right],7,11 - add [bottom_right],OUTPUTXY + add [bottom_right],7 shl 16 + 53 mov edx,[sc.work] int 0x40 _cy = 0 @@ -265,7 +261,7 @@ _sy = 2 _cx = 4 _sx = 6 push ebx ecx - mpack ebx,MAGIC4-3,MAGIC4-2 + mpack ebx,4,5 add bx,[esp+_cx] mov ecx,[esp+_sy-2] mov cx,[esp+_sy] @@ -277,7 +273,7 @@ _sx = 6 add ecx,esi madd ecx,1,1 mcall - mpack ebx,MAGIC4-3,MAGIC4-3 + mpack ebx,4,4 mov esi,[esp+_sy-2] mov si,cx mov ecx,esi @@ -294,13 +290,13 @@ _sx = 6 ; read string f1: mov [addr],infile - add [ya],MAGIC2*0 + add [ya], 14*0 jmp rk f2: mov [addr],outfile - add [ya],MAGIC2*1 + add [ya], 14*1 jmp rk f3: mov [addr],path - add [ya],MAGIC2*2 + add [ya], 14*2 rk: mov edi,[addr] @@ -365,7 +361,7 @@ f11:mcall 10 print_text: mpack ebx,MAGIC1+6,[pinfo.x_size] - sub ebx,MAGIC1*2+5*2+6+3 + sub ebx,MAGIC1*2+19 movzx esi,bx mov ecx,[ya-2] mov cx,8 @@ -431,7 +427,7 @@ start: call draw_messages push 0 pop [textxy] - add [textxy],OUTPUTXY + add [textxy],7 shl 16 + 53 @@: mov esi,_logo call display_string @@ -485,7 +481,7 @@ start: xor al,al cmp [_run_outfile],0 - je @f + je @f mov edx,outfile call make_fullpaths mov eax,70 @@ -497,7 +493,6 @@ start: include 'system.inc' - include 'version.inc' include 'errors.inc' include 'expressi.inc' diff --git a/programs/develop/fasm/trunk/formats.inc b/programs/develop/fasm/trunk/formats.inc index c90a45632b..9ba8c5fbe6 100644 --- a/programs/develop/fasm/trunk/formats.inc +++ b/programs/develop/fasm/trunk/formats.inc @@ -1418,12 +1418,12 @@ pe_heap: jmp instruction_assembled mark_pe_relocation: push eax ebx - mov al,2 test [format_flags],8 - jz check_pe_relocation_type - mov al,4 - check_pe_relocation_type: - cmp [value_type],al + jz check_pe32_relocation_type + cmp [value_type],4 + je pe_relocation_type_ok + check_pe32_relocation_type: + cmp [value_type],2 je pe_relocation_type_ok cmp [error_line],0 jne pe_relocation_type_ok @@ -1438,11 +1438,18 @@ mark_pe_relocation: mov ebx,[free_additional_memory] inc [number_of_relocations] jz invalid_use_of_symbol - mov [ebx],eax - add ebx,4 + add ebx,5 cmp ebx,[structures_buffer] jae out_of_memory mov [free_additional_memory],ebx + mov [ebx-5],eax + cmp [value_type],2 + je fixup_32bit + mov byte [ebx-1],0Ah + jmp fixup_ok + fixup_32bit: + mov byte [ebx-1],3 + fixup_ok: pop ebx eax ret generate_pe_data: @@ -1451,6 +1458,53 @@ generate_pe_data: cmp al,5 je make_pe_fixups ret +make_pe_fixups: + bts [resolver_flags],0 + jc pe_relocatable_ok + or [next_pass_needed],-1 + pe_relocatable_ok: + push esi + mov ecx,[number_of_relocations] + mov esi,[free_additional_memory] + lea eax,[ecx*5] + sub esi,eax + mov [free_additional_memory],esi + or [number_of_relocations],-1 + xor edx,edx + mov ebp,edi + make_fixups: + cmp [esi],edx + jb store_fixup + mov eax,edi + sub eax,ebp + test eax,11b + jz fixups_block + xor ax,ax + stos word [edi] + add dword [ebx],2 + fixups_block: + mov eax,edx + add edx,1000h + cmp [esi],edx + jae fixups_block + stos dword [edi] + mov ebx,edi + mov eax,8 + stos dword [edi] + store_fixup: + jecxz fixups_done + add dword [ebx],2 + mov eax,[esi] + and ax,0FFFh + mov dl,[esi+4] + shl dx,12 + or ax,dx + stos word [edi] + add esi,5 + loop make_fixups + fixups_done: + pop esi + ret make_pe_resource: cmp byte [esi],82h jne resource_done @@ -2017,58 +2071,6 @@ make_pe_resource: mov [resource_size],eax resource_done: ret -make_pe_fixups: - bts [resolver_flags],0 - jc pe_relocatable_ok - or [next_pass_needed],-1 - pe_relocatable_ok: - push esi - mov ecx,[number_of_relocations] - mov esi,[free_additional_memory] - mov eax,ecx - shl eax,2 - sub esi,eax - mov [free_additional_memory],esi - or [number_of_relocations],-1 - xor edx,edx - mov ebp,edi - make_fixups: - cmp [esi],edx - jb store_fixup - mov eax,edi - sub eax,ebp - test eax,11b - jz fixups_block - xor ax,ax - stos word [edi] - add dword [ebx],2 - fixups_block: - mov eax,edx - add edx,1000h - cmp [esi],edx - jae fixups_block - stos dword [edi] - mov ebx,edi - mov eax,8 - stos dword [edi] - store_fixup: - jecxz fixups_done - add dword [ebx],2 - mov eax,[esi] - and ax,0FFFh - test [format_flags],8 - jnz fixup_64bit - or ax,3000h - jmp fixup_ok - fixup_64bit: - or ax,0A000h - fixup_ok: - stos word [edi] - add esi,4 - loop make_fixups - fixups_done: - pop esi - ret close_pe: call close_pe_section mov edx,[code_start] diff --git a/programs/develop/fasm/trunk/system.inc b/programs/develop/fasm/trunk/system.inc index 195a2d224b..73512877b5 100644 --- a/programs/develop/fasm/trunk/system.inc +++ b/programs/develop/fasm/trunk/system.inc @@ -324,7 +324,7 @@ display_character: cmp dl,0xa jnz dc1 and [textxy],0x0000FFFF - add [textxy],OUTPUTXY and 0xFFFF0000 + 10 + add [textxy], 7 shl 16 +53 and 0xFFFF0000 + 10 dc2: popa ret @@ -398,7 +398,7 @@ digit_ok: display_user_messages: ; push [skinh] ; pop [textxy] -; add [textxy],OUTPUTXY +; add [textxy], 7 shl 16 +53 mov [displayed_count],0 call flush_display_buffer cmp [displayed_count],1 diff --git a/programs/develop/fasm/trunk/version.inc b/programs/develop/fasm/trunk/version.inc index 93d2f80d6f..9191e44033 100644 --- a/programs/develop/fasm/trunk/version.inc +++ b/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.20" +VERSION_STRING equ "1.67.21" VERSION_MAJOR = 1 VERSION_MINOR = 67 diff --git a/programs/develop/fasm/trunk/x86_64.inc b/programs/develop/fasm/trunk/x86_64.inc index 769af2d9d9..95f5cbad65 100644 --- a/programs/develop/fasm/trunk/x86_64.inc +++ b/programs/develop/fasm/trunk/x86_64.inc @@ -1402,6 +1402,7 @@ push_instruction: cmp al,70h jae invalid_operand sub al,61h + jc invalid_operand cmp al,4 jae push_sreg_386 shl al,3 @@ -1681,6 +1682,7 @@ pop_instruction: cmp al,70h jae invalid_operand sub al,61h + jc invalid_operand cmp al,4 jae pop_sreg_386 shl al,3