Updated to official version 1.67.11, new function of drawing title and window, compiled programs now runs with 70th function

git-svn-id: svn://kolibrios.org@174 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2006-10-10 22:15:57 +00:00
parent e60d47ae50
commit de97cea06c
9 changed files with 443 additions and 332 deletions

View File

@ -618,14 +618,17 @@ load_directive:
load_from_code: load_from_code:
cmp byte [esi],'.' cmp byte [esi],'.'
je invalid_value je invalid_value
call get_relative_offset call get_qword_value
neg eax call calculate_relative_offset
push esi edi
cmp [next_pass_needed],0 cmp [next_pass_needed],0
jne load_address_ok jne load_address_type_ok
cmp [value_type],0 cmp [value_type],0
jne invalid_use_of_symbol jne invalid_use_of_symbol
load_address_ok: load_address_type_ok:
push esi edi cmp edx,-1
jne bad_load_address
neg eax
mov esi,edi mov esi,edi
sub esi,eax sub esi,eax
jc bad_load_address jc bad_load_address
@ -673,14 +676,17 @@ store_directive:
jne invalid_argument jne invalid_argument
cmp byte [esi],'.' cmp byte [esi],'.'
je invalid_value je invalid_value
call get_relative_offset call get_qword_value
neg eax call calculate_relative_offset
push esi edi
cmp [next_pass_needed],0 cmp [next_pass_needed],0
jne store_address_ok jne store_address_type_ok
cmp [value_type],0 cmp [value_type],0
jne invalid_use_of_symbol jne invalid_use_of_symbol
store_address_ok: store_address_type_ok:
push esi edi cmp edx,-1
jne bad_store_address
neg eax
sub edi,eax sub edi,eax
jc bad_store_address jc bad_store_address
cmp edi,[org_start] cmp edi,[org_start]

View File

@ -841,6 +841,8 @@ calculate_expression:
sub ebx,14h sub ebx,14h
cmp al,0E0h cmp al,0E0h
je calculate_rva je calculate_rva
cmp al,0E1h
je calculate_plt
cmp al,0D0h cmp al,0D0h
je calculate_not je calculate_not
cmp al,083h cmp al,083h
@ -1145,12 +1147,7 @@ calculate_expression:
xor ah,ah xor ah,ah
mov ecx,[edi+16] mov ecx,[edi+16]
cmp ecx,[ebx+16] cmp ecx,[ebx+16]
je sub_values
cmp ecx,[org_symbol]
jne invalid_sub jne invalid_sub
test byte [ebx+12],1
jnz invalid_sub
mov ah,3
sub_values: sub_values:
mov [ebx+12],ah mov [ebx+12],ah
mov eax,[edi] mov eax,[edi]
@ -1556,17 +1553,41 @@ calculate_expression:
calculate_gotoff: calculate_gotoff:
test [format_flags],8+1 test [format_flags],8+1
jnz invalid_expression jnz invalid_expression
mov dl,5
cmp byte [edi+12],2 cmp byte [edi+12],2
je gotoff_ok je change_value_type
incorrect_change_of_value_type:
cmp [error_line],0 cmp [error_line],0
jne pe64_rva_ok jne change_value_type
mov eax,[current_line] mov eax,[current_line]
mov [error_line],eax mov [error_line],eax
mov [error],invalid_use_of_symbol mov [error],invalid_use_of_symbol
gotoff_ok: change_value_type:
mov byte [edi+12],5 mov byte [edi+12],dl
add edi,14h add edi,14h
jmp calculation_loop 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: div_64:
xor ebx,ebx xor ebx,ebx
cmp dword [edi],0 cmp dword [edi],0
@ -1955,6 +1976,7 @@ get_address_value:
mov [value_type],al mov [value_type],al
cmp al,5 cmp al,5
je gotoff_address je gotoff_address
ja invalid_use_of_symbol
test al,1 test al,1
jnz invalid_use_of_symbol jnz invalid_use_of_symbol
or al,al or al,al
@ -1984,8 +2006,10 @@ get_address_value:
mov [error_line],ecx mov [error_line],ecx
mov [error],value_out_of_range mov [error],value_out_of_range
address_size_ok: address_size_ok:
xor bx,bx xor ebx,ebx
xor cl,cl xor ecx,ecx
mov cl,[value_type]
shl ecx,16
mov ch,[address_size] mov ch,[address_size]
cmp word [edi+8],0 cmp word [edi+8],0
je check_immediate_address je check_immediate_address
@ -2071,42 +2095,31 @@ get_address_value:
cmp [address_size],4 cmp [address_size],4
je check_dword_value je check_dword_value
jmp check_qword_value jmp check_qword_value
get_relative_offset: calculate_relative_offset:
mov [value_size],4 cmp [value_undefined],0
mov [size_override],-1 jne relative_offset_ok
call calculate_expression add eax,dword [org_origin]
calculate_relative_offset: adc edx,dword [org_origin+4]
push esi sub eax,edi
add edi,14h sbb edx,0
mov esi,[display_buffer] mov bl,[value_type]
sub esi,7 or bl,bl
lea eax,[esi-14h] je relative_offset_ok
cmp eax,edi test bl,1
jb out_of_memory jnz invalid_use_of_symbol
mov byte [esi],11h cmp bl,6
xor eax,eax je plt_relative_offset
mov dword [esi+1],eax cmp bl,[labels_type]
mov word [esi+5],')' shl 8 + 81h jne invalid_use_of_symbol
call calculation_loop mov [value_type],0
pop esi mov ecx,[symbol_identifier]
cmp word [edi+8],0 cmp ecx,[org_symbol]
jne invalid_value je relative_offset_ok
mov al,[edi+12] mov [value_type],3
mov [value_type],al relative_offset_ok:
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
ret ret
offset_positive: plt_relative_offset:
bt eax,31 mov [value_type],7
jc range_exceeded
ret ret
preevaluate_logical_expression: preevaluate_logical_expression:

View File

