File system: new function 70.3 for write to the existing file

@panel: to match K0581 distro: SYSMETER -> GMON
@numcalc: moved to the appropriate place in repository
HeEd: added english variant
NetSendC, NetSendS: added english variant + optimization
pic4: changes in set background + optimization
tetris, @rcher, board, sysxtree, vrr: new versions from K0581 distro
bgitest: fixed small error + ability to set language via lang.inc
c4: small correction in label height to match K0581 distro

git-svn-id: svn://kolibrios.org@131 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2006-08-18 13:32:18 +00:00
parent b573c43d09
commit 16091ddd9e
54 changed files with 5621 additions and 3031 deletions

View File

@ -1788,6 +1788,7 @@ fs_RamdiskRewrite:
sub ebx, edx
mov [edi+28], ebx
add esp, 20
mov [esp+16], ebx
popad
xor eax, eax
ret
@ -1797,6 +1798,7 @@ fs_RamdiskRewrite:
sub ebx, edx
mov [edi+28], ebx
add esp, 20
mov [esp+16], ebx
popad
push ERROR_DISK_FULL
pop eax
@ -1820,6 +1822,230 @@ fs_RamdiskRewrite:
loop .read_symbols
ret
;----------------------------------------------------------------
;
; fs_RamdiskWrite - LFN variant for writing to sys floppy
;
; esi points to filename
; ebx pointer to 64-bit number = first wanted byte, 0+
; may be ebx=0 - start from first byte
; ecx number of bytes to write, 0+
; edx mem location to data
;
; ret ebx = bytes written (maybe 0)
; eax = 0 ok write or other = errormsg
;
;--------------------------------------------------------------
@@:
push ERROR_ACCESS_DENIED
fs_RamdiskWrite.ret0:
pop eax
xor ebx, ebx
ret
fs_RamdiskWrite:
cmp byte [esi], 0
jz @b
pushad
call rd_find_lfn
jnc .found
popad
push ERROR_FILE_NOT_FOUND
jmp .ret0
.found:
; must not be directory
test byte [edi+11], 10h
jz @f
popad
push ERROR_ACCESS_DENIED
jmp .ret0
@@:
; FAT does not support files larger than 4GB
test ebx, ebx
jz .l1
cmp dword [ebx+4], 0
jz @f
.eof:
popad
push ERROR_END_OF_FILE
jmp .ret0
@@:
mov ebx, [ebx]
.l1:
; now edi points to direntry, ebx=start byte to write,
; ecx=number of bytes to write, edx=data pointer
call get_time_for_file
mov [edi+22], ax ; last write time
call get_date_for_file
mov [edi+24], ax ; last write date
mov [edi+18], ax ; last access date
; extend file if needed
add ecx, ebx
jc .eof ; FAT does not support files larger than 4GB
push 0 ; return value=0
cmp ecx, [edi+28]
jbe .length_ok
cmp ecx, ebx
jz .length_ok
call ramdisk_extend_file
jnc .length_ok
; ramdisk_extend_file can return two error codes: FAT table error or disk full.
; First case is fatal error, in second case we may write some data
mov [esp], eax
cmp al, ERROR_DISK_FULL
jz .disk_full
pop eax
mov [esp+28], eax
popad
xor ebx, ebx
ret
.disk_full:
; correct number of bytes to write
mov ecx, [edi+28]
cmp ecx, ebx
ja .length_ok
.ret:
pop eax
mov [esp+28], eax ; eax=return value
sub edx, [esp+20]
mov [esp+16], edx ; ebx=number of written bytes
popad
ret
.length_ok:
; now ebx=start pos, ecx=end pos, both lie inside file
sub ecx, ebx
jz .ret
movzx edi, word [edi+26] ; starting cluster
.write_loop:
sub ebx, 0x200
jae .next_cluster
push ecx
neg ebx
cmp ecx, ebx
jbe @f
mov ecx, ebx
@@:
mov eax, edi
shl eax, 9
add eax, 0x100000+31*512+0x200
sub eax, ebx
mov ebx, eax
mov eax, edx
call memmove
xor ebx, ebx
add edx, ecx
sub [esp], ecx
pop ecx
jz .ret
.next_cluster:
movzx edi, word [edi*2+0x280000]
jmp .write_loop
ramdisk_extend_file.zero_size:
xor eax, eax
jmp ramdisk_extend_file.start_extend
; extends file on ramdisk to given size, new data area is filled by 0
; in: edi->direntry, ecx=new size
; out: CF=0 => OK, eax destroyed
; CF=1 => error, eax=code (ERROR_FAT_TABLE or ERROR_DISK_FULL)
ramdisk_extend_file:
push ecx
; find the last cluster of file
movzx eax, word [edi+26] ; first cluster
mov ecx, [edi+28]
jecxz .zero_size
@@:
sub ecx, 0x200
jbe @f
mov eax, [eax*2+0x280000]
and eax, 0xFFF
jz .fat_err
cmp eax, 0xFF8
jb @b
.fat_err:
pop ecx
push ERROR_FAT_TABLE
pop eax
stc
ret
@@:
push eax
mov eax, [eax*2+0x280000]
and eax, 0xFFF
cmp eax, 0xFF8
pop eax
jb .fat_err
; set length to full number of sectors and make sure that last sector is zero-padded
sub [edi+28], ecx
push eax edi
mov edi, eax
shl edi, 9
lea edi, [edi+0x100000+31*512+0x200+ecx]
neg ecx
xor eax, eax
rep stosb
pop edi eax
.start_extend:
pop ecx
; now do extend
push edx esi
mov esi, 0x280000+2*2 ; start scan from cluster 2
mov edx, 2847 ; number of clusters to scan
.extend_loop:
cmp [edi+28], ecx
jae .extend_done
; add new sector
push ecx
mov ecx, edx
push edi
mov edi, esi
jecxz .disk_full
push eax
xor eax, eax
repnz scasw
pop eax
jnz .disk_full
mov word [edi-2], 0xFFF
mov esi, edi
mov edx, ecx
sub edi, 0x280000
shr edi, 1
dec edi ; now edi=new cluster
test eax, eax
jz .first_cluster
mov [0x280000+eax*2], di
jmp @f
.first_cluster:
pop eax ; eax->direntry
push eax
mov [eax+26], di
@@:
push edi
shl edi, 9
add edi, 0x100000+31*512
xor eax, eax
mov ecx, 512/4
rep stosd
pop eax ; eax=new cluster
pop edi ; edi->direntry
pop ecx ; ecx=required size
add dword [edi+28], 0x200
jmp .extend_loop
.extend_done:
mov [edi+28], ecx
pop esi edx
clc
ret
.disk_full:
pop edi ecx
pop esi edx
stc
push ERROR_DISK_FULL
pop eax
ret
fs_RamdiskGetFileInfo:
cmp byte [esi], 0
jnz @f

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ All registers except explicitly declared in the returned value,
============== Function 0 - define and draw the window. ==============
======================================================================
Defines an application window. Draws a frame of the window, header and
working area. For windows with skin defines standard buttons for close
working area. For skinned windows defines standard buttons for close
and minimize.
Parameters:
* eax = 0 - function number
@ -18,10 +18,10 @@ Parameters:
* ecx = [coordinate on axis y]*65536 + [size on axis y]
* edx = 0xXYRRGGBB, where:
* Y = style of the window:
* Y=0 - type I - window of the fixed size
* Y=0 - type I - fixed-size window
* Y=1 - only define window area, draw nothing
* Y=2 - type II - window of the variable size
* Y=3 - window with skin
* Y=2 - type II - variable-size window
* Y=3 - skinned window
* other possible values (from 4 up to 15) are reserved,
function call with such Y is ignored
* RR, GG, BB = accordingly red, green, blue components of a color
@ -61,11 +61,11 @@ Remarks:
* The window must fit on the screen. If the transferred
coordinates and sizes do not satisfy to this condition,
appropriate coordinate (or, probably, both) is considered as zero,
and if also it does not help, the appropriate size
and if it does not help too, the appropriate size
(or, probably, both) is installed in a size of the screen.
Further we shall designate xpos,ypos,xsize,ysize - values
transmitted in ebx,ecx. The coordinates are resulted concerning
Further let us designate xpos,ypos,xsize,ysize - values passed
in ebx,ecx. The coordinates are resulted concerning
the left upper corner of the window, which, thus, is set as (0,0),
coordinates of the right lower corner essence (xsize,ysize).
* The sizes of the window are understood in sence of coordinates
@ -289,7 +289,7 @@ Returned value:
* function does not return value
Remarks:
* Sizes of the button must be more than 0 and less than 0x8000.
* For windows with skin definition of the window
* For skinned windows definition of the window
(call of 0th function) creates two standard buttons -
for close of the window with identifier 1 and
for minimize of the window with identifier 0xffff.
@ -926,52 +926,66 @@ Remarks:
process/thread by given slot.
======================================================================
====================== Function 18, subfunction 19 =====================
======================= Get/set mouse features. ======================
======== Function 18, subfunction 19 - get/set mouse features. =======
======================================================================
---------------- Subsubfunction 0 - get mouse speed. -----------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = subsubfunction number
* ecx = 0 - subsubfunction number
Returned value:
* eax = current mouse speed
ecx = 0 - get mouse speed
Returned value:
* eax = current mouse speed
---------------- Subsubfunction 1 - set mouse speed. -----------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 1 - subsubfunction number
* edx = new value for speed
Returned value:
* function does not return value
ecx = 1 - set mouse speed
edx = selected value of speed
Returned value:
* function does not return value
---------------- Subsubfunction 2 - get mouse delay. -----------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 2 - subsubfunction number
Returned value:
* eax = current mouse delay
ecx = 2 - get mouse delay
Returned value:
* eax = current mouse delay
ecx = 3 - set mouse delay
edx = selected value of delay
Returned value:
* function does not return value
ecx = 4 - set mouse pointer position
edx = [coordinate on axis x]*65536 + [coordinate on axis y]
Returned value:
* function does not return value
---------------- Subsubfunction 3 - set mouse delay. -----------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 3 - subsubfunction number
* edx = new value for mouse delay
Returned value:
* function does not return value
----------- Subsubfunction 4 - set mouse pointer position. -----------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 4 - subsubfunction number
* edx = [coordinate on axis x]*65536 + [coordinate on axis y]
Returned value:
* function does not return value
Remarks:
* Recommended speed of the mouse (in subfunction 1) from 1 up to 9.
The installed value is not inspected by the code of a kernel, on this use
cautiously, at incorrect value the cursor can "freeze".
Speed of mouse can be regulated through the application SETUP.
* Recommended delay of the mouse (in subfunction 3) = 10. Lower value
is not handled COM by mice. At the very large values the movement of
the mouse on 1 pixel is impossible and the cursor will jump
on the value of the installed speed (subfunction 1).
The installed value is not inspected by the code of a kernel.
* In subfunction 4 the installed value is not inspected by
the code of a kernel. Before usage it is necessary to find out current
screen resolution and at installation of a position to watch,
that the value of a position should do not fall outside
the limits the screen.
* It is recommended to set speed of the mouse (in subsubfunction 1)
from 1 up to 9. The installed value is not inspected by the kernel
code, so set it carefully, at incorrect value the cursor
can "freeze". Speed of the mouse can be regulated through the
application SETUP.
* Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
value is not handled by COM mice. At the very large values the
movement of the mouse on 1 pixel is impossible and the cursor will
jump on the value of installed speed (subsubfunction 1). The
installed value is not inspected by the kernel code.
* The subsubfunction 4 does not check the passed value. Before
its call find out current screen resolution (with function 14)
and check that the value of position is inside the limits of the
screen.
======================================================================
============ Function 19 - start application from ramdisk. ===========
@ -2134,11 +2148,11 @@ Remarks:
* Structure of the color table is described in the standard
include file 'macros.inc' as 'system_colors'; for example,
it is possible to write:
sc system_colors ; variable declaration
... ; somewhere one must call
; this function with ecx=sc
mov ecx, [sc.work_button_text] ; read text color on
; buttin in working area
sc system_colors ; variable declaration
... ; somewhere one must call
; this function with ecx=sc
mov ecx, [sc.work_button_text] ; read text color on
; buttin in working area
* A program itself desides to use or not to use color table.
For usage program must simply at calls to drawing functions select
color taken from the table.
@ -2994,6 +3008,7 @@ Returned value:
* eax = 0 - success, otherwise file system error code
* ebx destroyed
Remarks:
* This function is obsolete, use subfunction 3 of function 70.
* Ramdisk and floppies do not support this function, it is only
for hard disks.
* File must already exist (otherwise function returns 5, not found).
@ -3288,11 +3303,11 @@ Remarks:
The data of the graphics screen (the memory area which displays
screen contents) are accessible to a program directly, without
any system calls, through the selector gs:
mov eax, [gs:0]
mov eax, [gs:0]
places in eax the first dword of the buffer, which contains
information on color of the left upper point (and, possibly, colors
of several following).
mov [gs:0], eax
mov [gs:0], eax
by work in VESA modes with LFB sets color of the left upper point
(and, possibly, colors of several following).
To interpret the data of graphics screen program needs to know
@ -3854,7 +3869,7 @@ Remarks:
and at arrival of new message the system will wait.
For synchronization frame all work with the buffer by operations
lock/unlock
neg [bufsize]
neg [bufsize]
* Data in the buffer are considered as array of items with variable
length - messages. Format of a message is explained in
general description.
@ -4084,6 +4099,7 @@ Available subfunctions:
* subfunction 0 - read file
* subfunction 1 - read folder
* subfunction 2 - create/rewrite file
* subfunction 3 - write to existing file
* subfunction 5 - get attributes of file/folder
* subfunction 6 - set attributes of file/folder
* subfunction 7 - start application
@ -4243,6 +4259,35 @@ Remarks:
write as many as can and then return error code 8.
* The function is not supported for CD (returns error code 2).
======================================================================
===================== Function 70, subfunction 3 =====================
=========== Write to existing file with long names support. ==========
======================================================================
Parameters:
* eax = 70 - function number
* ebx = pointer to the information structure
Format of the information structure:
* +0: dword: 3 = subfunction number
* +4: dword: file offset (in bytes)
* +8: dword: high dword of offset (must be 0 for FAT)
* +12 = +0xC: dword: number of bytes to write
* +16 = +0x10: dword: pointer to data
* +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
given in the general description
or
* +20 = +0x14: db 0
* +21 = +0x15: dd pointer to ASCIIZ-string with file name
Returned value:
* eax = 0 - success, otherwise file system error code
* ebx = number of written bytes (possibly 0)
Remarks:
* The file must already exist, otherwise function returns eax=5.
* The only result of write 0 bytes is update in the file attributes
date/time of modification and access to the current date/time.
* If beginning and/or ending position is greater than file size
(except for the previous case), the file is expanded to needed
size with zero characters.
======================================================================
==== Function 70, subfunction 5 - get information on file/folder. ====
======================================================================
@ -4420,4 +4465,3 @@ Application start functions can return also following errors:
* 30 = 0x1E = not enough memory
* 31 = 0x1F = file is not executable
* 32 = 0x20 = too many processes

View File

@ -1265,6 +1265,11 @@ fd_find_lfn:
ret
.found:
mov eax, [esp+8]
add eax, 31
cmp dword [esp], flp_root_next
jnz @f
add eax, -31+19
@@:
add esp, 16 ; CF=0
pop esi
ret
@ -1915,6 +1920,304 @@ fs_FloppyRewrite:
pop edi ecx
jmp .ret
;----------------------------------------------------------------
;
; fs_FloppyWrite - LFN variant for writing to floppy
;
; esi points to filename
; ebx pointer to 64-bit number = first wanted byte, 0+
; may be ebx=0 - start from first byte
; ecx number of bytes to write, 0+
; edx mem location to data
;
; ret ebx = bytes written (maybe 0)
; eax = 0 ok write or other = errormsg
;
;--------------------------------------------------------------
@@:
push ERROR_ACCESS_DENIED
fs_FloppyWrite.ret0:
pop eax
xor ebx, ebx
ret
fs_FloppyWrite.ret11:
push 11
jmp fs_FloppyWrite.ret0
fs_FloppyWrite:
cmp byte [esi], 0
jz @b
call read_flp_fat
cmp [FDC_Status], 0
jnz .ret11
pushad
call fd_find_lfn
jnc .found
popad
push ERROR_FILE_NOT_FOUND
jmp .ret0
.found:
; FAT does not support files larger than 4GB
test ebx, ebx
jz .l1
cmp dword [ebx+4], 0
jz @f
.eof:
popad
push ERROR_END_OF_FILE
jmp .ret0
@@:
mov ebx, [ebx]
.l1:
; now edi points to direntry, ebx=start byte to write,
; ecx=number of bytes to write, edx=data pointer
; extend file if needed
add ecx, ebx
jc .eof ; FAT does not support files larger than 4GB
push eax ; save directory cluster
push 0 ; return value=0
call get_time_for_file
mov [edi+22], ax ; last write time
call get_date_for_file
mov [edi+24], ax ; last write date
mov [edi+18], ax ; last access date
push dword [edi+28] ; save current file size
cmp ecx, [edi+28]
jbe .length_ok
cmp ecx, ebx
jz .length_ok
call floppy_extend_file
jnc .length_ok
mov [esp+4], eax
; floppy_extend_file can return two error codes: FAT table error or disk full.
; First case is fatal error, in second case we may write some data
cmp al, ERROR_DISK_FULL
jz .disk_full
pop eax
pop eax
mov [esp+4+28], eax
pop eax
popad
xor ebx, ebx
ret
.disk_full:
; correct number of bytes to write
mov ecx, [edi+28]
cmp ecx, ebx
ja .length_ok
.ret:
pop eax
pop eax
mov [esp+4+28], eax ; eax=return value
pop eax
sub edx, [esp+20]
mov [esp+16], edx ; ebx=number of written bytes
popad
ret
.length_ok:
; save FAT & directory
; note that directory must be saved first because save_flp_fat uses buffer at 0xD000
mov esi, [edi+28]
movzx edi, word [edi+26] ; starting cluster
mov eax, [esp+8]
pusha
call save_chs_sector
popa
cmp [FDC_Status], 0
jnz .device_err
call save_flp_fat
cmp [FDC_Status], 0
jz @f
.device_err:
mov byte [esp+4], 11
jmp .ret
@@:
; now ebx=start pos, ecx=end pos, both lie inside file
sub ecx, ebx
jz .ret
call SetUserInterrupts
.write_loop:
lea eax, [edi+31] ; current sector
; get length of data in current sector
push ecx
sub ebx, 0x200
jb .hasdata
neg ebx
xor ecx, ecx
jmp @f
.hasdata:
neg ebx
cmp ecx, ebx
jbe @f
mov ecx, ebx
@@:
; load sector if needed
cmp dword [esp+4], 0 ; we don't need to read uninitialized data
jz .noread
cmp ecx, 0x200 ; we don't need to read sector if it is fully rewritten
jz .noread
cmp ecx, esi ; (same for the last sector)
jz .noread
pusha
call read_chs_sector
popa
cmp [FDC_Status], 0
jz @f
.device_err2:
pop ecx
jmp .device_err
@@:
.noread:
; zero uninitialized data if file was extended (because floppy_extend_file does not this)
push eax ecx edi
xor eax, eax
mov ecx, 0x200
sub ecx, [esp+4+12]
jbe @f
mov edi, 0xD000
add edi, [esp+4+12]
rep stosb
@@:
; zero uninitialized data in the last sector
mov ecx, 0x200
sub ecx, esi
jbe @f
mov edi, 0xD000
add edi, esi
rep stosb
@@:
pop edi ecx eax
; copy new data
push eax
mov eax, edx
neg ebx
jecxz @f
add ebx, 0xD000+0x200
call memmove
xor ebx, ebx
@@:
pop eax
; save sector
pusha
call save_chs_sector
popa
cmp [FDC_Status], 0
jnz .device_err2
add edx, ecx
sub [esp], ecx
pop ecx
jz .done
.next_cluster:
movzx edi, word [edi*2+0x282000]
sub esi, 0x200
jae @f
xor esi, esi
@@:
sub dword [esp], 0x200
jae .write_loop
and dword [esp], 0
jmp .write_loop
.done:
mov [fdc_irq_func], fdc_null
jmp .ret
floppy_extend_file.zero_size:
xor eax, eax
jmp floppy_extend_file.start_extend
; extends file on floppy to given size (new data area is undefined)
; in: edi->direntry, ecx=new size
; out: CF=0 => OK, eax destroyed
; CF=1 => error, eax=code (ERROR_FAT_TABLE or ERROR_DISK_FULL)
floppy_extend_file:
push ecx
; find the last cluster of file
movzx eax, word [edi+26] ; first cluster
mov ecx, [edi+28]
jecxz .zero_size
@@:
sub ecx, 0x200
jbe @f
mov eax, [eax*2+0x282000]
and eax, 0xFFF
jz .fat_err
cmp eax, 0xFF8
jb @b
.fat_err:
pop ecx
push ERROR_FAT_TABLE
pop eax
stc
ret
@@:
push eax
mov eax, [eax*2+0x282000]
and eax, 0xFFF
cmp eax, 0xFF8
pop eax
jb .fat_err
; set length to full number of sectors
sub [edi+28], ecx
.start_extend:
pop ecx
; now do extend
push edx esi
mov esi, 0x282000+2*2 ; start scan from cluster 2
mov edx, 2847 ; number of clusters to scan
.extend_loop:
cmp [edi+28], ecx
jae .extend_done
; add new sector
push ecx
push edi
.scan:
mov ecx, edx
mov edi, esi
jecxz .disk_full
push eax
xor eax, eax
repnz scasw
pop eax
jnz .disk_full
mov word [edi-2], 0xFFF
mov esi, edi
mov edx, ecx
sub edi, 0x282000
shr edi, 1
dec edi ; now edi=new cluster
test eax, eax
jz .first_cluster
mov [0x282000+eax*2], di
jmp @f
.first_cluster:
pop eax ; eax->direntry
push eax
mov [eax+26], di
@@:
mov eax, edi ; eax=new cluster
pop edi ; edi->direntry
pop ecx ; ecx=required size
add dword [edi+28], 0x200
jmp .extend_loop
.extend_done:
mov [edi+28], ecx
pop esi edx
clc
ret
.disk_full:
pop edi ecx
pop esi edx
stc
push ERROR_DISK_FULL
pop eax
ret
fs_FloppyGetFileInfo:
call read_flp_fat
cmp [FDC_Status], 0
@ -1951,16 +2254,9 @@ fs_FloppySetFileInfo:
push eax
call bdfe_to_fat_entry
pop eax
test eax, eax
jz .root
add eax, 31
pusha
call save_chs_sector
popa
jmp .cmn
.root:
call save_flp_root
.cmn:
pop edi
xor eax, eax
cmp [FDC_Status], 0

