5,16 → 5,8 |
; |
; 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 |
WRITE_LOG equ 1 |
|
FL_KRNL equ 1 |
|
include 'lang.inc' |
|
use32 |
23,8 → 15,8 |
dd 0x01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd i_end+0x2000 ; memory for app (4 Kb) |
dd i_end+0x2000 ; esp |
dd mem ; memory for app |
dd mem ; esp |
dd filename , 0x0 ; I_Param , I_Icon |
include '../../../macros.inc' |
include 'debug.inc' |
44,9 → 36,6 |
jnz @b |
param: |
|
mcall 60,1,ipcbuff,IPC_BUF+20 |
mcall 40,1000111b |
mov [ipcbuff+4],8 |
; allow user to see messages written before start |
; mov ecx,4096 |
; flush: |
95,8 → 84,6 |
je key |
cmp eax,3 ; button in buffer ? |
je button |
cmp eax,7 |
je ipc |
|
mov eax,63 |
mov ebx,2 |
190,58 → 177,17 |
cmp ebx,1 |
je new_data |
|
cmp [vmode],2 |
je still |
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 al,2 ; just read it and ignore |
mcall |
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: |
je button.noclose |
jmp still |
|
arrows dd -1,16,-16,1 |
|
button: ; button |
mov al,17 ; get id |
mcall |
252,51 → 198,9 |
or eax,-1 ; close this program |
mcall |
.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 |
xor [vmode],1 |
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] |
341,8 → 245,6 |
lea edx,[edx*4+duk] |
mcall 4,<300,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,text1 |
358,18 → 260,6 |
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 |
mcall |
376,169 → 266,7 |
|
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 |
|
|
if WRITE_LOG |
;******************************************** |
;* input: esi = pointer to the file name * |
606,16 → 334,10 |
|
|
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: |
duk db 'KernUser' |
|
; 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 |
631,7 → 353,6 |
I_END: |
offs dd ? |
flag rb 1 |
ipcbuff rb IPC_BUF+20 |
rd 2 |
; x1pos dd ? |
; y1pos dd ? |
642,12 → 363,11 |
; y2pos dd ? |
text2 rb 80*(MAXSTRINGS+1) |
tmp2 db ? |
work rb 4096 |
sel_byte dw ?,? |
pid dd ? |
xstart dd ? |
dump_len dd ? |
sc system_colors |
i_end: |
|
filename rb 256 |
align 4 |
stackbuf rb 2000h |
mem: |