2010-10-01 13:21:55 +04:00
|
|
|
|
; Copyright (c) 2009, <Lrz>
|
|
|
|
|
; All rights reserved.
|
|
|
|
|
;
|
|
|
|
|
; Redistribution and use in source and binary forms, with or without
|
|
|
|
|
; modification, are permitted provided that the following conditions are met:
|
|
|
|
|
; * Redistributions of source code must retain the above copyright
|
|
|
|
|
; notice, this list of conditions and the following disclaimer.
|
|
|
|
|
; * Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
; notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
; documentation and/or other materials provided with the distribution.
|
|
|
|
|
; * Neither the name of the <organization> nor the
|
|
|
|
|
; names of its contributors may be used to endorse or promote products
|
|
|
|
|
; derived from this software without specific prior written permission.
|
|
|
|
|
;
|
|
|
|
|
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
|
|
|
|
|
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
|
|
|
|
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
;*****************************************************************************
|
|
|
|
|
|
2013-05-28 23:09:31 +04:00
|
|
|
|
; тут описываются процедуры которые используются в secondary loader
|
2012-03-08 12:33:38 +04:00
|
|
|
|
color_sym_black equ 0
|
|
|
|
|
color_sym_blue equ 1
|
|
|
|
|
color_sym_green equ 2
|
2010-10-01 13:21:55 +04:00
|
|
|
|
color_sym_turquoise equ 3
|
2012-03-08 12:33:38 +04:00
|
|
|
|
color_sym_red equ 4
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
color_sym_lightgray equ 7
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
color_sym_lightblue equ 9
|
2010-10-01 13:21:55 +04:00
|
|
|
|
color_sym_lettuce equ 10
|
2012-03-08 12:33:38 +04:00
|
|
|
|
color_sym_pink equ 12
|
|
|
|
|
color_sym_yellow equ 14
|
|
|
|
|
color_sym_white equ 15
|
2010-10-01 13:21:55 +04:00
|
|
|
|
if DEBUG
|
|
|
|
|
decode:
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;input eax - число, es:di куда писать, cx=10
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp eax, ecx
|
2010-10-01 13:21:55 +04:00
|
|
|
|
jb @f
|
2012-03-08 12:33:38 +04:00
|
|
|
|
xor edx, edx
|
2010-10-01 13:21:55 +04:00
|
|
|
|
div ecx
|
|
|
|
|
push edx
|
|
|
|
|
call decode
|
|
|
|
|
pop eax
|
2012-03-08 12:33:38 +04:00
|
|
|
|
@@:
|
|
|
|
|
or al, 0x30
|
|
|
|
|
mov [ds:di], al
|
2010-10-01 13:21:55 +04:00
|
|
|
|
inc di
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
putchar:
|
|
|
|
|
; in: al=character
|
|
|
|
|
mov ah, 0Eh
|
|
|
|
|
mov bh, 0
|
|
|
|
|
int 10h
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
printplain:
|
|
|
|
|
; in: si->string
|
|
|
|
|
pushad
|
|
|
|
|
lodsb
|
|
|
|
|
@@:
|
|
|
|
|
call putchar
|
|
|
|
|
lodsb
|
2012-03-08 12:33:38 +04:00
|
|
|
|
test al, al
|
2010-10-01 13:21:55 +04:00
|
|
|
|
jnz @b
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov al, 13
|
2010-10-01 13:21:55 +04:00
|
|
|
|
call putchar
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov al, 10
|
2010-10-01 13:21:55 +04:00
|
|
|
|
call putchar
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
getkey:
|
|
|
|
|
; get number in range [bl,bh] (bl,bh in ['0'..'9'])
|
|
|
|
|
; in: bx=range
|
|
|
|
|
; out: ax=digit (1..9, 10 for 0)
|
|
|
|
|
mov ah, 0
|
|
|
|
|
int 16h
|
|
|
|
|
cmp al, bl
|
|
|
|
|
jb getkey
|
|
|
|
|
cmp al, bh
|
|
|
|
|
ja getkey
|
|
|
|
|
push ax
|
|
|
|
|
call putchar
|
|
|
|
|
pop ax
|
|
|
|
|
and ax, 0Fh
|
|
|
|
|
jnz @f
|
|
|
|
|
mov al, 10
|
|
|
|
|
@@:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
;setcursor:
|
|
|
|
|
; in: dl=column, dh=row
|
|
|
|
|
; mov ah, 2
|
|
|
|
|
; mov bh, 0
|
|
|
|
|
; int 10h
|
|
|
|
|
; ret
|
|
|
|
|
|
|
|
|
|
;macro _setcursor row,column
|
|
|
|
|
;{
|
|
|
|
|
; mov dx, row*256 + column
|
|
|
|
|
; call setcursor
|
|
|
|
|
;}
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
get_firs_sym:
|
|
|
|
|
.start:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov al, byte [es:di]
|
|
|
|
|
inc di
|
|
|
|
|
dec cx
|
|
|
|
|
jcxz .exit
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp al, 0xa ;cmp al,0xa
|
|
|
|
|
jz ._entry
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp al, ';'
|
|
|
|
|
jnz .start
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
.first_com:
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov al, 0xa
|
|
|
|
|
repnz scasb
|
2010-10-01 13:21:55 +04:00
|
|
|
|
jcxz .exit
|
|
|
|
|
._entry:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov al, byte [es:di]
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.first_sp:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp al, ' '
|
|
|
|
|
jnz .not_space
|
|
|
|
|
|
|
|
|
|
; mov al,' ' ;cut ' '
|
|
|
|
|
repe scasb
|
|
|
|
|
dec di
|
|
|
|
|
inc cx
|
|
|
|
|
mov al, byte [es:di]
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.not_space:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp al, ';'
|
|
|
|
|
jz .first_com
|
|
|
|
|
.exit:
|
|
|
|
|
ret
|
2010-10-01 13:21:55 +04:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
show_name_section:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push si
|
|
|
|
|
push ini_data_
|
|
|
|
|
pop es
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov al, ']'
|
|
|
|
|
repnz scasb
|
|
|
|
|
test cx, cx
|
|
|
|
|
jz error.incorect_section_def
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.find_val_name_fb1:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov al, 'n'
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.find_val_name_fb:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
repnz scasb
|
|
|
|
|
jcxz .not_name_sec_fb
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov si, parse_name
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push cx
|
|
|
|
|
push di
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov cx, parse_name_e -parse_name
|
|
|
|
|
repe cmpsb
|
|
|
|
|
pop di
|
|
|
|
|
pop cx
|
|
|
|
|
jz .yaaa_find_value
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
jmp .find_val_name_fb
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
.yaaa_find_value:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
sub cx, parse_name_e -parse_name
|
|
|
|
|
add di, parse_name_e -parse_name
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov ax, 0x3d20 ; ah='='
|
|
|
|
|
repe scasb
|
|
|
|
|
test cx, cx
|
|
|
|
|
jz .not_name_sec_fb
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp ah, byte [es:di-1] ;find '='
|
|
|
|
|
jnz .find_val_name_fb1
|
|
|
|
|
|
|
|
|
|
repe scasb ;cut ' '
|
|
|
|
|
inc cx
|
|
|
|
|
dec di
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;все вырезали и все готово для вывода имени секции ))
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push es
|
|
|
|
|
pop ds
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
.def_sect_name:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push 0xb800
|
|
|
|
|
pop es
|
2010-10-01 13:21:55 +04:00
|
|
|
|
;clear array for message
|
2012-03-08 12:33:38 +04:00
|
|
|
|
xor ax, ax
|
2010-10-01 13:21:55 +04:00
|
|
|
|
if DEBUG
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov ax, 0x0720
|
2010-10-01 13:21:55 +04:00
|
|
|
|
end if
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov cx, 39
|
|
|
|
|
mov si, di
|
|
|
|
|
mov di, dx
|
|
|
|
|
sub di, 2
|
|
|
|
|
rep stosw
|
2010-10-01 13:21:55 +04:00
|
|
|
|
;//////////////////////
|
|
|
|
|
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov di, dx
|
|
|
|
|
mov ah, color_sym_white;color_sym_lightblue
|
|
|
|
|
mov cx, 36
|
|
|
|
|
lodsb
|
|
|
|
|
sub di, 2
|
|
|
|
|
cmp al, '"'
|
|
|
|
|
jz @f
|
|
|
|
|
cmp al, "'"
|
|
|
|
|
jnz .end_sh_name_sec
|
2010-10-01 13:21:55 +04:00
|
|
|
|
@@:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
lodsb
|
|
|
|
|
@@:
|
|
|
|
|
stosw
|
|
|
|
|
lodsb
|
|
|
|
|
cmp al, '"'
|
|
|
|
|
jz .end_sh_name_sec
|
|
|
|
|
cmp al, "'"
|
|
|
|
|
jz .end_sh_name_sec
|
|
|
|
|
loop @b
|
|
|
|
|
|
|
|
|
|
mov al, '}'
|
|
|
|
|
mov ah, color_sym_yellow
|
|
|
|
|
stosw
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.end_sh_name_sec:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
pop si
|
|
|
|
|
ret
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2013-05-28 23:09:31 +04:00
|
|
|
|
.not_name_sec_fb: ;нет имени в названии секции - значит так и скажем об этом
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
mov di, default_section_name
|
|
|
|
|
jmp .def_sect_name
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;процедура поиска вверх следующей секции
|
|
|
|
|
;в point_default содержиться указатель на дефаулт секцию, и в пределах врейма мы бегаем по заранее пропарсеными значениям указателей
|
|
|
|
|
;для того что бы отобразить и пропарсить следующий фрейм, нам нужно получить за пердыдущий или следующий указатель
|
2010-10-01 13:21:55 +04:00
|
|
|
|
find_before_sect:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov di, point_default
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.e:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push ini_data_
|
|
|
|
|
pop es
|
2013-05-28 23:09:31 +04:00
|
|
|
|
mov cx, di ;предположим будем просматривать к началу, текущая позиция di = сколько символов от начала документа имеется
|
|
|
|
|
mov bx, cx ;копия
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;настроили указатель на дефаулт секцию
|
|
|
|
|
;будем искать вверх
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.find_start_section:
|
2013-05-28 23:09:31 +04:00
|
|
|
|
std ;установка флага направления - будем просматирвать к началу нашего ини файла
|
|
|
|
|
;будем искать начало секции т.е. '[' этот символ
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov al, 0xa
|
2013-05-28 23:09:31 +04:00
|
|
|
|
repnz scasb ;просканируем на наличее символа начала секции
|
|
|
|
|
jcxz .go_ ;мы просмотрели до начала файла, но так и ничего не нашли ;(( по тихому выйдем )
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2013-05-28 23:09:31 +04:00
|
|
|
|
mov find_sec_di, di ;сохраним данные
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov cx, di ;
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
sub bx, cx
|
2013-05-28 23:09:31 +04:00
|
|
|
|
mov cx, bx ;в сx значение - кол-во символов
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cld
|
|
|
|
|
call get_firs_sym
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.ret_go:
|
2013-05-28 23:09:31 +04:00
|
|
|
|
jcxz ._not_section ; в данном случае имеем конструкцию 0xa ... ; hello [секция] обломс ищем далее
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2013-05-28 23:09:31 +04:00
|
|
|
|
cmp di, point_loader; секцию loader мы не заносим иначе крах
|
2012-03-08 12:33:38 +04:00
|
|
|
|
jz ._not_section
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;все удачно мы нашли вхождение секции предыдущей
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp al, '['
|
|
|
|
|
jnz ._not_section
|
|
|
|
|
mov point_default, di
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.exit_scan_sect:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
ret
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;;;;;;;; восстановим значения и продолжим поиски начала секции которая нас устроит ))
|
2010-10-01 13:21:55 +04:00
|
|
|
|
._not_section:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov di, find_sec_di
|
|
|
|
|
mov cx, di
|
|
|
|
|
mov bx, cx
|
|
|
|
|
jmp .find_start_section
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.go_:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cld
|
2013-05-28 23:09:31 +04:00
|
|
|
|
mov cx, bx ;в сx значение - кол-во символов
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
|
|
mov al, byte [es:di]
|
|
|
|
|
push word .f_go
|
|
|
|
|
cmp al, ' '
|
|
|
|
|
jz @f
|
|
|
|
|
jmp get_firs_sym.not_space
|
2010-10-01 13:21:55 +04:00
|
|
|
|
@@:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
jmp get_firs_sym.first_sp
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
.f_go:
|
2013-05-28 23:09:31 +04:00
|
|
|
|
jcxz .exit_scan_sect ; в данном случае имеем конструкцию 0xa ... ; hello [секция] обломс ищем далее
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2013-05-28 23:09:31 +04:00
|
|
|
|
cmp di, point_loader; секцию loader мы не заносим иначе крах
|
2012-03-08 12:33:38 +04:00
|
|
|
|
jz .exit_scan_sect
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;все удачно мы нашли вхождение секции предыдущей
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp al, '['
|
|
|
|
|
jnz .exit_scan_sect
|
|
|
|
|
mov point_default, di
|
|
|
|
|
ret
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
find_next_sect:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov di, point_default
|
|
|
|
|
push ini_data_
|
|
|
|
|
pop es
|
2013-05-28 23:09:31 +04:00
|
|
|
|
mov cx, save_cx;di ;предположим будем просматривать к концу, текущая позиция di = сколько символов от начала документа имеется
|
|
|
|
|
sub cx, di ;сейчас в cx остаток т.е. сколько можно крутить до конца и не вылазить на начало
|
2012-03-08 12:33:38 +04:00
|
|
|
|
jmp .let_s_go
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.h:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push ini_data_
|
|
|
|
|
pop es
|
2013-05-28 23:09:31 +04:00
|
|
|
|
mov cx, save_cx;di ;предположим будем просматривать к концу, текущая позиция di = сколько символов от начала документа имеется
|
|
|
|
|
; sub cx,di ;сейчас в cx остаток т.е. сколько можно крутить до конца и не вылазить на начало
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
|
|
mov al, byte [es:di]
|
|
|
|
|
push word .let_s_go_ret
|
|
|
|
|
cmp al, ' '
|
|
|
|
|
jz @f
|
|
|
|
|
jmp get_firs_sym.not_space
|
2010-10-01 13:21:55 +04:00
|
|
|
|
@@:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
jmp get_firs_sym.first_sp
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;настроили указатель на дефаулт секцию
|
|
|
|
|
;будем искать вниз
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.let_s_go:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
call get_firs_sym
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.let_s_go_ret:
|
2013-05-28 23:09:31 +04:00
|
|
|
|
jcxz .exit_scan_sect ; в данном случае имеем конструкцию 0xa ... ; hello [секция] обломс ищем далее
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp al, '['
|
|
|
|
|
jnz .let_s_go
|
|
|
|
|
cmp di, point_loader
|
|
|
|
|
jz .let_s_go
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;все удачно мы нашли вхождение секции предыдущей
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov point_default, di
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.exit_scan_sect:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
ret
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;clean old cursor
|
|
|
|
|
clean_active_cursor:
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;не изменяет значение ax
|
|
|
|
|
;отображение курсора по умолчанию
|
2012-03-08 12:33:38 +04:00
|
|
|
|
lea si, point_to_hframe
|
|
|
|
|
mov di, 962-160
|
|
|
|
|
mov dx, point_default
|
|
|
|
|
mov cx, 18
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.clean_show_cur:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov bx, [si]
|
|
|
|
|
add di, 160
|
|
|
|
|
cmp bx, dx
|
|
|
|
|
jz .clean_cursor_
|
|
|
|
|
sub si, 2
|
|
|
|
|
loop .clean_show_cur
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
; jmp $
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
.clean_cursor_:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push 0xb800
|
|
|
|
|
pop es
|
|
|
|
|
push ax
|
|
|
|
|
mov point_to_point_def, si
|
|
|
|
|
xor ax, ax
|
2010-10-01 13:21:55 +04:00
|
|
|
|
if DEBUG
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov ax, 0x0720
|
2010-10-01 13:21:55 +04:00
|
|
|
|
end if
|
2012-03-08 12:33:38 +04:00
|
|
|
|
stosw
|
|
|
|
|
add di, 68
|
|
|
|
|
stosw
|
|
|
|
|
pop ax
|
|
|
|
|
ret
|
2010-10-01 13:21:55 +04:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;установка таймера и отображение счетчика времени
|
2010-10-01 13:21:55 +04:00
|
|
|
|
gettime:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov ah, 0
|
2010-10-01 13:21:55 +04:00
|
|
|
|
int 1Ah
|
|
|
|
|
xchg ax, cx
|
|
|
|
|
shl eax, 10h
|
|
|
|
|
xchg ax, dx
|
|
|
|
|
ret
|
|
|
|
|
newtimer:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push ds
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
|
|
|
|
|
pushf
|
2012-03-08 12:33:38 +04:00
|
|
|
|
call far dword [old_timer]
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
call gettime
|
|
|
|
|
|
|
|
|
|
sub eax, dword[start_timer]
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov bx, word [value_timeout]
|
|
|
|
|
imul bx, 18
|
2010-10-01 13:21:55 +04:00
|
|
|
|
sub bx, ax
|
|
|
|
|
jbe .timergo
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push es
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
push 0xb800
|
|
|
|
|
pop es
|
|
|
|
|
mov ax, bx
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
mov bx, 18
|
|
|
|
|
xor dx, dx
|
|
|
|
|
div bx
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov bx, 10
|
|
|
|
|
mov di, 3734
|
|
|
|
|
call .decode
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
xor ax, ax
|
|
|
|
|
stosw
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
; wait 5/4/3/2 seconds, 1 second
|
2012-03-08 12:33:38 +04:00
|
|
|
|
pop es
|
2010-10-01 13:21:55 +04:00
|
|
|
|
popad
|
2012-03-08 12:33:38 +04:00
|
|
|
|
pop ds
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
iret
|
|
|
|
|
.timergo:
|
|
|
|
|
push 0
|
|
|
|
|
pop es
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov eax, dword [old_timer]
|
2010-10-01 13:21:55 +04:00
|
|
|
|
mov [es:8*4], eax
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov dword [timer_], eax
|
|
|
|
|
mov sp, word [start_stack]
|
|
|
|
|
mov bp, word [save_bp_from_timer]
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;;не восстановленый стек :(
|
2012-03-08 12:33:38 +04:00
|
|
|
|
sti
|
|
|
|
|
jmp parse_start.parse_run_only
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.decode:
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;input ax - число, es:di куда писать, bx=10
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp ax, bx
|
2010-10-01 13:21:55 +04:00
|
|
|
|
jb @f
|
2012-03-08 12:33:38 +04:00
|
|
|
|
xor dx, dx
|
2010-10-01 13:21:55 +04:00
|
|
|
|
div bx
|
|
|
|
|
push dx
|
|
|
|
|
call .decode
|
|
|
|
|
pop ax
|
2012-03-08 12:33:38 +04:00
|
|
|
|
@@:
|
|
|
|
|
or al, 0x30
|
|
|
|
|
push ax
|
|
|
|
|
mov ah, 9
|
2010-10-01 13:21:55 +04:00
|
|
|
|
stosw
|
2012-03-08 12:33:38 +04:00
|
|
|
|
pop ax
|
2010-10-01 13:21:55 +04:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
show_bl_sc_sect:
|
2013-05-28 23:09:31 +04:00
|
|
|
|
;1) отображение списка секций. Если секция не имет имя - ошибка - вывод Section unname
|
|
|
|
|
;проверка на наличее имени.
|
|
|
|
|
;входные данные es:di -указатель на секцию - cx размер секции
|
2012-03-08 12:33:38 +04:00
|
|
|
|
; push bp
|
|
|
|
|
mov bx, point_to_eframe
|
|
|
|
|
lea si, point_to_hframe
|
|
|
|
|
mov dx, 966
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|
|
|
|
|
.home_show_fb:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp si, bx
|
|
|
|
|
jb ._show_space_fb
|
|
|
|
|
mov di, [si]
|
|
|
|
|
sub si, 2
|
|
|
|
|
mov cx, [si]
|
|
|
|
|
sub cx, di ;home first section it's end before section
|
|
|
|
|
call show_name_section
|
|
|
|
|
add dx, 160
|
|
|
|
|
jmp .home_show_fb
|
2010-10-01 13:21:55 +04:00
|
|
|
|
._show_space_fb:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
sub dx, 4
|
|
|
|
|
push 0xb800
|
|
|
|
|
pop es
|
2010-10-01 13:21:55 +04:00
|
|
|
|
@@:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
cmp dx, 0xE64
|
|
|
|
|
ja .exit_show_fb
|
|
|
|
|
mov di, dx
|
2010-10-01 13:21:55 +04:00
|
|
|
|
;clear array for message
|
2012-03-08 12:33:38 +04:00
|
|
|
|
xor ax, ax
|
2010-10-01 13:21:55 +04:00
|
|
|
|
if DEBUG
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov ax, 0x0720
|
2010-10-01 13:21:55 +04:00
|
|
|
|
end if
|
2012-03-08 12:33:38 +04:00
|
|
|
|
mov cx, 39
|
|
|
|
|
rep stosw
|
2010-10-01 13:21:55 +04:00
|
|
|
|
;//////////////////////
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
|
add dx, 160
|
|
|
|
|
jmp @b
|
2010-10-01 13:21:55 +04:00
|
|
|
|
.exit_show_fb:
|
2012-03-08 12:33:38 +04:00
|
|
|
|
; pop bp
|
|
|
|
|
ret
|
2010-10-01 13:21:55 +04:00
|
|
|
|
|