FASM 1.73.24 by Prohor Nikiforov

git-svn-id: svn://kolibrios.org@7859 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-05-03 13:24:00 +00:00
parent b9a45ff5fe
commit 78851ff66b
10 changed files with 234 additions and 213 deletions

View File

@ -3805,7 +3805,7 @@ format_elf_exe:
add eax,ebp add eax,ebp
adc ecx,0 adc ecx,0
mov [edx+18h],eax mov [edx+18h],eax
mov [edx+18h+8],ecx mov [edx+18h+4],ecx
jmp elf_exe_addressing_setup jmp elf_exe_addressing_setup
setup_elf_exe_labels_type: setup_elf_exe_labels_type:
mov eax,[code_start] mov eax,[code_start]

View File

@ -2153,6 +2153,8 @@ instructions_7:
dw insertq_instruction-instruction_handler dw insertq_instruction-instruction_handler
db 'invlpga',0DFh db 'invlpga',0DFh
dw invlpga_instruction-instruction_handler dw invlpga_instruction-instruction_handler
db 'invlpgb',0FEh
dw simple_instruction_0f_01-instruction_handler
db 'invpcid',82h db 'invpcid',82h
dw vmx_inv_instruction-instruction_handler dw vmx_inv_instruction-instruction_handler
db 'invvpid',81h db 'invvpid',81h
@ -2285,6 +2287,8 @@ instructions_7:
dw simple_extended_instruction-instruction_handler dw simple_extended_instruction-instruction_handler
db 'sysretq',07h db 'sysretq',07h
dw simple_extended_instruction_64bit-instruction_handler dw simple_extended_instruction_64bit-instruction_handler
db 'tlbsync',0FFh
dw simple_instruction_0f_01-instruction_handler
db 'ucomisd',2Eh db 'ucomisd',2Eh
dw comisd_instruction-instruction_handler dw comisd_instruction-instruction_handler
db 'ucomiss',2Eh db 'ucomiss',2Eh

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.73.23" VERSION_STRING equ "1.73.24"
VERSION_MAJOR = 1 VERSION_MAJOR = 1
VERSION_MINOR = 73 VERSION_MINOR = 73

View File

@ -26,15 +26,8 @@ appname equ 'flat assembler '
;------------------------------------------------- ;-------------------------------------------------
; INCLUDES ; INCLUDES
;------------------------------------------------- ;-------------------------------------------------
lang equ ru
include 'kolibria.inc' include 'kolibria.inc'
include 'fasm.inc' include 'fasm.inc'
MAX_PATH = 100
struc path name:?& {
.:
db name
rb MAX_PATH-$+. }
;------------------------------------------------- ;-------------------------------------------------
; CODE ; CODE
;------------------------------------------------- ;-------------------------------------------------
@ -119,8 +112,8 @@ parse_params:
ret ret
;------------------------------------------------- ;-------------------------------------------------
START: ; Start of execution START: ; Start of execution
mov edi, fileinfos mov edi, file_IO_slots
mov ecx, (fileinfos_end-fileinfos)/4 mov ecx, (file_IO_end-file_IO_slots)/4
or eax, -1 or eax, -1
rep stosd rep stosd
mcall SF_SYS_MISC,SSF_HEAP_INIT mcall SF_SYS_MISC,SSF_HEAP_INIT
@ -222,12 +215,12 @@ accept_systemcolors:
draw_window: draw_window:
cmp dword[PROCESS_INFO.client_box.width],WIN_MIN_W cmp dword[PROCESS_INFO.client_box.width],WIN_MIN_W
jge @f jge @f
mcall 67,-1,-1,WIN_MIN_W+20,-1 mcall SF_CHANGE_WINDOW,-1,-1,WIN_MIN_W+20,-1
ret ret
@@: @@:
cmp dword[PROCESS_INFO.client_box.height],WIN_MIN_H cmp dword[PROCESS_INFO.client_box.height],WIN_MIN_H
jge @f jge @f
mcall 67,-1,-1,-1,WIN_MIN_H+50 mcall SF_CHANGE_WINDOW,-1,-1,-1,WIN_MIN_H+50
ret ret
@@: @@:
mpack ebx,[PROCESS_INFO.client_box.width],RIGHT_BTN_W mpack ebx,[PROCESS_INFO.client_box.width],RIGHT_BTN_W
@ -553,9 +546,6 @@ include 'core/messages.inc'
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; INITIALIZED DATA ; INITIALIZED DATA
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;match =en,lang {include 'lang/en.inc'}
;match =ru,lang {include 'lang/ru.inc'}
include 'traslations.inc' include 'traslations.inc'
edit1 EDIT_BOX 153, 72, 3, 0xffffff, 0xA4C4E4, 0x80ff, 0, 0x10000000,(outfile-infile-1), infile, mouse_dd, 0, 11,11 edit1 EDIT_BOX 153, 72, 3, 0xffffff, 0xA4C4E4, 0x80ff, 0, 0x10000000,(outfile-infile-1), infile, mouse_dd, 0, 11,11
@ -673,8 +663,8 @@ dbgfilename rb MAX_PATH+4
sc system_colors sc system_colors
sc_prev system_colors sc_prev system_colors
max_handles = 8 max_handles = 8
fileinfos rb (4+20+MAX_PATH)*max_handles file_IO_slots rb (4+sizeof.FILEIO+MAX_PATH)*max_handles;(4+20+MAX_PATH)*max_handles
fileinfos_end: file_IO_end:
PROCESS_INFO process_information PROCESS_INFO process_information
bytes_count dd ? bytes_count dd ?