@ -11,26 +11,29 @@
NORMAL_MODE = 8 NORMAL_MODE = 8
CONSOLE_MODE = 32 CONSOLE_MODE = 32
MAGIC1 = 6*(text.line_size-1)+6*2+2 MAGIC1 = 6*(text.line_size-1)+14
MAGIC2 = 14 MAGIC2 = 14
MAGIC3 = 1 MAGIC3 = 1
MAGIC4 = 7 MAGIC4 = 7
OUTPUTXY = (5+MAGIC4) shl 16 + MAGIC2*3+MAGIC3+MAGIC4+1+2 OUTPUTXY = 7 shl 16 + 53
MAX_PATH = 100 MAX_PATH = 100
APP_MEMORY = 0x00800000 APP_MEMORY = 0x00800000
;; Menuet header ;; Menuet header
appname equ "FASM "
version equ "1.67.11"
use32 use32
org 0x0 org 0x0
db 'MENUET01' ; 8 byte id db 'MENUET01' ; 8 byte id
dd 0x01 ; header version dd 0x01 ; header version
dd START ; program start dd START ; program start
dd program_end ; program image size dd program_end ; program image size
dd APP_MEMORY ; required amount of memory dd APP_MEMORY ; required amount of memory
dd 0xDFFF0 ; stack dd 0xDFFF0 ; stack
dd params,0x0 ; parameters,icon dd params,0x0 ; parameters,icon
include 'lang.inc' include 'lang.inc'
@ -40,105 +43,100 @@ center fix true
START: ; Start of execution START: ; Start of execution
cmp [params],0 cmp [params],0
jz noparams jz red
mov ecx,10 mov ecx,10
mov al,' ' mov al,' '
mov edi,infile mov edi,infile
push ecx push ecx
cld cld
rep stosd rep stosd
mov ecx,[esp] mov ecx,[esp]
mov edi,outfile mov edi,outfile
rep stosd rep stosd
pop ecx pop ecx
mov edi,path mov edi,path
rep stosd rep stosd
mov esi,params mov esi,params
; DEBUGF "params: %s\n",esi ; DEBUGF "params: %s\n",esi
mov edi,infile mov edi,infile
call mov_param_str call mov_param_str
; mov edi,infile ; mov edi,infile
; DEBUGF " input: %s\n",edi ; DEBUGF " input: %s\n",edi
inc esi inc esi
mov edi,outfile mov edi,outfile
call mov_param_str call mov_param_str
; mov edi,outfile ; mov edi,outfile
; DEBUGF "output: %s\n",edi ; DEBUGF "output: %s\n",edi
inc esi inc esi
mov edi,path mov edi,path
call mov_param_str call mov_param_str
; mov edi,path ; mov edi,path
; DEBUGF " path: %s\n",edi ; DEBUGF " path: %s\n",edi
cmp [esi], dword ',run' cmp [esi], dword ',run'
jne @f jne @f
mov [_run_outfile],1 mov [_run_outfile],1
@@: @@:
mov [_mode],CONSOLE_MODE mov [_mode],CONSOLE_MODE
jmp start jmp start
noparams:
call draw_window
still:
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 red: ; Redraw
call draw_window call draw_window
jmp still
key: ; Key still:
mcall 2 ; Read it and ignore push 10 ; Wait here for event
pop eax
int 40h
dec eax
je red ; Redraw request
dec eax
jne button ; Button in buffer
key: ; Key
mov al,2 ; Read it and ignore
int 0x40
jmp still jmp still
button: ; Button in Window button: ; Button in Window
mcall 17 mov al,17
int 0x40
cmp ah,2 ; Start compiling cmp ah,1
je start jne noclose
cmp ah,3 ; Start compiled file or eax,-1
int 0x40
noclose:
cmp ah,2 ; Start compiling
je start
cmp ah,3 ; Start compiled file
jnz norunout jnz norunout
mov edx,outfile mov edx,outfile
call make_fullpaths call make_fullpaths
mcall 58,file_info_start mcall 70,file_info_start
; xor ecx,ecx ; xor ecx,ecx
jmp still jmp still
norunout: norunout:
mov ecx,[skinh] mov ecx,5
add ecx,MAGIC3+MAGIC2/2-3
mov [ya],ecx mov [ya],ecx
cmp ah,11 ; Infile cmp ah,11 ; Infile
je f1 je f1
cmp ah,12 ; Outfile cmp ah,12 ; Outfile
je f2 je f2
cmp ah,13 ; Path cmp ah,13 ; Path
je f3 je f3
dec ah ; Close application jmp still
jnz still
mcall -1
skinh dd ?
draw_window: draw_window:
@ -148,15 +146,19 @@ draw_window:
get_sys_colors 1,0 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] mpack ecx,1,1
mov cx,word[skinh]
madd ecx,MAGIC3,MAGIC3
mov ebx,[pinfo.x_size] mov ebx,[pinfo.x_size]
madd ebx,5,-5 sub ebx,10
push ecx push ecx
madd ecx,MAGIC2*3+2,MAGIC2*3+2 madd ecx,MAGIC2*3+2,MAGIC2*3+2
@ -164,7 +166,6 @@ draw_window:
pop ecx pop ecx
sub ebx,MAGIC1+3 sub ebx,MAGIC1+3
mcall mcall
madd ecx,MAGIC2,MAGIC2 madd ecx,MAGIC2,MAGIC2
mcall mcall
@ -173,17 +174,16 @@ draw_window:
madd ecx,MAGIC2,MAGIC2 madd ecx,MAGIC2,MAGIC2
mcall mcall
push ebx push ebx
mpack ebx,MAGIC1+5,MAGIC1+5 mpack ebx,MAGIC1,MAGIC1
sub cx,MAGIC2*3 sub ecx,MAGIC2*3
mcall mcall
mov ebx,[esp-2] mov ebx,[esp-2]
pop bx pop bx
mcall mcall
add esp,2 add esp,2
mpack ebx,5,MAGIC1-1 mpack ebx,0,MAGIC1-1
mpack ecx,[skinh],MAGIC2-2 mpack ecx,MAGIC3+1,MAGIC2-2
madd ecx,MAGIC3+1,0
mcall 8,,,0x4000000B ; Button: Enter Infile mcall 8,,,0x4000000B ; Button: Enter Infile
madd ecx,MAGIC2,0 madd ecx,MAGIC2,0
mcall ,,,0x4000000C ; Button: Enter Outfile mcall ,,,0x4000000C ; Button: Enter Outfile
@ -191,36 +191,35 @@ draw_window:
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+5+1,0 msub ebx,MAGIC1+10+1,0
mpack ecx,[skinh],MAGIC2*3/2-1 mpack ecx,0,MAGIC2*3/2-1
madd ecx,MAGIC3,0 madd ecx,MAGIC3,0
mcall ,,,0x00000002,[sc.work_button] mcall ,,,0x00000002,[sc.work_button]
madd ecx,MAGIC2*3/2+1,0 madd ecx,MAGIC2*3/2+1,0
mcall ,,,0x00000003 mcall ,,,0x00000003
mpack ebx,5+6,[skinh] ; Draw Window Text mpack ebx,6,0 ; Draw Window Text
add bx,MAGIC3+MAGIC2/2-3 add ebx,MAGIC3+MAGIC2/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:
mcall int 0x40
add ebx,MAGIC2 add ebx,MAGIC2
add edx,text.line_size add edx,text.line_size
cmp byte[edx],'x' cmp byte[edx],'x'
jne newline jne newline
mov ebx,[pinfo.x_size] mov ebx,[pinfo.x_size]
sub ebx,MAGIC1+5+1-9 sub ebx,MAGIC1+10+1-9
shl ebx,16 shl ebx,16
mov bx,word[skinh] add ebx,MAGIC3+(MAGIC2*3/2-1)/2-3
add bx,MAGIC3+(MAGIC2*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,MAGIC2*3/2+1
mcall ,,,s_run mcall ,,,s_run
mpack ebx,MAGIC1+5+6,[skinh] mpack ebx,MAGIC1+6,0
add ebx,MAGIC3+MAGIC2/2-3+MAGIC2*0 add ebx,MAGIC3+MAGIC2/2-3+MAGIC2*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
@ -248,15 +247,14 @@ bottom_right dd ?
draw_messages: draw_messages:
mov eax,13 ; clear work area 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 sub ebx,5*2+MAGIC4*2-1-2*2
mpack ecx,[skinh],[pinfo.y_size] mpack ecx,0,[pinfo.y_size]
madd ecx,MAGIC2*3+MAGIC3+MAGIC4+1,-(MAGIC2*3+MAGIC3+MAGIC4*2+5)+2 madd ecx,MAGIC2*3+MAGIC3+MAGIC4+1,-(MAGIC2*3+MAGIC3+MAGIC4*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],OUTPUTXY
sub ecx,[skinh]
mov edx,[sc.work] mov edx,[sc.work]
int 0x40 int 0x40
_cy = 0 _cy = 0
@ -264,7 +262,7 @@ _sy = 2
_cx = 4 _cx = 4
_sx = 6 _sx = 6
push ebx ecx push ebx ecx
mpack ebx,5+MAGIC4-3,5+MAGIC4-2 mpack ebx,MAGIC4-3,MAGIC4-2
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]
@ -276,7 +274,7 @@ _sx = 6
add ecx,esi add ecx,esi
madd ecx,1,1 madd ecx,1,1
mcall mcall
mpack ebx,5+MAGIC4-3,5+MAGIC4-3 mpack ebx,MAGIC4-3,MAGIC4-3
mov esi,[esp+_sy-2] mov esi,[esp+_sy-2]
mov si,cx mov si,cx
mov ecx,esi mov ecx,esi
@ -363,14 +361,14 @@ f11:mcall 10
print_text: 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 sub ebx,MAGIC1*2+5*2+6+3
movzx esi,bx movzx esi,bx
mov ecx,[ya-2] mov ecx,[ya-2]
mov cx,8 mov cx,8
mcall 13,,,[sc.work] mcall 13,,,[sc.work]
mpack ebx,MAGIC1+5+6,[ya] mpack ebx,MAGIC1+6,[ya]
mov eax,esi mov eax,esi
mov cl,6 mov cl,6
div cl div cl
@ -385,7 +383,7 @@ print_text:
; DATA ; DATA
sz header,'FASM FOR MENUET' header db appname,version,0
text: text:
db ' INFILE:' db ' INFILE:'
@ -430,7 +428,7 @@ start:
cmp [_mode],NORMAL_MODE cmp [_mode],NORMAL_MODE
jne @f jne @f
call draw_messages call draw_messages
push [skinh] push 0
pop [textxy] pop [textxy]
add [textxy],OUTPUTXY add [textxy],OUTPUTXY
@@: @@:
@ -489,7 +487,7 @@ start:
je @f je @f
mov edx,outfile mov edx,outfile
call make_fullpaths call make_fullpaths
mov eax,58 mov eax,70
mov ebx,file_info_start mov ebx,file_info_start
xor ecx,ecx xor ecx,ecx
int 0x40 int 0x40