View File

@ -2,11 +2,12 @@
;; ;;
;; FAT32.INC ;;
;; ;;
;; FAT16/32 functions for MenuetOS ;;
;; FAT16/32 functions for KolibriOS ;;
;; ;;
;; Copyright 2002 Paolo Minazzi, paolo.minazzi@inwind.it ;;
;; ;;
;; See file COPYING for details ;;
;; 17.08.2006 LFN write/append to file - diamond ;;
;; 23.06.2006 LFN start application - diamond ;;
;; 15.06.2006 LFN get/set file/folder info - diamond ;;
;; 27.05.2006 LFN create/rewrite file - diamond ;;
@ -104,7 +105,6 @@ uglobal
startpath: times 255 db 0
fat16_root db 0 ; flag for fat16 rootdir
f_del db 0 ; 1=overwrite fat entry
fat_change db 0 ; 1=fat has changed
endg
@ -225,27 +225,12 @@ set_FAT:
cmp [fat_type],16
jne sfc_test32
cmp [f_del],1 ; overwrite previous value?
je sfc_set16 ; yes
cmp word [ebx+esi],0 ; is cluster free?
je sfc_set16 ; yes
mov dword [8*0x100000],0xffffff
mov edx,[ebx+esi] ; get old value
jmp sfc_nonzero
sfc_set16:
xchg [ebx+esi],dx ; save new value and get old value
jmp sfc_write
sfc_test32:
mov eax,[fatMASK]
cmp [f_del],1 ; overwrite previous value?
je sfc_set32 ; yes
test eax,[ebx+esi] ; is cluster free?
je sfc_set32 ; yes
mov dword [8*0x100000],0xffffff
mov edx,[ebx+esi] ; get old value
jmp sfc_nonzero
sfc_set32:
and edx,eax
@ -554,13 +539,10 @@ analyze_directory_to_write:
push eax ; save new cluster
mov edx,eax
mov eax,[cluster_tmp] ; change last cluster to point new cluster
mov [f_del],1
call set_FAT
cmp [hd_error],0
jne adw_not_found_1
mov [f_del],0
mov ecx,-1 ; remove 1 cluster from free disk space
call add_disk_free_space
cmp [hd_error],0
@ -883,13 +865,10 @@ makedir:
jne make_dir_error_1
mov eax,[cluster] ; directory cluster
xor edx,edx ; free
mov [f_del],1
call set_FAT
cmp [hd_error],0
jne make_dir_error_1
mov [f_del],0
popad
call update_disk ; write all of cache and fat to hd
make_dir_error_2:
@ -1238,12 +1217,10 @@ file_append:
mov edx,eax
mov eax,[cluster]
mov [f_del],1
call set_FAT ; update previous cluster
cmp [hd_error],0
jne append_access_1
mov [f_del],0
pop eax
jmp append_remove_free
@ -1362,12 +1339,10 @@ file_append:
truncate_pos_found:
mov edx,[fatEND] ; new end for cluster chain
mov [f_del],1
call set_FAT
cmp [hd_error],0
jne append_access
mov [f_del],0
mov eax,edx ; clear rest of chain
truncate_clear_chain:
@ -1875,7 +1850,6 @@ clear_cluster_chain:
;-----------------------------------------------------
push eax ecx edx
xor ecx,ecx ; cluster count
mov [f_del],1 ; delete on
clean_new_chain:
cmp eax,[LAST_CLUSTER] ; end of file
@ -1897,7 +1871,6 @@ clear_cluster_chain:
delete_OK:
call add_disk_free_space ; add clusters to free disk space
access_denied_01:
mov [f_del],0
pop edx ecx eax
ret
@ -3288,7 +3261,6 @@ fat_notroot_extend_dir:
mov eax, [esp+4]
mov eax, [eax]
push edx
mov [f_del], 1
call set_FAT
pop edx
cmp [hd_error], 0
@ -3450,7 +3422,6 @@ fs_HdRewrite:
mov word [edi+26], cx
test eax, eax
jz .done1
mov [f_del], 1
@@:
cmp eax, [fatRESERVED]
jae .done1
@ -3736,7 +3707,6 @@ fs_HdRewrite:
mov ecx, eax
call get_free_FAT
jc .diskfull
mov [f_del], 1
push edx
mov edx, [fatEND]
call set_FAT
@ -3783,6 +3753,348 @@ fs_HdRewrite:
popad
ret
;----------------------------------------------------------------
;
; fs_HdWrite - LFN variant for writing to floppy
;
; esi points to filename
; ebx pointer to 64-bit number = first wanted byte, 0+
; may be ebx=0 - start from first byte
; ecx number of bytes to write, 0+
; edx mem location to data
;
; ret ebx = bytes written (maybe 0)
; eax = 0 ok write or other = errormsg
;
;--------------------------------------------------------------
fs_HdWrite.access_denied:
push ERROR_ACCESS_DENIED
fs_HdWrite.ret0:
pop eax
xor ebx, ebx
ret
fs_HdWrite.ret11:
push 11
jmp fs_HdWrite.ret0
fs_HdWrite:
cmp [fat_type], 0
jnz @f
push ERROR_UNKNOWN_FS
jmp .ret0
@@:
cmp byte [esi], 0
jz .access_denied
pushad
call hd_find_lfn
pushfd
cmp [hd_error], 0
jz @f
popfd
popad
push 11
jmp .ret0
@@:
popfd
jnc .found
popad
push ERROR_FILE_NOT_FOUND
jmp .ret0
.found:
; FAT does not support files larger than 4GB
test ebx, ebx
jz .l1
cmp dword [ebx+4], 0
jz @f
.eof:
popad
push ERROR_END_OF_FILE
jmp .ret0
@@:
mov ebx, [ebx]
.l1:
; now edi points to direntry, ebx=start byte to write,
; ecx=number of bytes to write, edx=data pointer
; extend file if needed
add ecx, ebx
jc .eof ; FAT does not support files larger than 4GB
push eax ; save directory sector
push 0 ; return value=0
call get_time_for_file
mov [edi+22], ax ; last write time
call get_date_for_file
mov [edi+24], ax ; last write date
mov [edi+18], ax ; last access date
push dword [edi+28] ; save current file size
cmp ecx, [edi+28]
jbe .length_ok
cmp ecx, ebx
jz .length_ok
call hd_extend_file
jnc .length_ok
mov [esp+4], eax
; hd_extend_file can return three error codes: FAT table error, device error or disk full.
; First two cases are fatal errors, in third case we may write some data
cmp al, ERROR_DISK_FULL
jz .disk_full
pop eax
pop eax
mov [esp+4+28], eax
pop eax
popad
xor ebx, ebx
ret
.disk_full:
; correct number of bytes to write
mov ecx, [edi+28]
cmp ecx, ebx
ja .length_ok
.ret:
call update_disk
cmp [hd_error], 0
jz @f
mov byte [esp+4], 11
@@:
pop eax
pop eax
mov [esp+4+28], eax ; eax=return value
pop eax
sub edx, [esp+20]
mov [esp+16], edx ; ebx=number of written bytes
popad
ret
.length_ok:
mov esi, [edi+28]
mov eax, [edi+20-2]
mov ax, [edi+26]
mov edi, eax ; edi=current cluster
xor ebp, ebp ; ebp=current sector in cluster
; save directory
mov eax, [esp+8]
push ebx
mov ebx, buffer
call hd_write
pop ebx
cmp [hd_error], 0
jz @f
.device_err:
mov byte [esp+4], 11
jmp .ret
@@:
; now ebx=start pos, ecx=end pos, both lie inside file
sub ecx, ebx
jz .ret
.write_loop:
; get length of data in current sector
push ecx
sub ebx, 0x200
jb .hasdata
neg ebx
xor ecx, ecx
jmp @f
.hasdata:
neg ebx
cmp ecx, ebx
jbe @f
mov ecx, ebx
@@:
; get current sector number
mov eax, edi
dec eax
dec eax
imul eax, [SECTORS_PER_CLUSTER]
add eax, [DATA_START]
add eax, ebp
; load sector if needed
cmp dword [esp+4], 0 ; we don't need to read uninitialized data
jz .noread
cmp ecx, 0x200 ; we don't need to read sector if it is fully rewritten
jz .noread
cmp ecx, esi ; (same for the last sector)
jz .noread
push ebx
mov ebx, buffer
call hd_read
pop ebx
cmp [hd_error], 0
jz @f
.device_err2:
pop ecx
jmp .device_err
@@:
.noread:
; zero uninitialized data if file was extended (because hd_extend_file does not this)
push eax ecx edi
xor eax, eax
mov ecx, 0x200
sub ecx, [esp+4+12]
jbe @f
mov edi, buffer
add edi, [esp+4+12]
rep stosb
@@:
; zero uninitialized data in the last sector
mov ecx, 0x200
sub ecx, esi
jbe @f
mov edi, buffer
add edi, esi
rep stosb
@@:
pop edi ecx eax
; copy new data
push eax
mov eax, edx
neg ebx
jecxz @f
add ebx, buffer+0x200
call memmove
xor ebx, ebx
@@:
pop eax
; save sector
push ebx
mov ebx, buffer
call hd_write
pop ebx
cmp [hd_error], 0
jnz .device_err2
add edx, ecx
sub [esp], ecx
pop ecx
jz .ret
; next sector
inc ebp
cmp ebp, [SECTORS_PER_CLUSTER]
jb @f
xor ebp, ebp
mov eax, edi
call get_FAT
mov edi, eax
cmp [hd_error], 0
jnz .device_err
@@:
sub esi, 0x200
jae @f
xor esi, esi
@@:
sub dword [esp], 0x200
jae @f
and dword [esp], 0
@@: jmp .write_loop
hd_extend_file.zero_size:
xor eax, eax
jmp hd_extend_file.start_extend
; extends file on hd to given size (new data area is undefined)
; in: edi->direntry, ecx=new size
; out: CF=0 => OK, eax destroyed
; CF=1 => error, eax=code (ERROR_FAT_TABLE or ERROR_DISK_FULL or 11)
hd_extend_file:
push ebp
mov ebp, [SECTORS_PER_CLUSTER]
imul ebp, [BYTES_PER_SECTOR]
push ecx
; find the last cluster of file
mov eax, [edi+20-2]
mov ax, [edi+26]
mov ecx, [edi+28]
jecxz .zero_size
.last_loop:
sub ecx, ebp
jbe .last_found
call get_FAT
cmp [hd_error], 0
jz @f
.device_err:
pop ecx
.device_err2:
pop ebp
push 11
.ret_err:
pop eax
stc
ret
@@:
cmp eax, 2
jb .fat_err
cmp eax, [fatRESERVED]
jb .last_loop
.fat_err:
pop ecx ebp
push ERROR_FAT_TABLE
jmp .ret_err
.last_found:
push eax
call get_FAT
cmp [hd_error], 0
jz @f
pop eax
jmp .device_err
@@:
cmp eax, [fatRESERVED]
pop eax
jb .fat_err
; set length to full number of clusters
sub [edi+28], ecx
.start_extend:
pop ecx
; now do extend
push edx
mov edx, 2 ; start scan from cluster 2
.extend_loop:
cmp [edi+28], ecx
jae .extend_done
; add new cluster
push eax
mov eax, edx
call get_free_FAT
jc .disk_full
mov edx, [fatEND]
call set_FAT
mov edx, eax
pop eax
test eax, eax
jz .first_cluster
push edx
call set_FAT
pop edx
jmp @f
.first_cluster:
ror edx, 16
mov [edi+20], dx
ror edx, 16
mov [edi+26], dx
@@:
mov eax, edx
cmp [hd_error], 0
jnz .device_err3
add [edi+28], ebp
jmp .extend_loop
.extend_done:
mov [edi+28], ecx
pop edx ebp
clc
ret
.device_err3:
pop edx
jmp .device_err2
.disk_full:
pop eax edx ebp
push ERROR_DISK_FULL
pop eax
cmp [hd_error], 0
jz @f
mov al, 11
@@: stc
ret
fs_HdGetFileInfo:
cmp [fat_type], 0
jnz @f

View File

@ -347,7 +347,7 @@ fs_RamdiskServices:
dd fs_RamdiskRead
dd fs_RamdiskReadFolder
dd fs_RamdiskRewrite
dd fs_NotImplemented
dd fs_RamdiskWrite
dd fs_NotImplemented
dd fs_RamdiskGetFileInfo
dd fs_RamdiskSetFileInfo
@ -376,7 +376,7 @@ fs_FloppyServices:
dd fs_FloppyRead
dd fs_FloppyReadFolder
dd fs_FloppyRewrite
dd fs_NotImplemented
dd fs_FloppyWrite
dd fs_NotImplemented
dd fs_FloppyGetFileInfo
dd fs_FloppySetFileInfo
@ -447,7 +447,7 @@ fs_HdServices:
dd fs_HdRead
dd fs_HdReadFolder
dd fs_HdRewrite
dd fs_NotImplemented
dd fs_HdWrite
dd fs_NotImplemented
dd fs_HdGetFileInfo
dd fs_HdSetFileInfo

View File