View File

@ -7,16 +7,16 @@ ID_OPENDLG_BTN = 5
NORMAL_MODE = 8 NORMAL_MODE = 8
CONSOLE_MODE = 32 CONSOLE_MODE = 32
APP_MEMORY = 0x00800000
DEFAULT_WIN_W = 450 DEFAULT_WIN_W = 450
DEFAULT_WIN_H = 350 DEFAULT_WIN_H = 350
WIN_MIN_W = 400
WIN_MIN_W = 350 WIN_MIN_H = 350
WIN_MIN_H = 300
LINE_H = 25 LINE_H = 25
RIGHT_BTN_W = 80 RIGHT_BTN_W = 80
APP_MEMORY = 0x00800000 MAX_PATH = 100
macro mmov reg,a1,a2 { macro mmov reg,a1,a2 {
mov reg,(a1) shl 16 + (a2) mov reg,(a1) shl 16 + (a2)
@ -30,4 +30,7 @@ macro msub reg,a1,a2 {
sub reg,(a1) shl 16 + (a2) sub reg,(a1) shl 16 + (a2)
} }
struc path name:?& {
.:
db name
rb MAX_PATH-$+. }

View File

@ -0,0 +1,12 @@
; General constants
NULL = 0
TRUE = 1
FALSE = 0
sizeof.GUID = $10
FILE_BEGIN = 0
FILE_CURRENT = 1
FILE_END = 2

View File

@ -0,0 +1,23 @@
struct POINT
x dd ?
y dd ?
ends
struct POINTS
x dw ?
y dw ?
ends
struct RECT
left dd ?
top dd ?
right dd ?
bottom dd ?
ends
struct RECTS
left dw ?
top dw ?
right dw ?
bottom dw ?
ends

View File

@ -40,11 +40,22 @@ ends
struct FILEIO struct FILEIO
cmd dd ? cmd dd ?
offset dd ? offset dd ?
union
flags dd ? flags dd ?
offshigh dd ?
ends
count dd ? count dd ?
buffer dd ? buffer dd ?
; db ? ends
;name dd ? label FILEIO.filesize dword at -4
struct namedFILEIO FILEIO
name db MAX_PATH dup (?)
ends
struct fullFILEIO FILEIO
name db ?
lpname dd ?
ends ends
struct FILEDATE struct FILEDATE

View File

@ -52,3 +52,5 @@ force@alignment equ
include 'kolibri/structs/kernel.inc' include 'kolibri/structs/kernel.inc'
include 'kolibri/structs/box_lib.inc' include 'kolibri/structs/box_lib.inc'
include 'kolibri/structs/proc_lib.inc' include 'kolibri/structs/proc_lib.inc'
include 'kolibri/structs/coords.inc'
include 'kolibri/structs/aces.inc'

View File

@ -2,10 +2,6 @@
; Copyright (c) 1999-2020, Tomasz Grysztar ; Copyright (c) 1999-2020, Tomasz Grysztar
; All rights reserved. ; All rights reserved.
init_memory: init_memory:
; mov ecx, 16*1024*1024 ; mov ecx, 16*1024*1024
@ -31,7 +27,7 @@ init_memory:
add eax,[additional_memory] add eax,[additional_memory]
mov [additional_memory_end],eax mov [additional_memory_end],eax
mov [memory_start],eax mov [memory_start],eax
ret retn
exit_program: exit_program:
cmp [_mode],NORMAL_MODE cmp [_mode],NORMAL_MODE
@ -48,7 +44,7 @@ make_timestamp:
mcall SF_SYSTEM_GET,SSF_TIME_COUNT mcall SF_SYSTEM_GET,SSF_TIME_COUNT
imul eax,10 imul eax,10
pop ebx pop ebx
ret retn
symbol_dump: symbol_dump:
@ -159,7 +155,7 @@ symbol_dump:
call close call close
pop edi pop edi
ret retn
get_environment_variable: get_environment_variable:
mov ecx,[memory_end] mov ecx,[memory_end]
@ -174,144 +170,128 @@ get_environment_variable:
rep movsb rep movsb
.finish: .finish:
; stc ; stc
ret retn
alloc_handle: alloc_handle:
; in:
; out: ebx = file handle
; on error: return to caller of caller with cf set
; preserves: esi, edi
call make_fullpaths call make_fullpaths
mov ebx, fileinfos+4 mov ebx, file_IO_slots+4
@@: jmp check_file_IO_slot
cmp dword [ebx], -1 next_file_IO_slot:
jz .found
add ebx, 4+20+MAX_PATH add ebx, 4+20+MAX_PATH
cmp ebx, fileinfos_end cmp ebx, file_IO_end
jb @b jae send_error_to_caller_of_caller
stc check_file_IO_slot:
ret cmp [ebx+FILEIO.cmd], -1
.found: jnz next_file_IO_slot
and dword [ebx+4], 0 and [ebx+FILEIO.offset], 0
and dword [ebx+8], 0 and [ebx+FILEIO.flags], 0
adapt_path:
push esi edi ecx push esi edi ecx
mov esi, fullpath_open mov esi, fullpath_open
lea edi, [ebx+20] lea edi, [ebx+namedFILEIO.name]
mov ecx, MAX_PATH mov ecx, MAX_PATH
rep movsb copy_path:
lodsb
cmp al,'\'
jne path_char_ok
mov al,'/'
path_char_ok:
stosb
or al,al
loopnz copy_path
pop ecx edi esi pop ecx edi esi
ret ; CF=0 jz adapt_path.done
send_error_to_caller_of_caller:
stc
pop eax
adapt_path.done:
ret
create: create:
; in:
; out: ebx = file handle, cf set on error
; preserves: esi, edi
call alloc_handle call alloc_handle
jc .ret and [ebx+FILEIO.filesize], 0
and dword [ebx-4], 0 mov [ebx+FILEIO.cmd], SSF_CREATE_FILE
mov dword [ebx], 2 retn
.ret:
ret
open: open:
; call make_fullpaths ; in:
; out: ebx = file handle, cf set on error
;; mov eax,fullpath_open ; preserves: esi, edi
;; DEBUGF '"%s"\n',eax
; mov dword[file_info_open+8],-1
; mcall 58,file_info_open
; or eax,eax ; found
; jz @f
; cmp eax,6
; jne file_error
;@@: mov [filesize],ebx
; clc
; ret
;file_error:
; stc
; ret
call alloc_handle call alloc_handle
jc .ret mov [ebx+FILEIO.cmd], SSF_GET_INFO
mov dword [ebx], SSF_GET_INFO and [ebx+FILEIO.count], 0
and dword [ebx+12], 0 mov [ebx+FILEIO.buffer], fileinfo
mov dword [ebx+16], fileinfo
mov eax, SF_FILE
push ebx push ebx
mcall mcall SF_FILE
pop ebx pop ebx
test eax, eax test eax, eax
jnz .fail jnz fail_close
mov eax, dword[fileinfo.size] mov eax, dword[fileinfo.size]
mov [ebx-4], eax mov [ebx+FILEIO.filesize], eax
and dword [ebx], 0 and [ebx+FILEIO.cmd], SSF_READ_FILE
.ret: retn
ret
.fail: fail_close:
or dword [ebx], -1 ; close handle
stc stc
ret
read:
; pusha
; mov edi,edx
; mov esi,[filepos]
; add esi,0x20000
; cld
; rep movsb
; popa
;; ret
mov [ebx+12], ecx
mov [ebx+16], edx
push ebx
mov eax, SF_FILE
mcall
xchg eax, [esp]
add [eax+4], ebx
adc [eax+8], dword 0
mov ebx, eax
pop eax
test eax, eax
jz .ok
cmp eax, 6
jz .ok
stc
.ok:
ret
close: close:
or dword [ebx], -1 ; in: ebx = file handle
ret ; preserves: ebx, esi, edi, cf
mov [ebx+FILEIO.cmd], -1 ; close handle
retn
; ebx file handle
; ecx count of bytes to write
; edx pointer to buffer
write: write:
; pusha ; in: ebx = file handle, edx - data, ecx = number of bytes
; mov [file_info_write+8],ecx ; out: cf set on error
; mov [file_info_write+12],edx ; preserves: ebx, esi, edi
; mov [filesize],edx call read_write
; mov eax,58 mov [ebx+FILEIO.cmd], SSF_WRITE_FILE
; mov ebx,file_info_write jmp read_write_check_S_OK
; mcall read:
; popa ; in: ebx = file handle, edx - buffer, ecx = number of bytes
; ret ; out: cf set on error
; preserves: ebx, esi, edi
mov [ebx+12], ecx call read_write
mov [ebx+16], edx cmp eax, 6
jz read_write_OK
read_write_check_S_OK:
test eax, eax
jz read_write_OK
stc
retn
read_write:
mov [ebx+FILEIO.count], ecx
mov [ebx+FILEIO.buffer], edx
push ebx push ebx
mov eax, SF_FILE mcall SF_FILE
mcall
xchg eax, [esp] xchg eax, [esp]
add [eax+4], ebx add [eax+FILEIO.offset], ebx
adc [eax+8], dword 0 adc [eax+FILEIO.offshigh], 0
mov ebx, eax mov ebx, eax
pop eax pop eax
mov byte [ebx], 3 read_write_OK:
cmp eax, 1 retn
cmc
ret
make_fullpaths: make_fullpaths:
pusha pusha
push edx push edx
mov esi,edx
mov ecx, MAX_PATH
copy_edxpath:
lodsb
cmp al,'\'
jne edxpath_char_ok
mov byte[esi-1],'/'
edxpath_char_ok:
or al,al
loopnz copy_edxpath
mov esi,path ; open mov esi,path ; open
; DEBUGF " '%s'",esi ; DEBUGF " '%s'",esi
@ -325,6 +305,8 @@ make_fullpaths:
cmp byte[esi],'/' cmp byte[esi],'/'
jne @f jne @f
cmp byte[esi],'\'
jne @f
mov edi,fullpath_open mov edi,fullpath_open
@@: @@:
@ -332,10 +314,6 @@ make_fullpaths:
stosb stosb
cmp al,0 cmp al,0
jne @b jne @b
; mov ecx,12
; cld
; rep movsb
; mov byte[edi],0
mov esi,path ; write mov esi,path ; write
mov edi,fullpath_write mov edi,fullpath_write
@ -348,6 +326,8 @@ make_fullpaths:
cmp byte[esi],'/' cmp byte[esi],'/'
jne @f jne @f
cmp byte[esi],'\'
jne @f
mov edi,fullpath_write mov edi,fullpath_write
@@: @@:
@ -355,10 +335,6 @@ make_fullpaths:
stosb stosb
cmp al,0 cmp al,0
jne @b jne @b
; mov ecx,12
; cld
; rep movsb
; mov byte[edi],0
mov esi,path ; start mov esi,path ; start
mov edi,file_io_start.path mov edi,file_io_start.path
@ -367,11 +343,12 @@ make_fullpaths:
movsb movsb
cmp byte[esi],0;' ' cmp byte[esi],0;' '
jne newc3 jne newc3
; mov esi,[esp]
pop esi pop esi
cmp byte[esi],'/' cmp byte[esi],'/'
jne @f jne @f
cmp byte[esi],'\'
jne @f
mov edi,file_io_start.path mov edi,file_io_start.path
@@: @@:
@ -379,77 +356,73 @@ make_fullpaths:
stosb stosb
cmp al,0 cmp al,0
jne @b jne @b
; mov ecx,12
; cld
; rep movsb
; mov byte[edi],0
; add esp,4
popa popa
ret retn
lseek: lseek:
cmp al,0 ; in: ebx = file handle, al = method, edx = delta offset
; out: cf set on error
; preserves: ebx, esi, edi
cmp al,FILE_BEGIN
jnz @f jnz @f
and dword [ebx+4], 0 and [ebx+FILEIO.offset], 0
and dword [ebx+8], 0 jmp .common
@@: cmp al,2 @@: cmp al,FILE_END
jnz @f jnz @f
mov eax, [ebx-4] mov eax, [ebx+FILEIO.filesize]
mov [ebx+4], eax mov [ebx+FILEIO.offset], eax
and dword [ebx+8], 0 jmp .common
@@: add dword [ebx+4], edx @@:
adc dword [ebx+8], 0 .common:
ret add [ebx+FILEIO.offset], edx
retn
display_character: display_character:
pusha pusha
cmp [_mode],NORMAL_MODE cmp [_mode],NORMAL_MODE
jne @f jne @f
cmp dl,13 cmp al,$D
jz dc2 jz dc2
cmp dl,0xa cmp al,$A
jnz dc1 jnz dc1
and [textxy],0x0000FFFF and [textxy],0x0000FFFF
add [textxy], 8 shl 16 and 0xFFFF0000 + 18 add [textxy], 8 shl 16 and 0xFFFF0000 + 18
dc2:
popa popa
ret retn
dc1: dc1:
mov [dc],al
mov eax,[textxy] mov eax,[textxy]
cmp ax,word[bottom_right] cmp ax,word[bottom_right]
ja dc2 ja dc2
shr eax,16 shr eax,16
cmp ax,word[bottom_right+2] cmp ax,word[bottom_right+2]
ja dc2 ja dc2
mov [dc],dl mov ecx,[sc.work_text]
mcall SF_DRAW_TEXT,[textxy],0x10000000,dc,1 or ecx,$10000000
mcall SF_DRAW_TEXT,[textxy],,dc,1
add [textxy],0x00080000 add [textxy],0x00080000
dc2:
popa popa
ret retn
@@: @@:
mov eax,SF_BOARD mov cl,al
mov ebx,1 mcall SF_BOARD,SSF_DEBUG_WRITE
mov cl,dl
mcall
popa popa
ret retn
display_string: display_string:
pusha ; in:
@@: ; esi - ASCIIZ string
cmp byte[esi],0 ; preserves: ebx, esi
push esi
@@: lodsb
test al,al
je @f je @f
mov dl,[esi]
call display_character call display_character
add esi,1
jmp @b jmp @b
@@: @@:
popa pop esi
ret retn
display_number: display_number:
push ebx push ebx
@ -467,8 +440,7 @@ display_loop:
jz digit_ok jz digit_ok
not bl not bl
display_digit: display_digit:
mov dl,al add al,'0'
add dl,30h
push ebx ecx push ebx ecx
call display_character call display_character
pop ecx ebx pop ecx ebx
@ -482,7 +454,7 @@ digit_ok:
or ecx,ecx or ecx,ecx
jnz display_loop jnz display_loop
pop ebx pop ebx
ret retn
display_user_messages: display_user_messages:
; push [skinh] ; push [skinh]
@ -502,18 +474,22 @@ make_line_break:
mov esi,crlf mov esi,crlf
call display_string call display_string
line_break_ok: line_break_ok:
ret retn
display_block: display_block:
pusha ; in:
@@: mov dl,[esi] ; esi - string
; ecx = string length
push esi
@@: lodsb
call display_character call display_character
inc esi
loop @b loop @b
popa pop esi
ret retn
fatal_error: fatal_error:
; no return, trashes stack
mov esi,error_prefix mov esi,error_prefix
call display_string call display_string
pop esi pop esi
@ -527,7 +503,7 @@ fatal_error:
assembler_error: assembler_error:
call display_user_messages call display_user_messages
push dword 0 push 0
mov ebx,[current_line] mov ebx,[current_line]
get_error_lines: get_error_lines:
push ebx push ebx
@ -549,12 +525,12 @@ display_error_line:
mov eax,[ebx+4] mov eax,[ebx+4]
and eax,7FFFFFFFh and eax,7FFFFFFFh
call display_number call display_number
mov dl,']' mov al,']'
call display_character call display_character
pop esi pop esi
cmp ebx,esi cmp ebx,esi
je line_number_ok je line_number_ok
mov dl,20h mov al,' '
call display_character call display_character
push esi push esi
mov esi,[esi] mov esi,[esi]
@ -567,7 +543,7 @@ display_error_line:
mov eax,[esi+4] mov eax,[esi+4]
and eax,7FFFFFFFh and eax,7FFFFFFFh
call display_number call display_number
mov dl,']' mov al,']'
call display_character call display_character
line_number_ok: line_number_ok:
mov esi,line_data_start mov esi,line_data_start
@ -594,11 +570,11 @@ line_number_ok:
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,$A
je display_line_data je display_line_data
cmp al,0Dh cmp al,$D
je display_line_data je display_line_data
cmp al,1Ah cmp al,$1A
je display_line_data je display_line_data
or al,al or al,al
jz display_line_data jz display_line_data