View File

@ -2887,18 +2887,23 @@ elf_section:
mark_elf_relocation: mark_elf_relocation:
cmp [value_type],3 cmp [value_type],3
je elf_relocation_relative je elf_relocation_relative
cmp [value_type],7
je elf_relocation_relative
push ebx eax push ebx eax
cmp [value_type],3 cmp [value_type],5
je elf_gotoff_relocation 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 test [format_flags],8
jz coff_relocation jz coff_relocation
cmp [value_type],4 cmp [value_type],4
je coff_relocation je coff_relocation
mov al,11 mov al,11 ; R_AMD64_32S
jmp coff_relocation jmp coff_relocation
elf_gotoff_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 jmp coff_relocation
elf_relocation_relative: elf_relocation_relative:
cmp [labels_type],0 cmp [labels_type],0
@ -2909,7 +2914,10 @@ mark_elf_relocation:
sub ebx,edi sub ebx,edi
sub eax,ebx sub eax,ebx
push eax 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 jmp coff_relocation
close_elf: close_elf:
bt [format_flags],0 bt [format_flags],0

View File

@ -5,15 +5,21 @@
; MenuetOS system.inc by VT ; MenuetOS system.inc by VT
file_info_open: dd 0,0,0xffffff,0x20000,0xf0000 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 times MAX_PATH db 0
file_info_write: dd 1,0,0,0,0xf0000 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 times MAX_PATH db 0
file_info_start: dd 16,0,0,0,0xf0000 file_info_start: ;this part is already rewrited to 70th function
fullpath_start:; db '/HD/1/EXAMPLE' dd 7
dd 0
dd 0
dd 0
dd 0
fullpath_start: ; db '/RD/1/EXAMPLE'
times MAX_PATH db 0 times MAX_PATH db 0
_ramdisk db '/RD/1/' _ramdisk db '/RD/1/'
@ -69,10 +75,10 @@ open:
jz @f jz @f
cmp eax,6 cmp eax,6
jne file_error jne file_error
@@: mov [filesize],ebx @@: mov [filesize],ebx
clc clc
ret ret
file_error: file_error:
stc stc
ret ret
@ -212,9 +218,11 @@ display_character:
jnz dc1 jnz dc1
and [textxy],0x0000FFFF and [textxy],0x0000FFFF
add [textxy],OUTPUTXY and 0xFFFF0000 + 10 add [textxy],OUTPUTXY and 0xFFFF0000 + 10
dc2: popa dc2:
popa
ret ret
dc1: mov eax,[textxy] dc1:
mov eax,[textxy]
cmp ax,word[bottom_right] cmp ax,word[bottom_right]
ja dc2 ja dc2
shr eax,16 shr eax,16
@ -225,7 +233,8 @@ dc1: mov eax,[textxy]
add [textxy],0x00060000 add [textxy],0x00060000
popa popa
ret ret
@@: mov eax,63 @@:
mov eax,63
mov ebx,1 mov ebx,1
mov cl,dl mov cl,dl
int 0x40 int 0x40
@ -233,16 +242,17 @@ dc1: mov eax,[textxy]
ret ret
display_string: display_string:
pusha pusha
@@: cmp byte[esi],0 @@:
cmp byte[esi],0
je @f je @f
mov dl,[esi] mov dl,[esi]
call display_character call display_character
add esi,1 add esi,1
jmp @b jmp @b
@@: popa @@:
popa
ret ret
display_number: display_number:
@ -250,7 +260,7 @@ display_number:
mov ecx,1000000000 mov ecx,1000000000
xor edx,edx xor edx,edx
xor bl,bl xor bl,bl
display_loop: display_loop:
div ecx div ecx
push edx push edx
cmp ecx,1 cmp ecx,1
@ -260,13 +270,13 @@ display_number:
or al,al or al,al
jz digit_ok jz digit_ok
not bl not bl
display_digit: display_digit:
mov dl,al mov dl,al
add dl,30h add dl,30h
push ebx ecx push ebx ecx
call display_character call display_character
pop ecx ebx pop ecx ebx
digit_ok: digit_ok:
mov eax,ecx mov eax,ecx
xor edx,edx xor edx,edx
mov ecx,10 mov ecx,10
@ -292,15 +302,15 @@ display_user_messages:
je line_break_ok je line_break_ok
cmp ax,0D0Ah cmp ax,0D0Ah
je line_break_ok je line_break_ok
make_line_break: make_line_break:
mov esi,lf mov esi,lf
call display_string call display_string
line_break_ok: line_break_ok:
ret ret
display_block: display_block:
pusha pusha
@@: mov dl,[esi] @@: mov dl,[esi]
call display_character call display_character
inc esi inc esi
loop @b loop @b
@ -323,19 +333,19 @@ assembler_error:
call display_user_messages call display_user_messages
push dword 0 push dword 0
mov ebx,[current_line] mov ebx,[current_line]
get_error_lines: get_error_lines:
push ebx push ebx
test byte [ebx+7],80h test byte [ebx+7],80h
jz display_error_line jz display_error_line
mov edx,ebx mov edx,ebx
find_definition_origin: find_definition_origin:
mov edx,[edx+12] mov edx,[edx+12]
test byte [edx+7],80h test byte [edx+7],80h
jnz find_definition_origin jnz find_definition_origin
push edx push edx
mov ebx,[ebx+8] mov ebx,[ebx+8]
jmp get_error_lines jmp get_error_lines
display_error_line: display_error_line:
mov esi,[ebx] mov esi,[ebx]
call display_string call display_string
mov esi,line_number_start mov esi,line_number_start
@ -363,7 +373,7 @@ assembler_error:
call display_number call display_number
mov dl,']' mov dl,']'
call display_character call display_character
line_number_ok: line_number_ok:
mov esi,line_data_start mov esi,line_data_start
call display_string call display_string
mov esi,ebx mov esi,ebx
@ -386,7 +396,7 @@ assembler_error:
call close call close
pop ecx pop ecx
mov esi,[additional_memory] mov esi,[additional_memory]
get_line_data: get_line_data:
mov al,[esi] mov al,[esi]
cmp al,0Ah cmp al,0Ah
je display_line_data je display_line_data
@ -398,7 +408,7 @@ assembler_error:
jz display_line_data jz display_line_data
inc esi inc esi
loop get_line_data loop get_line_data
display_line_data: display_line_data:
mov ecx,esi mov ecx,esi
mov esi,[additional_memory] mov esi,[additional_memory]
sub ecx,esi sub ecx,esi
@ -416,32 +426,6 @@ assembler_error:
call display_string call display_string
jmp exit_program 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 character db ?,0
bytes_count dd ? bytes_count dd ?
@ -459,4 +443,4 @@ line_data_start db ':'
cr_lf db 0Dh,0Ah,0 cr_lf db 0Dh,0Ah,0
line_number_start db ' [',0 line_number_start db ' [',0
macro dm string { db string,0 } macro dm string { db string,0 }

