PROTECTION TEST
1) Optimisations and code refactoring. 2) Reducing the consumption of RAM, 4 KB instead of 64 KB. 3) Translation into Russian. git-svn-id: svn://kolibrios.org@4618 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0dd1c5330c
commit
e81e5dc921
@ -1 +0,0 @@
|
||||
fasm test.asm test
|
6
programs/system/test/trunk/build_en.bat
Normal file
6
programs/system/test/trunk/build_en.bat
Normal file
@ -0,0 +1,6 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm -m 16384 test.asm test
|
||||
@kpack test
|
||||
@erase lang.inc
|
||||
@pause
|
6
programs/system/test/trunk/build_ru.bat
Normal file
6
programs/system/test/trunk/build_ru.bat
Normal file
@ -0,0 +1,6 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm -m 16384 test.asm test
|
||||
@kpack test
|
||||
@erase lang.inc
|
||||
@pause
|
@ -1,148 +1,134 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
;
|
||||
; PROTECTION TEST
|
||||
;
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; last update: 07/03/2014
|
||||
; changed by: Marat Zakiyanov aka Mario79, aka Mario
|
||||
; changes: Optimisations and code refactoring.
|
||||
; Reducing the consumption of RAM, 4 KB instead of 64 KB.
|
||||
; Translation into Russian.
|
||||
;---------------------------------------------------------------------
|
||||
use32
|
||||
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01' ; 8 byte id
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd I_END ; size of image
|
||||
dd 0x10000 ; memory for app
|
||||
dd 0xfff0 ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
dd IM_END ; memory for app
|
||||
dd stack_top ; esp
|
||||
dd 0x0 ; I_Param
|
||||
dd 0x0 ; I_Icon
|
||||
;-------------------------------------------------------------------------------
|
||||
include '../../../macros.inc'
|
||||
include 'lang.inc'
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
START: ; start of execution
|
||||
|
||||
red: ; redraw
|
||||
call draw_window ; at first, draw the window
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
still:
|
||||
|
||||
mcall 10 ; wait here for event
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
jz red
|
||||
cmp eax,2 ; key in buffer ?
|
||||
jz key
|
||||
|
||||
cmp eax,3 ; button in buffer ?
|
||||
jz button
|
||||
|
||||
cmp eax,2 ; key in buffer ?
|
||||
jnz still
|
||||
;-------------------------------------------------------------------------------
|
||||
key:
|
||||
mcall 2 ; just read it and ignore
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
call draw_window
|
||||
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
|
||||
jmp still
|
||||
|
||||
button: ; button
|
||||
mov eax,17
|
||||
int 0x40
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
button:
|
||||
mcall 17
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jnz noclose
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40
|
||||
noclose:
|
||||
|
||||
mcall -1 ; close this program
|
||||
;-------------------------------------------------------------------------------
|
||||
noclose:
|
||||
cmp ah,2
|
||||
jnz notest2
|
||||
cli
|
||||
;-------------------------------------------------------------------------------
|
||||
notest2:
|
||||
|
||||
cmp ah,3
|
||||
jnz notest3
|
||||
sti
|
||||
;-------------------------------------------------------------------------------
|
||||
notest3:
|
||||
|
||||
cmp ah,4
|
||||
jnz notest4
|
||||
mov [0x10000],byte 1
|
||||
;-------------------------------------------------------------------------------
|
||||
notest4:
|
||||
|
||||
cmp ah,5
|
||||
jnz notest5
|
||||
jmp dword 0x10000
|
||||
;-------------------------------------------------------------------------------
|
||||
notest5:
|
||||
|
||||
cmp ah,6
|
||||
jnz notest6
|
||||
mov esp,0
|
||||
push eax
|
||||
;-------------------------------------------------------------------------------
|
||||
notest6:
|
||||
|
||||
cmp ah,7
|
||||
jnz notest7
|
||||
in al,0x60
|
||||
;-------------------------------------------------------------------------------
|
||||
notest7:
|
||||
|
||||
cmp ah,8
|
||||
jnz notest8
|
||||
jnz still
|
||||
out 0x60,al
|
||||
notest8:
|
||||
|
||||
|
||||
jmp still
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
draw_window:
|
||||
|
||||
;mcall 48,3,sys_colors,40
|
||||
|
||||
mcall 12,1
|
||||
|
||||
mcall 0,<200,292>,<200,230>,0x14FFFFFF,,tlabel
|
||||
|
||||
mov eax,8 ; function 8 : define and draw button
|
||||
mov ebx,32*65536+10 ; [x start] *65536 + [x size]
|
||||
mov ecx,75*65536+10 ; [y start] *65536 + [y size]
|
||||
mov edx,2 ; button id
|
||||
mov esi,0x6888B8 ; button color RRGGBB
|
||||
newb:
|
||||
int 0x40
|
||||
.newb:
|
||||
mcall
|
||||
add ecx,20*65536
|
||||
inc edx
|
||||
cmp edx,9
|
||||
jb newb
|
||||
jb .newb
|
||||
|
||||
cld
|
||||
mov ebx,26*65536+37 ; draw info text with function 4
|
||||
mov ecx,0x000000
|
||||
mov edx,text
|
||||
mov esi,40
|
||||
newline:
|
||||
|
||||
mov eax,4
|
||||
int 0x40
|
||||
.newline:
|
||||
mcall
|
||||
add ebx,10
|
||||
add edx,40
|
||||
cmp [edx],byte 'x'
|
||||
jnz newline
|
||||
|
||||
jnz .newline
|
||||
|
||||
mcall 12,2 ; function 12:tell os about windowdraw
|
||||
|
||||
|
||||
ret
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; DATA AREA
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
if lang eq it
|
||||
text:
|
||||
db 'Il programma usa 0x10000 byte di memoria'
|
||||
db 'Il programma usa 0x1000 byte di memoria '
|
||||
db ' '
|
||||
db 'Open debug board for rezult information '
|
||||
db ' '
|
||||
@ -160,11 +146,31 @@ if lang eq it
|
||||
db ' '
|
||||
db ' OUT 0x60,AL '
|
||||
db 'x'
|
||||
else if lang eq ru
|
||||
text:
|
||||
db '<27>ਫ®¦¥¨¥ ¨á¯®«ì§ã¥â 0x1000 ¡ ©â ¯ ¬ïâ¨'
|
||||
db ' '
|
||||
db 'Žâªàëâì BOARD ¤«ï ¯à®á¬®âà १ã«ìâ â '
|
||||
db ' '
|
||||
db ' CLI '
|
||||
db ' '
|
||||
db ' STI '
|
||||
db ' '
|
||||
db ' MOV [0x10000],BYTE 1 '
|
||||
db ' '
|
||||
db ' JMP DWORD 0x10000 '
|
||||
db ' '
|
||||
db ' MOV ESP,0 & PUSH EAX '
|
||||
db ' '
|
||||
db ' IN Al,0x60 '
|
||||
db ' '
|
||||
db ' OUT 0x60,AL '
|
||||
db 'x'
|
||||
else
|
||||
text:
|
||||
db 'Application uses 0x10000 bytes of memory'
|
||||
db 'Application uses 0x1000 bytes of memory '
|
||||
db ' '
|
||||
db 'Open debug board for rezult information '
|
||||
db 'Open debug board for result information '
|
||||
db ' '
|
||||
db ' CLI '
|
||||
db ' '
|
||||
@ -181,8 +187,23 @@ else
|
||||
db ' OUT 0x60,AL '
|
||||
db 'x'
|
||||
end if
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
if lang eq it
|
||||
tlabel:
|
||||
db 'Kolibri prova di protezione',0
|
||||
else if lang eq ru
|
||||
tlabel:
|
||||
db 'Kolibri ¯à®¢¥àª § é¨âë ï¤à ',0
|
||||
else
|
||||
tlabel:
|
||||
db 'Kolibri protection test',0
|
||||
|
||||
end if
|
||||
;-------------------------------------------------------------------------------
|
||||
I_END:
|
||||
;-------------------------------------------------------------------------------
|
||||
align 4
|
||||
rb 256
|
||||
stack_top:
|
||||
;-------------------------------------------------------------------------------
|
||||
IM_END:
|
||||
;-------------------------------------------------------------------------------
|
Loading…
Reference in New Issue
Block a user