@ -1788,6 +1788,7 @@ fs_RamdiskRewrite:
sub ebx, edx
mov [edi+28], ebx
add esp, 20
mov [esp+16], ebx
popad
xor eax, eax
ret
@ -1797,6 +1798,7 @@ fs_RamdiskRewrite:
sub ebx, edx
mov [edi+28], ebx
add esp, 20
mov [esp+16], ebx
popad
push ERROR_DISK_FULL
pop eax
@ -1820,6 +1822,230 @@ fs_RamdiskRewrite:
loop .read_symbols
ret
;----------------------------------------------------------------
;
; fs_RamdiskWrite - LFN variant for writing to sys floppy
;
; esi points to filename
; ebx pointer to 64-bit number = first wanted byte, 0+
; may be ebx=0 - start from first byte
; ecx number of bytes to write, 0+
; edx mem location to data
;
; ret ebx = bytes written (maybe 0)
; eax = 0 ok write or other = errormsg
;
;--------------------------------------------------------------
@@:
push ERROR_ACCESS_DENIED
fs_RamdiskWrite.ret0:
pop eax
xor ebx, ebx
ret
fs_RamdiskWrite:
cmp byte [esi], 0
jz @b
pushad
call rd_find_lfn
jnc .found
popad
push ERROR_FILE_NOT_FOUND
jmp .ret0
.found:
; must not be directory
test byte [edi+11], 10h
jz @f
popad
push ERROR_ACCESS_DENIED
jmp .ret0
@@:
; FAT does not support files larger than 4GB
test ebx, ebx
jz .l1
cmp dword [ebx+4], 0
jz @f
.eof:
popad
push ERROR_END_OF_FILE
jmp .ret0
@@:
mov ebx, [ebx]
.l1:
; now edi points to direntry, ebx=start byte to write,
; ecx=number of bytes to write, edx=data pointer
call get_time_for_file
mov [edi+22], ax ; last write time
call get_date_for_file
mov [edi+24], ax ; last write date
mov [edi+18], ax ; last access date
; extend file if needed
add ecx, ebx
jc .eof ; FAT does not support files larger than 4GB
push 0 ; return value=0
cmp ecx, [edi+28]
jbe .length_ok
cmp ecx, ebx
jz .length_ok
call ramdisk_extend_file
jnc .length_ok
; ramdisk_extend_file can return two error codes: FAT table error or disk full.
; First case is fatal error, in second case we may write some data
mov [esp], eax
cmp al, ERROR_DISK_FULL
jz .disk_full
pop eax
mov [esp+28], eax
popad
xor ebx, ebx
ret
.disk_full:
; correct number of bytes to write
mov ecx, [edi+28]
cmp ecx, ebx
ja .length_ok
.ret:
pop eax
mov [esp+28], eax ; eax=return value
sub edx, [esp+20]
mov [esp+16], edx ; ebx=number of written bytes
popad
ret
.length_ok:
; now ebx=start pos, ecx=end pos, both lie inside file
sub ecx, ebx
jz .ret
movzx edi, word [edi+26] ; starting cluster
.write_loop:
sub ebx, 0x200
jae .next_cluster
push ecx
neg ebx
cmp ecx, ebx
jbe @f
mov ecx, ebx
@@:
mov eax, edi
shl eax, 9
add eax, 0x100000+31*512+0x200
sub eax, ebx
mov ebx, eax
mov eax, edx
call memmove
xor ebx, ebx
add edx, ecx
sub [esp], ecx
pop ecx
jz .ret
.next_cluster:
movzx edi, word [edi*2+0x280000]
jmp .write_loop
ramdisk_extend_file.zero_size:
xor eax, eax
jmp ramdisk_extend_file.start_extend
; extends file on ramdisk to given size, new data area is filled by 0
; in: edi->direntry, ecx=new size
; out: CF=0 => OK, eax destroyed
; CF=1 => error, eax=code (ERROR_FAT_TABLE or ERROR_DISK_FULL)
ramdisk_extend_file:
push ecx
; find the last cluster of file
movzx eax, word [edi+26] ; first cluster
mov ecx, [edi+28]
jecxz .zero_size
@@:
sub ecx, 0x200
jbe @f
mov eax, [eax*2+0x280000]
and eax, 0xFFF
jz .fat_err
cmp eax, 0xFF8
jb @b
.fat_err:
pop ecx
push ERROR_FAT_TABLE
pop eax
stc
ret
@@:
push eax
mov eax, [eax*2+0x280000]
and eax, 0xFFF
cmp eax, 0xFF8
pop eax
jb .fat_err
; set length to full number of sectors and make sure that last sector is zero-padded
sub [edi+28], ecx
push eax edi
mov edi, eax
shl edi, 9
lea edi, [edi+0x100000+31*512+0x200+ecx]
neg ecx
xor eax, eax
rep stosb
pop edi eax
.start_extend:
pop ecx
; now do extend
push edx esi
mov esi, 0x280000+2*2 ; start scan from cluster 2
mov edx, 2847 ; number of clusters to scan
.extend_loop:
cmp [edi+28], ecx
jae .extend_done
; add new sector
push ecx
mov ecx, edx
push edi
mov edi, esi
jecxz .disk_full
push eax
xor eax, eax
repnz scasw
pop eax
jnz .disk_full
mov word [edi-2], 0xFFF
mov esi, edi
mov edx, ecx
sub edi, 0x280000
shr edi, 1
dec edi ; now edi=new cluster
test eax, eax
jz .first_cluster
mov [0x280000+eax*2], di
jmp @f
.first_cluster:
pop eax ; eax->direntry
push eax
mov [eax+26], di
@@:
push edi
shl edi, 9
add edi, 0x100000+31*512
xor eax, eax
mov ecx, 512/4
rep stosd
pop eax ; eax=new cluster
pop edi ; edi->direntry
pop ecx ; ecx=required size
add dword [edi+28], 0x200
jmp .extend_loop
.extend_done:
mov [edi+28], ecx
pop esi edx
clc
ret
.disk_full:
pop edi ecx
pop esi edx
stc
push ERROR_DISK_FULL
pop eax
ret
fs_RamdiskGetFileInfo:
cmp byte [esi], 0
jnz @f

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ All registers except explicitly declared in the returned value,
============== Function 0 - define and draw the window. ==============
======================================================================
Defines an application window. Draws a frame of the window, header and
working area. For windows with skin defines standard buttons for close
working area. For skinned windows defines standard buttons for close
and minimize.
Parameters:
* eax = 0 - function number
@ -18,10 +18,10 @@ Parameters:
* ecx = [coordinate on axis y]*65536 + [size on axis y]
* edx = 0xXYRRGGBB, where:
* Y = style of the window:
* Y=0 - type I - window of the fixed size
* Y=0 - type I - fixed-size window
* Y=1 - only define window area, draw nothing
* Y=2 - type II - window of the variable size
* Y=3 - window with skin
* Y=2 - type II - variable-size window
* Y=3 - skinned window
* other possible values (from 4 up to 15) are reserved,
function call with such Y is ignored
* RR, GG, BB = accordingly red, green, blue components of a color
@ -61,11 +61,11 @@ Remarks:
* The window must fit on the screen. If the transferred
coordinates and sizes do not satisfy to this condition,
appropriate coordinate (or, probably, both) is considered as zero,
and if also it does not help, the appropriate size
and if it does not help too, the appropriate size
(or, probably, both) is installed in a size of the screen.
Further we shall designate xpos,ypos,xsize,ysize - values
transmitted in ebx,ecx. The coordinates are resulted concerning
Further let us designate xpos,ypos,xsize,ysize - values passed
in ebx,ecx. The coordinates are resulted concerning
the left upper corner of the window, which, thus, is set as (0,0),
coordinates of the right lower corner essence (xsize,ysize).
* The sizes of the window are understood in sence of coordinates
@ -289,7 +289,7 @@ Returned value:
* function does not return value
Remarks:
* Sizes of the button must be more than 0 and less than 0x8000.
* For windows with skin definition of the window
* For skinned windows definition of the window
(call of 0th function) creates two standard buttons -
for close of the window with identifier 1 and
for minimize of the window with identifier 0xffff.
@ -926,53 +926,66 @@ Remarks:
process/thread by given slot.
======================================================================
====================== Function 18, subfunction 19 =====================
======================= Get/set mouse features. ======================
======== Function 18, subfunction 19 - get/set mouse features. =======
======================================================================
---------------- Subsubfunction 0 - get mouse speed. -----------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = subsubfunction number
* ecx = 0 - subsubfunction number
Returned value:
* eax = current mouse speed
ecx = 0 - get mouse speed
Returned value:
* eax = current mouse speed
---------------- Subsubfunction 1 - set mouse speed. -----------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 1 - subsubfunction number
* edx = new value for speed
Returned value:
* function does not return value
ecx = 1 - set mouse speed
edx = selected value of speed
Returned value:
* function does not return value
---------------- Subsubfunction 2 - get mouse delay. -----------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 2 - subsubfunction number
Returned value:
* eax = current mouse delay
ecx = 2 - get mouse delay
Returned value:
* eax = current mouse delay
ecx = 3 - set mouse delay
edx = selected value of delay
Returned value:
* function does not return value
ecx = 4 - set mouse pointer position
edx = [coordinate on axis x]*65536 + [coordinate on axis y]
Returned value:
* function does not return value
---------------- Subsubfunction 3 - set mouse delay. -----------------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 3 - subsubfunction number
* edx = new value for mouse delay
Returned value:
* function does not return value
----------- Subsubfunction 4 - set mouse pointer position. -----------
Parameters:
* eax = 18 - function number
* ebx = 19 - subfunction number
* ecx = 4 - subsubfunction number
* edx = [coordinate on axis x]*65536 + [coordinate on axis y]
Returned value:
* function does not return value
Remarks:
* Recommended speed of the mouse (in subfunction 1) from 1 up to 9.
The installed value is not inspected by the code of a kernel, on this use
cautiously, at incorrect value the cursor can "freeze".
Speed of mouse can be regulated through the application SETUP.
* Recommended delay of the mouse (in subfunction 3) = 10. Lower value
is not handled COM by mice. At the very large values the movement of
the mouse on 1 pixel is impossible and the cursor will jump
on the value of the installed speed (subfunction 1).
Delay of mouse can be regulated through the application SETUP.
The installed value is not inspected by the code of a kernel.
* In subfunction 4 the installed value is not inspected by
the code of a kernel. Before usage it is necessary to find out current
screen resolution and at installation of a position to watch,
that the value of a position should do not fall outside
the limits the screen.
* It is recommended to set speed of the mouse (in subsubfunction 1)
from 1 up to 9. The installed value is not inspected by the kernel
code, so set it carefully, at incorrect value the cursor
can "freeze". Speed of the mouse can be regulated through the
application SETUP.
* Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
value is not handled by COM mice. At the very large values the
movement of the mouse on 1 pixel is impossible and the cursor will
jump on the value of installed speed (subsubfunction 1). The
installed value is not inspected by the kernel code.
* The subsubfunction 4 does not check the passed value. Before
its call find out current screen resolution (with function 14)
and check that the value of position is inside the limits of the
screen.
======================================================================
============ Function 19 - start application from ramdisk. ===========
@ -2135,11 +2148,11 @@ Remarks:
* Structure of the color table is described in the standard
include file 'macros.inc' as 'system_colors'; for example,
it is possible to write:
sc system_colors ; variable declaration
... ; somewhere one must call
; this function with ecx=sc
mov ecx, [sc.work_button_text] ; read text color on
; buttin in working area
sc system_colors ; variable declaration
... ; somewhere one must call
; this function with ecx=sc
mov ecx, [sc.work_button_text] ; read text color on
; buttin in working area
* A program itself desides to use or not to use color table.
For usage program must simply at calls to drawing functions select
color taken from the table.
@ -2995,6 +3008,7 @@ Returned value:
* eax = 0 - success, otherwise file system error code
* ebx destroyed
Remarks:
* This function is obsolete, use subfunction 3 of function 70.
* Ramdisk and floppies do not support this function, it is only
for hard disks.
* File must already exist (otherwise function returns 5, not found).
@ -3289,11 +3303,11 @@ Remarks:
The data of the graphics screen (the memory area which displays
screen contents) are accessible to a program directly, without
any system calls, through the selector gs:
mov eax, [gs:0]
mov eax, [gs:0]
places in eax the first dword of the buffer, which contains
information on color of the left upper point (and, possibly, colors
of several following).
mov [gs:0], eax
mov [gs:0], eax
by work in VESA modes with LFB sets color of the left upper point
(and, possibly, colors of several following).
To interpret the data of graphics screen program needs to know
@ -3855,7 +3869,7 @@ Remarks:
and at arrival of new message the system will wait.
For synchronization frame all work with the buffer by operations
lock/unlock
neg [bufsize]
neg [bufsize]
* Data in the buffer are considered as array of items with variable
length - messages. Format of a message is explained in
general description.
@ -4085,6 +4099,7 @@ Available subfunctions:
* subfunction 0 - read file
* subfunction 1 - read folder
* subfunction 2 - create/rewrite file
* subfunction 3 - write to existing file
* subfunction 5 - get attributes of file/folder
* subfunction 6 - set attributes of file/folder
* subfunction 7 - start application
@ -4244,6 +4259,35 @@ Remarks:
write as many as can and then return error code 8.
* The function is not supported for CD (returns error code 2).
======================================================================
===================== Function 70, subfunction 3 =====================
=========== Write to existing file with long names support. ==========
======================================================================
Parameters:
* eax = 70 - function number
* ebx = pointer to the information structure
Format of the information structure:
* +0: dword: 3 = subfunction number
* +4: dword: file offset (in bytes)
* +8: dword: high dword of offset (must be 0 for FAT)
* +12 = +0xC: dword: number of bytes to write
* +16 = +0x10: dword: pointer to data
* +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
given in the general description
or
* +20 = +0x14: db 0
* +21 = +0x15: dd pointer to ASCIIZ-string with file name
Returned value:
* eax = 0 - success, otherwise file system error code
* ebx = number of written bytes (possibly 0)
Remarks:
* The file must already exist, otherwise function returns eax=5.
* The only result of write 0 bytes is update in the file attributes
date/time of modification and access to the current date/time.
* If beginning and/or ending position is greater than file size
(except for the previous case), the file is expanded to needed
size with zero characters.
======================================================================
==== Function 70, subfunction 5 - get information on file/folder. ====
======================================================================
@ -4421,4 +4465,3 @@ Application start functions can return also following errors:
* 30 = 0x1E = not enough memory
* 31 = 0x1F = file is not executable
* 32 = 0x20 = too many processes

View File

@ -1265,6 +1265,11 @@ fd_find_lfn:
ret
.found:
mov eax, [esp+8]
add eax, 31
cmp dword [esp], flp_root_next
jnz @f
add eax, -31+19
@@:
add esp, 16 ; CF=0
pop esi
ret
@ -1915,6 +1920,304 @@ fs_FloppyRewrite:
pop edi ecx
jmp .ret
;----------------------------------------------------------------
;
; fs_FloppyWrite - LFN variant for writing to floppy
;
; esi points to filename
; ebx pointer to 64-bit number = first wanted byte, 0+
; may be ebx=0 - start from first byte
; ecx number of bytes to write, 0+
; edx mem location to data
;
; ret ebx = bytes written (maybe 0)
; eax = 0 ok write or other = errormsg
;
;--------------------------------------------------------------
@@:
push ERROR_ACCESS_DENIED
fs_FloppyWrite.ret0:
pop eax
xor ebx, ebx
ret
fs_FloppyWrite.ret11:
push 11
jmp fs_FloppyWrite.ret0
fs_FloppyWrite:
cmp byte [esi], 0
jz @b
call read_flp_fat
cmp [FDC_Status], 0
jnz .ret11
pushad
call fd_find_lfn
jnc .found
popad
push ERROR_FILE_NOT_FOUND
jmp .ret0
.found:
; FAT does not support files larger than 4GB
test ebx, ebx
jz .l1
cmp dword [ebx+4], 0
jz @f
.eof:
popad
push ERROR_END_OF_FILE
jmp .ret0
@@:
mov ebx, [ebx]
.l1:
; now edi points to direntry, ebx=start byte to write,
; ecx=number of bytes to write, edx=data pointer
; extend file if needed
add ecx, ebx
jc .eof ; FAT does not support files larger than 4GB
push eax ; save directory cluster
push 0 ; return value=0
call get_time_for_file
mov [edi+22], ax ; last write time
call get_date_for_file
mov [edi+24], ax ; last write date
mov [edi+18], ax ; last access date
push dword [edi+28] ; save current file size
cmp ecx, [edi+28]
jbe .length_ok
cmp ecx, ebx
jz .length_ok
call floppy_extend_file
jnc .length_ok
mov [esp+4], eax
; floppy_extend_file can return two error codes: FAT table error or disk full.
; First case is fatal error, in second case we may write some data
cmp al, ERROR_DISK_FULL
jz .disk_full
pop eax
pop eax
mov [esp+4+28], eax
pop eax
popad
xor ebx, ebx
ret
.disk_full:
; correct number of bytes to write
mov ecx, [edi+28]
cmp ecx, ebx
ja .length_ok
.ret:
pop eax
pop eax
mov [esp+4+28], eax ; eax=return value
pop eax
sub edx, [esp+20]
mov [esp+16], edx ; ebx=number of written bytes
popad
ret
.length_ok:
; save FAT & directory
; note that directory must be saved first because save_flp_fat uses buffer at 0xD000
mov esi, [edi+28]
movzx edi, word [edi+26] ; starting cluster
mov eax, [esp+8]
pusha
call save_chs_sector
popa
cmp [FDC_Status], 0
jnz .device_err
call save_flp_fat
cmp [FDC_Status], 0
jz @f
.device_err:
mov byte [esp+4], 11
jmp .ret
@@:
; now ebx=start pos, ecx=end pos, both lie inside file
sub ecx, ebx
jz .ret
call SetUserInterrupts
.write_loop:
lea eax, [edi+31] ; current sector
; get length of data in current sector
push ecx
sub ebx, 0x200
jb .hasdata
neg ebx
xor ecx, ecx
jmp @f
.hasdata:
neg ebx
cmp ecx, ebx
jbe @f
mov ecx, ebx
@@:
; load sector if needed
cmp dword [esp+4], 0 ; we don't need to read uninitialized data
jz .noread
cmp ecx, 0x200 ; we don't need to read sector if it is fully rewritten
jz .noread
cmp ecx, esi ; (same for the last sector)
jz .noread
pusha
call read_chs_sector
popa
cmp [FDC_Status], 0
jz @f
.device_err2:
pop ecx
jmp .device_err
@@:
.noread:
; zero uninitialized data if file was extended (because floppy_extend_file does not this)
push eax ecx edi
xor eax, eax
mov ecx, 0x200
sub ecx, [esp+4+12]
jbe @f
mov edi, 0xD000
add edi, [esp+4+12]
rep stosb
@@:
; zero uninitialized data in the last sector
mov ecx, 0x200
sub ecx, esi
jbe @f
mov edi, 0xD000
add edi, esi
rep stosb
@@:
pop edi ecx eax
; copy new data
push eax
mov eax, edx
neg ebx
jecxz @f
add ebx, 0xD000+0x200
call memmove
xor ebx, ebx
@@:
pop eax
; save sector
pusha
call save_chs_sector
popa
cmp [FDC_Status], 0
jnz .device_err2
add edx, ecx
sub [esp], ecx
pop ecx
jz .done
.next_cluster:
movzx edi, word [edi*2+0x282000]
sub esi, 0x200
jae @f
xor esi, esi
@@:
sub dword [esp], 0x200
jae .write_loop
and dword [esp], 0
jmp .write_loop
.done:
mov [fdc_irq_func], fdc_null
jmp .ret
floppy_extend_file.zero_size:
xor eax, eax
jmp floppy_extend_file.start_extend
; extends file on floppy to given size (new data area is undefined)
; in: edi->direntry, ecx=new size
; out: CF=0 => OK, eax destroyed
; CF=1 => error, eax=code (ERROR_FAT_TABLE or ERROR_DISK_FULL)
floppy_extend_file:
push ecx
; find the last cluster of file
movzx eax, word [edi+26] ; first cluster
mov ecx, [edi+28]
jecxz .zero_size
@@:
sub ecx, 0x200
jbe @f
mov eax, [eax*2+0x282000]
and eax, 0xFFF
jz .fat_err
cmp eax, 0xFF8
jb @b
.fat_err:
pop ecx
push ERROR_FAT_TABLE
pop eax
stc
ret
@@:
push eax
mov eax, [eax*2+0x282000]
and eax, 0xFFF
cmp eax, 0xFF8
pop eax
jb .fat_err
; set length to full number of sectors
sub [edi+28], ecx
.start_extend:
pop ecx
; now do extend
push edx esi
mov esi, 0x282000+2*2 ; start scan from cluster 2
mov edx, 2847 ; number of clusters to scan
.extend_loop:
cmp [edi+28], ecx
jae .extend_done
; add new sector
push ecx
push edi
.scan:
mov ecx, edx
mov edi, esi
jecxz .disk_full
push eax
xor eax, eax
repnz scasw
pop eax
jnz .disk_full
mov word [edi-2], 0xFFF
mov esi, edi
mov edx, ecx
sub edi, 0x282000
shr edi, 1
dec edi ; now edi=new cluster
test eax, eax
jz .first_cluster
mov [0x282000+eax*2], di
jmp @f
.first_cluster:
pop eax ; eax->direntry
push eax
mov [eax+26], di
@@:
mov eax, edi ; eax=new cluster
pop edi ; edi->direntry
pop ecx ; ecx=required size
add dword [edi+28], 0x200
jmp .extend_loop
.extend_done:
mov [edi+28], ecx
pop esi edx
clc
ret
.disk_full:
pop edi ecx
pop esi edx
stc
push ERROR_DISK_FULL
pop eax
ret
fs_FloppyGetFileInfo:
call read_flp_fat
cmp [FDC_Status], 0
@ -1951,16 +2254,9 @@ fs_FloppySetFileInfo:
push eax
call bdfe_to_fat_entry
pop eax
test eax, eax
jz .root
add eax, 31
pusha
call save_chs_sector
popa
jmp .cmn
.root:
call save_flp_root
.cmn:
pop edi
xor eax, eax
cmp [FDC_Status], 0

View File

@ -2,11 +2,12 @@
;; ;;
;; FAT32.INC ;;
;; ;;
;; FAT16/32 functions for MenuetOS ;;
;; FAT16/32 functions for KolibriOS ;;
;; ;;
;; Copyright 2002 Paolo Minazzi, paolo.minazzi@inwind.it ;;
;; ;;
;; See file COPYING for details ;;
;; 17.08.2006 LFN write/append to file - diamond ;;
;; 23.06.2006 LFN start application - diamond ;;
;; 15.06.2006 LFN get/set file/folder info - diamond ;;
;; 27.05.2006 LFN create/rewrite file - diamond ;;
@ -104,7 +105,6 @@ uglobal
startpath: times 255 db 0
fat16_root db 0 ; flag for fat16 rootdir
f_del db 0 ; 1=overwrite fat entry
fat_change db 0 ; 1=fat has changed
endg
@ -225,27 +225,12 @@ set_FAT:
cmp [fat_type],16
jne sfc_test32
cmp [f_del],1 ; overwrite previous value?
je sfc_set16 ; yes
cmp word [ebx+esi],0 ; is cluster free?
je sfc_set16 ; yes
mov dword [8*0x100000],0xffffff
mov edx,[ebx+esi] ; get old value
jmp sfc_nonzero
sfc_set16:
xchg [ebx+esi],dx ; save new value and get old value
jmp sfc_write
sfc_test32:
mov eax,[fatMASK]
cmp [f_del],1 ; overwrite previous value?
je sfc_set32 ; yes
test eax,[ebx+esi] ; is cluster free?
je sfc_set32 ; yes
mov dword [8*0x100000],0xffffff
mov edx,[ebx+esi] ; get old value
jmp sfc_nonzero
sfc_set32:
and edx,eax
@ -554,13 +539,10 @@ analyze_directory_to_write:
push eax ; save new cluster
mov edx,eax
mov eax,[cluster_tmp] ; change last cluster to point new cluster
mov [f_del],1
call set_FAT
cmp [hd_error],0
jne adw_not_found_1
mov [f_del],0
mov ecx,-1 ; remove 1 cluster from free disk space
call add_disk_free_space
cmp [hd_error],0
@ -883,13 +865,10 @@ makedir:
jne make_dir_error_1
mov eax,[cluster] ; directory cluster
xor edx,edx ; free
mov [f_del],1
call set_FAT
cmp [hd_error],0
jne make_dir_error_1
mov [f_del],0
popad
call update_disk ; write all of cache and fat to hd
make_dir_error_2:
@ -1238,12 +1217,10 @@ file_append:
mov edx,eax
mov eax,[cluster]
mov [f_del],1
call set_FAT ; update previous cluster
cmp [hd_error],0
jne append_access_1
mov [f_del],0
pop eax
jmp append_remove_free
@ -1362,12 +1339,10 @@ file_append:
truncate_pos_found:
mov edx,[fatEND] ; new end for cluster chain
mov [f_del],1
call set_FAT
cmp [hd_error],0
jne append_access
mov [f_del],0
mov eax,edx ; clear rest of chain
truncate_clear_chain:
@ -1875,7 +1850,6 @@ clear_cluster_chain:
;-----------------------------------------------------
push eax ecx edx
xor ecx,ecx ; cluster count
mov [f_del],1 ; delete on
clean_new_chain:
cmp eax,[LAST_CLUSTER] ; end of file
@ -1897,7 +1871,6 @@ clear_cluster_chain:
delete_OK:
call add_disk_free_space ; add clusters to free disk space
access_denied_01:
mov [f_del],0
pop edx ecx eax
ret
@ -3288,7 +3261,6 @@ fat_notroot_extend_dir:
mov eax, [esp+4]
mov eax, [eax]
push edx
mov [f_del], 1
call set_FAT
pop edx
cmp [hd_error], 0
@ -3450,7 +3422,6 @@ fs_HdRewrite:
mov word [edi+26], cx
test eax, eax
jz .done1
mov [f_del], 1
@@:
cmp eax, [fatRESERVED]
jae .done1
@ -3736,7 +3707,6 @@ fs_HdRewrite:
mov ecx, eax
call get_free_FAT
jc .diskfull
mov [f_del], 1
push edx
mov edx, [fatEND]
call set_FAT
@ -3783,6 +3753,348 @@ fs_HdRewrite:
popad
ret
;----------------------------------------------------------------
;
; fs_HdWrite - LFN variant for writing to floppy
;
; esi points to filename
; ebx pointer to 64-bit number = first wanted byte, 0+
; may be ebx=0 - start from first byte
; ecx number of bytes to write, 0+
; edx mem location to data
;
; ret ebx = bytes written (maybe 0)
; eax = 0 ok write or other = errormsg
;
;--------------------------------------------------------------
fs_HdWrite.access_denied:
push ERROR_ACCESS_DENIED
fs_HdWrite.ret0:
pop eax
xor ebx, ebx
ret
fs_HdWrite.ret11:
push 11
jmp fs_HdWrite.ret0
fs_HdWrite:
cmp [fat_type], 0
jnz @f
push ERROR_UNKNOWN_FS
jmp .ret0
@@:
cmp byte [esi], 0
jz .access_denied
pushad
call hd_find_lfn
pushfd
cmp [hd_error], 0
jz @f
popfd
popad
push 11
jmp .ret0
@@:
popfd
jnc .found
popad
push ERROR_FILE_NOT_FOUND
jmp .ret0
.found:
; FAT does not support files larger than 4GB
test ebx, ebx
jz .l1
cmp dword [ebx+4], 0
jz @f
.eof:
popad
push ERROR_END_OF_FILE
jmp .ret0
@@:
mov ebx, [ebx]
.l1:
; now edi points to direntry, ebx=start byte to write,
; ecx=number of bytes to write, edx=data pointer
; extend file if needed
add ecx, ebx
jc .eof ; FAT does not support files larger than 4GB
push eax ; save directory sector
push 0 ; return value=0
call get_time_for_file
mov [edi+22], ax ; last write time
call get_date_for_file
mov [edi+24], ax ; last write date
mov [edi+18], ax ; last access date
push dword [edi+28] ; save current file size
cmp ecx, [edi+28]
jbe .length_ok
cmp ecx, ebx
jz .length_ok
call hd_extend_file
jnc .length_ok
mov [esp+4], eax
; hd_extend_file can return three error codes: FAT table error, device error or disk full.
; First two cases are fatal errors, in third case we may write some data
cmp al, ERROR_DISK_FULL
jz .disk_full
pop eax
pop eax
mov [esp+4+28], eax
pop eax
popad
xor ebx, ebx
ret
.disk_full:
; correct number of bytes to write
mov ecx, [edi+28]
cmp ecx, ebx
ja .length_ok
.ret:
call update_disk
cmp [hd_error], 0
jz @f
mov byte [esp+4], 11
@@:
pop eax
pop eax
mov [esp+4+28], eax ; eax=return value
pop eax
sub edx, [esp+20]
mov [esp+16], edx ; ebx=number of written bytes
popad
ret
.length_ok:
mov esi, [edi+28]
mov eax, [edi+20-2]
mov ax, [edi+26]
mov edi, eax ; edi=current cluster
xor ebp, ebp ; ebp=current sector in cluster
; save directory
mov eax, [esp+8]
push ebx
mov ebx, buffer
call hd_write
pop ebx
cmp [hd_error], 0
jz @f
.device_err:
mov byte [esp+4], 11
jmp .ret
@@:
; now ebx=start pos, ecx=end pos, both lie inside file
sub ecx, ebx
jz .ret
.write_loop:
; get length of data in current sector
push ecx
sub ebx, 0x200
jb .hasdata
neg ebx
xor ecx, ecx
jmp @f
.hasdata:
neg ebx
cmp ecx, ebx
jbe @f
mov ecx, ebx
@@:
; get current sector number
mov eax, edi
dec eax
dec eax
imul eax, [SECTORS_PER_CLUSTER]
add eax, [DATA_START]
add eax, ebp
; load sector if needed
cmp dword [esp+4], 0 ; we don't need to read uninitialized data
jz .noread
cmp ecx, 0x200 ; we don't need to read sector if it is fully rewritten
jz .noread
cmp ecx, esi ; (same for the last sector)
jz .noread
push ebx
mov ebx, buffer
call hd_read
pop ebx
cmp [hd_error], 0
jz @f
.device_err2:
pop ecx
jmp .device_err
@@:
.noread:
; zero uninitialized data if file was extended (because hd_extend_file does not this)
push eax ecx edi
xor eax, eax
mov ecx, 0x200
sub ecx, [esp+4+12]
jbe @f
mov edi, buffer
add edi, [esp+4+12]
rep stosb
@@:
; zero uninitialized data in the last sector
mov ecx, 0x200
sub ecx, esi
jbe @f
mov edi, buffer
add edi, esi
rep stosb
@@:
pop edi ecx eax
; copy new data
push eax
mov eax, edx
neg ebx
jecxz @f
add ebx, buffer+0x200
call memmove
xor ebx, ebx
@@:
pop eax
; save sector
push ebx
mov ebx, buffer
call hd_write
pop ebx
cmp [hd_error], 0
jnz .device_err2
add edx, ecx
sub [esp], ecx
pop ecx
jz .ret
; next sector
inc ebp
cmp ebp, [SECTORS_PER_CLUSTER]
jb @f
xor ebp, ebp
mov eax, edi
call get_FAT
mov edi, eax
cmp [hd_error], 0
jnz .device_err
@@:
sub esi, 0x200
jae @f
xor esi, esi
@@:
sub dword [esp], 0x200
jae @f
and dword [esp], 0
@@: jmp .write_loop
hd_extend_file.zero_size:
xor eax, eax
jmp hd_extend_file.start_extend
; extends file on hd to given size (new data area is undefined)
; in: edi->direntry, ecx=new size
; out: CF=0 => OK, eax destroyed
; CF=1 => error, eax=code (ERROR_FAT_TABLE or ERROR_DISK_FULL or 11)
hd_extend_file:
push ebp
mov ebp, [SECTORS_PER_CLUSTER]
imul ebp, [BYTES_PER_SECTOR]
push ecx
; find the last cluster of file
mov eax, [edi+20-2]
mov ax, [edi+26]
mov ecx, [edi+28]
jecxz .zero_size
.last_loop:
sub ecx, ebp
jbe .last_found
call get_FAT
cmp [hd_error], 0
jz @f
.device_err:
pop ecx
.device_err2:
pop ebp
push 11
.ret_err:
pop eax
stc
ret
@@:
cmp eax, 2
jb .fat_err
cmp eax, [fatRESERVED]
jb .last_loop
.fat_err:
pop ecx ebp
push ERROR_FAT_TABLE
jmp .ret_err
.last_found:
push eax
call get_FAT
cmp [hd_error], 0
jz @f
pop eax
jmp .device_err
@@:
cmp eax, [fatRESERVED]
pop eax
jb .fat_err
; set length to full number of clusters
sub [edi+28], ecx
.start_extend:
pop ecx
; now do extend
push edx
mov edx, 2 ; start scan from cluster 2
.extend_loop:
cmp [edi+28], ecx
jae .extend_done
; add new cluster
push eax
mov eax, edx
call get_free_FAT
jc .disk_full
mov edx, [fatEND]
call set_FAT
mov edx, eax
pop eax
test eax, eax
jz .first_cluster
push edx
call set_FAT
pop edx
jmp @f
.first_cluster:
ror edx, 16
mov [edi+20], dx
ror edx, 16
mov [edi+26], dx
@@:
mov eax, edx
cmp [hd_error], 0
jnz .device_err3
add [edi+28], ebp
jmp .extend_loop
.extend_done:
mov [edi+28], ecx
pop edx ebp
clc
ret
.device_err3:
pop edx
jmp .device_err2
.disk_full:
pop eax edx ebp
push ERROR_DISK_FULL
pop eax
cmp [hd_error], 0
jz @f
mov al, 11
@@: stc
ret
fs_HdGetFileInfo:
cmp [fat_type], 0
jnz @f