View File

@ -61,6 +61,7 @@ single_operand_operators:
db 1,'+',0 db 1,'+',0
db 1,'-',083h db 1,'-',083h
db 3,'not',0D0h db 3,'not',0D0h
db 3,'plt',0E1h
db 3,'rva',0E0h db 3,'rva',0E0h
db 0 db 0
@ -513,8 +514,8 @@ instructions_3:
dw single_operand_instruction-assembler dw single_operand_instruction-assembler
db 'neg',3 db 'neg',3
dw single_operand_instruction-assembler dw single_operand_instruction-assembler
db 'nop',90h ;db 'nop',90h
dw simple_instruction-assembler ;dw nop_instruction-assembler
db 'not',2 db 'not',2
dw single_operand_instruction-assembler dw single_operand_instruction-assembler
db 'org',0 db 'org',0
@ -524,7 +525,7 @@ instructions_3:
db 'pop',0 db 'pop',0
dw pop_instruction-assembler dw pop_instruction-assembler
db 'por',0EBh db 'por',0EBh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'rcl',2 db 'rcl',2
dw sh_instruction-assembler dw sh_instruction-assembler
db 'rcr',3 db 'rcr',3
@ -687,7 +688,7 @@ instructions_4:
db 'outs',6Eh db 'outs',6Eh
dw outs_instruction-assembler dw outs_instruction-assembler
db 'pand',0DBh db 'pand',0DBh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'popa',61h db 'popa',61h
dw simple_instruction_except64-assembler dw simple_instruction_except64-assembler
db 'popd',4 db 'popd',4
@ -701,7 +702,7 @@ instructions_4:
db 'push',0 db 'push',0
dw push_instruction-assembler dw push_instruction-assembler
db 'pxor',0EFh db 'pxor',0EFh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'repe',0F3h db 'repe',0F3h
dw prefix_instruction-assembler dw prefix_instruction-assembler
db 'repz',0F3h db 'repz',0F3h
@ -991,22 +992,28 @@ instructions_5:
dw simple_instruction_32bit-assembler dw simple_instruction_32bit-assembler
db 'outsw',6Fh db 'outsw',6Fh
dw simple_instruction_16bit-assembler 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 db 'paddb',0FCh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'paddd',0FEh db 'paddd',0FEh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'paddq',0D4h db 'paddq',0D4h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'paddw',0FDh db 'paddw',0FDh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pandn',0DFh db 'pandn',0DFh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pause',0 db 'pause',0
dw pause_instruction-assembler dw pause_instruction-assembler
db 'pavgb',0E0h db 'pavgb',0E0h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pavgw',0E3h db 'pavgw',0E3h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pf2id',1Dh db 'pf2id',1Dh
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'pf2iw',1Ch db 'pf2iw',1Ch
@ -1056,13 +1063,13 @@ instructions_5:
db 'psrlw',0D1h db 'psrlw',0D1h
dw mmx_ps_instruction-assembler dw mmx_ps_instruction-assembler
db 'psubb',0F8h db 'psubb',0F8h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'psubd',0FAh db 'psubd',0FAh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'psubq',0FBh db 'psubq',0FBh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'psubw',0F9h db 'psubw',0F9h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pusha',60h db 'pusha',60h
dw simple_instruction_except64-assembler dw simple_instruction_except64-assembler
db 'pushd',4 db 'pushd',4
@ -1341,43 +1348,59 @@ instructions_6:
db 'movups',10h db 'movups',10h
dw movps_instruction-assembler dw movps_instruction-assembler
db 'paddsb',0ECh db 'paddsb',0ECh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'paddsw',0EDh db 'paddsw',0EDh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pextrw',0C5h db 'pextrw',0C5h
dw pextrw_instruction-assembler dw pextrw_instruction-assembler
db 'pfnacc',8Ah db 'pfnacc',8Ah
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'pfsubr',0AAh db 'pfsubr',0AAh
dw amd3dnow_instruction-assembler 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 db 'pinsrw',0C4h
dw pinsrw_instruction-assembler dw pinsrw_instruction-assembler
db 'pmaxsw',0EEh db 'pmaxsw',0EEh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pmaxub',0DEh db 'pmaxub',0DEh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pminsw',0EAh db 'pminsw',0EAh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pminub',0DAh db 'pminub',0DAh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pmulhw',0E5h db 'pmulhw',0E5h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pmullw',0D5h db 'pmullw',0D5h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'psadbw',0F6h db 'psadbw',0F6h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pshufb',0
dw ssse3_instruction-assembler
db 'pshufd',66h db 'pshufd',66h
dw pshufd_instruction-assembler dw pshufd_instruction-assembler
db 'pshufw',0 db 'pshufw',0
dw pshufw_instruction-assembler 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 db 'pslldq',111b
dw ps_dq_instruction-assembler dw ps_dq_instruction-assembler
db 'psrldq',011b db 'psrldq',011b
dw ps_dq_instruction-assembler dw ps_dq_instruction-assembler
db 'psubsb',0E8h db 'psubsb',0E8h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'psubsw',0E9h db 'psubsw',0E9h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pswapd',0BBh db 'pswapd',0BBh
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'public',0 db 'public',0
@ -1544,23 +1567,25 @@ instructions_7:
db 'movq2dq',0 db 'movq2dq',0
dw movq2dq_instruction-assembler dw movq2dq_instruction-assembler
db 'paddusb',0DCh db 'paddusb',0DCh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'paddusw',0DDh db 'paddusw',0DDh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'palignr',0
dw palignr_instruction-assembler
db 'pavgusb',0BFh db 'pavgusb',0BFh
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'pcmpeqb',74h db 'pcmpeqb',74h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pcmpeqd',76h db 'pcmpeqd',76h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pcmpeqw',75h db 'pcmpeqw',75h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pcmpgtb',64h db 'pcmpgtb',64h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pcmpgtd',66h db 'pcmpgtd',66h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pcmpgtw',65h db 'pcmpgtw',65h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pfcmpeq',0B0h db 'pfcmpeq',0B0h
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'pfcmpge',90h db 'pfcmpge',90h
@ -1571,22 +1596,26 @@ instructions_7:
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'pfrsqrt',97h db 'pfrsqrt',97h
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'phaddsw',3
dw ssse3_instruction-assembler
db 'phsubsw',7
dw ssse3_instruction-assembler
db 'pmaddwd',0F5h db 'pmaddwd',0F5h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pmulhrw',0B7h db 'pmulhrw',0B7h
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'pmulhuw',0E4h db 'pmulhuw',0E4h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pmuludq',0F4h db 'pmuludq',0F4h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pshufhw',0F3h db 'pshufhw',0F3h
dw pshufd_instruction-assembler dw pshufd_instruction-assembler
db 'pshuflw',0F2h db 'pshuflw',0F2h
dw pshufd_instruction-assembler dw pshufd_instruction-assembler
db 'psubusb',0D8h db 'psubusb',0D8h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'psubusw',0D9h db 'psubusw',0D9h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'rsqrtps',52h db 'rsqrtps',52h
dw sse_ps_instruction-assembler dw sse_ps_instruction-assembler
db 'rsqrtss',52h db 'rsqrtss',52h
@ -1701,11 +1730,11 @@ instructions_8:
db 'movsldup',12h db 'movsldup',12h
dw cvtdq2pd_instruction-assembler dw cvtdq2pd_instruction-assembler
db 'packssdw',6Bh db 'packssdw',6Bh
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'packsswb',63h db 'packsswb',63h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'packuswb',67h db 'packuswb',67h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'pfrcpit1',0A6h db 'pfrcpit1',0A6h
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'pfrcpit2',0B6h db 'pfrcpit2',0B6h
@ -1714,6 +1743,8 @@ instructions_8:
dw amd3dnow_instruction-assembler dw amd3dnow_instruction-assembler
db 'pmovmskb',0D7h db 'pmovmskb',0D7h
dw pextrw_instruction-assembler dw pextrw_instruction-assembler
db 'pmulhrsw',0Bh
dw ssse3_instruction-assembler
db 'prefetch',0 db 'prefetch',0
dw amd_prefetch_instruction-assembler dw amd_prefetch_instruction-assembler
db 'sysenter',34h db 'sysenter',34h
@ -1747,20 +1778,22 @@ instructions_9:
dw cvtsd2si_instruction-assembler dw cvtsd2si_instruction-assembler
db 'cvttss2si',2Ch db 'cvttss2si',2Ch
dw cvtss2si_instruction-assembler dw cvtss2si_instruction-assembler
db 'pmaddubsw',4
dw ssse3_instruction-assembler
db 'prefetchw',1 db 'prefetchw',1
dw amd_prefetch_instruction-assembler dw amd_prefetch_instruction-assembler
db 'punpckhbw',68h db 'punpckhbw',68h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'punpckhdq',6Ah db 'punpckhdq',6Ah
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'punpckhwd',69h db 'punpckhwd',69h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'punpcklbw',60h db 'punpcklbw',60h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'punpckldq',62h db 'punpckldq',62h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
db 'punpcklwd',61h db 'punpcklwd',61h
dw mmx_instruction-assembler dw basic_mmx_instruction-assembler
instructions_10: instructions_10:
db 'cmpunordpd',3 db 'cmpunordpd',3
dw cmp_pd_instruction-assembler dw cmp_pd_instruction-assembler

