forked from KolibriOS/kolibrios
fasm 1.67.21
git-svn-id: svn://kolibrios.org@370 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d7c8e47442
commit
161e2aa725
@ -12,10 +12,6 @@ NORMAL_MODE = 8
|
|||||||
CONSOLE_MODE = 32
|
CONSOLE_MODE = 32
|
||||||
|
|
||||||
MAGIC1 = 6*(text.line_size-1)+14
|
MAGIC1 = 6*(text.line_size-1)+14
|
||||||
MAGIC2 = 14
|
|
||||||
MAGIC3 = 1
|
|
||||||
MAGIC4 = 7
|
|
||||||
OUTPUTXY = 7 shl 16 + 53
|
|
||||||
MAX_PATH = 100
|
MAX_PATH = 100
|
||||||
|
|
||||||
APP_MEMORY = 0x00800000
|
APP_MEMORY = 0x00800000
|
||||||
@ -164,21 +160,21 @@ draw_window:
|
|||||||
sub ebx,10
|
sub ebx,10
|
||||||
|
|
||||||
push ecx
|
push ecx
|
||||||
madd ecx,MAGIC2*3+2,MAGIC2*3+2
|
madd ecx, 14*3+2, 14*3+2
|
||||||
mcall 38,,,[sc.work_graph]
|
mcall 38,,,[sc.work_graph]
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
sub ebx,MAGIC1+3
|
sub ebx,MAGIC1+3
|
||||||
mcall
|
mcall
|
||||||
madd ecx,MAGIC2,MAGIC2
|
madd ecx, 14, 14
|
||||||
mcall
|
mcall
|
||||||
madd ecx,MAGIC2,MAGIC2
|
madd ecx, 14, 14
|
||||||
mcall
|
mcall
|
||||||
madd ecx,MAGIC2,MAGIC2
|
madd ecx, 14, 14
|
||||||
mcall
|
mcall
|
||||||
push ebx
|
push ebx
|
||||||
mpack ebx,MAGIC1,MAGIC1
|
mpack ebx,MAGIC1,MAGIC1
|
||||||
sub ecx,MAGIC2*3
|
sub ecx, 14*3
|
||||||
mcall
|
mcall
|
||||||
mov ebx,[esp-2]
|
mov ebx,[esp-2]
|
||||||
pop bx
|
pop bx
|
||||||
@ -186,30 +182,30 @@ draw_window:
|
|||||||
add esp,2
|
add esp,2
|
||||||
|
|
||||||
mpack ebx,0,MAGIC1-1
|
mpack ebx,0,MAGIC1-1
|
||||||
mpack ecx,MAGIC3+1,MAGIC2-2
|
mpack ecx,1+1, 14-2
|
||||||
mcall 8,,,0x4000000B ; Button: Enter Infile
|
mcall 8,,,0x4000000B ; Button: Enter Infile
|
||||||
madd ecx,MAGIC2,0
|
madd ecx, 14,0
|
||||||
mcall ,,,0x4000000C ; Button: Enter Outfile
|
mcall ,,,0x4000000C ; Button: Enter Outfile
|
||||||
madd ecx,MAGIC2,0
|
madd ecx, 14,0
|
||||||
mcall ,,,0x4000000D ; Button: Enter Path
|
mcall ,,,0x4000000D ; Button: Enter Path
|
||||||
|
|
||||||
mpack ebx,[pinfo.x_size],MAGIC1
|
mpack ebx,[pinfo.x_size],MAGIC1
|
||||||
msub ebx,MAGIC1+10+1,0
|
msub ebx,MAGIC1+10+1,0
|
||||||
mpack ecx,0,MAGIC2*3/2-1
|
mpack ecx,0, 14*3/2-1
|
||||||
madd ecx,MAGIC3,0
|
madd ecx,1,0
|
||||||
mcall ,,,0x00000002,[sc.work_button]
|
mcall ,,,0x00000002,[sc.work_button]
|
||||||
madd ecx,MAGIC2*3/2+1,0
|
madd ecx, 14*3/2+1,0
|
||||||
mcall ,,,0x00000003
|
mcall ,,,0x00000003
|
||||||
|
|
||||||
mpack ebx,6,0 ; Draw Window Text
|
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 ecx,[sc.work_text]
|
||||||
mov edx,text
|
mov edx,text
|
||||||
mov esi,text.line_size
|
mov esi,text.line_size
|
||||||
mov eax,4
|
mov eax,4
|
||||||
newline:
|
newline:
|
||||||
int 0x40
|
int 0x40
|
||||||
add ebx,MAGIC2
|
add ebx, 14
|
||||||
add edx,text.line_size
|
add edx,text.line_size
|
||||||
cmp byte[edx],'x'
|
cmp byte[edx],'x'
|
||||||
jne newline
|
jne newline
|
||||||
@ -217,13 +213,13 @@ draw_window:
|
|||||||
mov ebx,[pinfo.x_size]
|
mov ebx,[pinfo.x_size]
|
||||||
sub ebx,MAGIC1+10+1-9
|
sub ebx,MAGIC1+10+1-9
|
||||||
shl ebx,16
|
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
|
mcall ,,[sc.work_button_text],s_compile,7
|
||||||
add ebx,MAGIC2*3/2+1
|
add ebx,14*3/2+1
|
||||||
mcall ,,,s_run
|
mcall ,,,s_run
|
||||||
|
|
||||||
mpack ebx,MAGIC1+6,0
|
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]
|
mov esi,[pinfo.x_size]
|
||||||
sub esi,MAGIC1*2+5*2+6+3
|
sub esi,MAGIC1*2+5*2+6+3
|
||||||
mov eax,esi
|
mov eax,esi
|
||||||
@ -234,9 +230,9 @@ draw_window:
|
|||||||
mov al,MAX_PATH
|
mov al,MAX_PATH
|
||||||
@@: movzx esi,al
|
@@: movzx esi,al
|
||||||
mcall 4,,[sc.work_text],infile
|
mcall 4,,[sc.work_text],infile
|
||||||
add ebx,MAGIC2
|
add ebx,14
|
||||||
mcall ,,,outfile
|
mcall ,,,outfile
|
||||||
add ebx,MAGIC2
|
add ebx,14
|
||||||
mcall ,,,path
|
mcall ,,,path
|
||||||
|
|
||||||
call draw_messages
|
call draw_messages
|
||||||
@ -250,14 +246,14 @@ bottom_right dd ?
|
|||||||
|
|
||||||
draw_messages:
|
draw_messages:
|
||||||
mov eax,13 ; clear work area
|
mov eax,13 ; clear work area
|
||||||
mpack ebx,MAGIC4-2,[pinfo.x_size]
|
mpack ebx,7-2,[pinfo.x_size]
|
||||||
sub ebx,5*2+MAGIC4*2-1-2*2
|
sub ebx,5*2+7*2-1-2*2
|
||||||
mpack ecx,0,[pinfo.y_size]
|
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+2],bx
|
||||||
mov word[bottom_right],cx
|
mov word[bottom_right],cx
|
||||||
msub [bottom_right],7,11
|
msub [bottom_right],7,11
|
||||||
add [bottom_right],OUTPUTXY
|
add [bottom_right],7 shl 16 + 53
|
||||||
mov edx,[sc.work]
|
mov edx,[sc.work]
|
||||||
int 0x40
|
int 0x40
|
||||||
_cy = 0
|
_cy = 0
|
||||||
@ -265,7 +261,7 @@ _sy = 2
|
|||||||
_cx = 4
|
_cx = 4
|
||||||
_sx = 6
|
_sx = 6
|
||||||
push ebx ecx
|
push ebx ecx
|
||||||
mpack ebx,MAGIC4-3,MAGIC4-2
|
mpack ebx,4,5
|
||||||
add bx,[esp+_cx]
|
add bx,[esp+_cx]
|
||||||
mov ecx,[esp+_sy-2]
|
mov ecx,[esp+_sy-2]
|
||||||
mov cx,[esp+_sy]
|
mov cx,[esp+_sy]
|
||||||
@ -277,7 +273,7 @@ _sx = 6
|
|||||||
add ecx,esi
|
add ecx,esi
|
||||||
madd ecx,1,1
|
madd ecx,1,1
|
||||||
mcall
|
mcall
|
||||||
mpack ebx,MAGIC4-3,MAGIC4-3
|
mpack ebx,4,4
|
||||||
mov esi,[esp+_sy-2]
|
mov esi,[esp+_sy-2]
|
||||||
mov si,cx
|
mov si,cx
|
||||||
mov ecx,esi
|
mov ecx,esi
|
||||||
@ -294,13 +290,13 @@ _sx = 6
|
|||||||
; read string
|
; read string
|
||||||
|
|
||||||
f1: mov [addr],infile
|
f1: mov [addr],infile
|
||||||
add [ya],MAGIC2*0
|
add [ya], 14*0
|
||||||
jmp rk
|
jmp rk
|
||||||
f2: mov [addr],outfile
|
f2: mov [addr],outfile
|
||||||
add [ya],MAGIC2*1
|
add [ya], 14*1
|
||||||
jmp rk
|
jmp rk
|
||||||
f3: mov [addr],path
|
f3: mov [addr],path
|
||||||
add [ya],MAGIC2*2
|
add [ya], 14*2
|
||||||
rk:
|
rk:
|
||||||
|
|
||||||
mov edi,[addr]
|
mov edi,[addr]
|
||||||
@ -365,7 +361,7 @@ f11:mcall 10
|
|||||||
print_text:
|
print_text:
|
||||||
|
|
||||||
mpack ebx,MAGIC1+6,[pinfo.x_size]
|
mpack ebx,MAGIC1+6,[pinfo.x_size]
|
||||||
sub ebx,MAGIC1*2+5*2+6+3
|
sub ebx,MAGIC1*2+19
|
||||||
movzx esi,bx
|
movzx esi,bx
|
||||||
mov ecx,[ya-2]
|
mov ecx,[ya-2]
|
||||||
mov cx,8
|
mov cx,8
|
||||||
@ -431,7 +427,7 @@ start:
|
|||||||
call draw_messages
|
call draw_messages
|
||||||
push 0
|
push 0
|
||||||
pop [textxy]
|
pop [textxy]
|
||||||
add [textxy],OUTPUTXY
|
add [textxy],7 shl 16 + 53
|
||||||
@@:
|
@@:
|
||||||
mov esi,_logo
|
mov esi,_logo
|
||||||
call display_string
|
call display_string
|
||||||
@ -485,7 +481,7 @@ start:
|
|||||||
xor al,al
|
xor al,al
|
||||||
|
|
||||||
cmp [_run_outfile],0
|
cmp [_run_outfile],0
|
||||||
je @f
|
je @f
|
||||||
mov edx,outfile
|
mov edx,outfile
|
||||||
call make_fullpaths
|
call make_fullpaths
|
||||||
mov eax,70
|
mov eax,70
|
||||||
@ -497,7 +493,6 @@ start:
|
|||||||
|
|
||||||
|
|
||||||
include 'system.inc'
|
include 'system.inc'
|
||||||
|
|
||||||
include 'version.inc'
|
include 'version.inc'
|
||||||
include 'errors.inc'
|
include 'errors.inc'
|
||||||
include 'expressi.inc'
|
include 'expressi.inc'
|
||||||
|
@ -1418,12 +1418,12 @@ pe_heap:
|
|||||||
jmp instruction_assembled
|
jmp instruction_assembled
|
||||||
mark_pe_relocation:
|
mark_pe_relocation:
|
||||||
push eax ebx
|
push eax ebx
|
||||||
mov al,2
|
|
||||||
test [format_flags],8
|
test [format_flags],8
|
||||||
jz check_pe_relocation_type
|
jz check_pe32_relocation_type
|
||||||
mov al,4
|
cmp [value_type],4
|
||||||
check_pe_relocation_type:
|
je pe_relocation_type_ok
|
||||||
cmp [value_type],al
|
check_pe32_relocation_type:
|
||||||
|
cmp [value_type],2
|
||||||
je pe_relocation_type_ok
|
je pe_relocation_type_ok
|
||||||
cmp [error_line],0
|
cmp [error_line],0
|
||||||
jne pe_relocation_type_ok
|
jne pe_relocation_type_ok
|
||||||
@ -1438,11 +1438,18 @@ mark_pe_relocation:
|
|||||||
mov ebx,[free_additional_memory]
|
mov ebx,[free_additional_memory]
|
||||||
inc [number_of_relocations]
|
inc [number_of_relocations]
|
||||||
jz invalid_use_of_symbol
|
jz invalid_use_of_symbol
|
||||||
mov [ebx],eax
|
add ebx,5
|
||||||
add ebx,4
|
|
||||||
cmp ebx,[structures_buffer]
|
cmp ebx,[structures_buffer]
|
||||||
jae out_of_memory
|
jae out_of_memory
|
||||||
mov [free_additional_memory],ebx
|
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
|
pop ebx eax
|
||||||
ret
|
ret
|
||||||
generate_pe_data:
|
generate_pe_data:
|
||||||
@ -1451,6 +1458,53 @@ generate_pe_data:
|
|||||||
cmp al,5
|
cmp al,5
|
||||||
je make_pe_fixups
|
je make_pe_fixups
|
||||||
ret
|
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:
|
make_pe_resource:
|
||||||
cmp byte [esi],82h
|
cmp byte [esi],82h
|
||||||
jne resource_done
|
jne resource_done
|
||||||
@ -2017,58 +2071,6 @@ make_pe_resource:
|
|||||||
mov [resource_size],eax
|
mov [resource_size],eax
|
||||||
resource_done:
|
resource_done:
|
||||||
ret
|
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:
|
close_pe:
|
||||||
call close_pe_section
|
call close_pe_section
|
||||||
mov edx,[code_start]
|
mov edx,[code_start]
|
||||||
|
@ -324,7 +324,7 @@ display_character:
|
|||||||
cmp dl,0xa
|
cmp dl,0xa
|
||||||
jnz dc1
|
jnz dc1
|
||||||
and [textxy],0x0000FFFF
|
and [textxy],0x0000FFFF
|
||||||
add [textxy],OUTPUTXY and 0xFFFF0000 + 10
|
add [textxy], 7 shl 16 +53 and 0xFFFF0000 + 10
|
||||||
dc2:
|
dc2:
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
@ -398,7 +398,7 @@ digit_ok:
|
|||||||
display_user_messages:
|
display_user_messages:
|
||||||
; push [skinh]
|
; push [skinh]
|
||||||
; pop [textxy]
|
; pop [textxy]
|
||||||
; add [textxy],OUTPUTXY
|
; add [textxy], 7 shl 16 +53
|
||||||
mov [displayed_count],0
|
mov [displayed_count],0
|
||||||
call flush_display_buffer
|
call flush_display_buffer
|
||||||
cmp [displayed_count],1
|
cmp [displayed_count],1
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
; cannot simply be copied and put under another distribution licence
|
; cannot simply be copied and put under another distribution licence
|
||||||
; (including the GNU Public Licence).
|
; (including the GNU Public Licence).
|
||||||
|
|
||||||
VERSION_STRING equ "1.67.20"
|
VERSION_STRING equ "1.67.21"
|
||||||
|
|
||||||
VERSION_MAJOR = 1
|
VERSION_MAJOR = 1
|
||||||
VERSION_MINOR = 67
|
VERSION_MINOR = 67
|
||||||
|
@ -1402,6 +1402,7 @@ push_instruction:
|
|||||||
cmp al,70h
|
cmp al,70h
|
||||||
jae invalid_operand
|
jae invalid_operand
|
||||||
sub al,61h
|
sub al,61h
|
||||||
|
jc invalid_operand
|
||||||
cmp al,4
|
cmp al,4
|
||||||
jae push_sreg_386
|
jae push_sreg_386
|
||||||
shl al,3
|
shl al,3
|
||||||
@ -1681,6 +1682,7 @@ pop_instruction:
|
|||||||
cmp al,70h
|
cmp al,70h
|
||||||
jae invalid_operand
|
jae invalid_operand
|
||||||
sub al,61h
|
sub al,61h
|
||||||
|
jc invalid_operand
|
||||||
cmp al,4
|
cmp al,4
|
||||||
jae pop_sreg_386
|
jae pop_sreg_386
|
||||||
shl al,3
|
shl al,3
|
||||||
|
Loading…
Reference in New Issue
Block a user