View File

@ -347,7 +347,7 @@ fs_RamdiskServices:
dd fs_RamdiskRead
dd fs_RamdiskReadFolder
dd fs_RamdiskRewrite
dd fs_NotImplemented
dd fs_RamdiskWrite
dd fs_NotImplemented
dd fs_RamdiskGetFileInfo
dd fs_RamdiskSetFileInfo
@ -376,7 +376,7 @@ fs_FloppyServices:
dd fs_FloppyRead
dd fs_FloppyReadFolder
dd fs_FloppyRewrite
dd fs_NotImplemented
dd fs_FloppyWrite
dd fs_NotImplemented
dd fs_FloppyGetFileInfo
dd fs_FloppySetFileInfo
@ -447,7 +447,7 @@ fs_HdServices:
dd fs_HdRead
dd fs_HdReadFolder
dd fs_HdRewrite
dd fs_NotImplemented
dd fs_HdWrite
dd fs_NotImplemented
dd fs_HdGetFileInfo
dd fs_HdSetFileInfo

View File

@ -570,6 +570,12 @@ if ~ BGI_LEVEL eq KERNEL
jg .nobold
end if
mov edx,[.color]
; \begin{diamond}[18.08.2006]
; starting from K0530 kernel interprets flag 0x1000000 as
; negate existing pixels colors, disregarding passed color
; we do not want this
and edx, 0xFFFFFF
; \end{diamond}[18.08.2006]
mov eax,38
int 0x40
test ebp,BGI_BOLD

View File

@ -68,11 +68,10 @@ use32
dd 0x0
not1strun dd 0x0
include 'lang.inc'
include 'lang.inc'
include 'macros.inc'
;include 'debug.inc'
include 'bgifont.inc'
lang equ en;ru;en
START:
mov [help],0

View File

@ -1159,7 +1159,7 @@ help_window:
add edx,14 ;help_text addr.
add esi,37 ; = 51 - length 1 line
mov ecx,0x00ffffff
mov edi,15
mov edi,(help_end-help_text)/51
@@:
add ebx,0x10
int 0x40
@ -1329,6 +1329,7 @@ db 0xEC,0xED,0xEE,0xEF
;text for help_window
help_label: db 'Help for HeEd.'
help_text:
if lang eq ru
db '1.HeEd ¢ á®áâ®ï­¨¨ ®âªàëâì ä ©« ⮫쪮 ®¤¨­ à § ¨ '
db ' ­ã¦­®¥ ç¨á«® à § á®åà ­¨âì ¥£®. '
db '2.<2E>ਠ®âªàë⨨ ä ©«  ¡¥§ à áè¨à¥­¨ï ­ ¤® íâ® à áè¨-'
@ -1344,12 +1345,27 @@ help_text:
db ' ¤¨âáï ¯ ¬ïâì á  ¤à¥á  0å80000, ­® à §¬¥à ä ©«  '
db ' à ¢¥­ 0xFFFFFFFF. '
db ' (á¬. ¨­ä® "About") '
else
db '1.HeEd can once open file and many times save it. '
db '2.To open file without extension it is required to '
db ' specify anyway as three spaces after a dot. '
db '3.File is opened when the button "Go" is pressed. '
db '4.Creation of new files in the menu is not provided'
db ' but you can edit... '
db '5.Only number of bytes which was file size when '
db ' opening is written to file. '
db '6.If you press "Go" with empty filename field, '
db ' memory starting from address 0x80000 is output, '
db ' but file size equals to 0xFFFFFFFF. '
db ' (see info "About") '
end if
help_end:
;text for about_window
about_label: db 'About this funny.'
about_text:
if lang eq ru
db '<27>¥ª®â®à ï ¨­ä®à¬ æ¨ï ¤«ï â¥å, ªâ® § å®ç¥â ¤®¯¨á âì '
db 'á çâ®-⮠᢮¥: ª®¤ ¯à ªâ¨çªáª¨ ­¥ ®¯â¨¬¨§¨à®¢ ­,'
db 'á çâ®-⮠᢮¥: ª®¤ ¯à ªâ¨ç¥áª¨ ­¥ ®¯â¨¬¨§¨à®¢ ­,'
db 'â ª çâ® à §®¡à âìáï ¡ã¤¥â ­¥ â ª 㦠᫮¦­®. ‘âப¨ '
db '¤«ï ª­®¯®ª ¬¥­î ¤®«¦­ë ¨¤â¨ ¯àאַ ¤à㣠§  ¤à㣮¬, '
db 'â. ª. ï ¯à¨ ¢ë¢®¤¥ ¨á¯®«ì§ãî ­¥ mov esi,à §¬¥à ¨ '
@ -1363,6 +1379,23 @@ about_text:
db 'ப á GUI MeOS ¨ ¯®í⮬㠭¥ ¯à¥â¥­¤ã¥â ­  çâ®-â® '
db '¡®«ì襥, 祬 ¯à¨¬¥à. <20>à®áâ® ­ ¤®¥«  íâ  â¥¬ ,   ¢ë-'
db 'ª¨­ãâì ¦ «ª®. mailto:babalbes@yandex.ru '
else
db 'Some information for those who want add to this '
db 'something their own: the code is practically not '
db 'optimized, so investigation is not complicated. '
db 'Strings for menu buttons must rank after each other'
db 'as I use not mov esi,size and mov edx,address when '
db 'output but simply add offsets. For encodins and '
db 'file sizes for save, it remains only add buttons '
db 'with text in menu (at addition one should take into'
db 'account that buttons ID are recognized as dec ah '
db 'rather than cmp ah,ID). Nevertheless if study is '
db 'unpleasant, you can write and ask. This program has'
db 'been written in course of study GUI MeOS and does '
db 'not therefore pretend on some more than example. '
db 'Just this theme bothers, but I regret to delete. '
db ' mailto:babalbes@yandex.ru '
end if
about_end:
I_END:

View File

@ -20,8 +20,8 @@ lang equ ru
;0.07 convbmp ~13.05.2004
;0.08 fps ~14.05.2004
;0.09 drawfbox ~03.06.2004
;0.10 all macros optimized by halyavin, add at ~07.06.2004
;0.11 many macros optimized by halyavin, add at ~30.08.2004
;0.10 all macros optimized by Halyavin A., add at ~07.06.2004
;0.11 many macros optimized by Halyavin A., add at ~30.08.2004
;0.12 bmptoimg ~07.09.2004
;0.13 imgtoimg ~08.09.2004
;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004
@ -369,8 +369,8 @@ end if
;DrawBox
macro drawfbox x,y,xs,ys,color
{
wordstoreg ebx,x,xs ;x*65536+xs
wordstoreg ecx,y,ys ;y*65536+ys
words2reg ebx,x,xs ;x*65536+xs
words2reg ecx,y,ys ;y*65536+ys
mov edx,color
mov eax,13
int 0x40
@ -385,8 +385,8 @@ local no_out_fps
jmp spdat
savetime dd 0
fps_cntr dd 0
fps dd 0
ttt dd 0
fps dd 0
ttt dd 0
spdat:
get_time:
mov eax,3
@ -395,7 +395,7 @@ get_time:
jne new_time
inc [fps_cntr]
cmp dword [ttt],0
je out_fps
je out_fps
dec dword [ttt]
jmp no_out_fps
new_time:
@ -405,7 +405,7 @@ new_time:
mov [fps_cntr],0
out_fps:
if ~(delcolor eq )
mov ebx,x*65536+30
mov ebx,x*65536+36
mov ecx,y*65536+7
mov edx,delcolor
mov eax,13
@ -413,7 +413,7 @@ if ~(delcolor eq )
end if
mov dword [ttt],fps_show_frequency
mov eax,47
mov ebx,5*65536
mov ebx,6*65536
; mov bl,0
mov edx,x*65536+y
mov esi,color
@ -427,43 +427,43 @@ _1dbounce_count=0;
macro collimg img1_off,x1,y1,img2_off,x2,y2,otv
{
local bounce,exit,anot,bc,nbc
mov esi,[img1_off] ;xs1
mov edi,[img2_off] ;ys2
mov eax,x1 ;
mov ebx,x2 ;
call _1dbounce
mov edx,ecx
mov esi,[img1_off+4] ;ys1
mov edi,[img2_off+4] ;ys2
mov eax,y1 ;
mov ebx,y2 ;
call _1dbounce
add edx,ecx
cmp edx,2
je bounce
mov otv,0
jmp exit
mov esi,[img1_off] ;xs1
mov edi,[img2_off] ;ys2
mov eax,x1 ;
mov ebx,x2 ;
call _1dbounce
mov edx,ecx
mov esi,[img1_off+4] ;ys1
mov edi,[img2_off+4] ;ys2
mov eax,y1 ;
mov ebx,y2 ;
call _1dbounce
add edx,ecx
cmp edx,2
je bounce
mov otv,0
jmp exit
_1dbounce_count=_1dbounce_count+1
if _1dbounce_count = 1
_1dbounce:
cmp ebx,eax
jb anot
add eax,esi
cmp eax,ebx
jbe nbc
cmp ebx,eax
jb anot
add eax,esi
cmp eax,ebx
jbe nbc
bc:
mov ecx,1
ret
mov ecx,1
ret
anot:
add ebx,edi
cmp ebx,eax
ja bc
cmp ebx,eax
ja bc
nbc:
xor ecx,ecx
ret
xor ecx,ecx
ret
end if
bounce:
mov otv,1
mov otv,1
exit:
}
@ -495,7 +495,7 @@ macro setimg x , y ,arg3
shl ecx,16
add cx,[arg3+4]
; wordstoreg ecx,[arg3],[arg3+4]
wordstoreg edx, x , y ;arg1*65536+arg2
words2reg edx, x , y ;arg1*65536+arg2
int 0x40
}
@ -504,7 +504,7 @@ macro setframe x , y ,arg3
mov eax,7
mov ebx,arg3
add ebx,8
wordstoreg edx, x , y ;arg1*65536+arg2
words2reg edx, x , y ;arg1*65536+arg2
add edx,dword [arg3]
mov ecx,dword [arg3+4]
int 0x40
@ -697,7 +697,7 @@ local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
sub esi,dword [bmptoimg_data_area_bps]
sub esi,dword [bmptoimg_data_area_bps]
cmp esi,dword [bmptoimg_data_area_sop]
jb end_bmp
jb end_bmp
add edi,eax
add ebp,eax
jmp nextstring
@ -705,7 +705,7 @@ local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
convertno32:
mov ebx,bmp_load_area
add ebx, [bmp_load_area+14]
add ebx,14 ;start of color table
add ebx,14 ;start of color table
push esi
add esi,dword [bmptoimg_data_area_bps]
mov dword [bmptoimg_data_area_eos],esi
@ -714,9 +714,9 @@ local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
push eax
movzx eax,byte [esi]
cmp word [bmp_load_area+28],4
je convert4bpp
je convert4bpp
cmp word [bmp_load_area+28],1
je convert1bpp
je convert1bpp
call converttable
convert2:
@ -750,7 +750,7 @@ local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
mov edx,7
nextbit:
xor eax,eax
bt ecx,edx
bt ecx,edx
jnc noaddelem
inc eax
noaddelem:
@ -758,7 +758,7 @@ local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
call converttable
pop edx
dec edx
js convert2
js convert2
add edi,3
add ebp,3
@ -776,12 +776,12 @@ local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize
bmptoimg_data_area_count=bmptoimg_data_area_count+1
if bmptoimg_data_area_count = 1
; DATA AREA
bmptoimg_soi dd 0
bmptoimg_data_area_bps dd 0
bmptoimg_soi dd 0
bmptoimg_data_area_bps dd 0
bmptoimg_data_area_dwps dd 0
bmptoimg_data_area_sop dd 0
bmptoimg_data_area_eop dd 0
bmptoimg_data_area_eos dd 0
bmptoimg_data_area_sop dd 0
bmptoimg_data_area_eop dd 0
bmptoimg_data_area_eos dd 0
end if
end_bmp:
@ -806,7 +806,7 @@ local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
_null equ 0x1000 ; 0x1000
_null = 0x1000 ; 0x1000
; jmp sss
; if defined gif_hash_offset
@ -816,13 +816,13 @@ _null equ 0x1000 ; 0x1000
; end if
;sss:
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
if defined gif_hash_offset
mov eax,gif_hash_offset ;<EFBFBD> ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
mov eax,gif_hash_offset ;<EFBFBD> ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
else
mov eax,hasharea ;<EFBFBD> ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
mov eax,hasharea ;<EFBFBD> ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
end if
call ReadGIF
@ -845,12 +845,12 @@ ReadGIF:
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
@ -891,8 +891,8 @@ noextblock:
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
@ -909,7 +909,7 @@ setPal:
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
@ -933,7 +933,7 @@ reinit:
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
je reinit
call Gif_output
cycle:
movzx ebx,ax
@ -941,9 +941,9 @@ cycle:
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
je reinit
cmp eax,[EOI]
je zend
je zend
call Gif_output
zadd:
push eax
@ -997,7 +997,7 @@ Gif_skipmap:
; out: edi - pointer to area after colormap
and ecx,111b
inc ecx ; color map size
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
@ -1015,7 +1015,7 @@ shift:
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
jb noblock
push eax
xor eax,eax
lodsb
@ -1057,14 +1057,14 @@ loop2:
add esi,[Palette]
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
movsw
movsb
end if
loop loop2
@ -1073,7 +1073,7 @@ loop2:
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1
@ -1101,15 +1101,15 @@ local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
_null fix 0x1000 ; 0x1000
_null = 0x1000 ; 0x1000
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
mov esi,gifsrc ;“ª § â¥«ì ­  ƒˆ” ä ¨« ¢ ¯ ¬ïâ¨
mov edi,imgsrc ;“ª § â¥«ì ­  ᯨ᮪ ª à⨭®ª
if defined gif_hash_offset
mov eax,gif_hash_offset ;<EFBFBD> ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
mov eax,gif_hash_offset ;<EFBFBD> ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
else
mov eax,hasharea ;<EFBFBD> ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
mov eax,hasharea ;<EFBFBD> ¡®ç ï ®¡« áâì ¬¨­¨¬ã¬ 4096*4 ¡ ©â
end if
call ReadGIF
@ -1130,12 +1130,12 @@ ReadGIF:
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
@ -1187,8 +1187,8 @@ noextblock:
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
@ -1205,7 +1205,7 @@ setPal:
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
@ -1229,7 +1229,7 @@ reinit:
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
je reinit
call Gif_output
cycle:
movzx ebx,ax
@ -1237,9 +1237,9 @@ cycle:
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
je reinit
cmp eax,[EOI]
je zend
je zend
call Gif_output
zadd:
push eax
@ -1291,9 +1291,8 @@ ex:
Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
and ecx,111b
inc ecx ; color map size
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
@ -1311,7 +1310,7 @@ shift:
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
jb noblock
push eax
xor eax,eax
lodsb
@ -1353,14 +1352,14 @@ loop2:
add esi,[Palette]
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
movsw
movsb
end if
loop loop2
@ -1369,7 +1368,7 @@ loop2:
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1

View File