View File

@ -106,6 +106,7 @@ value_type db ?
compare_type db ? compare_type db ?
base_code db ? base_code db ?
extended_code db ? extended_code db ?
supplemental_code db ?
postbyte_register db ? postbyte_register db ?
segment_register db ? segment_register db ?
mmx_size db ? mmx_size db ?

View File

@ -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.9" VERSION_STRING equ "1.67.11"
VERSION_MAJOR = 1 VERSION_MAJOR = 1
VERSION_MINOR = 67 VERSION_MINOR = 67

View File

@ -114,7 +114,7 @@ basic_instruction:
jne invalid_operand jne invalid_operand
basic_mem: basic_mem:
call get_address call get_address
push edx bx cx push edx ebx ecx
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
jne invalid_operand jne invalid_operand
@ -128,7 +128,7 @@ basic_instruction:
lods byte [esi] lods byte [esi]
call convert_register call convert_register
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
mov al,ah mov al,ah
cmp al,1 cmp al,1
je basic_mem_reg_8bit je basic_mem_reg_8bit
@ -160,7 +160,7 @@ basic_instruction:
mov al,[base_code] mov al,[base_code]
shr al,3 shr al,3
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
mov [base_code],80h mov [base_code],80h
call store_instruction_with_imm8 call store_instruction_with_imm8
jmp instruction_assembled jmp instruction_assembled
@ -171,7 +171,7 @@ basic_instruction:
mov al,[base_code] mov al,[base_code]
shr al,3 shr al,3
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
cmp [value_type],0 cmp [value_type],0
jne basic_mem_imm_16bit_store jne basic_mem_imm_16bit_store
cmp [size_declared],0 cmp [size_declared],0
@ -196,7 +196,7 @@ basic_instruction:
mov al,[base_code] mov al,[base_code]
shr al,3 shr al,3
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
cmp [value_type],0 cmp [value_type],0
jne basic_mem_imm_32bit_store jne basic_mem_imm_32bit_store
cmp [size_declared],0 cmp [size_declared],0
@ -430,7 +430,7 @@ mov_instruction:
jne invalid_operand jne invalid_operand
mov_mem: mov_mem:
call get_address call get_address
push edx bx cx push edx ebx ecx
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
jne invalid_operand jne invalid_operand
@ -449,7 +449,7 @@ mov_instruction:
mov_mem_general_reg: mov_mem_general_reg:
call convert_register call convert_register
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
cmp ah,1 cmp ah,1
je mov_mem_reg_8bit je mov_mem_reg_8bit
mov al,ah mov al,ah
@ -542,7 +542,7 @@ mov_instruction:
mov_mem_sreg: mov_mem_sreg:
sub al,61h sub al,61h
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
mov ah,[operand_size] mov ah,[operand_size]
or ah,ah or ah,ah
jz mov_mem_sreg_store jz mov_mem_sreg_store
@ -575,7 +575,7 @@ mov_instruction:
mov byte [value],al mov byte [value],al
mov [postbyte_register],0 mov [postbyte_register],0
mov [base_code],0C6h mov [base_code],0C6h
pop cx bx edx pop ecx ebx edx
call store_instruction_with_imm8 call store_instruction_with_imm8
jmp instruction_assembled jmp instruction_assembled
mov_mem_imm_16bit: mov_mem_imm_16bit:
@ -584,7 +584,7 @@ mov_instruction:
mov word [value],ax mov word [value],ax
mov [postbyte_register],0 mov [postbyte_register],0
mov [base_code],0C7h mov [base_code],0C7h
pop cx bx edx pop ecx ebx edx
call store_instruction_with_imm16 call store_instruction_with_imm16
jmp instruction_assembled jmp instruction_assembled
mov_mem_imm_32bit: mov_mem_imm_32bit:
@ -594,7 +594,7 @@ mov_instruction:
mov dword [value],eax mov dword [value],eax
mov [postbyte_register],0 mov [postbyte_register],0
mov [base_code],0C7h mov [base_code],0C7h
pop cx bx edx pop ecx ebx edx
call store_instruction_with_imm32 call store_instruction_with_imm32
jmp instruction_assembled jmp instruction_assembled
mov_mem_imm_64bit: mov_mem_imm_64bit:
@ -998,7 +998,7 @@ test_instruction:
jne invalid_operand jne invalid_operand
test_mem: test_mem:
call get_address call get_address
push edx bx cx push edx ebx ecx
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
jne invalid_operand jne invalid_operand
@ -1012,7 +1012,7 @@ test_instruction:
lods byte [esi] lods byte [esi]
call convert_register call convert_register
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
mov al,ah mov al,ah
cmp al,1 cmp al,1
je test_mem_reg_8bit je test_mem_reg_8bit
@ -1044,7 +1044,7 @@ test_instruction:
mov byte [value],al mov byte [value],al
mov [postbyte_register],0 mov [postbyte_register],0
mov [base_code],0F6h mov [base_code],0F6h
pop cx bx edx pop ecx ebx edx
call store_instruction_with_imm8 call store_instruction_with_imm8
jmp instruction_assembled jmp instruction_assembled
test_mem_imm_16bit: test_mem_imm_16bit:
@ -1053,7 +1053,7 @@ test_instruction:
mov word [value],ax mov word [value],ax
mov [postbyte_register],0 mov [postbyte_register],0
mov [base_code],0F7h mov [base_code],0F7h
pop cx bx edx pop ecx ebx edx
call store_instruction_with_imm16 call store_instruction_with_imm16
jmp instruction_assembled jmp instruction_assembled
test_mem_imm_32bit: test_mem_imm_32bit:
@ -1063,7 +1063,7 @@ test_instruction:
mov dword [value],eax mov dword [value],eax
mov [postbyte_register],0 mov [postbyte_register],0
mov [base_code],0F7h mov [base_code],0F7h
pop cx bx edx pop ecx ebx edx
call store_instruction_with_imm32 call store_instruction_with_imm32
jmp instruction_assembled jmp instruction_assembled
test_mem_imm_64bit: test_mem_imm_64bit:
@ -1200,7 +1200,7 @@ xchg_instruction:
jne invalid_operand jne invalid_operand
xchg_mem: xchg_mem:
call get_address call get_address
push edx bx cx push edx ebx ecx
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
jne invalid_operand jne invalid_operand
@ -2055,7 +2055,7 @@ sh_instruction:
jne invalid_operand jne invalid_operand
sh_mem: sh_mem:
call get_address call get_address
push edx bx cx push edx ebx ecx
mov al,[operand_size] mov al,[operand_size]
push eax push eax
mov [operand_size],0 mov [operand_size],0
@ -2072,7 +2072,7 @@ sh_instruction:
lods byte [esi] lods byte [esi]
cmp al,11h cmp al,11h
jne invalid_operand jne invalid_operand
pop eax cx bx edx pop eax ecx ebx edx
cmp al,1 cmp al,1
je sh_mem_cl_8bit je sh_mem_cl_8bit
jb sh_mem_cl_nosize jb sh_mem_cl_nosize
@ -2099,7 +2099,7 @@ sh_instruction:
sh_mem_imm_size_ok: sh_mem_imm_size_ok:
call get_byte_value call get_byte_value
mov byte [value],al mov byte [value],al
pop eax cx bx edx pop eax ecx ebx edx
cmp al,1 cmp al,1
je sh_mem_imm_8bit je sh_mem_imm_8bit
jb sh_mem_imm_nosize jb sh_mem_imm_nosize
@ -2207,7 +2207,7 @@ shd_instruction:
jne invalid_operand jne invalid_operand
shd_mem: shd_mem:
call get_address call get_address
push edx bx cx push edx ebx ecx
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
jne invalid_operand jne invalid_operand
@ -2233,7 +2233,7 @@ shd_instruction:
lods byte [esi] lods byte [esi]
cmp al,11h cmp al,11h
jne invalid_operand jne invalid_operand
pop eax cx bx edx pop eax ecx ebx edx
call operand_autodetect call operand_autodetect
inc [extended_code] inc [extended_code]
call store_instruction call store_instruction
@ -2247,7 +2247,7 @@ shd_instruction:
shd_mem_reg_imm_size_ok: shd_mem_reg_imm_size_ok:
call get_byte_value call get_byte_value
mov byte [value],al mov byte [value],al
pop eax cx bx edx pop eax ecx ebx edx
call operand_autodetect call operand_autodetect
call store_instruction_with_imm8 call store_instruction_with_imm8
jmp instruction_assembled jmp instruction_assembled
@ -2422,7 +2422,7 @@ bt_instruction:
cmp al,'[' cmp al,'['
jne invalid_operand jne invalid_operand
call get_address call get_address
push eax bx cx push eax ebx ecx
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
jne invalid_operand jne invalid_operand
@ -2440,7 +2440,7 @@ bt_instruction:
lods byte [esi] lods byte [esi]
call convert_register call convert_register
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
mov al,ah mov al,ah
call operand_autodetect call operand_autodetect
call store_instruction call store_instruction
@ -2466,7 +2466,7 @@ bt_instruction:
jz bt_mem_imm_nosize jz bt_mem_imm_nosize
call operand_autodetect call operand_autodetect
bt_mem_imm_store: bt_mem_imm_store:
pop cx bx edx pop ecx ebx edx
mov [extended_code],0BAh mov [extended_code],0BAh
call store_instruction_with_imm8 call store_instruction_with_imm8
jmp instruction_assembled jmp instruction_assembled
@ -2620,12 +2620,12 @@ imul_instruction:
jne invalid_operand jne invalid_operand
imul_reg_mem: imul_reg_mem:
call get_address call get_address
push edx bx cx push edx ebx ecx
cmp byte [esi],',' cmp byte [esi],','
je imul_reg_mem_imm je imul_reg_mem_imm
mov al,[operand_size] mov al,[operand_size]
call operand_autodetect call operand_autodetect
pop cx bx edx pop ecx ebx edx
mov [base_code],0Fh mov [base_code],0Fh
mov [extended_code],0AFh mov [extended_code],0AFh
call store_instruction call store_instruction
@ -2657,7 +2657,7 @@ imul_instruction:
cmp ax,80h cmp ax,80h
jl imul_reg_mem_imm_8bit_store jl imul_reg_mem_imm_8bit_store
imul_reg_mem_imm_16bit_store: imul_reg_mem_imm_16bit_store:
pop cx bx edx pop ecx ebx edx
mov [base_code],69h mov [base_code],69h
call store_instruction_with_imm16 call store_instruction_with_imm16
jmp instruction_assembled jmp instruction_assembled
@ -2675,7 +2675,7 @@ imul_instruction:
cmp eax,80h cmp eax,80h
jl imul_reg_mem_imm_8bit_store jl imul_reg_mem_imm_8bit_store
imul_reg_mem_imm_32bit_store: imul_reg_mem_imm_32bit_store:
pop cx bx edx pop ecx ebx edx
mov [base_code],69h mov [base_code],69h
call store_instruction_with_imm32 call store_instruction_with_imm32
jmp instruction_assembled jmp instruction_assembled
@ -2688,7 +2688,7 @@ imul_instruction:
jae long_immediate_not_encodable jae long_immediate_not_encodable
jmp imul_reg_mem_imm_32bit_ok jmp imul_reg_mem_imm_32bit_ok
imul_reg_mem_imm_8bit_store: imul_reg_mem_imm_8bit_store:
pop cx bx edx pop ecx ebx edx
mov [base_code],6Bh mov [base_code],6Bh
call store_instruction_with_imm8 call store_instruction_with_imm8
jmp instruction_assembled jmp instruction_assembled
@ -3168,26 +3168,9 @@ jmp_instruction:
stos word [edi] stos word [edi]
jmp instruction_assembled jmp instruction_assembled
calculate_jump_offset: calculate_jump_offset:
cmp [value_undefined],0 add edi,2
jne jump_offset_ok call calculate_relative_offset
add eax,dword [org_origin] sub edi,2
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:
ret ret
check_for_short_jump: check_for_short_jump:
cmp [jump_type],1 cmp [jump_type],1
@ -3610,7 +3593,7 @@ cmps_instruction:
or bl,ch or bl,ch
jnz invalid_address jnz invalid_address
mov al,[segment_register] mov al,[segment_register]
push ax bx push eax ebx
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
jne invalid_operand jne invalid_operand
@ -3623,7 +3606,7 @@ cmps_instruction:
jnz invalid_address jnz invalid_address
or bl,ch or bl,ch
jnz invalid_address jnz invalid_address
pop dx ax pop edx eax
cmp [segment_register],1 cmp [segment_register],1
ja invalid_address ja invalid_address
mov [segment_register],al mov [segment_register],al
@ -3954,7 +3937,7 @@ basic_486_instruction:
cmp al,'[' cmp al,'['
jne invalid_operand jne invalid_operand
call get_address call get_address
push edx bx cx push edx ebx ecx
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
jne invalid_operand jne invalid_operand
@ -3965,7 +3948,7 @@ basic_486_instruction:
lods byte [esi] lods byte [esi]
call convert_register call convert_register
mov [postbyte_register],al mov [postbyte_register],al
pop cx bx edx pop ecx ebx edx
mov al,ah mov al,ah
cmp al,1 cmp al,1
je basic_486_mem_reg_8bit je basic_486_mem_reg_8bit
@ -4046,6 +4029,49 @@ cmpxchgx_instruction:
cmpxchgx_store: cmpxchgx_store:
call store_instruction call store_instruction
jmp instruction_assembled 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: basic_fpu_instruction:
mov [postbyte_register],al mov [postbyte_register],al
@ -4472,9 +4498,10 @@ fcomip_instruction:
stos word [edi] stos word [edi]
jmp instruction_assembled jmp instruction_assembled
mmx_instruction: basic_mmx_instruction:
mov [base_code],0Fh mov [base_code],0Fh
mov [extended_code],al mov [extended_code],al
mmx_instruction:
lods byte [esi] lods byte [esi]
call get_size_operator call get_size_operator
cmp al,10h cmp al,10h
@ -4573,7 +4600,7 @@ pextrw_instruction:
call store_nomem_instruction call store_nomem_instruction
jmp instruction_assembled jmp instruction_assembled
mmx_imm8: mmx_imm8:
push bx cx edx push ebx ecx edx
mov [operand_size],0 mov [operand_size],0
lods byte [esi] lods byte [esi]
cmp al,',' cmp al,','
@ -4586,7 +4613,7 @@ pextrw_instruction:
jne invalid_operand jne invalid_operand
call get_byte_value call get_byte_value
mov byte [value],al mov byte [value],al
pop edx cx bx pop edx ecx ebx
call store_instruction_with_imm8 call store_instruction_with_imm8
jmp instruction_assembled jmp instruction_assembled
mmx_nomem_imm8: mmx_nomem_imm8:
@ -5318,9 +5345,9 @@ sse_cmp_instruction:
cmp al,[mmx_size] cmp al,[mmx_size]
jne invalid_operand_size jne invalid_operand_size
sse_cmp_size_ok: sse_cmp_size_ok:
push bx cx edx push ebx ecx edx
call get_nextbyte call get_nextbyte
pop edx cx bx pop edx ecx ebx
call store_instruction_with_imm8 call store_instruction_with_imm8
jmp instruction_assembled jmp instruction_assembled
sse_cmp_xmmreg_xmmreg: sse_cmp_xmmreg_xmmreg:
@ -5482,6 +5509,40 @@ cvtsd2si_instruction:
jne invalid_operand_size jne invalid_operand_size
call operand_64bit call operand_64bit
jmp sse_reg 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: amd3dnow_instruction:
mov [base_code],0Fh mov [base_code],0Fh
mov [extended_code],0Fh mov [extended_code],0Fh
@ -5948,15 +6009,11 @@ get_address:
jnz address_ok jnz address_ok
calculate_relative_address: calculate_relative_address:
call calculate_relative_offset call calculate_relative_offset
cmp byte [esi-1],']'
jne invalid_address
mov [address_high],edx mov [address_high],edx
mov edx,[symbol_identifier] mov edx,[symbol_identifier]
mov [address_symbol],edx mov [address_symbol],edx
mov edx,eax mov edx,eax
mov ch,[value_type]
mov bx,0FF00h mov bx,0FF00h
xor cl,cl
address_ok: address_ok:
ret ret
@ -6051,8 +6108,16 @@ store_instruction_code:
store_extended_code: store_extended_code:
mov al,[extended_code] mov al,[extended_code]
stos byte [edi] stos byte [edi]
cmp al,38h
je store_supplemental_code
cmp al,3Ah
je store_supplemental_code
instruction_code_ok: instruction_code_ok:
ret ret
store_supplemental_code:
mov al,[supplemental_code]
stos byte [edi]
ret
store_nomem_instruction: store_nomem_instruction:
test [postbyte_register],1000b test [postbyte_register],1000b
jz nomem_reg_code_ok jz nomem_reg_code_ok
@ -6373,7 +6438,8 @@ store_instruction:
store_address_32bit_value: store_address_32bit_value:
test ch,0F0h test ch,0F0h
jz address_32bit_relocation_ok jz address_32bit_relocation_ok
mov al,2 mov eax,ecx
shr eax,16
xchg [value_type],al xchg [value_type],al
mov ebx,[address_symbol] mov ebx,[address_symbol]
xchg ebx,[symbol_identifier] xchg ebx,[symbol_identifier]
@ -6387,7 +6453,8 @@ store_instruction:
store_address_64bit_value: store_address_64bit_value:
test ch,0F0h test ch,0F0h
jz address_64bit_relocation_ok jz address_64bit_relocation_ok
mov al,4 mov eax,ecx
shr eax,16
xchg [value_type],al xchg [value_type],al
mov ebx,[address_symbol] mov ebx,[address_symbol]
xchg ebx,[symbol_identifier] xchg ebx,[symbol_identifier]
@ -6403,8 +6470,8 @@ store_instruction:
address_immediate_sib: address_immediate_sib:
test ch,not 44h test ch,not 44h
jnz invalid_address_size jnz invalid_address_size
cmp [value_type],0 test ecx,0FF0000h
jne address_immediate_sib_nosignextend jnz address_immediate_sib_nosignextend
test edx,80000000h test edx,80000000h
jz address_immediate_sib_prefix_ok jz address_immediate_sib_prefix_ok
address_immediate_sib_nosignextend: address_immediate_sib_nosignextend:
@ -6436,12 +6503,13 @@ store_instruction:
shl cl,3 shl cl,3
or al,cl or al,cl
stos byte [edi] stos byte [edi]
xchg [value_type],ch shr ecx,16
xchg [value_type],cl
mov ebx,[address_symbol] mov ebx,[address_symbol]
xchg ebx,[symbol_identifier] xchg ebx,[symbol_identifier]
mov eax,edx mov eax,edx
call mark_relocation call mark_relocation
mov [value_type],ch mov [value_type],cl
mov [symbol_identifier],ebx mov [symbol_identifier],ebx
stos dword [edi] stos dword [edi]
ret ret