forked from KolibriOS/kolibrios
icon2: russian and english variants corrected
jpegview, launcher, life, mv, pcidev: new versions from K0581 distro rccc, rccs: english translation added git-svn-id: svn://kolibrios.org@132 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
16091ddd9e
commit
8df5cba38d
835
programs/games/life/trunk/ascl.inc
Normal file
835
programs/games/life/trunk/ascl.inc
Normal file
@ -0,0 +1,835 @@
|
||||
lang equ ru ; ru en fr ge fi
|
||||
|
||||
;
|
||||
; Assembler
|
||||
; SMALL
|
||||
; CODE
|
||||
; Libary
|
||||
;
|
||||
; Ver 0.14 By Pavlushin Evgeni (RUSSIA)
|
||||
; www.waptap@mail.ru
|
||||
|
||||
;Please compile aplications on FASM ver1.54 or higer!!!
|
||||
|
||||
;InfoList
|
||||
;0.01 scank,putpix,puttxt
|
||||
;0.02 label,random,colors
|
||||
;0.03 window,startwd,endwd,attributes
|
||||
;0.04 close,delay,scevent ~30.04.2004
|
||||
;0.05 small random, ~04.05.2004
|
||||
;0.06 wtevent ~09.05.2004
|
||||
;0.07 timeevent ~23.05.2004
|
||||
;0.08 txtput ~14.06.2004
|
||||
;0.09 opendialog,savedialog ~20.06.2004
|
||||
;0.10 wordstoreg by halyavin, add at ~30.08.2004
|
||||
; random bug deleted eax is use.
|
||||
;0.11 loadfile from me +puttxt bug del ~07.09.2004
|
||||
;0.12 open/save dialog ~13.09.2004
|
||||
;0.13 dialogs bugs deleted
|
||||
;0.14 drawlbut ~03.10.2004
|
||||
|
||||
; 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
|
||||
jmp open
|
||||
fileinfo:
|
||||
dd 0
|
||||
dd 0
|
||||
dd 1
|
||||
dd file_load_area
|
||||
dd file_temp_area
|
||||
string:
|
||||
db file_name,0
|
||||
open:
|
||||
mov dword [fileinfo+8],1 ; how many blocks to read (1)
|
||||
mov eax,58
|
||||
mov ebx,fileinfo
|
||||
int 0x40
|
||||
mov eax,[file_load_area+2]
|
||||
shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
|
||||
inc eax
|
||||
mov dword [fileinfo+8],eax
|
||||
mov eax,58
|
||||
mov ebx,fileinfo
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
macro wordstoreg reg,hiword,loword
|
||||
{
|
||||
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 12 & loword eqtype [123]
|
||||
mov reg,hiword*65536
|
||||
add reg,loword
|
||||
else
|
||||
mov reg,hiword
|
||||
shl reg,16
|
||||
add reg,loword
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
; DRAW BUTTON with label
|
||||
|
||||
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor
|
||||
{
|
||||
local asd,lab
|
||||
jmp asd
|
||||
lab db text ;arg label
|
||||
asd:
|
||||
wordstoreg ebx,x,xs
|
||||
wordstoreg ecx,y,ys
|
||||
mov edx,id
|
||||
mov esi,bcolor
|
||||
mov eax,8
|
||||
int 0x40
|
||||
|
||||
mov eax,asd-lab ;calc size
|
||||
mov ebx,6
|
||||
mul ebx
|
||||
mov esi,eax
|
||||
|
||||
mov eax,xs
|
||||
sub eax,esi
|
||||
shr eax,1
|
||||
add eax,x
|
||||
|
||||
mov edx,ys
|
||||
sub edx,7
|
||||
shr edx,1
|
||||
add edx,y
|
||||
|
||||
mov ebx,eax
|
||||
shl ebx,16
|
||||
add ebx,edx
|
||||
|
||||
mov ecx,tcolor ;arg4 color
|
||||
mov edx,lab
|
||||
mov esi,asd-lab ;calc size
|
||||
mov eax,4
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
macro opendialog redproc,openoff,erroff,path
|
||||
{
|
||||
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
|
||||
local run_fileinfo, param
|
||||
local getmesloop, loox, mred, mkey, mbutton, mgetmes
|
||||
local dlg_is_work, ready, procinfo
|
||||
;
|
||||
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
|
||||
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
|
||||
;
|
||||
|
||||
cld
|
||||
;; mov esi,path
|
||||
mov edi,path
|
||||
mov eax,0
|
||||
mov ecx,200
|
||||
rep stosb
|
||||
|
||||
;mov [get_loops],0
|
||||
mov [dlg_pid_get],0
|
||||
|
||||
; Get my PID in dec format 4 bytes
|
||||
mov eax,9
|
||||
mov ebx,procinfo
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
|
||||
; convert eax bin to param dec
|
||||
mov eax,dword [procinfo+30] ;offset of myPID
|
||||
mov edi,param+4-1 ;offset to 4 bytes
|
||||
mov ecx,4
|
||||
mov ebx,10
|
||||
cld
|
||||
new_d:
|
||||
xor edx,edx
|
||||
div ebx
|
||||
add dl,'0'
|
||||
mov [edi],dl
|
||||
dec edi
|
||||
loop new_d
|
||||
|
||||
; wirite 1 byte space to param
|
||||
mov [param+4],byte 32 ;Space for next parametr
|
||||
; and 1 byte type of dialog to param
|
||||
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog)
|
||||
|
||||
;
|
||||
; STEP2 prepare IPC area for get messages
|
||||
;
|
||||
|
||||
; prepare IPC area
|
||||
mov [path],dword 0
|
||||
mov [path+4],dword 8
|
||||
|
||||
; define IPC memory
|
||||
mov eax,60
|
||||
mov ebx,1 ; define IPC
|
||||
mov ecx,path ; offset of area
|
||||
mov edx,150 ; size 150 bytes
|
||||
int 0x40
|
||||
|
||||
; change wanted events list 7-bit IPC event
|
||||
mov eax,40
|
||||
mov ebx,01000111b
|
||||
int 0x40
|
||||
|
||||
;
|
||||
; STEP 3 run SYSTEM XTREE with parameters
|
||||
;
|
||||
|
||||
mov eax,58
|
||||
mov ebx,run_fileinfo
|
||||
int 0x40
|
||||
|
||||
call redproc
|
||||
|
||||
mov [get_loops],0
|
||||
getmesloop:
|
||||
mov eax,23
|
||||
mov ebx,50 ;0.5 sec
|
||||
int 0x40
|
||||
|
||||
cmp eax,1
|
||||
je mred
|
||||
cmp eax,2
|
||||
je mkey
|
||||
cmp eax,3
|
||||
je mbutton
|
||||
cmp eax,7
|
||||
je mgetmes
|
||||
|
||||
; Get number of procces
|
||||
mov ebx,procinfo
|
||||
mov ecx,-1
|
||||
mov eax,9
|
||||
int 0x40
|
||||
mov ebp,eax
|
||||
|
||||
loox:
|
||||
mov eax,9
|
||||
mov ebx,procinfo
|
||||
mov ecx,ebp
|
||||
int 0x40
|
||||
mov eax,[DLGPID]
|
||||
cmp [procinfo+30],eax ;IF Dialog find
|
||||
je dlg_is_work ;jmp to dlg_is_work
|
||||
dec ebp
|
||||
jnz loox
|
||||
|
||||
jmp erroff
|
||||
|
||||
dlg_is_work:
|
||||
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
|
||||
je erroff ;TESTODP2 terminated too
|
||||
|
||||
cmp [dlg_pid_get],dword 1
|
||||
je getmesloop
|
||||
inc [get_loops]
|
||||
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
|
||||
jae erroff
|
||||
jmp getmesloop
|
||||
|
||||
mred:
|
||||
call redproc
|
||||
jmp getmesloop
|
||||
mkey:
|
||||
mov eax,2
|
||||
int 0x40 ; read (eax=2)
|
||||
jmp getmesloop
|
||||
mbutton:
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne getmesloop
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40
|
||||
mgetmes:
|
||||
|
||||
; If dlg_pid_get then second message get jmp to still
|
||||
cmp [dlg_pid_get],dword 1
|
||||
je ready
|
||||
|
||||
; First message is number of PID SYSXTREE dialog
|
||||
|
||||
; convert PID dec to PID bin
|
||||
movzx eax,byte [path+16]
|
||||
sub eax,48
|
||||
imul eax,10
|
||||
movzx ebx,byte [path+16+1]
|
||||
add eax,ebx
|
||||
sub eax,48
|
||||
imul eax,10
|
||||
movzx ebx,byte [path+16+2]
|
||||
add eax,ebx
|
||||
sub eax,48
|
||||
imul eax,10
|
||||
movzx ebx,byte [path+16+3]
|
||||
add eax,ebx
|
||||
sub eax,48
|
||||
mov [DLGPID],eax
|
||||
|
||||
; Claear and prepare IPC area for next message
|
||||
mov [path],dword 0
|
||||
mov [path+4],dword 8
|
||||
mov [path+8],dword 0
|
||||
mov [path+12],dword 0
|
||||
mov [path+16],dword 0
|
||||
|
||||
; Set dlg_pid_get for get next message
|
||||
mov [dlg_pid_get],dword 1
|
||||
call redproc ;show DLG_PID
|
||||
jmp getmesloop
|
||||
|
||||
ready:
|
||||
;
|
||||
; The second message get
|
||||
; Second message is 100 bytes path to SAVE/OPEN file
|
||||
; shl path string on 16 bytes
|
||||
;
|
||||
cld
|
||||
mov esi,path+16
|
||||
mov edi,path
|
||||
mov ecx,200
|
||||
rep movsb
|
||||
mov [edi],byte 0
|
||||
|
||||
jmp openoff
|
||||
|
||||
|
||||
; DATA AREA
|
||||
get_loops dd 0
|
||||
dlg_pid_get dd 0
|
||||
DLGPID dd 0
|
||||
|
||||
param:
|
||||
dd 0 ; My dec PID
|
||||
dd 0,0 ; Type of dialog
|
||||
|
||||
run_fileinfo:
|
||||
dd 16
|
||||
dd 0
|
||||
dd param
|
||||
dd 0
|
||||
dd procinfo ; 0x10000
|
||||
;run_filepath
|
||||
db '/RD/1/SYSXTREE',0
|
||||
|
||||
procinfo:
|
||||
times 256 db 0
|
||||
}
|
||||
|
||||
|
||||
macro savedialog redproc,openoff,erroff,path
|
||||
{
|
||||
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
|
||||
local run_fileinfo, run_filepath, param
|
||||
local getmesloop, loox, mred, mkey, mbutton, mgetmes
|
||||
local dlg_is_work, ready, procinfo
|
||||
;
|
||||
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
|
||||
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
|
||||
;
|
||||
|
||||
cld
|
||||
;; mov esi,path
|
||||
mov edi,path
|
||||
mov eax,0
|
||||
mov ecx,200
|
||||
rep stosb
|
||||
|
||||
;mov [get_loops],0
|
||||
mov [dlg_pid_get],0
|
||||
|
||||
; Get my PID in dec format 4 bytes
|
||||
mov eax,9
|
||||
mov ebx,procinfo
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
|
||||
; convert eax bin to param dec
|
||||
mov eax,dword [procinfo+30] ;offset of myPID
|
||||
mov edi,param+4-1 ;offset to 4 bytes
|
||||
mov ecx,4
|
||||
mov ebx,10
|
||||
cld
|
||||
new_d:
|
||||
xor edx,edx
|
||||
div ebx
|
||||
add dl,'0'
|
||||
mov [edi],dl
|
||||
dec edi
|
||||
loop new_d
|
||||
|
||||
; wirite 1 byte space to param
|
||||
mov [param+4],byte 32 ;Space for next parametr
|
||||
; and 1 byte type of dialog to param
|
||||
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog)
|
||||
|
||||
;
|
||||
; STEP2 prepare IPC area for get messages
|
||||
;
|
||||
|
||||
; prepare IPC area
|
||||
mov [path],dword 0
|
||||
mov [path+4],dword 8
|
||||
|
||||
; define IPC memory
|
||||
mov eax,60
|
||||
mov ebx,1 ; define IPC
|
||||
mov ecx,path ; offset of area
|
||||
mov edx,120 ; size 150 bytes
|
||||
int 0x40
|
||||
|
||||
; change wanted events list 7-bit IPC event
|
||||
mov eax,40
|
||||
mov ebx,01000111b
|
||||
int 0x40
|
||||
|
||||
;
|
||||
; STEP 3 run SYSTEM XTREE with parameters
|
||||
;
|
||||
|
||||
mov eax,58
|
||||
mov ebx,run_fileinfo
|
||||
int 0x40
|
||||
|
||||
call redproc
|
||||
|
||||
mov [get_loops],0
|
||||
getmesloop:
|
||||
mov eax,23
|
||||
mov ebx,50 ;0.5 sec
|
||||
int 0x40
|
||||
|
||||
cmp eax,1
|
||||
je mred
|
||||
cmp eax,2
|
||||
je mkey
|
||||
cmp eax,3
|
||||
je mbutton
|
||||
cmp eax,7
|
||||
je mgetmes
|
||||
|
||||
; Get number of procces
|
||||
mov ebx,procinfo
|
||||
mov ecx,-1
|
||||
mov eax,9
|
||||
int 0x40
|
||||
mov ebp,eax
|
||||
|
||||
loox:
|
||||
mov eax,9
|
||||
mov ebx,procinfo
|
||||
mov ecx,ebp
|
||||
int 0x40
|
||||
mov eax,[DLGPID]
|
||||
cmp [procinfo+30],eax ;IF Dialog find
|
||||
je dlg_is_work ;jmp to dlg_is_work
|
||||
dec ebp
|
||||
jnz loox
|
||||
|
||||
jmp erroff
|
||||
|
||||
dlg_is_work:
|
||||
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
|
||||
je erroff ;TESTODP2 terminated too
|
||||
|
||||
cmp [dlg_pid_get],dword 1
|
||||
je getmesloop
|
||||
inc [get_loops]
|
||||
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated
|
||||
jae erroff
|
||||
jmp getmesloop
|
||||
|
||||
mred:
|
||||
call redproc
|
||||
jmp getmesloop
|
||||
mkey:
|
||||
int 0x40 ; read (eax=2)
|
||||
jmp getmesloop
|
||||
mbutton:
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne getmesloop
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40
|
||||
mgetmes:
|
||||
|
||||
; If dlg_pid_get then second message get jmp to still
|
||||
cmp [dlg_pid_get],dword 1
|
||||
je ready
|
||||
|
||||
; First message is number of PID SYSXTREE dialog
|
||||
|
||||
; convert PID dec to PID bin
|
||||
movzx eax,byte [path+16]
|
||||
sub eax,48
|
||||
imul eax,10
|
||||
movzx ebx,byte [path+16+1]
|
||||
add eax,ebx
|
||||
sub eax,48
|
||||
imul eax,10
|
||||
movzx ebx,byte [path+16+2]
|
||||
add eax,ebx
|
||||
sub eax,48
|
||||
imul eax,10
|
||||
movzx ebx,byte [path+16+3]
|
||||
add eax,ebx
|
||||
sub eax,48
|
||||
mov [DLGPID],eax
|
||||
|
||||
; Claear and prepare IPC area for next message
|
||||
mov [path],dword 0
|
||||
mov [path+4],dword 8
|
||||
mov [path+8],dword 0
|
||||
mov [path+12],dword 0
|
||||
mov [path+16],dword 0
|
||||
|
||||
; Set dlg_pid_get for get next message
|
||||
mov [dlg_pid_get],dword 1
|
||||
call redproc ;show DLG_PID
|
||||
jmp getmesloop
|
||||
|
||||
ready:
|
||||
;
|
||||
; The second message get
|
||||
; Second message is 100 bytes path to SAVE/OPEN file
|
||||
; shl path string on 16 bytes
|
||||
;
|
||||
cld
|
||||
mov esi,path+16
|
||||
mov edi,path
|
||||
mov ecx,200
|
||||
rep movsb
|
||||
mov [edi],byte 0
|
||||
|
||||
jmp openoff
|
||||
|
||||
|
||||
; DATA AREA
|
||||
get_loops dd 0
|
||||
dlg_pid_get dd 0
|
||||
DLGPID dd 0
|
||||
|
||||
param:
|
||||
rb 4 ; My dec PID
|
||||
rb 6 ; Type of dialog
|
||||
|
||||
run_fileinfo:
|
||||
dd 16
|
||||
dd 0
|
||||
dd param
|
||||
dd 0
|
||||
dd procinfo
|
||||
run_filepath:
|
||||
db '/RD/1/SYSXTREE',0
|
||||
|
||||
procinfo:
|
||||
times 256 db 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
; RANDOM - generate random count (small)
|
||||
; (SYNTAX) RANDOM MaxCount,OutArgument
|
||||
; (SAMPLE) RANDOM 10000,eax
|
||||
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations
|
||||
|
||||
randomuse = 0
|
||||
|
||||
macro random arg1,arg2
|
||||
{
|
||||
local rxproc
|
||||
randomuse = randomuse + 1
|
||||
|
||||
jmp rxproc
|
||||
|
||||
if defined randomuse & randomuse = 1
|
||||
randomproc:
|
||||
jmp rnj
|
||||
rsx1 dw 0x4321
|
||||
rsx2 dw 0x1234
|
||||
rnj:
|
||||
; mov eax,arg1
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push si
|
||||
push di
|
||||
mov cx,ax
|
||||
mov ax,word ptr rsx1
|
||||
mov bx,word ptr rsx2
|
||||
mov si,ax
|
||||
mov di,bx
|
||||
mov dl,ah
|
||||
mov ah,al
|
||||
mov al,bh
|
||||
mov bh,bl
|
||||
xor bl,bl
|
||||
rcr dl,1
|
||||
rcr ax,1
|
||||
rcr bx,1
|
||||
add bx,di
|
||||
adc ax,si
|
||||
add bx,0x62e9
|
||||
adc ax,0x3619
|
||||
mov word ptr rsx1,bx
|
||||
mov word ptr rsx2,ax
|
||||
xor dx,dx
|
||||
cmp ax,0
|
||||
je nodiv
|
||||
cmp cx,0
|
||||
je nodiv
|
||||
div cx
|
||||
nodiv:
|
||||
mov ax,dx
|
||||
pop di
|
||||
pop si
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
and eax,0000ffffh
|
||||
; mov arg2,0
|
||||
; mov arg2,eax
|
||||
ret
|
||||
end if
|
||||
|
||||
rxproc:
|
||||
mov eax,arg1
|
||||
call randomproc
|
||||
mov arg2,eax
|
||||
}
|
||||
|
||||
macro scank
|
||||
{
|
||||
mov eax,10
|
||||
int 0x40
|
||||
}
|
||||
|
||||
macro putpix x,y,color
|
||||
{
|
||||
mov ebx,x
|
||||
mov ecx,y
|
||||
mov edx,color
|
||||
mov eax,1
|
||||
int 0x40
|
||||
}
|
||||
|
||||
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
|
||||
mov eax,4
|
||||
int 0x40
|
||||
}
|
||||
|
||||
macro outcount data, x, y, color, numtype
|
||||
{
|
||||
mov ecx,data
|
||||
mov ebx,numtype
|
||||
mov bl,0
|
||||
; mov edx,x*65536+y
|
||||
wordstoreg edx,x,y
|
||||
mov esi,color
|
||||
mov eax,47
|
||||
int 0x40
|
||||
}
|
||||
|
||||
; SCEVENT - Scan event
|
||||
|
||||
macro scevent red,key,but
|
||||
{
|
||||
mov eax,11
|
||||
int 0x40
|
||||
dec eax
|
||||
jz red
|
||||
dec eax
|
||||
jz key
|
||||
dec eax
|
||||
jz but
|
||||
}
|
||||
|
||||
; WTEVENT - Wait event
|
||||
|
||||
macro wtevent red,key,but
|
||||
{
|
||||
mov eax,10
|
||||
int 0x40
|
||||
dec eax
|
||||
jz red
|
||||
dec eax
|
||||
jz key
|
||||
dec eax
|
||||
jz but
|
||||
}
|
||||
|
||||
; TIMEEVENT - Wite for event with timeout
|
||||
|
||||
macro timeevent xfps,noevent,red,key,but
|
||||
{
|
||||
mov eax,23
|
||||
mov ebx,xfps
|
||||
int 0x40
|
||||
cmp eax,0
|
||||
je noevent
|
||||
dec eax
|
||||
jz red
|
||||
dec eax
|
||||
jz key
|
||||
dec eax
|
||||
jz but
|
||||
}
|
||||
|
||||
|
||||
; CLOSE - Close program
|
||||
|
||||
macro close
|
||||
{
|
||||
mov eax,-1
|
||||
int 0x40
|
||||
}
|
||||
|
||||
; DELAY - Create delay 1/100 sec
|
||||
; (SYNTAX) Delay time
|
||||
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec
|
||||
|
||||
macro delay arg1
|
||||
{
|
||||
mov eax,5
|
||||
mov ebx,arg1
|
||||
int 0x40
|
||||
}
|
||||
|
||||
; WINDOW - Draw window
|
||||
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color
|
||||
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned
|
||||
|
||||
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
|
||||
mov edx,arg5
|
||||
mov eax,0
|
||||
int 0x40
|
||||
}
|
||||
|
||||
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
|
||||
{
|
||||
mov ebx,arg1*65536+arg3
|
||||
mov ecx,arg2*65536+arg4
|
||||
mov edx,arg5
|
||||
mov esi,arg6
|
||||
mov edi,arg7
|
||||
mov eax,0
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
; STARTWD - Start of window draw
|
||||
|
||||
macro startwd
|
||||
{
|
||||
mov eax,12
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
}
|
||||
|
||||
; ENDWD - End window draw
|
||||
|
||||
macro endwd
|
||||
{
|
||||
mov eax,12
|
||||
mov ebx,2
|
||||
int 0x40
|
||||
}
|
||||
|
||||
; LABEL - Put text to frame
|
||||
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color
|
||||
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big
|
||||
|
||||
macro label arg1,arg2,arg3,arg4
|
||||
{
|
||||
local asd,lab
|
||||
jmp asd
|
||||
lab db arg3 ;arg label
|
||||
asd:
|
||||
; mov ebx,arg1 ;arg1=y arg2=x
|
||||
; shl ebx,16
|
||||
; add ebx,arg2
|
||||
wordstoreg ebx,arg1,arg2
|
||||
mov ecx,arg4 ;arg4 color
|
||||
mov edx,lab
|
||||
mov esi,asd-lab ;calc size
|
||||
mov eax,4
|
||||
int 0x40
|
||||
}
|
||||
|
||||
;Key's
|
||||
key_Up equ 178
|
||||
key_Down equ 177
|
||||
key_Right equ 179
|
||||
key_Left equ 176
|
||||
key_Esc equ 27
|
||||
key_Space equ 32
|
||||
key_Enter equ 13
|
||||
key_Bspace equ 8
|
||||
key_F1 equ 50
|
||||
key_F2 equ 51
|
||||
key_F3 equ 52
|
||||
key_F4 equ 53
|
||||
key_F5 equ 54
|
||||
key_F6 equ 55
|
||||
key_F7 equ 56
|
||||
key_F8 equ 57
|
||||
key_F9 equ 48
|
||||
key_F10 equ 49
|
||||
key_F11 equ 68
|
||||
key_F12 equ 255
|
||||
key_Home equ 180
|
||||
key_End equ 181
|
||||
key_PgUp equ 184
|
||||
key_PgDown equ 183
|
||||
|
||||
;Attributes
|
||||
|
||||
;Window Attributes
|
||||
window_Skinned equ 0x03000000
|
||||
window_Type2 equ 0x02000000
|
||||
window_Type1 equ 0x00000000
|
||||
window_Reserve equ 0x01000000
|
||||
|
||||
;Font Attributes
|
||||
font_Big equ 0x10000000
|
||||
|
||||
;Colors
|
||||
cl_White equ 0x00ffffff
|
||||
cl_Black equ 0x00000000
|
||||
cl_Grey equ 0x00888888
|
||||
cl_Red equ 0x00ff0000
|
||||
cl_Lime equ 0x0000ff00
|
||||
cl_Green equ 0x0000af00
|
||||
cl_Blue equ 0x000000ff
|
||||
cl_Purple equ 0x008080ff
|
||||
cl_Violet equ 0x008040ff
|
||||
cl_Cyan equ 0x0040e0ff
|
@ -3,31 +3,32 @@
|
||||
;
|
||||
; This program displays Conways game of life
|
||||
;
|
||||
; Compile with FASM v1.49 for DOS;
|
||||
; Compile with FASM for Menuet;
|
||||
;
|
||||
; Version 0.1a 20th May 2004
|
||||
; Ivan Poddubny
|
||||
;
|
||||
; Version 0.1 30th March 2004
|
||||
; Mike Hibbett
|
||||
;
|
||||
; Version 0.2 23th May 2004
|
||||
; Random generation dots with start
|
||||
;
|
||||
; Convert to ASCL Libary by Pavlushin Evgeni
|
||||
;
|
||||
; This is an experiment to see how small a usefull application can get
|
||||
;
|
||||
|
||||
include "lang.inc"
|
||||
include "macros.inc"
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
db 'MENUET01' ; 8 byte id
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd I_END ; size of image
|
||||
dd 0x100000 ; memory for app
|
||||
dd 0x100000 ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
include 'ascl.inc'
|
||||
|
||||
db 'MENUET01' ; 8 byte id
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd I_END ; size of image
|
||||
dd 0xc1000 ; memory for app
|
||||
dd 0xc1000 ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
;include "DEBUG.INC"
|
||||
macro setcell x,y { mov [esi + 512*(y)*3 + (x)*3], al }
|
||||
|
||||
START:
|
||||
@ -42,88 +43,54 @@ START:
|
||||
; setcell take the arguments setcell x,y
|
||||
; 0,0 is the top left corner.
|
||||
|
||||
; setcell 200,120
|
||||
; setcell 201,120
|
||||
; setcell 200,121
|
||||
; setcell 199,121
|
||||
; setcell 200,122
|
||||
setcell 200,120
|
||||
setcell 201,120
|
||||
setcell 200,121
|
||||
setcell 199,121
|
||||
setcell 200,122
|
||||
|
||||
; setcell 70,120
|
||||
; setcell 71,120
|
||||
; setcell 70,121
|
||||
; setcell 69,121
|
||||
; setcell 70,122
|
||||
|
||||
mov eax, 40
|
||||
mov ebx, 100101b
|
||||
int 0x40
|
||||
setcell 70,120
|
||||
setcell 71,120
|
||||
setcell 70,121
|
||||
setcell 69,121
|
||||
setcell 70,122
|
||||
|
||||
call draw_window
|
||||
|
||||
;Random generation dots
|
||||
|
||||
mov ecx,20000
|
||||
xxx:
|
||||
push ecx
|
||||
random 30000,edi ;up pice of screen
|
||||
mov al,0xff
|
||||
shl edi,3
|
||||
; mov [I_END+edi],al
|
||||
; random 50000,edi ;down pice of screen
|
||||
; mov al,0xff
|
||||
; shl edi,3
|
||||
add edi,512*460 ;760
|
||||
mov [I_END+edi],al
|
||||
pop ecx
|
||||
dec ecx
|
||||
jnz xxx
|
||||
|
||||
still:
|
||||
|
||||
; mov eax, 23 ; wait here for event
|
||||
; mov ebx, 5
|
||||
; int 0x40
|
||||
mov eax, 11
|
||||
int 0x40
|
||||
timeevent 5,nokey,red,key,button ;Wait EVENT with 5 fps
|
||||
jmp still
|
||||
|
||||
test eax, eax
|
||||
je nokey
|
||||
cmp eax,1 ; redraw request ?
|
||||
je red
|
||||
cmp eax,3 ; button in buffer ?
|
||||
je button
|
||||
cmp eax,6
|
||||
je mouse
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
mouse:
|
||||
mov eax, 37
|
||||
mov ebx, 2
|
||||
int 0x40
|
||||
test eax, eax
|
||||
jz still
|
||||
|
||||
mov eax, 37
|
||||
mov ebx, 1
|
||||
int 0x40
|
||||
sub eax, 5*65536+20
|
||||
mov ebx, eax
|
||||
shr eax, 16
|
||||
and ebx, 0xffff
|
||||
|
||||
; WRITE COORDINATES
|
||||
; dpd eax
|
||||
; dps " "
|
||||
; dpd ebx
|
||||
; dps <10,13>
|
||||
|
||||
cmp ax, 0
|
||||
js still
|
||||
cmp bx, 0
|
||||
js still
|
||||
|
||||
shl ebx, 9
|
||||
add ebx, eax
|
||||
imul ebx, 3
|
||||
add ebx, I_END
|
||||
mov [ebx], dword 0xFFFFFFFF
|
||||
jmp draw
|
||||
|
||||
red: ; REDRAW WINDOW
|
||||
red: ; REDRAW WINDOW
|
||||
call draw_window
|
||||
jmp still
|
||||
|
||||
key: ; KEY
|
||||
mov eax,2 ; get it, but ignore
|
||||
int 0x40
|
||||
|
||||
nokey:
|
||||
; cycle life state
|
||||
|
||||
mov eax,5
|
||||
mov ebx,5
|
||||
int 0x40
|
||||
; cycle life state
|
||||
|
||||
mov esi, I_END + 512*3
|
||||
|
||||
@ -187,7 +154,6 @@ nextcell:
|
||||
|
||||
; copy new generation across
|
||||
|
||||
|
||||
mov ecx, 512*512*3
|
||||
mov esi, I_END+1
|
||||
mov edi, I_END
|
||||
@ -199,56 +165,26 @@ nc1:
|
||||
mov [esi+2], byte 0
|
||||
add esi, 3
|
||||
loop nc1
|
||||
draw:
|
||||
|
||||
mov ebx, I_END
|
||||
mov ecx, 512*65536+512
|
||||
mov edx, 5*65536+22
|
||||
mov edx, 5*65536+20
|
||||
mov eax,7
|
||||
int 0x40
|
||||
|
||||
jmp still
|
||||
|
||||
button: ; BUTTON - only close supported
|
||||
or eax,-1
|
||||
int 0x40
|
||||
|
||||
|
||||
|
||||
close
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
|
||||
|
||||
draw_window:
|
||||
mov eax,12
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
|
||||
mov eax,0 ; open window
|
||||
mov ebx,50*65536+512+9
|
||||
mov ecx,50*65536+512+22+4
|
||||
mov edx,0x03000000
|
||||
int 0x40
|
||||
|
||||
mov eax,4 ; WINDOW LABEL
|
||||
mov ebx,8*65536+8
|
||||
mov ecx,0x10ffffff
|
||||
mov edx,header
|
||||
mov esi,header.size
|
||||
int 0x40
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
|
||||
startwd
|
||||
window 50,50,512+9,512+23,window_Skinned
|
||||
label 8,8,'Life Screen',cl_White+font_Big
|
||||
endwd
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; DATA AREA
|
||||
|
||||
header db 'Life'
|
||||
.size = $ - header
|
||||
|
||||
I_END:
|
||||
|
@ -36,6 +36,7 @@ use32
|
||||
include 'lang.inc'
|
||||
stack_size=4096 + 1024
|
||||
|
||||
include 'macros.inc'
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
@ -141,31 +142,8 @@ check_parameters:
|
||||
;******************************************************************************
|
||||
|
||||
|
||||
set_default_colours:
|
||||
|
||||
pusha
|
||||
|
||||
mov eax,6 ; load default color map
|
||||
mov ebx,defcol
|
||||
mov ecx,0
|
||||
mov edx,-1
|
||||
mov esi,0x10000
|
||||
int 0x40
|
||||
|
||||
mov eax,48 ; set default color map
|
||||
mov ebx,2
|
||||
mov ecx,0x10000
|
||||
mov edx,10*4
|
||||
int 0x40
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
defcol db 'DEFAULT.DTP'
|
||||
|
||||
|
||||
boot_set_background:
|
||||
call set_default_colours
|
||||
|
||||
mov ecx,memsize-fin-stack_size ; size
|
||||
mov edi,fin ; pointer
|
||||
|
@ -12,12 +12,11 @@
|
||||
dd 0x300000 ; memory for app
|
||||
dd 0x300000 ; esp
|
||||
dd temp_area , 0x0 ; I_Param , I_Icon
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
;******************************************************************************
|
||||
|
||||
tmp_param dd 0
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
; check for parameters
|
||||
@ -35,6 +34,7 @@ START: ; start of execution
|
||||
mov edi,string ; clear string
|
||||
mov ecx,43*3 ; length of a string
|
||||
xor eax,eax ; symbol <0>
|
||||
add al,14h
|
||||
cld
|
||||
rep stosb
|
||||
|
||||
@ -49,8 +49,9 @@ START: ; start of execution
|
||||
mov edi,string
|
||||
rep movsb ; copy string from temp_area to "string" (filename)
|
||||
|
||||
call draw_window
|
||||
mov [tmp_param],0xdeadbeef
|
||||
call load_image
|
||||
call convert
|
||||
|
||||
.no_param:
|
||||
|
||||
|
||||
@ -71,11 +72,6 @@ START: ; start of execution
|
||||
; ⥯¥àì ¢ ecx ®¬¥à ¯à®æ¥áá
|
||||
mov [process],ecx
|
||||
|
||||
cmp [tmp_param],0xdeadbeef
|
||||
jne @f
|
||||
jmp kopen
|
||||
@@:
|
||||
|
||||
call draw_window
|
||||
|
||||
still:
|
||||
@ -195,7 +191,7 @@ still:
|
||||
|
||||
getappinfo:
|
||||
mov eax,9
|
||||
mov ebx,I_END
|
||||
mov ebx,process_info
|
||||
int 0x40
|
||||
ret
|
||||
|
||||
@ -206,7 +202,7 @@ load_image:
|
||||
mov ebx,fileinfo
|
||||
int 0x40
|
||||
cmp [I_END+2],dword 512 ; à §¬¥à ä ©« (file size)
|
||||
jbe open1
|
||||
jbe @f
|
||||
mov eax,[I_END+2]
|
||||
shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
|
||||
inc eax
|
||||
@ -215,7 +211,31 @@ load_image:
|
||||
mov eax,58
|
||||
mov ebx,fileinfo
|
||||
int 0x40
|
||||
ret
|
||||
@@:
|
||||
mov eax,[I_END+18]
|
||||
mov ebx,[I_END+22]
|
||||
add eax,20
|
||||
cmp eax,210
|
||||
jae @f
|
||||
mov eax,210
|
||||
@@:
|
||||
add ebx,58
|
||||
cmp ebx,56
|
||||
jae @f
|
||||
mov ebx,56
|
||||
@@:
|
||||
mov [wnd_width],eax
|
||||
mov [wnd_height],ebx
|
||||
test [bWasDraw],1
|
||||
jz @f
|
||||
mov esi,ebx
|
||||
mov edx,eax
|
||||
mov ecx,-1
|
||||
mov ebx,-1
|
||||
mov eax,67
|
||||
int 40h
|
||||
@@:
|
||||
ret
|
||||
|
||||
|
||||
drawimage:
|
||||
@ -384,7 +404,7 @@ ret
|
||||
|
||||
|
||||
draw_window:
|
||||
|
||||
or [bWasDraw],1
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
@ -392,8 +412,12 @@ draw_window:
|
||||
|
||||
; DRAW WINDOW
|
||||
xor eax,eax ; function 0 : define and draw window
|
||||
mov ebx,350 ; [x start] *65536 + [x size]
|
||||
mov ecx,400 ; [y start] *65536 + [y size]
|
||||
; mov ebx,350 ; [x start] *65536 + [x size]
|
||||
; mov ecx,400 ; [y start] *65536 + [y size]
|
||||
mov ebx,100*65536
|
||||
mov ecx,100*65536
|
||||
add ebx,[wnd_width]
|
||||
add ecx,[wnd_height]
|
||||
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
|
||||
int 0x40
|
||||
|
||||
@ -449,6 +473,8 @@ eop dd 0
|
||||
eos dd 0
|
||||
process dd 0
|
||||
|
||||
bWasDraw db 0
|
||||
|
||||
thread1: ; start of thread1
|
||||
|
||||
call draw_window1
|
||||
@ -624,7 +650,7 @@ draw_window1:
|
||||
mov eax,8 ;invisible button
|
||||
mov ebx,21*65536+258
|
||||
mov ecx,40*65536+15
|
||||
mov edx,0x40000002
|
||||
mov edx,0x60000002
|
||||
int 0x40
|
||||
|
||||
mov eax,13 ;bar
|
||||
@ -664,7 +690,8 @@ fileinfo:
|
||||
dd temp_area
|
||||
string:
|
||||
; db '/HARDDISK/FIRST/1/DICK.BMP '
|
||||
db '/hd/1/menuet/pics/new.bmp '
|
||||
; db '/hd/1/menuet/pics/new.bmp '
|
||||
db '/rd/1/bgr.bmp '
|
||||
db ' '
|
||||
db ' '
|
||||
|
||||
@ -967,6 +994,9 @@ draw_window3:
|
||||
vflag: db 'x'
|
||||
bgrmode: dd 1
|
||||
|
||||
wnd_width dd 210
|
||||
wnd_height dd 53
|
||||
|
||||
lsz labelt3,\
|
||||
en, 'Background set',\
|
||||
ru, "“áâ ®¢ª ä® "
|
||||
@ -990,7 +1020,7 @@ lsz ok_btn,\
|
||||
|
||||
|
||||
IM_END:
|
||||
process_info:
|
||||
temp_area:
|
||||
rb 0x10000
|
||||
I_END:
|
||||
process_info:
|
||||
|
@ -268,6 +268,7 @@ draw_window:
|
||||
|
||||
|
||||
text:
|
||||
if lang eq ru
|
||||
db ' ‚६ï á¥à¢¥à : '
|
||||
db ' '
|
||||
db ' Œ¥î ã¯à ¢«¥¨ï á¥à¢¥à®¬: '
|
||||
@ -282,8 +283,25 @@ text:
|
||||
db ' ‹®ª «ìë© ¤à¥á : 192.168.0.1 '
|
||||
db ' “¤ «ñë© ¤à¥á : 192.168.0.2 '
|
||||
db '€¤à¥á á¥à¢¥à - ¢ ª®æ¥ ¨á室¨ª '
|
||||
db 'x <- END MARKER, DONT DELETE '
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
|
||||
else
|
||||
db ' On server: '
|
||||
db ' '
|
||||
db ' Server control menu: '
|
||||
db ' '
|
||||
db ' - Shutdown '
|
||||
db ' - Reboot '
|
||||
db ' - Save ramdisk image to floppy '
|
||||
db ' - Save ramdisk image to hard disk '
|
||||
db ' - Kernel restart '
|
||||
db ' - Close server part '
|
||||
db ' '
|
||||
db ' Local address : 192.168.0.1 '
|
||||
db ' Remote address : 192.168.0.2 '
|
||||
db 'Address of server is in end of source '
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
end if
|
||||
|
||||
labeltext: db 'Remote Control Center(Client)' ;
|
||||
lte:
|
||||
@ -301,9 +319,3 @@ sen_exit db 'E'
|
||||
connect db 'C'
|
||||
|
||||
I_END:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@ data_arrived:
|
||||
add ebx,[y]
|
||||
mov ecx,0x000000
|
||||
mov edx,inp_con
|
||||
mov esi,29
|
||||
mov esi,inp_con.len
|
||||
int 0x40
|
||||
add [y],10
|
||||
|
||||
@ -131,7 +131,7 @@ no_con:
|
||||
add ebx,[y]
|
||||
mov ecx,0x000000
|
||||
mov edx,inp_shut
|
||||
mov esi,26
|
||||
mov esi,inp_shut.len
|
||||
int 0x40
|
||||
add [y],10
|
||||
|
||||
@ -150,7 +150,7 @@ no_shut:
|
||||
add ebx,[y]
|
||||
mov ecx,0x000000
|
||||
mov edx,inp_reb
|
||||
mov esi,20
|
||||
mov esi,inp_reb.len
|
||||
int 0x40
|
||||
add [y],10
|
||||
|
||||
@ -168,7 +168,7 @@ no_reb:
|
||||
add ebx,[y]
|
||||
mov ecx,0x000000
|
||||
mov edx,inp_savefi
|
||||
mov esi,29
|
||||
mov esi,inp_savefi.len
|
||||
int 0x40
|
||||
add [y],10
|
||||
|
||||
@ -186,7 +186,7 @@ no_savefi:
|
||||
add ebx,[y]
|
||||
mov ecx,0x000000
|
||||
mov edx,inp_savehi
|
||||
mov esi,29
|
||||
mov esi,inp_savehi.len
|
||||
int 0x40
|
||||
add [y],10
|
||||
|
||||
@ -205,7 +205,7 @@ no_savehi:
|
||||
add ebx,[y]
|
||||
mov ecx,0x000000
|
||||
mov edx,inp_hotreb
|
||||
mov esi,28
|
||||
mov esi,inp_hotreb.len
|
||||
int 0x40
|
||||
add [y],10
|
||||
|
||||
@ -223,7 +223,7 @@ no_hotreb:
|
||||
add ebx,[y]
|
||||
mov ecx,0x000000
|
||||
mov edx,inp_exit
|
||||
mov esi,28
|
||||
mov esi,inp_exit.len
|
||||
int 0x40
|
||||
add [y],10
|
||||
|
||||
@ -236,7 +236,7 @@ no_com:
|
||||
add ebx,[y]
|
||||
mov ecx,0x000000
|
||||
mov edx,inp_com
|
||||
mov esi,22
|
||||
mov esi,inp_com.len
|
||||
int 0x40
|
||||
add [y],10
|
||||
|
||||
@ -303,11 +303,17 @@ draw_window:
|
||||
|
||||
|
||||
text:
|
||||
if lang eq ru
|
||||
db '„ ë© ¤à¥á : 192.168.0.2 '
|
||||
db '<27>à®á«ã訢 ¥¬ë© ¯®àâ : 0x6100 '
|
||||
db '‘®áâ®ï¨¥: '
|
||||
db 'x <- END MARKER, DONT DELETE '
|
||||
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
else
|
||||
db 'This address : 192.168.0.2 '
|
||||
db 'Used port : 0x6100 '
|
||||
db 'Status: '
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
end if
|
||||
|
||||
labeltext: db 'Remote Control Center(Server)'
|
||||
lte:
|
||||
@ -316,19 +322,39 @@ socket dd 0x0
|
||||
y dd 0x10
|
||||
sysclock dd 0x0
|
||||
|
||||
if lang eq ru
|
||||
inp_con db '‚¨¬ ¨¥, ¯®¤ª«î稫áï ª«¨¥â!'
|
||||
.len = $-inp_con
|
||||
inp_shut db 'ˆ¤ñ⠮⪫î票¥ á¨á⥬ë...'
|
||||
.len = $-inp_shut
|
||||
inp_reb db 'ˆ¤ñâ ¯¥à¥§ £à㧪 ...'
|
||||
.len = $-inp_reb
|
||||
inp_savefi db '‘®åà 塞 ¨¬¥¤¦ ¤¨áª¥âã...'
|
||||
.len = $-inp_savefi
|
||||
inp_savehi db '‘®åà 塞 ¨¬¥¤¦ †. ¤¨áª...'
|
||||
.len = $-inp_savehi
|
||||
inp_hotreb db 'ˆ¤ñâ £®àï稩 à¥áâ àâ ï¤à ...'
|
||||
.len = $-inp_hotreb
|
||||
inp_exit db '‚ë室 ¨§ ¯à®£à ¬¬ë...'
|
||||
.len = $-inp_exit
|
||||
inp_com db '<27>¥®¯®§ ï ª®¬¬ ¤ !'
|
||||
.len = $-inp_com
|
||||
else
|
||||
inp_con db 'Note, client has been connected!'
|
||||
.len = $-inp_con
|
||||
inp_shut db 'Turn off in progress...'
|
||||
.len = $-inp_shut
|
||||
inp_reb db 'Reboot in progress...'
|
||||
.len = $-inp_reb
|
||||
inp_savefi db 'Saving image to floppy...'
|
||||
.len = $-inp_savefi
|
||||
inp_savehi db 'Saving image to hard disk...'
|
||||
.len = $-inp_savehi
|
||||
inp_hotreb db 'Kernel restart in progress...'
|
||||
.len = $-inp_hotreb
|
||||
inp_exit db 'Exiting from program...'
|
||||
.len = $-inp_exit
|
||||
inp_com db 'Unknown command!'
|
||||
.len = $-inp_com
|
||||
end if
|
||||
I_END:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -26,8 +26,8 @@ ICON_STRIP equ '/RD/1/ICONSTRP.GIF'
|
||||
dd icon_data+0x30000 ; memory for app
|
||||
dd icon_data+0x30000 ; esp
|
||||
dd I_Param , 0x0 ; I_Param , I_Icon
|
||||
include 'macros.inc'
|
||||
include 'lang.inc'
|
||||
include 'macros.inc'
|
||||
COLOR_ORDER equ MENUETOS
|
||||
include 'gif_lite.inc'
|
||||
;include 'debug.inc'
|
||||
@ -801,7 +801,7 @@ else
|
||||
db 255,255,255,0, ' PARAMETERS '
|
||||
db 255,255,255,0, ' APPLY CHANGES '
|
||||
db 255,255,255,0, ' ADD ICON REMOVE ICON '
|
||||
db 0,0,0,0, '<EFBFBD>€†Œˆ’… <20>€ <20>Ž‡ˆ–ˆž ˆŠŽ<C5A0>Šˆ „‹Ÿ <20>…„€Š’ˆ<E28099>Ž‚€<E2809A>ˆŸ '
|
||||
db 0,0,0,0, ' PRESS ON POSITION OF ICON TO EDIT '
|
||||
db 'x' ; <- END MARKER, DONT DELETE
|
||||
|
||||
labelt:
|
||||
@ -811,11 +811,19 @@ end if
|
||||
|
||||
;ya dd 0
|
||||
|
||||
if lang eq ru
|
||||
add_text db '<27>€†Œˆ’… <20>€ <20>Ž‡ˆ–ˆž <20>…ˆ‘<CB86>Ž‹œ‡“…ŒŽ‰ ˆŠŽ<C5A0>Šˆ'
|
||||
add_text_len:
|
||||
|
||||
rem_text db '<27>€†Œˆ’… <20>€ <20>Ž‡ˆ–ˆž ˆ‘<CB86>Ž‹œ‡“…ŒŽ‰ ˆŠŽ<C5A0>Šˆ'
|
||||
rem_text_len:
|
||||
else
|
||||
add_text db 'PRESS ON POSITION OF UNUSED ICON'
|
||||
add_text_len:
|
||||
|
||||
rem_text db 'PRESS ON POSITION OF USED ICON'
|
||||
rem_text_len:
|
||||
end if
|
||||
arrows db '</>'
|
||||
iconname:
|
||||
db ICON_APP,0
|
||||
|
@ -6,8 +6,7 @@
|
||||
;
|
||||
; Š®¬¯¨«¨àã©â¥ á ¯®¬®éìî FASM 1.52 ¨ ¢ëè¥
|
||||
;
|
||||
include "lang.inc"
|
||||
include "macros.inc"
|
||||
include "MACROS.INC"
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
@ -23,9 +22,11 @@ include "macros.inc"
|
||||
|
||||
START: ; start of execution
|
||||
|
||||
mov eax, 5
|
||||
mov ebx, 10
|
||||
int 0x40
|
||||
; mov eax, 5
|
||||
; mov ebx, 10
|
||||
; int 0x40
|
||||
|
||||
mcall 18,15
|
||||
|
||||
mov eax, 58 ; load AUTORUN.DAT
|
||||
mov ebx, autorun_dat_info
|
||||
|
512
programs/system/pcidev/trunk/PCIDEV.ASM
Normal file
512
programs/system/pcidev/trunk/PCIDEV.ASM
Normal file
@ -0,0 +1,512 @@
|
||||
;***************************************************************
|
||||
; project name: PCI Device Enumeration
|
||||
; target platform: KolibriOS and MenuetOS
|
||||
; compiler: flat assmebler 1.63.2
|
||||
; version: 1.31
|
||||
; last update: 13(th) May 2006
|
||||
; maintained by: Jason Delozier (cordata51)
|
||||
; e-mail: cordata51@hotmail.com
|
||||
; project site: http://www.asmfreaks.com/menuetos
|
||||
;***************************************************************
|
||||
;Summary: This program will attempt to scan the PCI Bus
|
||||
; and display basic information about each device
|
||||
; connected to the PCI Bus.
|
||||
;***************************************************************
|
||||
;HISTORY:
|
||||
;keep dates in european format (dd/mm/yyyy), please
|
||||
; '!' means big changes
|
||||
; to-do:
|
||||
;PCI version should be normalized (0210->02.10)
|
||||
;----------------------------------------------------------------
|
||||
;1.31: PCIDEV 13/05/2006
|
||||
;Author: Jason Delozier <cordata51@hotmail.com>
|
||||
;Features:
|
||||
; fixed
|
||||
; * ! bug in Company Name look up code that would cause Unknown Name errors.
|
||||
; * ! possible bugs, many instructions missing byte, word, dword prefixes
|
||||
; * ! possible bug which could have occured after removing "PREVIOUSVERSIONLIST"
|
||||
; entry in loop up code and not fixing jump parameters.
|
||||
; added
|
||||
; * comments to various parts of the code
|
||||
; optimized
|
||||
; * various parts of the source, too many to remember and mention.
|
||||
; * changed entries for Subclasses in vendors.inc to Byte format, saves a little space.
|
||||
;----------------------------------------------------------------
|
||||
;1.30: PCIDEV 11/05/2006
|
||||
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
|
||||
;Features:
|
||||
; added
|
||||
; * 3 new vendor id's (ESS from Madis Kalme and 2 id's
|
||||
; forgotten from 1.15 release: Broadcom -SiByte and Chaintech Comp.)
|
||||
; changed
|
||||
; * I don't know why other devs (Jason or Victor) changed window style
|
||||
; to old ugly one, so I changed it back to skinned type 3.
|
||||
; * the same goes to the use of macroc.inc - it is enabled again.
|
||||
; deleted
|
||||
; * there is no more label "PREVIOUSVERSIONLIST" - id's moved to the
|
||||
; appropriate parts of global list.
|
||||
;----------------------------------------------------------------
|
||||
;1.29: PCIDEV 30/04/2006
|
||||
;Author: Jason Delozier <cordata51@hotmail.com>
|
||||
;Features:
|
||||
; fixed
|
||||
; * ! bug that would not allow devices with device
|
||||
; numbers > 16 to be displayed.
|
||||
; added
|
||||
; * ! another heading called "FNC" (function) which allows
|
||||
; the multipurpose Device/Function varible to be split and
|
||||
; displayed to the user properly.
|
||||
; * horizontal bars to display for easier reading.
|
||||
; optimized
|
||||
; * vendor/description search routines for speed and space.
|
||||
;----------------------------------------------------------------
|
||||
;1.25: PCIDEV 02/10/2005
|
||||
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
|
||||
;Features:
|
||||
; changed
|
||||
; * ! Description is based on Class and SubClass
|
||||
; now (PCI 3.0). The Names of Classes and SubClasses
|
||||
; are in the end of Vendors.inc
|
||||
; deleted
|
||||
; * label "Descriptions" (names of Classes)
|
||||
;
|
||||
;----------------------------------------------------------------
|
||||
;1.20: PCIDEV 16/08/2005
|
||||
;Author: Victor Alberto Gil Hanla a.k.a. vhanla <vhanla@gmail.com>
|
||||
;Features:
|
||||
; added
|
||||
; * ! many vendor lists (865)
|
||||
; deleted
|
||||
; * previous version's list
|
||||
; changed
|
||||
; * previous Company Name searching and printing
|
||||
;----------------------------------------------------------------
|
||||
;1.15: PCIDEV 03/06/2005
|
||||
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
|
||||
;Features:
|
||||
; added
|
||||
; * quantity of devices,
|
||||
; * ! detection of Company Name based on Vendor ID,
|
||||
; * database of VenID (35 ID's),
|
||||
; * macros.inc for smaller size,
|
||||
; changed
|
||||
; * interface+(skinned window),
|
||||
; * VenID before DevID in 'table'(was DevID before VenID)
|
||||
;----------------------------------------------------------------
|
||||
;1.0: PCIDEV 30/01/2005
|
||||
;Author: Jason Delozier
|
||||
;Features:
|
||||
; able to
|
||||
; * detect PCI version,
|
||||
; * quantity of PCI buses,
|
||||
; * Vendor&Device ID for appropriate Device on Bus;
|
||||
; * detect Revision, Class and Subclass of Device,
|
||||
; * and make Description based on Class
|
||||
;-------------------------------------------------------------
|
||||
use32
|
||||
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'; 8 byte id
|
||||
dd 0x01 ; header version
|
||||
dd START ; start of code
|
||||
dd I_END ; size of image
|
||||
dd 0xFFFF ; memory for app = 64 KB
|
||||
dd I_END ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
|
||||
|
||||
include 'macros.inc'
|
||||
include 'VENDORS.INC'
|
||||
|
||||
START: ; start of execution
|
||||
call draw_window
|
||||
|
||||
still:
|
||||
mov eax,10 ; wait here for event
|
||||
int 0x40
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
je red
|
||||
cmp eax,2 ; key in buffer ?
|
||||
je key
|
||||
cmp eax,3 ; button in buffer ?
|
||||
je button
|
||||
|
||||
jmp still
|
||||
|
||||
red: ; redraw
|
||||
mov eax, 9 ;window redraw requested so get new window coordinates and size
|
||||
mov ebx, Proc_Info ;area to store process information
|
||||
mov ecx, -1 ;
|
||||
int 0x40 ;get the process information
|
||||
mov eax,[Proc_Info+34] ;store the window coordinates into the Form Structure
|
||||
mov [Form+2], ax ;x start position
|
||||
mov eax,[Proc_Info+38] ;
|
||||
mov [Form+6],ax ;ystart position
|
||||
mov eax,[Proc_Info+42] ;
|
||||
mov [Form],ax ;window width
|
||||
mov eax,[Proc_Info+46] ;
|
||||
mov [Form+4] ,ax ;window height
|
||||
call draw_window ;go redraw window now
|
||||
jmp still
|
||||
|
||||
key: ; key
|
||||
mov eax,2 ; just read it and ignore
|
||||
int 0x40
|
||||
jmp still
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
int 0x40
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
jne noclose
|
||||
|
||||
mov eax,-1 ; close this program
|
||||
int 0x40
|
||||
noclose:
|
||||
jmp still
|
||||
|
||||
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
Form:
|
||||
dw 780 ;window width
|
||||
dw 100 ;window x start
|
||||
dw 420 ;window height
|
||||
dw 100 ;window y start
|
||||
|
||||
|
||||
|
||||
draw_window:
|
||||
|
||||
mov byte [total],0
|
||||
|
||||
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, dword [Form] ; x/width of window
|
||||
mov ecx, dword [Form+4] ; y/height of window
|
||||
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
|
||||
mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl
|
||||
mov edi,0x005080d0 ; color of frames RRGGBB
|
||||
int 0x40 ; draw the window
|
||||
; WINDOW LABEL
|
||||
mov eax,4 ; function 4 : write text to window
|
||||
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
|
||||
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
|
||||
mov edx,labelt ; pointer to text beginning
|
||||
mov esi,labellen-labelt ; text length
|
||||
int 0x40
|
||||
|
||||
;draw captions to window
|
||||
mov ebx, 20*65536+25 ;x start, ystart of text
|
||||
mov ecx, 0x224466 ;color of text
|
||||
mov edx, dword PCIWin ;start of text buffer
|
||||
mov esi, 106 ;lenght of line
|
||||
newline: ;
|
||||
mov eax, 4 ;draw text system function
|
||||
int 0x40 ;draw the text
|
||||
add ebx, 10 ;one line down
|
||||
add edx, esi ;add lenght of line to offset of text buffer
|
||||
cmp byte[edx], byte 'x' ;is it the end of buffer?
|
||||
jne newline ;if not draw another line of text
|
||||
|
||||
;Insert horizontal bars in list area
|
||||
mov eax, 13 ;draw bar system function
|
||||
mov ebx, 18 ;set Xstart position of bar
|
||||
shl ebx, 16 ;
|
||||
mov bx,word [Form] ;get width of window
|
||||
sub bx, 32 ;bar is 32 pixels shorter then window width
|
||||
mov ecx, 109*65536+10 ;set Ystart(109) and Height(10) of bar
|
||||
mov edx, 0xb6b6b6 ;set color of bar
|
||||
again: ;begin draw bar loop
|
||||
int 0x40 ;draw bar to window area
|
||||
shr ecx, 16 ;move the Ystart position to working area
|
||||
add ecx, 34 ;add 34 pixels to Y Start (moves bar down)
|
||||
cmp cx,word [Form+4] ;is the Ystart position outside of window area
|
||||
jae nomo ;if so stop drawing bars
|
||||
sub ecx, 14 ;if not, we only need 20 pixels between bar tops
|
||||
shl ecx, 16 ;set that values as Ystart
|
||||
add ecx, 10 ;Bar Height is always 10 pixels
|
||||
jmp again ;draw another bar
|
||||
nomo: ;done drawing bars here
|
||||
|
||||
;start PCI stuff
|
||||
call Get_PCI_Info ;get pci version and last bus
|
||||
mov cx,word [PCI_Version] ;number to draw
|
||||
mov eax, 47 ;draw number system function
|
||||
xor esi, esi ;color of text
|
||||
mov ebx, 0x00040100 ;4 digits to draw in hex format
|
||||
mov edx, 110*65536+45 ;x/y start position of number
|
||||
int 0x40 ;draw pci version to window
|
||||
mov cl,byte [PCI_LastBus] ;number to draw
|
||||
mov ebx, 0x00020100 ;2 digits hex format
|
||||
add edx, 10 ;one line below pci version
|
||||
int 0x40 ;draw the last bus to window
|
||||
|
||||
call scan_Pci ;scan for and draw each pci device
|
||||
|
||||
movzx ecx, byte [total] ;number to draw
|
||||
mov eax, 47 ;draw number system function
|
||||
mov ebx, 0x00020000 ;2 digits to draw in decimal format
|
||||
xor esi, esi ;color of text
|
||||
mov edx, 150*65536+65 ;x/y position to draw to
|
||||
int 0x40 ;draw total number of devices to window
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
int 0x40
|
||||
|
||||
ret
|
||||
; ***********************************************
|
||||
; ******* END WINDOW DEFINITIONS & DRAW *******
|
||||
; ***********************************************
|
||||
|
||||
|
||||
;******************************************************
|
||||
;* Gets the PCI Versioin and Last Bus
|
||||
Get_PCI_Info:
|
||||
mov eax, 62
|
||||
xor ebx, ebx
|
||||
int 0x40
|
||||
mov word [PCI_Version], ax
|
||||
mov eax, 62
|
||||
mov ebx, 1
|
||||
int 0x40
|
||||
mov byte [PCI_LastBus], al
|
||||
ret
|
||||
;******************************************************
|
||||
|
||||
|
||||
;******************************************************
|
||||
;* Get all devices on PCI Bus
|
||||
scan_Pci:
|
||||
cmp byte [PCI_LastBus],0xff ;0xFF means no pci bus found
|
||||
jne Pci_Exists ;
|
||||
ret ;if no bus then leave
|
||||
Pci_Exists:
|
||||
mov byte [V_Bus], 0 ;reset varibles
|
||||
mov byte [V_Dev], 0 ;
|
||||
mov edx, 20*65536+110 ;set start write position
|
||||
Start_Enum:
|
||||
mov bl, 6 ;get a dword
|
||||
mov bh, byte [V_Bus] ;bus of pci device
|
||||
mov ch, byte [V_Dev] ;device number/function
|
||||
mov cl, 0 ;offset to device/vendor id
|
||||
mov eax, 62 ;pci system function
|
||||
int 0x40 ;get ID's
|
||||
|
||||
cmp ax, 0 ;Vendor ID should not be 0 or 0xFFFF
|
||||
je nextDev ;check next device if nothing exists here
|
||||
cmp ax, 0xffff ;
|
||||
je nextDev ;
|
||||
|
||||
mov word [PCI_Vendor], ax ;There is a device here, save the ID's
|
||||
shr eax, 16 ;
|
||||
mov word [PCI_Device], ax ;
|
||||
mov eax, 62 ;PCI Sys Function
|
||||
mov bl, 4 ;Read config byte
|
||||
mov bh, byte [V_Bus] ;Bus #
|
||||
mov ch, byte [V_Dev] ;Device # on bus
|
||||
mov cl, 0x08 ;Register to read (Get Revision)
|
||||
int 0x40 ;Read it
|
||||
mov byte [PCI_Rev], al ;Save it
|
||||
mov eax, 62 ;PCI Sys Function
|
||||
mov cl, 0x0b ;Register to read (Get class)
|
||||
int 0x40 ;Read it
|
||||
mov byte [PCI_Class], al ;Save it
|
||||
mov eax, 62 ;PCI Sys Function
|
||||
mov cl, 0x0a ;Register to read (Get Subclass)
|
||||
int 0x40 ;Read it
|
||||
mov byte [PCI_SubClass], al ;Save it
|
||||
inc byte [total] ;one more device found
|
||||
call Print_New_Device ;print device info to screen
|
||||
nextDev:
|
||||
inc byte [V_Dev] ;next device on this bus
|
||||
jnz Start_Enum ;jump until we reach zero
|
||||
;(used to be JNO which caused bug!!! 30-4-2006, JMD)
|
||||
mov byte [V_Dev], 0 ;reset device number
|
||||
inc byte [V_Bus] ;next bus
|
||||
mov al, byte [PCI_LastBus] ;get last bus
|
||||
cmp byte [V_Bus], al ;was it last bus
|
||||
jbe Start_Enum ;if not jump to keep searching
|
||||
ret
|
||||
;******************************************************
|
||||
|
||||
|
||||
|
||||
;******************************************************
|
||||
;* Print device info to screen
|
||||
Print_New_Device:
|
||||
mov eax, 47 ;Write number to screen system function
|
||||
mov ebx, 0x00040100 ;4 byte number, print in hexidecimal
|
||||
xor esi, esi ;Color of text
|
||||
movzx ecx,word [PCI_Vendor] ;Pointer to number to be written
|
||||
int 0x40 ;Write Vendor ID
|
||||
and edx, 0xFFFF ;*****************************************
|
||||
or edx, 54*65536 ;X start becomes 54
|
||||
movzx ecx,word [PCI_Device] ;get Vendor ID
|
||||
int 0x40 ;Draw Vendor ID to Window
|
||||
mov ebx, 0x00020100 ;2 digit number, in hexidecimal format
|
||||
and edx, 0xFFFF ;*****************************************
|
||||
or edx, 98*65536 ;X start becomes 98
|
||||
movzx ecx,byte [V_Bus] ;get bus number
|
||||
int 0x40 ;draw bus number to screen
|
||||
and edx, 0xFFFF ;*****************************************
|
||||
or edx, 128*65536 ;X start becomes 128
|
||||
movzx ecx,byte [V_Dev] ;get device number
|
||||
shr ecx, 3 ;device number is bits 3-7
|
||||
int 0x40 ;Draw device Number To Window
|
||||
and edx, 0xFFFF ;*****************************************
|
||||
or edx, 155*65536 ;X start becomes 155
|
||||
movzx ecx, byte [V_Dev] ;get Function number
|
||||
and ecx, 7 ;function is first 3 bits
|
||||
int 0x40 ;Draw Function Number To Window
|
||||
and edx, 0xFFFF ;*****************************************
|
||||
or edx, 179*65536 ;X start becomes 179
|
||||
movzx ecx,byte [PCI_Rev] ;get revision number
|
||||
int 0x40 ;Draw Revision to screen
|
||||
and edx, 0xFFFF ;*****************************************
|
||||
or edx, 215*65536 ;X start becomes 215
|
||||
movzx ecx,byte [PCI_Class] ;get PCI_Class
|
||||
int 0x40 ;Draw Class to screen
|
||||
and edx, 0xFFFF ;*****************************************
|
||||
or edx, 266*65536 ;X start becomes 266
|
||||
movzx ecx,byte [PCI_SubClass];get sub class
|
||||
int 0x40 ;Draw Sub Class to screen
|
||||
;Write Names
|
||||
movzx ebx, dx ;Set y position
|
||||
or ebx, 310*65536 ;set Xposition to 310
|
||||
|
||||
;**********************************************************
|
||||
;Prints the Vendor's Name based on Vendor ID
|
||||
;
|
||||
; modified part by vhanla (I know it is not a fastest way to search)
|
||||
; it needs optimization... HELP this project!
|
||||
;
|
||||
; Modified on 30-04-2006 by JMD for size
|
||||
;-----------------------------------------------------------------------------
|
||||
;first determine which list to find the vendor in
|
||||
mov ax, word [PCI_Vendor]
|
||||
mov ecx, 255 ;# vendors in most lists
|
||||
cmp ax,4800 ;Check if Vendor's value is less than this number
|
||||
jae next1 ;if it is less, let's continue, or jump to next1
|
||||
mov edx, _FIRSTPART ;select this list
|
||||
jmp rep1 ;start searching list
|
||||
next1: ;
|
||||
cmp ax,5314 ;same thing happening here as above^
|
||||
jae next2 ;
|
||||
mov edx, _SECONDPART ;
|
||||
jmp rep1 ;
|
||||
next2: ;
|
||||
cmp ax,5574 ;
|
||||
jae next3 ;
|
||||
mov edx, _THIRDPART ;
|
||||
jmp rep1 ;
|
||||
next3: ;
|
||||
mov ecx, 110 ;only 110 vendors in this list
|
||||
mov edx, _FOURTHPART ;
|
||||
|
||||
rep1:
|
||||
cmp ax,word[edx+50] ;are Vendor ID's the same?
|
||||
je ex ;if so jump to print the description to screen
|
||||
add edx, 52 ;if not put us at start of next description
|
||||
dec ecx ;one less description in list
|
||||
jnz rep1 ;was it our last?
|
||||
mov edx, _UNKNOWN ;if so we dont know this Vendor
|
||||
|
||||
ex:
|
||||
;lets print the vendor Name
|
||||
xor ecx, ecx ;font color
|
||||
mov eax,4 ;OS CMD
|
||||
mov esi,50 ;Length of text
|
||||
int 0x40 ;Print the text
|
||||
;------------------------------------------------------------------
|
||||
|
||||
;------------------------------------------------------------------
|
||||
;Get description based on Class/Subclass
|
||||
cmp byte [PCI_Class], 11h ;we only know of 17 classes
|
||||
ja endd ;if its more then, its unknown to us, so jump
|
||||
movzx eax, byte [PCI_Class] ;load our class
|
||||
shl eax, 3 ;multiply for jump table
|
||||
mov ecx, [ClassList+eax+4] ;number of descriptions for this class
|
||||
mov edx, [ClassList+eax] ;start of description list for class
|
||||
movzx eax, byte [PCI_SubClass] ;get subclass
|
||||
repu1:
|
||||
cmp al,byte[edx+32] ;are subclasses the same?
|
||||
je endd ;if so jump to print the description to screen
|
||||
add edx, 33 ;if not put us at start of next description
|
||||
dec ecx ;one less description in list
|
||||
jnz repu1 ;was it our last?
|
||||
mov edx,_UNKNOWND ;if so its unknown device
|
||||
endd:
|
||||
and ebx, 0x0000FFFF ;clear X position
|
||||
or ebx, 0x02300000 ;set X position to 560 pixels
|
||||
xor ecx, ecx ;color of text
|
||||
mov eax,4 ;draw text system function
|
||||
mov esi,32 ;length of text to draw
|
||||
int 0x40 ;draw the text
|
||||
|
||||
movzx edx, bx ;get y coordinate
|
||||
add edx, 0x0014000A ;add 10 to y coordinate and set x coordinate to 20
|
||||
ret
|
||||
|
||||
ClassList:
|
||||
dd Class0 , 2, Class1 , 8, Class2, 8, Class3, 4
|
||||
dd Class4 , 4, Class5 , 3, Class6, 12, Class7, 7
|
||||
dd Class8 , 8, Class9 , 6, ClassA, 2, ClassB, 7
|
||||
dd ClassC , 10, ClassD , 8, ClassE, 1, ClassF, 4
|
||||
dd Class10, 3, Class11, 5
|
||||
;------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
; DATA AREA
|
||||
|
||||
labelt:
|
||||
db 'PCI Device Enumeration v 1.31 by J. Delozier, S. Kuzmin and V. Hanla'
|
||||
labellen:
|
||||
|
||||
PCIWin:
|
||||
db 'Please remember to enable PCI Access to Applications in Setup Menu.'
|
||||
db ' '
|
||||
db ' '
|
||||
db ' '
|
||||
db 'PCI Version = '
|
||||
db ' '
|
||||
db 'Last PCI Bus = '
|
||||
db ' '
|
||||
db 'Quantity of devices = '
|
||||
db ' '
|
||||
db ' '
|
||||
db ' '
|
||||
db 'VenID DevID Bus# Dev# Fnc Rev Class Subclass Comp'
|
||||
db 'any Description '
|
||||
db '----- ----- ---- ---- --- --- ----- -------- --------------------'
|
||||
db '---------------------- ----------------'
|
||||
db 'x'
|
||||
|
||||
total db 0
|
||||
V_Bus db 0
|
||||
V_Dev db 0
|
||||
PCI_Version dw 0
|
||||
PCI_LastBus db 0
|
||||
PCI_Device dw 0
|
||||
PCI_Vendor dw 0
|
||||
PCI_Bus db 0
|
||||
PCI_Dev db 0
|
||||
PCI_Rev db 0
|
||||
PCI_Class db 0
|
||||
PCI_SubClass db 0
|
||||
|
||||
|
||||
Proc_Info:
|
||||
times 1024 db 0
|
||||
|
||||
I_END:
|
File diff suppressed because it is too large
Load Diff
266
programs/system/pcidev/trunk/macros.inc
Normal file
266
programs/system/pcidev/trunk/macros.inc
Normal file
@ -0,0 +1,266 @@
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd __memory
|
||||
dd __stack
|
||||
|
||||
if used __params & ~defined __params
|
||||
dd __params
|
||||
else
|
||||
dd 0x0
|
||||
end if
|
||||
|
||||
dd 0x0
|
||||
}
|
||||
MEOS_APP_START fix meos_app_start
|
||||
|
||||
macro code
|
||||
{
|
||||
__start:
|
||||
}
|
||||
CODE fix code
|
||||
|
||||
macro data
|
||||
{
|
||||
__data:
|
||||
}
|
||||
DATA fix data
|
||||
|
||||
macro udata
|
||||
{
|
||||
if used __params & ~defined __params
|
||||
__params:
|
||||
db 0
|
||||
__end:
|
||||
rb 255
|
||||
else
|
||||
__end:
|
||||
end if
|
||||
__udata:
|
||||
}
|
||||
UDATA fix udata
|
||||
|
||||
macro meos_app_end
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
MEOS_APP_END fix meos_app_end
|
||||
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mstr [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring
|
||||
ssize = $
|
||||
end virtual
|
||||
dd ssize
|
||||
db sstring
|
||||
common
|
||||
dd -1
|
||||
}
|
||||
|
||||
|
||||
; 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 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
|
||||
}
|
||||
|
||||
|
||||
|
||||
; easy system call macro
|
||||
macro mpack dest, hsrc, lsrc
|
||||
{
|
||||
if (hsrc eqtype 0) & (lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16 + lsrc
|
||||
else
|
||||
if (hsrc eqtype 0) & (~lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16
|
||||
add dest, lsrc
|
||||
else
|
||||
mov dest, hsrc
|
||||
shl dest, 16
|
||||
add dest, lsrc
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a { ; mike.dld
|
||||
if ~a eq
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
|
||||
macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
|
||||
; language for programs
|
||||
lang fix ru ; ru en fr ge fi
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
macro add arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
inc arg1
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro sub arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
dec arg1
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & (arg2 eqtype 0)
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
xor arg1,arg1
|
||||
inc arg1
|
||||
else if (arg2) = -1
|
||||
or arg1,-1
|
||||
else if (arg2) > -128 & (arg2) < 128
|
||||
push arg2
|
||||
pop arg1
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
macro struct name
|
||||
{
|
||||
virtual at 0
|
||||
name name
|
||||
sizeof.#name = $ - name
|
||||
end virtual
|
||||
}
|
||||
|
||||
; 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
|
||||
|
||||
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
|
||||
|
||||
|
||||
; constants
|
||||
|
||||
; events
|
||||
EV_IDLE = 0
|
||||
EV_TIMER = 0
|
||||
EV_REDRAW = 1
|
||||
EV_KEY = 2
|
||||
EV_BUTTON = 3
|
||||
EV_EXIT = 4
|
||||
EV_BACKGROUND = 5
|
||||
EV_MOUSE = 6
|
||||
EV_IPC = 7
|
||||
EV_STACK = 8
|
||||
|
||||
; event mask bits for function 40
|
||||
EVM_REDRAW = 1b
|
||||
EVM_KEY = 10b
|
||||
EVM_BUTTON = 100b
|
||||
EVM_EXIT = 1000b
|
||||
EVM_BACKGROUND = 10000b
|
||||
EVM_MOUSE = 100000b
|
||||
EVM_IPC = 1000000b
|
||||
EVM_STACK = 10000000b
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user