@ -0,0 +1,49 @@
lang equ ru
;
; Assembler
; SMALL
; CODE
; GaMe
; Libary
;
; Ver 0.03 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
;InfoList
;0.01 correct
;0.02 control ~14.05.2004
;0.03 all macros optimized by halyavin, add at ~07.06.2004
; corectiryemoe,corectnoe,step
macro correct arg1,arg2,arg3
{
local plus,minus,equal
mov eax,arg2
cmp arg1,eax
je equal
mov eax,arg3
ja minus
plus:
add arg1,eax
jmp equal
minus:
sub arg1,eax
equal:
}
macro control min,max,arg
{
local gr,low,norm
mov eax,max
cmp arg,eax
jg gr
mov eax,min
cmp arg,eax
jnl norm
gr:
low:
mov arg,eax
norm:
}

View File

@ -27,11 +27,13 @@ lang equ ru ; ru en fr ge fi
;0.12 open/save dialog ~13.09.2004
;0.13 dialogs bugs deleted
;0.14 drawlbut ~03.10.2004
;0.15 extendet label!
; LOADFILE
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area
macro loadfile file_name,file_load_area,file_temp_area
{
local open,fileinfo,string
@ -59,24 +61,74 @@ open:
}
macro wordstoreg reg,hiword,loword
;macro wordstoreg reg,hiword,loword
;{
;if hiword eqtype 0 & loword eqtype 0
; mov reg,dword hiword*65536+loword
;else if hiword eqtype 12 & loword eqtype eax
; mov reg,dword hiword*65536
; add reg,dword loword
;else if hiword eqtype 12 & loword eqtype [123]
; mov reg,dword hiword*65536
; add reg,dword loword
;else
; mov reg,dword hiword
; shl reg,16
; add reg,dword loword
;end if
;}
macro dword2reg reg,doubleword
{
if hiword eqtype 0 & loword eqtype 0
mov reg,(hiword)*65536+(loword)
else if hiword eqtype 12 & loword eqtype eax
mov reg,(hiword)*65536
add reg,loword
else if hiword eqtype 0 & loword eqtype [123]
mov reg,(hiword)*65536
add reg,loword
else if (hiword eq ) & (loword eq )
if doubleword eq
; not changes
else
mov reg,hiword
shl reg,16
add reg,loword
mov reg,dword doubleword
end if
}
macro words2reg reg,hiword,lowword
{
if hiword eq
if lowword eq
; not changes
else
if lowword eqtype 12
and reg,dword 0xffff0000
add reg,dword lowword
else
and reg,dword 0xffff0000
add reg,dword lowword
end if
end if
else
if lowword eq
if hiword eqtype 12
and reg,dword 0x0000ffff
add reg,dword hiword*65536
else
shl reg,16
add reg,dword hiword
ror reg,16
end if
else
if lowword eqtype 12 & hiword eqtype 12
if lowword eq 0 & hiword eq 0
xor reg,reg
else
mov reg,dword hiword*65536+lowword
end if
else
mov reg,dword hiword
shl reg,16
add reg,dword lowword
end if
end if
end if
}
; DRAW BUTTON with label
@ -86,8 +138,8 @@ local asd,lab
jmp asd
lab db text ;arg label
asd:
wordstoreg ebx,x,xs
wordstoreg ecx,y,ys
words2reg ebx,x,xs
words2reg ecx,y,ys
mov edx,id
mov esi,bcolor
mov eax,8
@ -328,7 +380,7 @@ run_fileinfo:
db '/RD/1/SYSXTREE',0
procinfo:
times 256 db 0
times 1024 db 0
}
@ -390,7 +442,7 @@ new_d:
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,120 ; size 150 bytes
mov edx,150 ; size 150 bytes
int 0x40
; change wanted events list 7-bit IPC event
@ -458,6 +510,7 @@ mred:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
@ -526,8 +579,8 @@ dlg_pid_get dd 0
DLGPID dd 0
param:
rb 4 ; My dec PID
rb 6 ; Type of dialog
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
run_fileinfo:
dd 16
@ -535,11 +588,11 @@ run_fileinfo:
dd param
dd 0
dd procinfo
run_filepath:
;run_filepath:
db '/RD/1/SYSXTREE',0
procinfo:
times 256 db 0
times 1024 db 0
}
@ -635,10 +688,15 @@ macro puttxt x,y,offs,size,color
; mov ebx,x
; shl ebx,16
; add ebx,y
wordstoreg ebx,x,y
mov ecx,color
mov edx,offs
mov esi,size
words2reg ebx,x,y
dword2reg ecx,color
dword2reg edx,offs
dword2reg esi,size
; mov ecx,color
; mov edx,offs
; mov esi,size
mov eax,4
int 0x40
}
@ -649,7 +707,7 @@ macro outcount data, x, y, color, numtype
mov ebx,numtype
mov bl,0
; mov edx,x*65536+y
wordstoreg edx,x,y
words2reg edx,x,y
mov esi,color
mov eax,47
int 0x40
@ -728,8 +786,8 @@ macro window arg1,arg2,arg3,arg4,arg5
{
; mov ebx,arg1*65536+arg3
; mov ecx,arg2*65536+arg4
wordstoreg ebx,arg1,arg3
wordstoreg ecx,arg2,arg4
words2reg ebx,arg1,arg3
words2reg ecx,arg2,arg4
mov edx,arg5
mov eax,0
int 0x40
@ -769,7 +827,7 @@ macro endwd
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big
macro label arg1,arg2,arg3,arg4
macro glabel arg1,arg2,arg3,arg4
{
local asd,lab
jmp asd
@ -778,10 +836,11 @@ asd:
; mov ebx,arg1 ;arg1=y arg2=x
; shl ebx,16
; add ebx,arg2
wordstoreg ebx,arg1,arg2
if ~(arg4 eq )
mov ecx,arg4 ;arg4 color
end if
words2reg ebx,arg1,arg2
dword2reg ecx,arg4
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4

View File

@ -0,0 +1,93 @@
lang equ ru
;
; Assembler
; SMALL
; CODE
; Massive operation
; Libary
;
; Ver 0.1 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
;InfoList
;0.01 readmas,compmas,findmas
macro readmas masoff,obroff
{
local loo
mov edi,masoff
add edi,8
mov ebp,[masoff] ;elements
mov edx,[masoff+4] ;elemsize
mov eax,0 ;count
loo:
pushad
call obroff
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
}
macro compmas masoff1,masoff2,obroff
{
local loo,loo2
mov esi,masoff2
add esi,8
mov ecx,[masoff2]
mov ebx,[masoff2+4]
mov eax,0
loo2:
push eax
mov edi,masoff1
add edi,8
mov ebp,[masoff1] ;elements1
mov edx,[masoff1+4] ;elemsize1
mov eax,0 ;count
loo:
pushad
call obroff
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
add esi,ebx
pop eax
inc eax
cmp eax,ecx
jne loo2
}
macro findmas masoff,obroff
{
local loo,looend,lend
mov edi,masoff
add edi,8
mov ebp,[masoff] ;elements
mov edx,[masoff+4] ;elemsize
mov eax,0 ;count
loo:
pushad
mov eax,0
call obroff
cmp eax,1
je looend
popad
add edi,edx
inc eax
cmp eax,ebp
jne loo
stc
jmp lend
looend:
popad
clc
lend:
}

View File

@ -1,3 +1,15 @@
; language for programs
lang fix en ; ru en fr ge fi
@^ fix macro comment {
^@ fix }
macro m2m dest,src {
push src
pop dest
}
; new application structure
macro meos_app_start
{
@ -74,36 +86,73 @@ struc mstr [sstring]
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
name db data
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
common
if used name
label name
forward
if lang eq lng
db data
end if
common
.size = $-name
end if
}
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
common
local s,m
m = 0
if used name
label name
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
.size = $-name
.maxl = m
end if
}
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
common
local s,m,c
m = 0
c = 0
if used name
label name
forward
if lang eq lng
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
c = c+1
end if
common
.size = $-name
.maxl = m
.count = c
end if
}
; easy system call macro
@ -123,8 +172,16 @@ macro mpack dest, hsrc, lsrc
end if
}
macro __mov reg,a { ; mike.dld
if ~a eq
;macro __mov reg,a { ; mike.dld
; if ~a eq
; mov reg,a
; end if
;}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
@ -140,11 +197,71 @@ macro mcall a,b,c,d,e,f { ; mike.dld
}
; -------------------------
macro header a,[b] {
common
use32
org 0
db 'MENUET',a
forward
if b eq
dd 0
else
dd b
end if }
macro section name { align 16
label name }
macro func name {
if ~used name
display 'FUNC NOT USED: ',`name,13,10
else
align 4
name:
;pushad
;pushfd
;dps `name
;newline
;mcall 5,1
;popfd
;popad
}
macro endf { end if }
; language for programs
lang fix ru ; ru en fr ge fi
macro diff16 title,l1,l2
{
local s,d
s = l2-l1
display title,': 0x'
repeat 8
d = '0' + s shr ((8-%) shl 2) and $0F
if d > '9'
d = d + 'A'-'9'-1
end if
display d
end repeat
display 13,10
}
macro diff10 title,l1,l2
{
local s,d,z,m
s = l2-l1
z = 0
m = 1000000000
display title,': '
repeat 10
d = '0' + s / m
s = s - (s/m)*m
m = m / 10
if d <> '0'
z = 1
end if
if z <> 0
display d
end if
end repeat
display 13,10
}
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
@ -153,9 +270,9 @@ macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
inc arg1
else
add arg1,arg2
add arg1,arg2
end if
else
add arg1,arg2
@ -166,9 +283,9 @@ macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
dec arg1
else
sub arg1,arg2
sub arg1,arg2
end if
else
sub arg1,arg2
@ -179,17 +296,17 @@ macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
push arg2
pop arg1
else
mov arg1,arg2
mov arg1,arg2
end if
else
mov arg1,arg2
@ -197,48 +314,230 @@ macro mov arg1,arg2
}
macro RGB [a] {
common
match (r=,g=,b),a \{
\dd ((r) shl 16) or ((g) shl 8) or (b)
\}
}
struc POINT _t,_dx,_dy {
.x _t _dx
.y _t _dy
}
; Macroinstructions for defining data structures
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
{ fields@struct equ name
match child parent, name \{ fields@struct equ child,fields@\#parent \}
sub@struct equ
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
macro db [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,db,<val> \}
macro dw [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dw,<val> \}
macro du [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,du,<val> \}
macro dd [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dd,<val> \}
macro dp [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dp,<val> \}
macro dq [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dq,<val> \}
macro dt [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dt,<val> \}
macro rb count \{ \local anonymous
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
macro rw count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
macro rd count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
macro rp count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
macro rq count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
macro rt count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
macro union \{ fields@struct equ fields@struct,,union,<
sub@struct equ union \}
macro struct \{ fields@struct equ fields@struct,,substruct,<
sub@struct equ substruct \}
virtual at 0 }
macro ends
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
restruc rb,rw,rd,rp,rq,rt
purge db,dw,du,dd,dp,dq,dt
purge rb,rw,rd,rp,rq,rt
purge union,struct
match name=,fields,fields@struct \\{ fields@struct equ
make@struct name,fields
fields@\\#name equ fields \\}
end virtual \}
match any, sub@struct \{ fields@struct equ fields@struct> \}
restore sub@struct }
macro make@struct name,[field,type,def]
{ common
if $
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
err
end if
local define
define equ name
forward
local sub
match , field \{ make@substruct type,name,sub def
define equ define,.,sub, \}
match any, field \{ define equ define,.#field,type,<def> \}
common
match fields, define \{ define@struct fields \} }
macro define@struct name,[field,type,def]
{ common
local list
list equ
forward
if ~ field eq .
name#field type def
sizeof.#name#field = $ - name#field
else
rb sizeof.#type
end if
local value
match any, list \{ list equ list, \}
list equ list <value>
common
sizeof.#name = $
restruc name
match values, list \{
struc name value \\{
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
match , fields@struct \\\{ label .
forward
match , value \\\\{ field type def \\\\}
match any, value \\\\{ field type value
if ~ field eq .
rb sizeof.#name#field - ($-field)
end if \\\\}
common \\\} \\} \} }
macro enable@substruct
{ macro make@substruct substruct,parent,name,[field,type,def]
\{ \common
\local define
define equ parent,name
\forward
\local sub
match , field \\{ match any, type \\\{ enable@substruct
make@substruct type,name,sub def
purge make@substruct
define equ define,.,sub, \\\} \\}
match any, field \\{ define equ define,.\#field,type,<def> \\}
\common
match fields, define \\{ define@\#substruct fields \\} \} }
enable@substruct
macro define@union parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
virtual at 0
parent#field type def
sizeof.#parent#field = $ - parent#field
end virtual
if sizeof.#parent#field > $
rb sizeof.#parent#field - $
end if
else if sizeof.#type > $
rb sizeof.#type - $
end if
common
sizeof.#name = $
end virtual
struc name [value] \{ \common
label .\#name
last@union equ
forward
match any, last@union \\{ virtual at .\#name
field type def
end virtual \\}
match , last@union \\{ match , value \\\{ field type def \\\}
match any, value \\\{ field type value \\\} \\}
last@union equ field
common rb sizeof.#name - ($ - .\#name) \} }
macro define@substruct parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
parent#field type def
sizeof.#parent#field = $ - parent#field
else
rb sizeof.#type
end if
local value
common
sizeof.#name = $
end virtual
struc name value \{
label .\#name
forward
match , value \\{ field type def \\}
match any, value \\{ field type value
if ~ field eq .
rb sizeof.#parent#field - ($-field)
end if \\}
common \} }
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
cpu_usage dd ? ; +0
window_stack_position dw ? ; +4
window_stack_value dw ? ; +6
not_used1 dw ? ; +8
process_name rb 12 ; +10
memory_start dd ? ; +22
used_memory dd ? ; +26
PID dd ? ; +30
x_start dd ? ; +34
y_start dd ? ; +38
x_size dd ? ; +42
y_size dd ? ; +46
slot_state dw ? ; +50
rb (1024-52)
ends
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
frame dd ?
grab dd ?
grab_button dd ?
grab_button_text dd ?
grab_text dd ?
work dd ?
work_button dd ?
work_button_text dd ?
work_text dd ?
work_graph dd ?
ends
; constants
@ -247,16 +546,16 @@ struct system_colors
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,87 @@
SYSTEM X-TREE
The new file browser with support sorting file by name, extension, size, date
Develop by Pavlushin Evgeni for Menuet OS e-mail: waptap@mail.ru
site (slow update) : www.deck4.narod.ru
~~~Manuals~~~
Copy program COPYR to ramdisk !!! for work feuters - copy and paste file's
~~~Keys~~~
PageUp\PageDown , Up Arrow/Down Arrow -Navigation
Blackspace - goto to previous folder
Enter - enter to folder or run/view/edit file
F2 - change sort mode (name,extension,size,date,sohw/fade del files)
F3 - view file in notepad
F5 - copy file to clipboard
F6 - paste file from clipboard
F12 - update source
SYSTEM X-TREE
Íîâûé ôàéëîâûé áðàóçåð ïîäåððæèâàþùèé ñîðòèðîâêó ôîèëîâ ïî èìåíè,
ðàñøèðåíèþ, ðàçìåðó è äàòå.
Ðàçðàáîòàë Ïàâëþøèí Åâãåíèé äëÿ Menuet OS e-mail: waptap@mail.ru
ñàéò (ìåäëåííî îáíîâëÿåòñÿ) : www.deck4.narod.ru
~~~Èíñòðóêöèÿ~~~
Ñêîïèðóéòå ïðîãó COPYR íà ramdisk !!! äëÿ âîçìîæíîñòè êîïèðîâàòü è âñòàâëÿòü ôàèëû
~~~Êëàâèøè~~~
PageUp\PageDown , Up Arrow/Down Arrow - Íàâèãàöèÿ
Blackspace - Ïåðåéòè ê ïðåäèäóùåé ïàïêå
Enter - Çàéòè â ïàïêó èëè çàïóñòèòü/ïðîñìîòðåòü/ðåäàêòèðîâàòü ôàèë
F2 - Ñìåíèòü ðåæèì ñîðòèðîâêè (Ïî èìåíè,ðàñøèðåíèþ,ðàçìåðó,äàòå,ïîêàçûâàòü óäàë. ôàèëû)
F3 - Ïðîñìîòðåòü ôàèë â òåêñòîâîì áëîêíîòå
F5 - êîïèðîâàòü ôàèë â clipboard
F6 - âñòàâèòü ôàèë èç clipboard'à
F12 - Îáíîâèòü ñîäåðæèìîå îêíà
Translate of russian documentation for xtree
Sorry i'm write in English very poor.
The new concept of dialogues, now dialogues
is made do not use file system for an exchange
with the client, and use IPC - Inter process comunication
(Support since 52 Versions).
52 Version support IPC of dialogues
53 Version is added protection dialogs from
external processes.
Test with TESTOPDG 54 Version IPC protection it is
improved Test with TESTOPD2 That testing dialogues
copy SYSTRE54 on ramdisk under name SYSXTREE and start TESTOPD2
In window TESTOPD2 the following information is displayed:
In heading at the left???
Below parameters transferred SYSTEM XTREE,
namely PID TESTOPD2, the blank and
type of dialogue of one byte (O-Open, S-Save)
is even lower PID SYSTEM XTREE and current num of the
started processes After file will be open in dialogue,
it will be displayed in window TESTOPD2 below heading,
and dialogue will be closed.
Protection TESTOPD2:
1) If at start SYSTEM XTREE from XTREE don't it is
received it PID during 2 sec, 54 version XTREE or
not XTREE at all means on ramdisk not, TESTOPD2
comes to the end.
2) If worked SYSTEM XTREE it was closed not
having sent path to file (itself or from CPU programs)
TESTOPD2 comes to the end since parameters from XTREE
have not been received and since XTREE is closed
that already and don't are received.
;78Ver input in dir whith extension (for example TEST.DIR\XT\) bug deleted
;64Ver Run file from HD bug deleted.
;65Ver The bad scroll realization
;66Ver The good scroll realization, url line anti-flick
;67Ver Url line monolith procedure
;68Ver Mini icon on left of file name
;69Ver Getimg proc size minus 900 bytes
;70Ver Del data area ramsize minus 140000 bytes
;72Ver Quick sort, ramsize minus 200000 bytes
;73Ver Url flick and out bugs delete
;sort type in headmenu bug del

View File

@ -0,0 +1,80 @@
Сделана новая концепция диалогов, теперь диалоги не используют
файловую систему для обмена с клиентом, а используют IPC -
Inter process comunication (Поддержка начиная с 52 Версии).
52 Версия поддержка IPC диалогов
53 Версия добавлена защиты диологов от внешних процессов.
Тестируйте с TESTOPDG
54 Версия IPC защита улучшена
Тестируйте с TESTOPD2
Что-бы протестить диалоги скопируйте SYSTRE54 на рамдиск под
именем SYSXTREE и запустите TESTOPD2
В окне TESTOPD2 отображается следующая информация:
В заголовке слева ???
Ниже параметры переданные SYSTEM XTREE , а именно PID TESTOPD2,
пробел и тип диалога один байт (O-Open,S-Save)
Еще ниже PID SYSTEM XTREE и текущее кол-во запущенных процессов
После того как фаил будет открыт в диалоге, он отобразится в
окне TESTOPD2 ниже заголовка, а диалог закроется.
Защита TESTOPD2:
1) Если при запуске SYSTEM XTREE от XTREE небыл получен его PID
в течении 2 сек, значит на рамдиске не 54 версия XTREE или не XTREE
вовсе, TESTOPD2 завершается.
2) Если запущеный SYSTEM XTREE закрылся не отослав путьфаила(сам или
от CPU проги),то TESTOPD2 завершается т.к. параметры от XTREE не
были получены а т.к. XTREE закрыт то уже и небудут получены.
68 Версия
За два дня я добился приличных успехов по модернизации X-TREE
И так шо нового...
60Ver Теперь FileList и в диалоге и в браузере выводится одной
процедурой нужно только указать координаты и размер листа отслеживание
и прорисовка скроллбара выполняется процедурой.
61Ver Настроил координаты ФаилЛиста
62Ver Дабавил панельку слева в окне (как в Виндах) для красоты
63Ver Изменил скин и добавил картинки на кнопочки скроллбара
64Ver Удалил старый добрый баг - ошибка запуска прог с HD которая
выносит Меос нафиг не исключаю, что этот баг удален не до конца
65Ver Изменил обработку и прорисовку скролла
66Ver Довел до конца прорисовку скролла, добавил противомигающий
код для URL строки
67Ver Теперь URL строка и в диалоге и в браузере выводится одной
процедурой нужно только указать координаты и размер строки.
68Ver Добавил мини иконки слева от фаил нейма (очень прикольно смотрится).
73 Версия
69Ver Getimg выполнил в виде процесса, а не макроса код уменьшился
на 900 байт
70Ver data_area теперь не исподльзуется, а значит памяти требуется
теперь на 140000 байт меньше!
72Ver Более быстрая сортировка , fileinfo требут только 200 байт,
а значит памяти тепрь требуется на 200000 байт меньше!
73Ver Мигание Url строки баг исправлен.
Итого код уменьшен где-то на 900 байт. Если раньше требовалось памяти
1 МБ, то теперь всего 600Кб, а это почти в два раза меньше.
80Ver Диалоги опять работают, удален баг редактированеия строки URL
81Ver Save диалог работает более корректно

View File

@ -69,7 +69,7 @@ LABEL_PL2TYPE_Y equ LABEL_PL2_Y
LABEL_STATUS_X equ 14
LABEL_STATUS_Y equ 279
LABEL_STATUS_WIDTH equ 220
LABEL_STATUS_HEIGHT equ 8
LABEL_STATUS_HEIGHT equ 12

View File

@ -1,376 +0,0 @@
;--------------------------------------------------------------
;DRAW BLOCK
;
;--------------------------------------------------------------
draw_block: mov eax,13
mov edx,[color_table+edx*4]
mov ebx,[current_block_x]
mov ecx,[current_block_y]
mov edi,[current_block_pointer]
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
mov dword [TMP_1],4
adr_122: mov dword [TMP_0],4
adr_121: cmp byte [edi],0
je adr_120
int 040h
call draw_frames
adr_120: inc edi
add ebx,ADOBE_SIZE*65536
dec dword [TMP_0]
jnz adr_121
sub ebx,4*ADOBE_SIZE*65536
add ecx,ADOBE_SIZE*65536
dec dword [TMP_1]
jnz adr_122
ret
draw_frames:
cmp edx,0
jne df1
ret
df1:
pusha
mov bx,1
add edx,0x282828
mov eax,13
int 0x40
popa
pusha
mov cx,1
add edx,0x282828
mov eax,13
int 0x40
popa
pusha
push ebx
sub bx,1
add [esp+2],bx
pop ebx
mov bx,1
shr edx,1
and edx,0x7f7f7f
mov eax,13
int 0x40
popa
pusha
push ecx
sub cx,1
add [esp+2],cx
pop ecx
mov cx,1
shr edx,1
and edx,0x7f7f7f
mov eax,13
int 0x40
popa
ret
;-------------------------------------------------------------
; FIX BLOCK
;-------------------------------------------------------------
fix_block: mov ebx,[current_block_pointer]
mov edx,[current_block_y]
imul edx,LEN_X
add edx,[current_block_x] ;find the offset in tetris_t
add edx,table_tetris
mov ecx,4
mov al,[current_block_color]
adr_21: cmp byte [ebx],1
jne adr_22
mov [edx],al
adr_22: inc ebx
inc edx
cmp byte [ebx],1
jne adr_23
mov [edx],al
adr_23: inc ebx
inc edx
cmp byte [ebx],1
jne adr_24
mov [edx],al
adr_24: inc ebx
inc edx
cmp byte [ebx],1
jne adr_25
mov [edx],al
adr_25: inc ebx
add edx,LEN_X-3
loop adr_21
ret
;-------------------------------------------------------------
;NEW BLOCK
;-------------------------------------------------------------
new_block: mov dword [current_block_y],1
mov dword [current_block_x],7
mov eax,dword [next_block_pointer]
mov dword [current_block_pointer],eax
mov eax,dword [next_block_color]
mov dword [current_block_color],eax
call random
and al,7
setz ah
add al,ah
mov [next_block_color],al
call random
;and eax,15
; ---- Ivan ----
and eax,0xff
@@:
cmp eax,_MAXBLOCKS_
jl @f
add eax,-(_MAXBLOCKS_)
jmp @b
@@:
; ---- Ivan ----
mov edx,[block_table+eax*4]
mov [next_block_pointer],edx
mov dword[delay],5
sub dword[delay],speed
ret
;-------------------------------------------------------------
;DRAW TITLE BLOCK
;-------------------------------------------------------------
draw_title_block:
; movzx edx,byte [current_block_color]
mov eax,13
; mov edx,[color_table+edx*4]
; mov ebx,[current_block_x]
; mov ecx,[current_block_y]
; mov edi,[current_block_pointer]
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
mov dword [TMP_1],5
call adr_122
ret
;-------------------------------------------------------------
;FIRST BLOCK
;-------------------------------------------------------------
first_block: call random
and al,7
setz ah
add al,ah
mov [next_block_color],al
call random
;and eax,15
; ---- Ivan ----
and eax,0xff
@@:
cmp eax,_MAXBLOCKS_
jl @f
add eax,-(_MAXBLOCKS_)
jmp @b
@@:
; ---- Ivan ----
mov edx,[block_table+eax*4]
mov [next_block_pointer],edx
; call draw_next_block
; mov byte [delay],5 ;19 ;!!! 15
ret
ret
;-------------------------------------------------------------
;DRAW NEXT BLOCK
;-------------------------------------------------------------
draw_next_block:
movzx edx,byte [next_block_color]
mov eax,13
mov edx,[color_table+edx*4]
mov ebx,LEN_X+1
mov ecx,5
mov edi,[next_block_pointer]
sub ebx,BORDER_LEFT
imul ebx,ADOBE_SIZE
add ebx,X_LOCATION
shl ebx,16
mov bx,ADOBE_SIZE
sub ecx,BORDER_TOP
imul ecx,ADOBE_SIZE
add ecx,Y_LOCATION
shl ecx,16
mov cx,ADOBE_SIZE
mov dword [TMP_1],4
jmp adr_122
ret
;-------------------------------------------------------------
; ROTATE BLOCK
;-------------------------------------------------------------
rotate_block:
mov edx,[current_block_pointer]
mov edx,[edx+16]
mov esi,[current_block_pointer]
mov [current_block_pointer],edx
call check_crash
call attesa
mov [current_block_pointer],esi
ret
;-------------------------------------------------------------
; CHECK CRASH
; output Z flag => OK
; NZ flag => NO
;-------------------------------------------------------------
check_crash: mov ebx,[current_block_pointer]
mov edx,[current_block_y]
imul edx,LEN_X
add edx,[current_block_x] ;find the offset in tetris_t
add edx,table_tetris
mov ecx,4
xor ax,ax
adr_1: cmp byte [ebx],1
jne adr_2
add al,[edx]
adc ah,0
adr_2: inc ebx
inc edx
cmp byte [ebx],1
jne adr_3
add al,[edx]
adc ah,0
adr_3: inc ebx
inc edx
cmp byte [ebx],1
jne adr_4
add al,[edx]
adc ah,0
adr_4: inc ebx
inc edx
cmp byte [ebx],1
jne adr_5
add al,[edx]
adc ah,0
adr_5: inc ebx
add edx,LEN_X-3
loop adr_1
or ax,ax
ret
;--------------------------------------------------------------
;CHECK LINE
;--------------------------------------------------------------
;edx = pointer
;ebx = contatore
check_full_line:
std
mov al,0
mov edx,table_tetris+LEN_X*(LEN_Y-BORDER_BOTTOM)-1
mov ebx,(LEN_Y-BORDER_TOP-BORDER_BOTTOM-1)*LEN_X
adr_5000: mov edi,edx
mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT
repne scasb
jz no_full_line
lea esi,[edx-LEN_X]
mov edi,edx
mov ecx,ebx
rep movsb
sub edi,BORDER_RIGHT
mov ecx,LEN_X-BORDER_LEFT-BORDER_RIGHT
rep stosb
add dword [score],100
add dword [lines],1
; mov esi,dword[score]
;
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; mov esi,dword [speed]
; imul esi,linestonewlevel
; add esi,linestonewlevel
; cmp dword [lines],esi
; jne adr_5000 1 line : 100
; cmp dword[speed],4 2 lines: 300
; je adr_51 3 lines: 700
; inc dword[speed] 4 lines:1500
; jmp adr_5000
; adr_51:
; mov dword[speed],0
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
jmp adr_5000
no_full_line: sub edx,LEN_X
sub ebx,LEN_X
jnz adr_5000
ret

View File

@ -1,235 +0,0 @@
;+---------------------------------+
;| DEFINITION BLOCKS |
;+---------------------------------+
t_block_0:
db 0,0,0,0
db 1,1,1,0
db 0,1,0,0
db 0,0,0,0
dd t_block_3
t_block_1:
db 0,1,0,0
db 1,1,0,0
db 0,1,0,0
db 0,0,0,0
dd t_block_0
t_block_2:
db 0,1,0,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd t_block_1
t_block_3:
db 0,1,0,0
db 0,1,1,0
db 0,1,0,0
db 0,0,0,0
dd t_block_2
;-----------------------------------
i_block_0:
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
dd i_block_1
i_block_1:
db 0,0,0,0
db 1,1,1,1
db 0,0,0,0
db 0,0,0,0
dd i_block_0
;-----------------------------------
q_block_0:
db 0,1,1,0
db 0,1,1,0
db 0,0,0,0
db 0,0,0,0
dd q_block_0
;-----------------------------------
s_block_0:
db 0,0,0,0
db 0,1,1,0
db 1,1,0,0
db 0,0,0,0
dd s_block_1
s_block_1:
db 1,0,0,0
db 1,1,0,0
db 0,1,0,0
db 0,0,0,0
dd s_block_0
;-----------------------------------
l_block_0:
db 0,0,0,0
db 1,1,1,0
db 1,0,0,0
db 0,0,0,0
dd l_block_3
l_block_1:
db 1,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,0,0,0
dd l_block_0
l_block_2:
db 0,0,1,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd l_block_1
l_block_3:
db 0,1,0,0
db 0,1,0,0
db 0,1,1,0
db 0,0,0,0
dd l_block_2
;-----------------------------------
g_block_0:
db 0,1,0,0
db 0,1,0,0
db 1,1,0,0
db 0,0,0,0
dd g_block_1
g_block_1:
db 0,0,0,0
db 1,1,1,0
db 0,0,1,0
db 0,0,0,0
dd g_block_2
g_block_2:
db 0,1,1,0
db 0,1,0,0
db 0,1,0,0
db 0,0,0,0
dd g_block_3
g_block_3:
db 1,0,0,0
db 1,1,1,0
db 0,0,0,0
db 0,0,0,0
dd g_block_0
;-----------------------------------
k_block_0:
db 0,0,0,0
db 1,1,0,0
db 0,1,1,0
db 0,0,0,0
dd k_block_1
k_block_1:
db 0,1,0,0
db 1,1,0,0
db 1,0,0,0
db 0,0,0,0
dd k_block_0
;-----------------------------------
;logo blocks
;-----------------------------------
tetris_t:
db 1,1,1,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
tetris_e:
db 1,1,1,0
db 1,0,0,0
db 1,1,0,0
db 1,0,0,0
db 1,1,1,0
tetris_r:
db 1,1,0,0
db 1,0,1,0
db 1,1,0,0
db 1,0,1,0
db 1,0,1,0
tetris_i:
db 0,1,0,0
db 0,0,0,0
db 0,1,0,0
db 0,1,0,0
db 0,1,0,0
tetris_s:
db 0,1,1,1
db 1,0,0,0
db 0,1,1,0
db 0,0,0,1
db 1,1,1,0
tetris_II:
db 1,1,1,1
db 0,1,1,0
db 0,1,1,0
db 0,1,1,0
db 1,1,1,1
;-----------------------------------
block_table:
dd t_block_0 ; t
dd t_block_1
dd t_block_2
dd t_block_3
dd i_block_0 ; i
dd i_block_1
dd i_block_0
dd i_block_1
dd q_block_0 ; q
dd q_block_0
dd q_block_0
dd q_block_0
dd s_block_0 ; s
dd s_block_1
dd s_block_0
dd s_block_1
dd l_block_0 ; l
dd l_block_1
dd l_block_2
dd l_block_3
dd g_block_0 ; g
dd g_block_1
dd g_block_2
dd g_block_3
dd k_block_0 ; k
dd k_block_1
dd k_block_0
dd k_block_1
color_table:
dd 00000000h ;black 0
dd 00cccccch ;white 1
dd 00cc0000h ;red 2
dd 0000cc00h ;green 3
dd 000000cch ;blue 4
dd 00cccc00h ;yellow 5
dd 0000cccch ;cyan 6
dd 00cc00cch ;pink 7

View File

@ -1,161 +0,0 @@
UP_KEY equ 178 ; the ascii keycodes of some keys
DOWN_KEY equ 177
LEFT_KEY equ 176
RIGHT_KEY equ 179
ENTER_KEY equ 13
ESCAPE_KEY equ 27
key:
mov eax,2 ; Read key ascii and store it into ah
int 0x40
cmp ah,LEFT_KEY ; Check if left key is pressed
jne no_left
cmp byte[status],'1'
jne no_left
go_left:
dec dword [current_block_x]
call check_crash
jz no_left
inc dword [current_block_x]
no_left:
cmp ah,RIGHT_KEY ; Check if right key is pressed
jne no_right
cmp byte[status],'1'
jne no_right
go_right:
inc dword [current_block_x]
call check_crash
jz no_right
dec dword [current_block_x]
no_right:
cmp ah,UP_KEY ; Compare pressed key with up key
jne no_up ; Jump to nu_up if up key isnt pressed
cmp byte[status],'0' ; Check if menu is running
jne no_menu2 ; Jump to no_up ifgame isnt running
cmp byte[menu],'0' ; Compare menu state with 0
jne no_menu0 ; Jump to no_menu0 if menu state isnt zero
mov byte[menu],'3' ; Change menu state to 2
call draw_window ; Redraw the window
jmp no_menu2 ; Jump to no_menu2
no_menu0:
dec byte[menu] ; menu state = menu state - 1
call draw_window ; Redraw the window
no_menu2:
cmp byte[status],'1' ; Compare game state with 1
jne no_up ; Jump to no_up if game state isnt 1 (if game isnt running)
call rotate_block
no_up:
cmp ah,DOWN_KEY ; Check if down key is pressed
jne no_down
cmp byte[status],'0'
jne no_menu3
cmp byte[menu],'3'
jne no_menu1
mov byte[menu],'0'
call draw_window
jmp no_menu3
no_menu1:
inc byte[menu]
call draw_window
no_menu3:
cmp byte[status],'1'
jne no_down
inc dword [current_block_y]
call check_crash
jne block_crash
jmp still
no_down:
cmp ah,'n' ; Check if n key is pressed
jne no_n
jmp new_game
no_n:
cmp ah,'p' ; Check if p key is pressed
jne no_p
cmp byte[status],'2'
je unpause
cmp byte[status],'1' ; add this two line or p will work
jne no_p ; when your still in the menu
mov byte[status],'2'
call draw_window
jmp attesa
unpause:
mov byte[status],'1'
call draw_window
jmp still
no_p:
cmp byte[status],'0'
jne no_menu
no_menu:
cmp byte[status],'1'
jne no_game
no_game:
cmp byte[status],'2'
jne no_pause1
no_pause1:
cmp ah,ENTER_KEY ; Check if enter key is pressed
jne no_enter
cmp byte[status],'0'
jne no_enter
call exemenu
no_enter:
cmp ah,ESCAPE_KEY ; Check if escape key is pressed
jne no_escape
cmp byte[status],'0'
jne no_instr1
mov eax,-1
int 0x40
no_instr1:
cmp byte[status],'1'
jne no_menu4
mov byte[status],'0'
call draw_window
no_menu4:
cmp byte[status],'3'
jne no_menu5
mov byte[status],'0'
call draw_window
no_menu5:
cmp byte[status],'4'
jne no_escape
mov byte[status],'0'
call draw_window
no_escape:
cmp byte[status],'1'
jne still
jmp scendi
ret

View File

@ -1,137 +0,0 @@
draw_menu:
cmp byte[menu],'0'
jne menu1
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ffff00
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
menu1:
cmp byte[menu],'1'
jne menu2
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ffff00
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
menu2:
cmp byte[menu],'2'
jne menu3
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ffff00
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ff0000
mov edx,quit
mov esi,paused-quit
int 0x40
menu3:
cmp byte[menu],'3'
jne menu4
mov eax,4
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-39)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*4)
mov ecx,0x10ff0000
mov edx,startgame
mov esi,instr-startgame
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-84)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*5)
mov ecx,0x10ff0000
mov edx,instr
mov esi,hist-instr
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-50)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*6)
mov ecx,0x10ff0000
mov edx,hist
mov esi,quit-hist
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98-26)/2*65536+(((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-2)/8*7)
mov ecx,0x10ffff00
mov edx,quit
mov esi,paused-quit
int 0x40
menu4:
ret
exemenu:
cmp byte[menu],'0' ;start
jne exemenu1
call new_game
exemenu1:
cmp byte[menu],'1' ;instr
jne exemenu2
mov byte[status],'4'
call draw_window
exemenu2:
cmp byte[menu],'2' ;history
jne exemenu3
mov byte[status],'3'
call draw_window
exemenu3:
cmp byte[menu],'3' ;exit
jne exemenu4
mov eax,-1
int 0x40
exemenu4:
ret

View File

@ -1,87 +0,0 @@
mouse:
mov eax,37 ; get mouse position ; EXPERIMENTAL !!!
mov ebx,1 ; window relative ;
int 0x40 ; ;
shr eax,16 ; we only need to know the x position ;
sub eax,X_LOCATION ;
;
cmp eax,ADOBE_SIZE*(LEN_X-2) ; check to see if mouse is in field ;
jg no_mouse ; ;
cmp eax,0 ; ;
jl no_mouse ; ;
;
mov ebx,0 ;
;
mouseloop: ;
cmp eax,ADOBE_SIZE ;
jl yes_mouse ;
sub eax,ADOBE_SIZE ;
inc ebx ;
jmp mouseloop ;
;
yes_mouse: ;
cmp ebx,[current_block_x]
jg go_right
jl go_left
; mov dword[current_block_x],ebx ;
mov eax,37 ; get mouse position ;
mov ebx,2 ; buttons pressed (1=left, 2=right, 3=both) ;
int 0x40 ;
;
cmp eax,0 ;
jne yes_mouse_button ;
mov byte[lastmousebutton],0 ;
jmp no_mouse ;
yes_mouse_button: ;
;
cmp eax,2 ;
jne no_left_mouse ;
cmp byte[status],'1' ;
jne no_left_mouse ;
mov byte[lastmousebutton],2 ;
inc dword [current_block_y] ;
call check_crash ;
jne block_crash ;
jmp no_mouse ;
;
no_left_mouse: ;
;
;
cmp eax,1 ;
jne no_right_mouse ;
cmp byte[status],'1' ;
jne no_right_mouse ;
cmp byte[lastmousebutton],1 ;
mov byte[lastmousebutton],1 ;
je no_right_mouse ;
call rotate_block ;
call check_crash ;
jne block_crash ;
call draw_block ;
jmp scendi ;
;
no_right_mouse: ;
;
;
cmp eax,3 ;
jne no_mouse ;
cmp byte[lastmousebutton],3 ;
mov byte[lastmousebutton],3 ;
je no_mouse ;
cmp byte[status],'2' ;
je unpause ;
mov byte[status],'2' ;
call draw_window ;
jmp attesa ;
; unpause: ;
; mov byte[status],'1' ;
; call draw_window ;
; jmp still ;
;
; ;
no_mouse: ;
ret

View File

@ -1,18 +0,0 @@
;--------------------------------------------------------------
random: mov eax,[generator]
add eax,-43ab45b5h
ror eax,1
xor eax,32c4324fh
ror eax,1
mov [generator],eax
; --- IVAN ---
push ebx
mov eax,22
mov ebx,9
int 0x40
pop ebx
xor eax,0xdeadbeef
add eax,[generator]
; --- IVAN ---
ret

View File

@ -1,100 +0,0 @@
write_score:
mov eax,13
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-3)*65536+95 ;clear box to write new score
mov ecx,20*65536+((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION-20)
mov edx,0x00000000
int 40h
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+25 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,scoretext
mov esi,linestext-scoretext
mov eax,4
int 0x40
mov eax,[score]
call number_to_str
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+25 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+35 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,linestext
mov esi,speedtext-linestext
mov eax,4
int 0x40
mov eax,[lines]
call number_to_str
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+35 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+45 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,speedtext
mov esi,leveltext-speedtext
mov eax,4
int 0x40
mov eax,[speed]
call number_to_str
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+45 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2)*65536+55 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,leveltext
mov esi,startgame-leveltext
mov eax,4
int 0x40
mov eax,[level]
call number_to_str
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+35)*65536+55 ; draw info text with function 4
mov ecx,0xffff00 ; color
mov edx,number_str
mov esi,[size_of_number_str]
mov eax,4
int 0x40
call draw_next_block
ret
number_to_str:
mov edi,end_number_str-1
mov ecx,9;size_of_number_str
mov ebx,10
cld
new_digit:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
loop new_digit
ret

View File

@ -1,56 +0,0 @@
;--------------------------------------------------------------
; DRAW_TABLE
;--------------------------------------------------------------
draw_table: mov esi,table_tetris+LEN_X*BORDER_TOP+BORDER_LEFT
mov ebx,X_LOCATION*65536+ADOBE_SIZE
mov ecx,Y_LOCATION*65536+ADOBE_SIZE
mov edi,LEN_Y-BORDER_TOP-BORDER_BOTTOM
y_draw: push edi
mov edi,LEN_X-BORDER_LEFT-BORDER_RIGHT
x_draw: push edi
mov ax,13
movzx edx,byte [esi]
mov edx,[color_table+edx*4]
int 0x40
call draw_frames
inc esi
add ebx,65536*ADOBE_SIZE
pop edi
dec edi
jnz x_draw
add esi,BORDER_LEFT+BORDER_RIGHT
mov ebx,X_LOCATION*65536+ADOBE_SIZE
add ecx,65536*ADOBE_SIZE
pop edi
dec edi
jnz y_draw
ret
;--------------------------------------------------------------
clear_table_tetris:
cld
mov al,1
mov edi,table_tetris
mov ecx,LEN_X*BORDER_TOP
rep stosb
mov edx,LEN_Y-BORDER_TOP-BORDER_BOTTOM
adr300: mov cl,BORDER_LEFT
rep stosb
dec ax ;AL=0
mov cl,LEN_X-BORDER_LEFT-BORDER_RIGHT
rep stosb
inc ax ;AL=1
mov cl,BORDER_RIGHT
rep stosb
dec dx
jne adr300
mov ecx,LEN_X*BORDER_BOTTOM
rep stosb
ret

File diff suppressed because it is too large Load Diff

View File

@ -1,142 +0,0 @@
draw_window:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98
mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+4
mov edx,0x03000000 ; color of work area RRGGBB
mov esi,0x006688ee ; color of grab bar RRGGBB,8->col
mov edi,0x007799ff ; color of frames RRGGBB
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+5 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,scoretext-labelt ; text length
int 0x40
cmp byte[status],'0'
jne status1
call draw_logo
call draw_menu
status1:
cmp byte[status],'1'
jne status2
call draw_game
status2:
cmp byte[status],'2'
jne status3
call draw_game
mov eax,4 ; function 4 : write text to window
mov ebx,80*65536+170 ; [x start] *65536 + [y start]
mov ecx,0x10ff0000 ; color of text RRGGBB
mov edx,paused ; pointer to text beginning
mov esi,txt_end-paused ; text length
int 0x40
status3:
cmp byte[status],'3'
jne status4
call draw_logo
mov edx,history
call show_text
status4:
cmp byte[status],'4'
jne status5
call draw_logo
mov edx,instructions
call show_text
status5:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
draw_game:
call draw_table
movzx edx,byte [current_block_color]
call draw_block
call write_score
mov eax,38
mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-4) shl 16 + ((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-4)
mov ecx,20 shl 16 + ((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+2-4)
mov edx,0x00ffffff
int 0x40
ret
draw_logo:
mov ebx,2
mov ecx,2
mov edx,[color_table+1*4]
mov edi,tetris_t
call draw_title_block
mov ebx,5
mov ecx,3
mov edx,[color_table+2*4]
mov edi,tetris_e
call draw_title_block
mov ebx,8
mov ecx,2
mov edx,[color_table+3*4]
mov edi,tetris_t
call draw_title_block
mov ebx,11
mov ecx,3
mov edx,[color_table+4*4]
mov edi,tetris_r
call draw_title_block
mov ebx,13
mov ecx,2
mov edx,[color_table+5*4]
mov edi,tetris_i
call draw_title_block
mov ebx,15
mov ecx,3
mov edx,[color_table+6*4]
mov edi,tetris_s
call draw_title_block
mov ebx,20
mov ecx,2
mov edx,[color_table+7*4]
mov edi,tetris_II
call draw_title_block
ret
show_text:
mov ebx,6*65536+120 ; draw info text with function 4
mov ecx,0xff0000
mov esi,34
newline:
mov eax,4
int 0x40
add ebx,10
add edx,34
cmp [edx],byte 'x'
jne newline
ret

View File

@ -16,12 +16,13 @@ use32
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
db 'MENUET01' ; 8 byte id
dd 1 ; header version
dd START ; program start
dd I_END ; program image size
dd 0x100000 ; required amount of memory
dd 0x00000000 ; reserved=no extended header
dd mem ; required amount of memory
dd mem ; stack pointer
dd 0, 0 ; param, icon
include 'lang.inc'
include 'macros.inc'
@ -37,37 +38,29 @@ START: ; start of execution
mov [socketNum], eax
red:
call draw_window ; at first, draw the window
still:
mov eax,23 ; wait here for event
mov ebx,1
mov eax,10 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
dec eax
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
jmp still
red:
call draw_window
jmp still
dec eax
jnz button
key:
mov eax,2
mov al,2
int 0x40
jmp still
button:
mov eax,17
mov al,17
int 0x40
cmp ah,1 ; button id=1 ?
dec ah ; button id=1 ?
jnz noclose
mov eax, 53
mov ebx, 1
@ -76,13 +69,7 @@ button:
mov eax,-1
int 0x40
noclose:
cmp ah,2 ; SEND CODE ?
je send_xcode
jmp still
; it was not close button, so it must be send code button
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
@ -92,17 +79,11 @@ button:
send_xcode:
mov esi,send_data ; header
mov edi,I_END
mov ecx,end_message-send_data
cld
rep movsb
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socketNum]
mov edx,end_message-send_data
mov esi,I_END
mov esi,send_data
int 0x40
jmp still
@ -124,8 +105,6 @@ draw_window:
mov ebx,100*65536+250 ; [x start] *65536 + [x size]
mov ecx,60*65536+150 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl
mov edi,0x00aabbcc ; color of frames RRGGBB
int 0x40
; WINDOW LABEL
@ -143,7 +122,6 @@ draw_window:
mov esi,0x667788
int 0x40
cld
mov ebx,25*65536+50 ; draw info text with function 4
mov ecx,0x000000
mov edx,text
@ -152,7 +130,7 @@ draw_window:
mov eax,4
int 0x40
add ebx,16
add edx,40
add edx,esi
cmp [edx],byte 'x'
jnz newline
@ -165,34 +143,38 @@ draw_window:
; DATA AREA
if lang eq ru
text:
db ' <20>®á« âì á®®¡é¥­¨¥ '
db ' '
db ' ‹®ª «ì­ë©  ¤à¥á : 192.168.0.1 '
db ' “¤ «ñ­­ë©  ¤à¥á : 192.168.0.2 '
db '’¥ªáâ ¨  ¤à¥á ¢ ª®­æ¥ ¨á室­¨ª  '
db 'x <- END MARKER, DONT DELETE '
db 'x' ; <- END MARKER, DONT DELETE
else
text:
db ' Send message '
db ' '
db ' Local address : 192.168.0.1 '
db ' Remote address : 192.168.0.2 '
db 'Text and address in end of source '
db 'x' ; <- END MARKER, DONT DELETE
end if
labeltext: db 'NetSend(Client)' ;
lte:
socketNum dd 0x0
remote_ip db 192,168,1,2
picture_position dd 0x0
send_data db '<27>ਢ¥â,íâ® â¥áâ!Hello,this is a test!'
end_message:
I_END:
align 4
socketNum dd ?
rb 32 ; this is for stack
mem:

View File

@ -183,13 +183,19 @@ draw_window:
; DATA AREA
if lang eq ru
text:
db '„ ­­ë©  ¤à¥á : 192.168.0.2 '
db '<27>à®á«ã訢 ¥¬ë© ¯®àâ : 0x5000 '
db '<27>à¨á« ­­ë¥ á®®¡é¥­¨ï: '
db 'x <- END MARKER, DONT DELETE '
db 'x' ; <- END MARKER, DONT DELETE
else
text:
db 'This address : 192.168.0.2 '
db 'Used port : 0x5000 '
db 'Received messages: '
db 'x' ; <- END MARKER, DONT DELETE
end if
labeltext: db 'NetSend(Server)'
lte:
@ -198,10 +204,3 @@ socketNum dd 0x0
I_END:

View File

@ -1,4 +1,4 @@
; @RCHER - DEflate unpacker v1.0
; @RCHER - Deflate unpacker v2.0 beta
;
; Written in pure assembler by Ivushkin Andrey aka Willow
;
@ -8,15 +8,17 @@
;
; Compile with FASM
SYS equ meos
PARAM_PTR equ png_image
OUTBUF equ 4*1024*1024
png_imag = output+OUTBUF
PARAM_PTR = os_work;png_image
MEMINIT=next_code;output
DUMPFILE equ '/hd/1/out.txt'
SHOW_RBLOCK equ 0;1
SHOW_PNG_SEC equ 0;1
SHOW_METH equ 0;1
FILE_NUM equ 0
FILE_NUM equ 15;8
MEMORY equ 0x800000
BITS equ 16
@ -28,7 +30,6 @@ NO_STOPS equ 1
SHOW_CHARS equ 0
BSIZE equ 512
INBUF equ BUFSIZE*BSIZE*2
OUTBUF equ 4*1024*1024
IGNORE_DIRS equ 0
MOVE_SLINE_LEV equ 8
@ -40,6 +41,9 @@ STAY_MODE equ 10000b
IPC_MODE equ 100000b
RAW_MODE equ 1000000b
THREAD_YES equ 10000000b
LIST_MODE equ 100000000b
MEM_MODE equ 1000000000b
FIND_MODE equ 10000000000b
if SYS eq win
format PE console
@ -57,34 +61,36 @@ use32
dd 0x01
dd start
dd I_END
dd MEMORY
dd MEMORY-2048
dd MEMINIT
dd main_stack;MEMORY-2048
if PARAM_PTR eq param
dd 0
else
dd PARAM_PTR
end if
dd 0x0
include "lang.inc"
if PARAM_PTR eq param
param db 'RQ'
db '000037'
db '/hd/1/zip/png.zip',0
param db 'N'
db '000015'
db '/hd/1/zip/gz/fasm-1~1.tgz',0
end if
;match =meos,SYS
;{
include "macros.inc"
; purge mov
include "debug.inc"
include 'dump.inc'
;}
end if
language equ en
include 'lang.inc'
language equ lang
if SYS eq win
section '.text' code readable executable writeable
end if
include "arcmacro.inc"
include "parser.inc"
include "deflate.inc"
@ -107,6 +113,12 @@ else
mcall 40,10000101b
; jmp again
CmdLine
cmdl:
test [Flags],LIST_MODE
jz red
; Dump [lpath],[lpath_len],os_work
; ud2
red:
call draw_window
mcall 12,2
@ -134,12 +146,15 @@ else
mcall -1
.noquit:
mcall 17
mcall 64,1,MEMINIT
QueryFile
and [FileNum],0
mov [FileNum],FILE_NUM
test eax,eax
jnz still
end if
again:
; Dump Flags,4,os_work
mov [fat_],fat
Newline
xor eax,eax
; and [Flags],STAY_MODE
@ -153,6 +168,11 @@ again:
Msg 14
jmp quit
.sizeok2:
call KillViewer
xor eax,eax
mov ecx,(child_stack-fat)/4
mov edi,fat
rep stosd
mov [filesize],ebx
test [Flags],RAW_MODE
jz .norawm
@ -213,13 +233,37 @@ again:
jmp exit
.sizeok1:
if ~ SYS eq win
call KillViewer
end if
Msg 39
Msg 39 ; unpacking PNG
mov ecx,[unp_size]
add ecx,output
mov [png_],ecx
mov eax,[PNG_info.Width]
imul eax,[PNG_info.Height]
lea eax,[eax+eax*2]
add ecx,eax
; dps 'Mem='
; dpd ecx
mcall 64,1
test eax,eax
jz .ok
Msg 41
jmp exit
.ok:
mov edi,[outp]
call Deflate.blkbegin
jmp .defl_end
.sizeok:
mov ecx,[unp_size]
dpd ecx
add ecx,output
; mov [png_],ecx
mcall 64,1
test eax,eax
jz .ok2
Msg 41
jmp exit
.ok2:
call Deflate ; <===========
.defl_end:
test [bits],7
@ -252,6 +296,8 @@ again:
pop ecx esi
jmp .skipAdler
.skipCRC:
; dps 'Out='
; dpd ecx
call UAdler
Msg 10
mov eax,[Adler32]
@ -283,15 +329,20 @@ if SYS eq win
else
test [Flags],PNG_MODE
jnz .nosave
test [Flags],LIST_MODE
jnz quit
test [Flags],TAR_MODE
jnz .nomsg
Msg 37
.nomsg:
mov [outfile.out],ebx
mcall 58,outfile
; dps 'Before Quit1'
; ud2
test [Flags],TAR_MODE
jnz .nosave
call StartPad
jz exit.pad
; call StartPad
.nosave:
end if
test [Flags],PNG_MODE
@ -300,7 +351,7 @@ end if
mov edi,filters
mov ecx,6
rep stosd
mov edi,png_image
mov edi,[png_]
mov esi,output
;//
mov [outp],edi
@ -310,34 +361,37 @@ end if
mov [outfile.size],edi
mov ebx,[outp];png_image
if SYS eq win
exit:
exit:
Msg 12
invoke CreateFile,outfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL
mov [hnd],eax
invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL
invoke CloseHandle, [hnd]
call RunViewer
and [arc_base],0
call RunViewer
and [arc_base],0
and [Flags],STAY_MODE
quit:
; dps 'Before Quit2'
quit:
QueryFile
test eax,eax
jnz again
invoke ExitProcess,0
else
exit:
exit:
mov [outfile.out],ebx
test [Flags],TAR_MODE
jz .notar
Msg 37
test [Flags],LIST_MODE
jne quit
mcall 58,outfile
.pad:
call StartPad
.notar:
.notar:
Msg 12
call RunViewer
and [arc_base],0
call RunViewer
and [arc_base],0
and [Flags],STAY_MODE
quit:
test [Flags],STAY_MODE
@ -352,16 +406,19 @@ NoPng:
else
jz still
end if
mov ecx,dumpf_len
mov esi,dumpfile
mov edi,filename
rep movsb
call OpenFile
test ebx,ebx
jz again.sizebadq
; Dump output,255,os_work
; ud2
; mov ecx,dumpf_len
; mov esi,dumpfile
; mov edi,filename
; rep movsb
; call OpenFile
; test ebx,ebx
; jz again.sizebadq
call TarParse
mov ecx,[FileNum]
call TarFindN
; dpd [outfile.size]
cmp [outfile.size],0
jz again.sizebadq
mov ebx,esi
@ -397,21 +454,21 @@ section '.idata' import data readable writeable
WriteFile,'WriteFile',\
SetFilePointer,'SetFilePointer',\
CloseHandle,'CloseHandle',\
GetStdHandle,'GetStdHandle',\
WriteConsole,'WriteConsoleA',\
ReadConsole,'ReadConsoleA',\
CreateProcess,'CreateProcessA',\
WritePrivateProfileString,'WritePrivateProfileStringA',\
ExitProcess,'ExitProcess'
GetStdHandle,'GetStdHandle',\
WriteConsole,'WriteConsoleA',\
ReadConsole,'ReadConsoleA',\
CreateProcess,'CreateProcessA',\
WritePrivateProfileString,'WritePrivateProfileStringA',\
ExitProcess,'ExitProcess'
import comdlg,\
GetOpenFileName,'GetOpenFileNameA'
import user,\
wsprintf,'wsprintfA',\
SendMessage,'SendMessageA',\
FindWindowEx,'FindWindowExA',\
WaitForInputIdle,'WaitForInputIdle'
wsprintf,'wsprintfA',\
SendMessage,'SendMessageA',\
FindWindowEx,'FindWindowExA',\
WaitForInputIdle,'WaitForInputIdle'
section '.reloc' fixups data readable discardable

View File

@ -177,7 +177,7 @@ str_table \
' ',\ ;38
<'<27>®¤£®â®¢ª  ¨§®¡à ¦¥­¨ï...',13,10>,\ ;39
<'“ª ¦¨â¥ "R" ¤«ï ®¡à ¡®âª¨ áëàëå ¤ ­­ëå. Žâ¬¥­ .',13,10>,\ ;40
' ',\ ;
<'<EFBFBD>¥ 墠⠥⠯ ¬ïâ¨! Žâ¬¥­ .',13,10>,\ ; 41
' ',\ ;
' ',\ ;
' ',\ ;
@ -232,7 +232,7 @@ str_table \
' ',\ ;38
<'Preparing bitmap...',13,10>,\ ;39
<'Specify "R" to force raw data. Abort.',13,10>,\ ;40
' ',\ ;
<'Not enough memory! Abort.',13,10>,\ ;
' ',\ ;
' ',\ ;
' ',\ ;

View File

@ -84,6 +84,11 @@ DKeys rd 3
Dheader rb 12
Dpassword rb PASSW_LEN
png_ dd ?
fat_ dd ?
fat_fnum dd ?
lpath dd ?
lpath_len dd ?
png_bpp dd ?
sline_len dd ?
IDATcount dd ?
@ -120,6 +125,15 @@ tblLen dw ?
hclen db ?
max_len dw ?
fat:
rb 4096;512
child_stack:
rb 1024
main_stack:
area:
rb INBUF
os_work rb 4*1024
bl_count rb BITS
next_code rw BITS
@ -143,16 +157,10 @@ hdist db ?
Distance rw 32
Dist_c rw 32
area:
rb INBUF
os_work rb 4*1024
output:
rb OUTBUF
;rb OUTBUF
png_image:
;png_image:
if SYS eq win
rb OUTBUF
end if

View File

@ -73,10 +73,16 @@ debug_outstr:
@@:
ret
_debug_crlf db 13, 10, 0
macro newline
{
dps <13,10>
pushf
pushad
mov edx, _debug_crlf
call debug_outstr
popad
popf
}
macro print message

View File

@ -128,7 +128,7 @@ if SHOW_METH eq 1
end if
pusha
xor eax,eax
mov ecx,(area-bl_count) / 4
mov ecx,(output-bl_count) / 4
mov edi,bl_count
rep stosd
popa

View File

@ -0,0 +1,55 @@
; Include file for dumping user apps' memory through new debug BOARD
; Max amount of bytes to be dumped
IPC_BUF equ 160
; Dump macro parameters:
; ptr - pointer to memory dumped
; len - dump length
; workarea - any work area for sysfunc 9
; run_new - if not empty, run BOARD unless it is running already
macro Dump ptr, len, workarea,run_new
{
local .exist,.lt
pusha
mov ebx,workarea
call Board_seek
if ~ run_new eq
test edx,edx
jne .exist
mcall 19,Board_seek.board_fn,0
mov edx,eax
mcall 5,20
end if
.exist:
mov esi,len
cmp esi,IPC_BUF
jbe .lt
mov esi,IPC_BUF
.lt:
mcall 60,2,edx,ptr
popa
}
if used Board_seek
Board_seek:
; ebx - prcinfo
xor edx,edx
mcall 9,,-1
mov ecx,eax
mov esi,dword[.board_fn]
.lp:
mcall 9
cmp dword[ebx+10],esi
; jne .no
; cmp dword[ebx+42],399
je .ok
.no:
loop .lp
ret
.ok:
mov edx,[ebx+30]
ret
.board_fn db 'BOARD '
end if

View File

@ -143,9 +143,6 @@ macro mcall a,b,c,d,e,f { ; mike.dld
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
@ -177,7 +174,7 @@ macro sub arg1,arg2
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1

View File

@ -22,11 +22,85 @@ PrintFilename:
rep movsb
mov dword[edi],0x00a0d
call DebugPrint
; mcall 10
; mcall 2
popa
call Add2Fat
ret
Add2Fat:
; edx - ptr, ecx - len
pusha
test [Flags],LIST_MODE
jz .ex
mov ebp,8
mov edi,edx
lea ebx,[edx+ecx]
mov ecx,[lpath_len]
cmp ecx,1
je .lbl
mov esi,[lpath]
repe cmpsb
jne .full
mov eax,[lpath_len]
sub dword[esp+24],eax;path_len-path
cmp edi,ebx
je .full
mov edx,edi
.lbl:
mov ecx,[esp+24]
mov al,'/'
repne scasb
mov eax,[fat_]
mov ecx,[esp+24]
jne .nofol
cmp edi,ebx
jne .full
lea ecx,[edi-1]
sub ecx,edx
or byte[eax+11],0x10
; sub edx,ecx
.nofol:
push [fat_fnum]
pop dword[eax+12]
mov edi,eax
mov esi,edx
.lp1:
mov bl,[esi]
lea edx,[eax+ebp]
inc esi
cmp bl,'.'
jne .nodot
lea edi,[eax+ebp]
mov ebp,11
jmp .ll
.nodot:
cmp edi,edx
jae .ll
mov [edi],bl
inc edi
.ll:
loop .lp1
mov ecx,11
dec eax
.lp2:
cmp byte[eax+ecx],0
jne .no0
mov byte[eax+ecx],' '
.no0:
loop .lp2
cmp eax,child_stack-1
jae .full
add [fat_],32
.full:
inc [fat_fnum]
.ex:
popa
ret
;path db '/';'fasm/examples/elfexe/'
;path_len:
; Parse routines:
; out: edx= 0 if all ok, 1 - central dir, 2-EOD
@ -78,16 +152,19 @@ end if
popa
end if
Newline
; Dump fat,160,os_work
ret
ZipFindN:
; ecx - file #
Msg 33
or [Flags],FIND_MODE
cmp ecx,[file_count]
jae .err
push ecx
call ResetFile
.nxt:
call ZipCrawl
cmp edx,51
je .ok2
@ -111,6 +188,7 @@ ZipFindN:
add esi,eax
mov edx,5
.ex:
and [Flags],-1-FIND_MODE
push edx
Msg edx
pop edx
@ -159,6 +237,8 @@ if IGNORE_DIRS eq 1
cmp byte[edx+ecx-1],'/'
je .skipdp
end if
test [Flags],FIND_MODE
jnz .skipdp
call PrintFilename
.skipdp:
movzx ecx,word[esi+28]
@ -252,7 +332,19 @@ PngParse:
mov [PNG_info.Width],eax
mov eax,[PNG_info.Height]
bswap eax
mov ebx,eax
mov [PNG_info.Height],eax
call scanline_calc
; dps 'All='
cmp [PNG_info.Color_type],3
jne .nopal
shl eax,3
inc eax
.nopal:
inc eax
imul eax,ebx
mov [unp_size],eax
; dpd eax
add esi,25
cmp byte[esi-5],0
rep_err e,52,29
@ -423,7 +515,8 @@ setcurb:
ret
TarParse:
call ResetFile
mov esi,output
; call ResetFile
.nxt:
call TarCrawl
; wait
@ -436,8 +529,9 @@ end if
inc [file_count]
.skipinc:
add eax,ecx
mov ebx,1
call FileSeek
; mov ebx,1
add esi,eax
; call FileSeek
jmp .nxt
TarFindN:
@ -447,7 +541,8 @@ TarFindN:
cmp ecx,[file_count]
jae .err
push ecx
call ResetFile
mov esi,output
; call ResetFile
.nxt:
call TarCrawl
if IGNORE_DIRS eq 1
@ -461,8 +556,9 @@ end if
dec dword[esp]
.seek:
add eax,ecx
mov ebx,1
call FileSeek
; mov ebx,1
add esi,eax
; call FileSeek
jmp .nxt
.err:
mov edx,4
@ -559,13 +655,8 @@ SfxParse:
.err:
ret
; Created: May 31, 2005
FiltCall:
dd PngFilter.nofilt,Filt_sub,Filt_up,Filt_av,Filt_paeth,PngFilter.nofilt
PngFilter:
; esi - filtered uncompressed image data
; edi - destination
mov cl,[PNG_info.Color_type]
scanline_calc:
movzx ecx,byte[PNG_info.Color_type]
mov eax,1
cmp cl,3
je .palette
@ -594,6 +685,15 @@ PngFilter:
jnz .noz2
inc eax
.noz2:
ret
; Created: May 31, 2005
FiltCall:
dd PngFilter.nofilt,Filt_sub,Filt_up,Filt_av,Filt_paeth,PngFilter.nofilt
PngFilter:
; esi - filtered uncompressed image data
; edi - destination
call scanline_calc
mov [sline_len],eax ; scanline length
push edi
and [Flags],not 1

View File

@ -105,7 +105,7 @@ RunViewer:
else
test [Flags],THREAD_YES
jnz .ex
mcall 51,1,thread,MEMORY
mcall 51,1,thread,child_stack;MEMORY
mov [child],eax
end if
.ex:
@ -191,7 +191,7 @@ thread:
mov ecx,[PNG_info.Width]
shl ecx,16
add ecx,[PNG_info.Height]
mcall 7,png_image,,10 shl 16+25
mcall 7,[png_],,10 shl 16+25
mcall 12,2
.still:
mcall 10
@ -208,6 +208,7 @@ thread:
jne .still
.close:
and [child],0
mcall 64,1,MEMINIT
mcall -1
KillViewer:
@ -256,7 +257,68 @@ macro CmdLine
mov ecx,255
mov edi,filename
rep movsb
jmp again
; test [Flags],LIST_MODE
; jz again
xor eax,eax
mov edi,filename
mov ecx,255
repne scasb
cmp byte[edi-2],'/'
je .slash
mov byte[edi-1],'/'
inc edi
.slash:
; Dump filename,255,os_work
; ud2
mov ecx,edi
; dec ecx
mov edx,ecx
mov dword[Finfo],13
; mov dword[Finfo.count],1
mov edi,filename+5
sub ecx,edi
.lp:
mov al,'/'
repne scasb
; jne .ex
; dpd ecx
and byte[edi-1],0
mcall 58,Finfo
mov byte[edi-1],'/'
test ebx,32
jz .lp
test [Flags],LIST_MODE
jne .listm
and byte[edi-1],0
; Dump filename,255,os_work
jmp .agg
; ud2
.listm:
lea esi,[edi-1+ecx]
lea edi,[esi+1]
std
rep movsb
and byte[edi],0
cld
; dpd filename
inc edi
dpd edi
cmp edx,edi
jne .slash2
; cmp byte[edi],'/'
; je .slash2
mov byte[edi],'/'
inc edx
.slash2:
sub edx,edi
mov [lpath],edi
mov [lpath_len],edx
dpd edx
.agg:
mov dword[Finfo],0
; ud2
jmp again;cmdl
.yespar:
cmp al,'N'
jne .nonum
@ -300,6 +362,10 @@ macro CmdLine
call get_6ASCII_num
jmp .fofs
.noofs2:
cmp al,'L'
jne .nolist
or [Flags],LIST_MODE
.nolist:
jmp .parse
get_6ASCII_num:
@ -319,8 +385,20 @@ get_6ASCII_num:
}
StartPad:
mcall 19,editorcmd,dumpfile
; mcall 19,editorcmd,dumpfile
pusha
mov esi,[outfile.size]
; dpd esi
mov [par_fsize],esi
mcall 19,editorcmd,editor_par
mov ecx,eax
mcall 5,20
mcall 60,2,,[outfile.out];output
mcall 64,1,MEMINIT
popa
ret
editorcmd db 'TINYPAD '
editor_par db '*'
par_fsize dd ?
end if

View File

@ -5,9 +5,16 @@
;
; Compile with FASM for Menuet
;
LMARGIN equ (15+5)
TMARGIN equ (35+5)
HSPACE equ 16
VSPACE equ 12
IPC_BUF equ 160
DR_GRID equ 0;1
FL_KRNL equ 1
include 'lang.inc'
include 'macros.inc'
use32
org 0x0
@ -15,18 +22,20 @@ include 'macros.inc'
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x2000 ; memory for app (4 Kb)
dd 0x2000 ; esp
dd i_end+0x2000 ; memory for app (4 Kb)
dd i_end+0x2000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
include 'MACROS.INC'
include 'debug.inc'
purge newline
MAXSTRINGS = 16
xpos dd 0x0
ypos dd 0
TMP = 80*(MAXSTRINGS+1)
START: ; start of execution
mcall 60,1,ipcbuff,IPC_BUF+20
mcall 40,1000111b
mov [ipcbuff+4],8
mov ecx,1024
flush:
mov eax,63
@ -34,20 +43,21 @@ START: ; start of execution
int 0x40
loop flush
mov ecx, 80*(MAXSTRINGS+1)
mov ecx, TMP
xor eax, eax
mov edi, text
mov edi, [targ]
rep stosb
mov [tmp],'x'
mov [tmp1],'x'
mov [tmp2],'x'
mov eax,14
int 0x40
and eax,0xffff0000
sub eax,400 shl 16
add eax,400
sub eax,399 shl 16
add eax,399
mov [xstart],eax
red:
call draw_window
still:
@ -62,7 +72,8 @@ still:
je key
cmp eax,3 ; button in buffer ?
je button
cmp eax,7
je ipc
mov eax,63
mov ebx,2
int 0x40
@ -71,44 +82,60 @@ still:
jne still
new_data:
mov ebp,[targ]
.no4:
cmp al,13
jne no13
mov [xpos],0
and dword[ebp-8],0
jmp new_check
no13:
cmp al,10
jne no10
inc [ypos]
cmp [ypos],MAXSTRINGS
jbe noypos
mov [ypos],MAXSTRINGS
mov esi,text+80
mov edi,text
inc dword[ebp-4]
cmp dword[ebp-4],MAXSTRINGS
jbe .noypos
mov dword[ebp-4],MAXSTRINGS
lea esi,[ebp+80]
mov edi,ebp
mov ecx,80*(MAXSTRINGS)
cld
rep movsb
mov esi,[ypos]
mov esi,[ebp-4]
imul esi,80
add esi,[xpos]
add esi,text
add esi,[ebp-8]
add esi,ebp
mov ecx,80
xor al,al
rep stosb
noypos:
.noypos:
mov [targ],text2
and [krnl_cnt],0
jmp new_check
no10:
mov esi,[ypos]
imul esi,80
add esi,[xpos]
mov [text+esi],al
inc [xpos]
cmp [xpos],80
jb xposok
mov [xpos],79
xposok:
cmp ebp,text1
je add2
mov ecx,[krnl_cnt]
cmp al,[krnl_msg+ecx]
jne .noknl
inc [krnl_cnt]
cmp [krnl_cnt],4
jne new_check
mov [targ],text1
.noknl:
mov ebp,[targ]
jecxz .add
push eax
mov esi,krnl_msg
.l1:
lodsb
call add_char
loop .l1
pop eax
.add:
and [krnl_cnt],0
add2:
call add_char
new_check:
@ -119,35 +146,126 @@ still:
cmp ebx,1
je new_data
cmp [vmode],2
je still
call draw_window
jmp still
red: ; redraw
call draw_window
jmp still
ipc:
mov [vmode],2
mov eax,ipcbuff
mov esi,[eax+8]
mov byte[eax],1
push dword[eax+12]
pop [dump_len]
mcall 9,work,-1
mov ecx,eax
.lp:
mcall 9
cmp [ebx+30],esi
je .ok
loop .lp
and [dump_len],0
jmp red
.ok:
mov [pid],esi
lea esi,[ebx+10]
mov edi,dump_title+10
mov ecx,12
rep movsb
jmp red
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
cmp ah,' '
je button.no_krnl_flt
cmp [vmode],2
jne still
cmp ah,176 ;left
jb still
cmp ah,179 ;right
ja still
mov ecx,[offs]
shr eax,8
sub eax,176
add ecx,[arrows+eax*4]
shl ecx,12
shr cx,12
jmp button.check_sel
.nol:
jmp still
arrows dd -1,16,-16,1
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose
jne .noclose
mov eax,-1 ; close this program
int 0x40
noclose:
.noclose:
shr eax,8
cmp eax,10
jb .nodump
lea edi,[eax-10]
mcall 37,1
sub eax,[edi*4+dump_cell_marg]
sub eax,TMARGIN+VSPACE
push eax
and eax,0xffff
xor edx,edx
div word[edi*4+dump_cell_size+2]
mov ecx,eax
shl ecx,16
xor edx,edx
pop eax
shr eax,16
div word[edi*4+dump_cell_size]
mov cx,ax
.check_sel:
mov eax,ecx
shl ax,12
shr eax,12
inc eax
cmp eax,[dump_len]
ja still;.nosel
mov dword[sel_byte],ecx
dec eax
mov [offs],eax
jmp red
.nodump:
cmp eax,2
jne .no_krnl_flt
xor [flag],FL_KRNL
jmp still
.no_krnl_flt:
mov [ipcbuff+4],8
and byte[ipcbuff],0
inc [vmode]
cmp [vmode],3
jb .vmok
and [vmode],0
.vmok:
jmp red
add_char:
push esi
mov esi,[ebp-4]
imul esi,80
add esi,[ebp-8]
mov [ebp+esi],al
inc dword[ebp-8]
cmp dword[ebp-8],80
jb .ok
mov dword[ebp-8],79
.ok:
pop esi
ret
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
@ -170,7 +288,7 @@ draw_window:
mov eax,0 ; function 0 : define and draw window
; mov ebx,50*65536+400 ; [x start] *65536 + [x size]
mov ebx,[xstart]
mov ecx,MAXSTRINGS*10+40 ; [y start] *65536 + [y size]
mov ecx,MAXSTRINGS*10+45 ; [y start] *65536 + [y size]
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
or edx,0x03000000
int 0x40
@ -184,9 +302,24 @@ draw_window:
mov esi,header.len ; text length
int 0x40
mov ecx,4
mov esi,[sc.work]
mov ebx,316 shl 16+5*6
mov edx,3;+1 shl 30
mcall 8,,<5,12>
mov edx,[vmode]
lea edx,[edx*4+duk]
mcall 4,<320,8>,,,4
cmp [vmode],2
je no_mdbg
mov ebx,15*65536+33 ; draw info text with function 4
mov ecx,[sc.work_text]
mov edx,text
mov edx,text1
cmp [vmode],0
je .kern
mov edx,text2
.kern:
mov esi,80
newline:
mov eax,4
@ -195,16 +328,199 @@ draw_window:
add edx,80
cmp [edx],byte 'x'
jne newline
jmp enddraw
no_mdbg:
if DUMP_TEST eq 1
mov esi,0
mov [dump_len],100;IPC_BUF
else
mov esi,ipcbuff+16
end if
mov ecx,[dump_len]
call dump_btn
call draw_dump
enddraw:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
if DR_GRID eq 1
draw_grid:
mov ecx,11
mov edi,(TMARGIN+VSPACE)shl 16+TMARGIN+VSPACE
.l1:
push ecx
mov ebx,LMARGIN shl 16+LMARGIN+16*HSPACE
mcall 38,,edi,0
add edi,VSPACE shl 16+VSPACE
pop ecx
loop .l1
mov ecx,17
mov edi,(TMARGIN+VSPACE)shl 16+TMARGIN+VSPACE*10
mov ebx,LMARGIN shl 16+LMARGIN
.l2:
push ecx
mcall 38,,edi,0
add ebx,HSPACE shl 16+HSPACE
pop ecx
loop .l2
ret
end if
draw_numbers:
mcall 4,(LMARGIN+2) shl 16+180,0,numb,numb_len-numb
mov eax,dword[sel_byte]
shl ax,12
shr eax,12
mov edi,eax
if ~ DUMP_TEST eq 1
add edi,ipcbuff+16
end if
mov edx,(LMARGIN+2+6*6)shl 16+180
mov ebx,0x30000
movzx ecx,byte[edi]
mcall 47,,,,0x4e00e7
add ebx,0x20000
add edx,(6*10)shl 16
movzx ecx,word[edi]
mcall
add ebx,0x50000
add edx,(6*13)shl 16
mov ecx,[edi]
mcall
mov ebx,0x80100
add edx,(6*19)shl 16
mcall
.ex:
ret
draw_dump:
; esi - data ptr, ecx - length
jecxz draw_numbers.ex
pusha
call draw_numbers
mcall 4,(LMARGIN+2) shl 16+27,0,dump_title,dump_t_len-dump_title
mcall 47,0x30101,ipcbuff+8,(LMARGIN+2+6*29)shl 16+27
add edx,(6*27) shl 16
mov ecx,offs
mcall
sub edx,(5*6)shl 16
mcall ,0x30001
mov ecx,16
mov edi,HSPACE shl 16
mov ebx,(LMARGIN+5)shl 16+42
call draw_marks
mov ecx,[esp+24]
dec ecx
shr ecx,4
inc ecx
mov ebx,(LMARGIN-10)shl 16+TMARGIN+2+VSPACE
mov edi,VSPACE
call draw_marks
popa
mov edx,TMARGIN+2
mov edi,ecx
.lp:
add edx,(LMARGIN+2) shl 16+VSPACE
mov ecx,16
cmp edi,ecx
jae .less
mov ecx,edi
.less:
sub edi,ecx
push esi ecx
mov ebx,0x20100
.lp1:
push ecx esi
movzx ecx,byte[esi]
mcall 47,,,,0
add edx,HSPACE shl 16
pop esi ecx
inc esi
loop .lp1
pusha
mov ebx,edx
and ebx,0xffff
add ebx,(LMARGIN+16*HSPACE+15)shl 16
mov edx,[esp+36]
mov esi,[esp+32]
mcall 4,,0
popa
add esp,8
and edx,0xffff
test edi,edi
jnz .lp
.ex:
ret
draw_marks:
; ebx -xy, edi-addition, ecx -cycles
pusha
mov edx,__hexdigits
mov eax,4
mov esi,1
.tt:
push ecx
mcall ,,0xffffff
add ebx,edi
inc edx
pop ecx
loop .tt
popa
ret
dump_btn: ; ecx-length
jecxz draw_dump.ex
pusha
test ecx,0xffff
je .even
add ecx,16
.even:
shr ecx,4
imul ecx,VSPACE
add ecx,(TMARGIN+VSPACE)shl 16-5
mcall 8,LMARGIN shl 16+16*HSPACE-5,,10+3 shl 29,[sc.work]
inc edx
mcall ,(LMARGIN+16*HSPACE+15)shl 16+6*16
mov edx,0xff0000
mov esi,dump_cell_size
xor eax,eax
movzx ebx,[sel_byte]
lodsw
imul bx,ax
shl ebx,16
lea ebx,[ebx+eax+LMARGIN shl 16]
movzx ecx,[sel_byte+2]
lodsw
imul cx,ax
shl ecx,16
lea ecx,[ecx+eax+(TMARGIN+VSPACE) shl 16]
mcall 13
movzx ebx,[sel_byte]
lodsw
imul bx,ax
shl ebx,16
lea ebx,[ebx+eax+(LMARGIN+16*HSPACE+15)shl 16]
mcall 13
popa
.ex:
ret
krnl_msg db 'K : '
duk db 'KernUserDump'
numb db 'Byte: Word: Dword: Hex:'
numb_len:
dump_title db 'Dump from (pid= h) Offset: ( h)'
dump_t_len:
; DATA AREA
dump_cell_marg dd LMARGIN shl 16,(LMARGIN+16*HSPACE+15)shl 16
dump_cell_size dw HSPACE,VSPACE,6,VSPACE
; 11,11 > 0,-1
; 5,11 > 0,-1
if lang eq ru
header:
db '„Ž‘Š€ Ž’‹€„Šˆ ˆ ŽŽ<C5BD>™…<E284A2>ˆ‰'
@ -214,8 +530,27 @@ else
db 'GENERAL DEBUG & MESSAGE BOARD'
.len = $ - header
end if
krnl_cnt dd 0
vmode dd 0
targ dd text2
I_END:
text rb 80*(MAXSTRINGS+1)
tmp db ?
offs dd ?
flag rb 1
ipcbuff rb IPC_BUF+20
rd 2
; x1pos dd ?
; y1pos dd ?
text1 rb 80*(MAXSTRINGS+1)
tmp1 db ?
rd 2
; x2pos dd ?
; y2pos dd ?
text2 rb 80*(MAXSTRINGS+1)
tmp2 db ?
work rb 4096
sel_byte dw ?,?
pid dd ?
xstart dd ?
sc system_colors
dump_len dd ?
sc system_colors
i_end:

View File

@ -1982,7 +1982,7 @@ exec_fileinfo:
end_name db '/RD/1/END',0
menu_name db '/RD/1/MENU',0
calendar_name db '/RD/1/CALENDAR',0
sysmeter_name db '/RD/1/SYSMETER',0
sysmeter_name db '/RD/1/GMON',0
dat_fileinfo:
dd 0

View File

@ -107,29 +107,6 @@ still:
jmp bg2
set_default_colours:
pusha
mov eax,6 ; load default color map
mov ebx,defcol
mov ecx,0
mov edx,-1
mov esi,0x8000
int 0x40
mov eax,48 ; set default color map
mov ebx,2
mov ecx,0x8000
mov edx,10*4
int 0x40
popa
ret
defcol db 'DEFAULT.DTP'
check_parameters:
cmp [I_Param],dword 'BOOT'
@ -137,7 +114,6 @@ check_parameters:
ret
@@:
call set_default_colours
call load_texture
mov eax,15
@ -148,7 +124,8 @@ check_parameters:
mov eax,15
mov ebx,5
mov ecx,0x40000+1
mov ecx,0x40000 ; <<< 0x40000 for blue, 0x40000+1 for red,
; <<< 0x40000+2 for green background at boot
mov edx,0
mov esi,256*3*256
int 0x40
@ -308,7 +285,7 @@ gentexture:
ylup:
mov ebx,0
call precalcbar
; call precalcbar
xlup:
push edi
@ -342,10 +319,10 @@ gentexture:
mov eax,esi ; now evaluate color...
cmp eax,255*24
jbe ok2
; cmp eax,255*24
; jbe ok2
; imul eax,12
ok2:
; ok2:
mov edi,24 ; 50 = max shaded distance
idiv edi
@ -376,21 +353,21 @@ wrappit:
nowrap:
ret
precalcbar:
pusha
mov eax,1
mov ebx,ecx
add ebx,18
mov ecx,44
mov edx,0x00000060
bar:
add ecx,2
add edx,0x00020100
;precalcbar:
; pusha
; mov eax,1
; mov ebx,ecx
; add ebx,18
; mov ecx,44
; mov edx,0x00000060
; bar:
; add ecx,2
; add edx,0x00020100
; int 0x40
cmp ecx,298
jb bar
popa
ret
; cmp ecx,298
; jb bar
; popa
; ret
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW *********
@ -517,12 +494,7 @@ draw_window:
mov ecx,(y_add2+40)*65536+14 ; button start y & size
newcb:
push edx
sub edx,14
shl edx,2
add edx,colors
mov esi,[edx]
pop edx
mov esi,[(edx-14)*4+colors]
mov eax,8
int 0x40

View File

@ -11,15 +11,14 @@ use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x5000 ; memory for app
dd 0x5000 ; memory for app
dd 0x4ff0 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
dd 0x0 , 0x0 ; I_Param , I_Icon
include 'lang.inc'
include 'macros.inc'
START: ; start of execution
@ -204,7 +203,7 @@ dw_continue:
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+400 ; [x start] *65536 + [x size]
mov ecx,100*65536+200 ; [y start] *65536 + [y size]
mov edx,0x030020C0;0x00000040 ; color of work area RRGGBB,8->color glide
mov edx,0x020020C0;0x00000040 ; color of work area RRGGBB,8->color glide
mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color glide
mov edi,0x00ffffff ; color of frames RRGGBB
int 0x40
@ -212,6 +211,13 @@ dw_continue:
; WINDOW LABEL
call print_my_title
; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button
mov ebx,(400-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,5*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id
mov esi,0x5599cc ; button color RRGGBB
int 0x40
; BUTTONS
xor eax,eax
@ -1016,7 +1022,7 @@ warning_window:
warning_loop:
mov eax,5
mov ebx,10
mov ebx,13
int 0x40
mov eax,11
int 40h