Kernel: now bootcode loads from floppy only used sectors

sysxtree: rewritten to 70th function, corrected scrollbar
copyr: new version for new sysxtree
@rcher, rtfread: modified to work with new sysxtree
midamp: added version modified to work with new sysxtree

git-svn-id: svn://kolibrios.org@134 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2006-08-24 12:33:31 +00:00
parent ec76c66cd2
commit dde2612191
34 changed files with 5228 additions and 1685 deletions

View File

@ -152,6 +152,26 @@ pagetable_set:
loop @b
ret
boot_read_floppy:
push si
xor si, si
mov ah, 2 ; read
@@:
push ax
int 0x13
pop ax
jnc @f
inc si
cmp si, 10
jb @b
mov si, badsect-0x10000
sayerr_plain:
call printplain
jmp $
@@:
pop si
ret
org $+0x10000
; table for move to extended memory (int 15h, ah=87h)
@ -824,73 +844,195 @@ end if
xor ax, ax ; reset drive
xor dx, dx
int 0x13
mov cx,0x0001 ; startcyl,startsector
xor dx, dx ; starthead,drive
push word 80*2 ; read no of sect
reads:
pusha
xor si,si
newread:
mov bx,0xa000 ; es:bx -> data area
mov ax,0x0200+18 ; read, no of sectors to read
int 0x13
test ah, ah
jz goodread
inc si
cmp si,10
jnz newread
mov si,badsect-0x10000
sayerr_plain:
call printplain
jmp $
goodread:
; move -> 1mb
mov si,movedesc-0x10000
; now load floppy image to memory
; at first load boot sector and first FAT table
mov cx, 0x0001 ; startcyl,startsector
xor dx, dx ; starthead,drive
mov al, 1+9 ; no of sectors to read
mov bx, 0xB000 ; es:bx -> data area
call boot_read_floppy
; and copy them to extended memory
mov si, movedesc-0x10000
mov [si+8*2+3], bh
push es
push ds
pop es
mov cx,256*18
mov ah,0x87
mov cx, 256*10
mov ah, 0x87
int 0x15
pop es
test ah,ah ; was the move successfull ?
je goodmove
mov dx,0x3f2 ; floppy motor off
mov al,0
out dx,al
mov si,memmovefailed-0x10000
jmp sayerr_plain
goodmove:
add dword [movedesc-0x10000+0x18+2], 512*18
popa
inc dh
cmp dh,2
jnz bb2
mov dh,0
inc ch
pusha ; print prosentage
mov si,pros-0x10000
shr ch, 2
mov al, '5'
test ch, 1
jnz @f
mov al, '0'
test ah, ah
jz @f
sayerr_floppy:
mov dx, 0x3f2
mov al, 0
out dx, al
mov si, memmovefailed-0x10000
jmp sayerr_plain
@@:
mov [si+1], al
shr ch, 1
add ch, '0'
mov [si], ch
call printplain
popa
bb2:
pop ax
dec ax
add dword [si+8*3+2], 512*10
; copy FAT to second copy
mov byte [si+8*2+3], 0xB2
mov cx, 256*9
mov ah, 0x87
int 0x15
pop es
test ah, ah
jnz sayerr_floppy
add dword [si+8*3+2], 512*9
; calculate total number of sectors to read
mov ax, 1+9+14 ; boot+FAT+root
mov di, 0xB203
.calc_loop:
test word [es:di], 0xFFF
jz @f
inc ax
@@:
test word [es:di+1], 0xFFF0
jz @f
inc ax
@@:
add di, 3
cmp di, 0xB200+1440*3
jb .calc_loop
push ax
jnz reads
readdone:
mov bp, 1+9 ; already read sectors
; now read rest
mov byte [si+8*2+3], 0xA0
mov di, 2-14 ; absolute sector-31
mov cx, 0x0002 ; cylinder=0, sector=2
mov dx, 0x0100 ; head=1, disk=0
.read_loop:
; determine whether sector must be read
cmp di, 2
jl .read
mov bx, di
shr bx, 1
jnc .even
test word [es:bx+di+0xB200], 0xFFF0
jmp @f
.even:
test word [es:bx+di+0xB200], 0xFFF
@@:
jz .skip
.read:
mov bx, 0xA000
mov al, 1 ; 1 sector
call boot_read_floppy
inc bp
push es
push ds
pop es
pusha
mov cx, 256
mov ah, 0x87
int 0x15
test ah, ah
popa
pop es
jnz sayerr_floppy
.skip:
add dword [si+8*3+2], 512
inc cx
cmp cl, 19
jnz @f
mov cl, 1
inc dh
cmp dh, 2
jnz @f
mov dh, 0
inc ch
@@:
pop ax
push ax
pusha
; draw percentage
; total sectors: ax
; read sectors: bp
xchg ax, bp
mov cx, 100
mul cx
div bp
aam
xchg al, ah
add ax, '00'
mov si, pros-0x10000
cmp [si], ax
jz @f
mov [si], ax
call printplain
@@:
popa
inc di
cmp di, 2880-31
jnz .read_loop
; mov cx,0x0001 ; startcyl,startsector
; xor dx, dx ; starthead,drive
; push word 80*2 ; read no of sect
; reads:
; pusha
; xor si,si
; newread:
; mov bx,0xa000 ; es:bx -> data area
; mov ax,0x0200+18 ; read, no of sectors to read
; int 0x13
; test ah, ah
; jz goodread
; inc si
; cmp si,10
; jnz newread
; mov si,badsect-0x10000
;sayerr_plain:
; call printplain
; jmp $
; goodread:
; ; move -> 1mb
; mov si,movedesc-0x10000
; push es
; push ds
; pop es
; mov cx,256*18
; mov ah,0x87
; int 0x15
; pop es
;
; test ah,ah ; was the move successfull ?
; je goodmove
; mov dx,0x3f2 ; floppy motor off
; mov al,0
; out dx,al
; mov si,memmovefailed-0x10000
; jmp sayerr_plain
; goodmove:
;
; add dword [movedesc-0x10000+0x18+2], 512*18
; popa
; inc dh
; cmp dh,2
; jnz bb2
; mov dh,0
; inc ch
; pusha ; print prosentage
; mov si,pros-0x10000
; shr ch, 2
; mov al, '5'
; test ch, 1
; jnz @f
; mov al, '0'
;@@:
; mov [si+1], al
; shr ch, 1
; add ch, '0'
; mov [si], ch
; call printplain
; popa
; bb2:
; pop ax
; dec ax
; push ax
; jnz reads
; readdone:
; pop ax
mov si,backspace2-0x10000
call printplain
mov si,okt-0x10000

View File

@ -62,7 +62,8 @@ s_vesa db "VESA version: "
.mem db "??? Mbytes)",13,10,0
gr_mode db "Select mode: ",13,10,0
s_bpp db 13,10,186," Bits per pixel: "
.bpp dw "??",13,10,13,10,0
.bpp dw "??"
db 13,10,0
vrrmprint db "Apply VRR? (picture frequency greater than 60Hz"
db " only for transfers:",13,10
db 186," 1024*768->800*600 and 800*600->640*480) [1-yes,2-no]:",0

View File

@ -24,10 +24,10 @@ macro line_space {
times 78 db 32
db 186
}
d80x25_top:
line_full_top
space_msg: line_space
verstr:
verstr2:
; line_space
; version string
db 186,32
@ -38,12 +38,14 @@ verstr:
end if
db a
end repeat
repeat 78 - ($-verstr)
repeat 78 - ($-verstr2)
db ' '
end repeat
db 32,186
verstr:
line_half
d80x25_top_num = 4
space_msg: line_space
d80x25_top_num = 3
d80x25_bottom:
db 186,' Kolibri OS ®á­®¢ ­  ­  Menuet OS ¨ ­¥ ¯à¥¤®áâ ¢«ï¥â '
db '­¨ª ª¨å £ àa­â¨©. ',186
@ -52,43 +54,26 @@ d80x25_bottom:
line_full_bottom
d80x25_bottom_num = 3
msg_apm db " APM x.x ",0
novesa db "‚¨¤¥®ª àâ : EGA/CGA",13,10,0
vervesa db "‚¥àá¨ï VESA: Vesa x.x",13,10,0
vervesa_off=19
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
db "[3] 1024x768, [4] 1280x1024",13,10
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
db "[7] 1024x768, [8] 1280x1024",13,10
db 186," EGA/CGA 256 –¢¥â®¢: [9] 320x200, "
db "VGA 16 –¢¥â®¢: [0] 640x480",13,10
db 186," ‚ë¡¥à¨â¥ ¢¨¤¥®à¥¦¨¬: ",0
bt24 db "ƒ«ã¡¨­  梥â : 24",13,10,0
bt32 db "ƒ«ã¡¨­  梥â : 32",13,10,0
s_vesa db "‚¥àá¨ï VESA: "
.ver db "?.? ("
.mem db "??? Œ¡)",13,10,0
gr_mode db "‚ë¡¥à¨â¥ ¢¨¤¥®à¥¦¨¬: ",13,10,0
s_bpp db 13,10,186," ƒ«ã¡¨­  梥â : "
.bpp dw "??"
db 13,10,0
vrrmprint db "ˆá¯®«ì§®¢ âì VRR? (ç áâ®â  ª ¤à®¢ ¢ëè¥ 60 ƒæ"
db " ⮫쪮 ¤«ï ¯¥à¥å®¤®¢:",13,10
db 186," 1024*768>800*600 ¨ 800*600>640*480) [1-¤ , 2-­¥â]: ",0
;askmouse db "Œëèì:" ; 186, " "
; db " [1] PS/2 (USB), [2] Com1, [3] Com2."
; db " ‚ë¡¥à¨â¥ ¯®àâ [1-3]: ",0
;no_com1 db 13,10,186," No COM1 mouse",0
;no_com2 db 13,10,186," No COM2 mouse",0
gr_acc db "Vesa 2.0+: ‚ª«îç¨âì MTRR ¤«ï ã᪮७¨ï £à ä¨ª¨? "
db "[1-¤ /2-­¥â]: ",0
;gr_direct db 186," ˆá¯®«ì§®¢ âì «¨­¥©­ë© ¢¨¤¥®¡ãä¥à? "
; db "[1-¤ /2-­¥â]: ",0
;mem_model db 13,10,186," Ž¡ê+¬ ¯ ¬ï⨠[1-16 Mb / 2-32 Mb / "
; db "3-64Mb / 4-128 Mb / 5-256 Mb]: ",0
;bootlog db 13,10,186," <20>à®á¬®âà¥âì ¦ãà­ « § £à㧪¨? [1-­¥â/2-¤ ]: ",0
bdev db "‡ £à㧨âì ®¡à § ¨§ [1-¤¨áª¥â ; 2-C:\menuet.img (FAT32);"
db 13,10,186," "
db "3-¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §]: ",0
probetext db 13,10,13,10,186," ‘â ­¤ àâ­ë© ¢¨¤¥®à¥¦¨¬? [1-¤ , "
db "2-¯à®¢¥à¨âì ¤à㣨¥ (Vesa 3.0)]: ",0
;memokz256 db 13,10,186," RAM 256 Mb",0
;memokz128 db 13,10,186," RAM 128 Mb",0
;memokz64 db 13,10,186," RAM 64 Mb",0
;memokz32 db 13,10,186," RAM 32 Mb",0
;memokz16 db 13,10,186," RAM 16 Mb",0
prnotfnd db "Žè¨¡ª  - ‚¨¤¥®à¥¦¨¬ ­¥ ­ ©¤¥­.",0
;modena db "Žè¨¡ª  - ’ॡã¥âáï ¯®¤¤¥à¦ª  VBE 0x112+.",0
not386 db "Žè¨¡ª  - ’ॡã¥âáï ¯à®æ¥áá®à 386+.",0
@ -131,3 +116,33 @@ pdm3 db "
loading_msg db "ˆ¤ñâ § £à㧪  KolibriOS...",0
save_quest db "‡ ¯®¬­¨âì ⥪ã騥 ­ áâனª¨? [y/n]: ",0
loader_block_error db "Žè¨¡ª  ¢ ¤ ­­ëå ­ ç «ì­®£® § £àã§ç¨ª , ¯à®¤®«¦¥­¨¥ ­¥¢®§¬®¦­®.",0
_oem db 'oem: ',0
db 5
s_ven_intel db 'Intel'
db 2
s_ven_s3 db 'S3'
;db 5
;s_ven_bochs db 'Bochs'
;db 8
;s_ven_vmware db 'V M ware'
s_mode db " ????-????-?? (?) ",0
s_mode1 db " 0640-0480-04 (a) 0320-0200-08 (b) ",13,10,0
;_tl db 'ÚÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄ¿',13,10,\
; '³ à §à¥è¥­¨¥ ³ 4 ³ 8 ³ 15 ³ 16 ³ 24 ³ 32 ³',13,10,\
; 'ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄ´',13,10,0
;_rs db '³ ????x???? ³ - ³ - ³ - ³ - ³ - ³ - ³',13,10,0
;_bt db 'ÀÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÙ',13,10,0
_tl db 186,' ÚÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄ¿',13,10,\
186,' ³ 4 ³ 8 ³ 15 ³ 16 ³ 24 ³ 32 ³',13,10,\
186,' ÚÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÅÄ¿',13,10,0
_rs db 186,' ³ ????x???? ³ ? ³ ? ³ ? ³ ? ³ ? ³ ? ³Û³',13,10,0
_bt db 186,' ÀÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÁÄÙ',13,10,0
_sel1 db 0x1A,0
_sel2 db 0x1B,0

View File

@ -150,6 +150,26 @@ pagetable_set:
loop @b
ret
boot_read_floppy:
push si
xor si, si
mov ah, 2 ; read
@@:
push ax
int 0x13
pop ax
jnc @f
inc si
cmp si, 10
jb @b
mov si, badsect-0x10000
sayerr_plain:
call printplain
jmp $
@@:
pop si
ret
; 16-bit data
; videomodes table
org $+0x10000
@ -210,6 +230,7 @@ start_of_code:
mov ax, 3
int 0x10
if lang eq ru
; Load & set russian VGA font (RU.INC)
mov bp,RU_FNT1-10000h ; RU_FNT1 - First part
mov bx,1000h ; 768 bytes
@ -225,6 +246,7 @@ start_of_code:
mov ax,1100h
int 10h
; End set VGA russian font
end if
; draw frames
push 0xb800
@ -960,73 +982,195 @@ end if
xor ax, ax ; reset drive
xor dx, dx
int 0x13
mov cx,0x0001 ; startcyl,startsector
xor dx, dx ; starthead,drive
push word 80*2 ; read no of sect
reads:
pusha
xor si,si
newread:
mov bx,0xa000 ; es:bx -> data area
mov ax,0x0200+18 ; read, no of sectors to read
int 0x13
test ah, ah
jz goodread
inc si
cmp si,10
jnz newread
mov si,badsect-0x10000
sayerr_plain:
call printplain
jmp $
goodread:
; move -> 1mb
mov si,movedesc-0x10000
; now load floppy image to memory
; at first load boot sector and first FAT table
mov cx, 0x0001 ; startcyl,startsector
xor dx, dx ; starthead,drive
mov al, 1+9 ; no of sectors to read
mov bx, 0xB000 ; es:bx -> data area
call boot_read_floppy
; and copy them to extended memory
mov si, movedesc-0x10000
mov [si+8*2+3], bh
push es
push ds
pop es
mov cx,256*18
mov ah,0x87
mov cx, 256*10
mov ah, 0x87
int 0x15
pop es
test ah,ah ; was the move successfull ?
je goodmove
mov dx,0x3f2 ; floppy motor off
mov al,0
out dx,al
mov si,memmovefailed-0x10000
jmp sayerr_plain
goodmove:
add dword [movedesc-0x10000+0x18+2], 512*18
popa
inc dh
cmp dh,2
jnz bb2
mov dh,0
inc ch
pusha ; print prosentage
mov si,pros-0x10000
shr ch, 2
mov al, '5'
test ch, 1
jnz @f
mov al, '0'
test ah, ah
jz @f
sayerr_floppy:
mov dx, 0x3f2
mov al, 0
out dx, al
mov si, memmovefailed-0x10000
jmp sayerr_plain
@@:
mov [si+1], al
shr ch, 1
add ch, '0'
mov [si], ch
call printplain
popa
bb2:
pop ax
dec ax
add dword [si+8*3+2], 512*10
; copy FAT to second copy
mov byte [si+8*2+3], 0xB2
mov cx, 256*9
mov ah, 0x87
int 0x15
pop es
test ah, ah
jnz sayerr_floppy
add dword [si+8*3+2], 512*9
; calculate total number of sectors to read
mov ax, 1+9+14 ; boot+FAT+root
mov di, 0xB203
.calc_loop:
test word [es:di], 0xFFF
jz @f
inc ax
@@:
test word [es:di+1], 0xFFF0
jz @f
inc ax
@@:
add di, 3
cmp di, 0xB200+1440*3
jb .calc_loop
push ax
jnz reads
readdone:
mov bp, 1+9 ; already read sectors
; now read rest
mov byte [si+8*2+3], 0xA0
mov di, 2-14 ; absolute sector-31
mov cx, 0x0002 ; cylinder=0, sector=2
mov dx, 0x0100 ; head=1, disk=0
.read_loop:
; determine whether sector must be read
cmp di, 2
jl .read
mov bx, di
shr bx, 1
jnc .even
test word [es:bx+di+0xB200], 0xFFF0
jmp @f
.even:
test word [es:bx+di+0xB200], 0xFFF
@@:
jz .skip
.read:
mov bx, 0xA000
mov al, 1 ; 1 sector
call boot_read_floppy
inc bp
push es
push ds
pop es
pusha
mov cx, 256
mov ah, 0x87
int 0x15
test ah, ah
popa
pop es
jnz sayerr_floppy
.skip:
add dword [si+8*3+2], 512
inc cx
cmp cl, 19
jnz @f
mov cl, 1
inc dh
cmp dh, 2
jnz @f
mov dh, 0
inc ch
@@:
pop ax
push ax
pusha
; draw percentage
; total sectors: ax
; read sectors: bp
xchg ax, bp
mov cx, 100
mul cx
div bp
aam
xchg al, ah
add ax, '00'
mov si, pros-0x10000
cmp [si], ax
jz @f
mov [si], ax
call printplain
@@:
popa
inc di
cmp di, 2880-31
jnz .read_loop
; mov cx, 0x0001 ; startcyl,startsector
; xor dx, dx ; starthead,drive
; push word 80*2 ; read no of sect
; reads:
; pusha
; xor si,si
; newread:
; mov bx,0xa000 ; es:bx -> data area
; mov ax,0x0200+18 ; read, no of sectors to read
; int 0x13
; test ah, ah
; jz goodread
; inc si
; cmp si,10
; jnz newread
; mov si,badsect-0x10000
;sayerr_plain:
; call printplain
; jmp $
; goodread:
; ; move -> 1mb
; mov si,movedesc-0x10000
; push es
; push ds
; pop es
; mov cx,256*18
; mov ah,0x87
; int 0x15
; pop es
;
; test ah,ah ; was the move successfull ?
; je goodmove
; mov dx,0x3f2 ; floppy motor off
; mov al,0
; out dx,al
; mov si,memmovefailed-0x10000
; jmp sayerr_plain
; goodmove:
;
; add dword [movedesc-0x10000+0x18+2], 512*18
; popa
; inc dh
; cmp dh,2
; jnz bb2
; mov dh,0
; inc ch
; pusha ; print prosentage
; mov si,pros-0x10000
; shr ch, 2
; mov al, '5'
; test ch, 1
; jnz @f
; mov al, '0'
;@@:
; mov [si+1], al
; shr ch, 1
; add ch, '0'
; mov [si], ch
; call printplain
; popa
; bb2:
; pop ax
; dec ax
; push ax
; jnz reads
; readdone:
; pop ax
mov si,backspace2-0x10000
call printplain
mov si,okt-0x10000

View File

@ -1,5 +1,3 @@
lang equ ru ; ru en fr ge fi
;
; Assembler
; SMALL

View File

@ -19,7 +19,7 @@
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x20000 ; memory for app
dd 0x10000 ; memory for app
dd 0x10000 ; esp
dd param_area , 0x0 ; I_Param , I_Icon
@ -27,49 +27,30 @@ include 'lang.inc'
include 'macros.inc' ; very useful stuff for MeOS
include 'ascl.inc'
STRLEN = 48 ; maximal length of filename
START: ; start of execution
; <20> à ¬¥âàë:
; ®â 0 ¤® 100 ¯ãâì ª ¨áâ®ç­¨ªã
; ®â 100 ¤® 200 ¯ãâì ª ¯à¨¥¬­¨ªã
;
; db n1 = ¤«¨­  ¯ã⨠ª ¨áâ®ç­¨ªã
; times n1 db ? = ¯ãâì ª ¨áâ®ç­¨ªã
; db n2 = ¤«¨­  ¯ã⨠ª ¯à¨ñ¬­¨ªã
; times n2 db ? = ¯ãâì ª ¯à¨ñ¬­¨ªã
; db 0
;get param
mov eax,15
cmp byte [param_area],0
je err_exit ;source not found
mov eax,16
cmp byte [param_area+100],0
je err_exit ;dest not found
mov ecx,199
cdf:
mov al,[param_area+ecx]
cmp al,byte 32
jne nor
mov al,byte 0
nor:
mov al,[param_area+ecx]
dec ecx
jns cdf
mov ecx,STRLEN - 4
copysp:
mov al,[param_area+ecx]
mov [source+ecx],al
dec ecx
jns copysp
mov [source+42],byte 0
mov ecx,STRLEN - 4
copydp:
mov al,[param_area+ecx+100]
mov [destination+ecx],al
dec ecx
jns copydp
mov [destination+42],byte 0
mov eax, 15
lea esi, [param_area+1]
movzx ecx, byte [esi-1]
jecxz err_exit
mov edi, source
rep movsb
mov byte [edi], 0
inc eax
movzx ecx, byte [esi]
inc esi
jecxz err_exit
mov edi, destination
rep movsb
mov byte [edi], 0
call draw_window
call copy_file
@ -90,19 +71,16 @@ err_exit:
push eax
call draw_window
pop eax
jmp copy_error
; jmp copy_error
; print message now
copy_error:
mov ebp,43
mul ebp
mov ebp,eax
imul ebp, eax, 43
mov eax,4
mov ebx,20*65536+70
mov ecx,0x10ff0000
mov edx,errors ;*8]
add edx,ebp
lea edx,[errors+ebp]
mov esi,43 ;[errors+edi*8+4]
int 0x40
jmp dexit
@ -122,10 +100,10 @@ copy_error:
;====================================================
copy_file:
; at first we must get the size of the source file
mov [source_info.blocks],1 ; load only 512 bytes
mov eax,58
mov ebx,source_info
int 0x40
mov dword [source_attr+32], 0
mov eax, 70
mov ebx, source_attr_info
int 0x40
; now eax contains error code
; and ebx contains file size in bytes
@ -141,9 +119,9 @@ copy_file:
.ok_getsize:
; allocate memory
mov ebx,[source_attr+32]
push ebx ; save file size
mov ecx,ebx
add ecx,0x20000 ; size of memory needed = 0x20000+filesize
lea ecx,[ebx+0x10000] ; size of memory needed = 0x10000+filesize
mov eax,64 ; func 64
mov ebx,1 ; resize application memory
int 0x40
@ -157,18 +135,16 @@ copy_file:
.ok_memory:
; save number of blocks to source_info
shr ebx,9 ; divide by 512
inc ebx ; blocks++
mov [source_info.blocks],ebx
mov [source_info.bytes], ebx
; read the source file
mov eax,58
mov eax,70
mov ebx,source_info
int 0x40
; ebx = file size
; ebx = number of read bytes = file size
; save loaded file
mov [dest_info.bytes2write],ebx ; file size in bytes
mov eax,58
mov [dest_info.bytes],ebx ; file size in bytes
mov eax,70
mov ebx,dest_info
int 0x40
@ -185,30 +161,11 @@ copy_file:
; return to the initial amount of memory
mov eax,64
mov ebx,1
mov ecx,0x20000
mov ecx,0x10000
int 0x40
xor eax,eax ; eax = message number (0-OK)
; print strings (source & destination)
print_text:
mov eax,13
mov ebx,107*65536+STRLEN*6
mov ecx,[ya]
shl ecx,16
add ecx,9
mov edx,0xf2f2f2
int 0x40
mov eax,4
mov ebx,109*65536
add ebx,[ya]
xor ecx,ecx
mov edx,[addr]
mov esi,STRLEN
int 0x40
ret
jmp copy_error
; *********************************************
@ -251,23 +208,23 @@ draw_window:
mov esi,source
mov edi,text+14
mov ecx,STRLEN
mov ecx,47
rep movsb
mov esi,destination
mov edi,text+STRLEN+59-45+14
mov ecx,STRLEN
mov edi,text+62+14
mov ecx,47
rep movsb
mov ebx,25*65536+36 ; print filenames
xor ecx,ecx
mov edx,text
mov esi,STRLEN+59-45
mov esi,62
newline:
mov eax,4
int 0x40
add ebx,16
add edx,STRLEN+59-45
add edx,62
cmp [edx],byte 'x'
jnz newline
@ -279,43 +236,20 @@ draw_window:
; DATA AREA
align 4
param_area:
times 256 db 0
source_info: ; SOURCE FILEINFO
.mode dd 0 ; read file
.start_block dd 0x0 ; block to read
.blocks dd 0x700 ; num of blocks
.address dd 0x20000
.workarea dd 0x10000
source:
times (STRLEN) db 32
db 0
dest_info: ; DESTINATION FILEINFO
.mode dd 1 ; write
.notused dd 0x0 ; not used
.bytes2write dd 0 ; bytes to write
.address dd 0x20000
.workarea dd 0x10000
destination:
times (STRLEN) db 32
db 0
align 4
addr dd 0x0
ya dd 0x0
temp dd 0
if lang eq ru
text:
db ' Ž’Š“„€: |<7C>®áá¨ï, ‘¥«ï⨭®, Œ<>Š Œ®áª¢  , 1 Šãàá '
db ' Š“„€: | <20> ¢«î設 …¢£¥­¨©, waptap@mail.ru '
db ' '
db 'x' ; <- END MARKER, DONT DELETE
labelt:
db 'ŠŽ<C5A0>ˆ<EFBFBD>Žˆ… ”€‰‹€'
db 'ŠŽ<C5A0>ˆ<EFBFBD>Ž<E2809A>ˆ… ”€‰‹€'
labellen:
errors:
@ -336,6 +270,70 @@ errors:
db "(§ ¯¨áì) ­¥¨§¢¥áâ­ ï ®è¨¡ª  "
db "<22>ãâì ª ¨áâ®ç­¨ªã ¨ ¯à¨¥¬­¨ªã ­¥ 㪠§ ­ë!!! "
db "<22>ãâì ª ¯à¨¥¬­¨ªã ­¥ 㪠§ ­!!! "
else
text:
db 'SOURCE: | '
db 'DESTINATION: | '
db ' '
db 'x' ; <- END MARKER, DONT DELETE
labelt:
db 'SYSTREE FILE COPIER'
labellen:
errors:
db "Success! "
db "(read) no hd base or partition defined "
db "(read) unsupported file system "
db "(read) unknown file system "
db "(read) hd partition not defined "
db "out of memory "
db "(read) end of file "
db "(read) unknown error "
db "(write) no hd base or partition defined "
db "(write) unsupported file system "
db "(write) unknown file system "
db "(write) hd partition not defined "
db "oh shit! "
db "(write) file not found "
db "(write) unknown error "
db "Path to source is not given!!! "
db "Path to destination is not given!!! "
end if
;0123456789012345678901234567890123456789012
I_END:
source_attr_info:
dd 5
dd 0
dd 0
dd 0
dd source_attr
db 0
dd source
source_info:
dd 0
dd 0 ; start from 1st byte
dd 0
.bytes dd ?
dd 0x10000
db 0
dd source
dest_info: ; DESTINATION FILEINFO
dd 2
dd 0
dd 0
.bytes dd ?
dd 0x10000
I_END:
destination:
rb 256
source:
rb 256
source_attr:
rb 40
param_area rb 256

View File

@ -186,9 +186,9 @@ local dlg_is_work, ready, procinfo
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
xor eax,eax
mov ecx,(1024+16)/4
rep stosd
;mov [get_loops],0
mov [dlg_pid_get],0
@ -230,7 +230,7 @@ new_d:
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
mov edx,1024+16 ; size
int 0x40
; change wanted events list 7-bit IPC event
@ -242,7 +242,7 @@ new_d:
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,58
mov eax,70
mov ebx,run_fileinfo
int 0x40
@ -253,15 +253,14 @@ 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
dec eax
jz mred
dec eax
jz mkey
dec eax
jz mbutton
cmp al, 7-3
jz mgetmes
; Get number of procces
mov ebx,procinfo
@ -348,14 +347,14 @@ mgetmes:
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; Second message is 1024 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 ecx,1024/4
rep movsd
mov [edi],byte 0
jmp openoff
@ -371,11 +370,11 @@ param:
dd 0,0 ; Type of dialog
run_fileinfo:
dd 16
dd 7
dd 0
dd param
dd 0
dd procinfo ; 0x10000
dd 0
;run_filepath
db '/RD/1/SYSXTREE',0
@ -398,9 +397,9 @@ local dlg_is_work, ready, procinfo
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
xor eax,eax
mov ecx,(1024+16)/4
rep stosd
;mov [get_loops],0
mov [dlg_pid_get],0
@ -442,7 +441,7 @@ new_d:
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
mov edx,1024+16 ; size
int 0x40
; change wanted events list 7-bit IPC event
@ -454,7 +453,7 @@ new_d:
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,58
mov eax,70
mov ebx,run_fileinfo
int 0x40
@ -465,15 +464,14 @@ 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
dec eax
jz mred
dec eax
jz mkey
dec eax
jz mbutton
cmp al, 7-3
jz mgetmes
; Get number of procces
mov ebx,procinfo
@ -560,14 +558,14 @@ mgetmes:
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; Second message is 1024 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 ecx,1024/4
rep movsd
mov [edi],byte 0
jmp openoff
@ -583,11 +581,11 @@ param:
dd 0,0 ; Type of dialog
run_fileinfo:
dd 16
dd 7
dd 0
dd param
dd 0
dd procinfo
dd 0
;run_filepath:
db '/RD/1/SYSXTREE',0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,398 @@
; MIDI PLAYER FOR MENUET v1.0
; Written in pure assembler by Ivushkin Andrey aka Willow
;
;
; Created: December 7, 2004
; Last changed: July 29, 2005
;
; COMPILE WITH FASM
PLAYLIST_PATH equ '/HD/1/MIDI/PLAYLIST.TXT'
APP_MEM equ 150*1024
DIR_SIZE equ 1024
IPC_PLAY equ 0xa1
IPC_PAUS equ 0xa2
IPC_TRIG equ 0xa3
IPC_UPDT equ 0xb1
IPC_NEXT equ 0xb2
LISTITEMS equ 40
WND_BACK equ 0x24263c
PLY equ 63
WND_HEIGHT equ (PLY+9*LISTITEMS+10)+25
BTNS_XY equ 14 shl 16+42
BTNS_SIZE equ 222 shl 16+17
BROWSE_X equ 10 shl 16+8
BROWSE_Y equ 26 shl 16+8
FN_XY equ 12 shl 16+15
BAR_WIDTH equ 251
BAR_X equ 10 shl 16
BAR_Y equ 29 shl 16+5
TOTALTIME_XY equ 124 shl 16+28
CURTIME_X equ 225 shl 16+40
CURTIME_Y equ 15 shl 16+11
CURTIME_XY equ 236 shl 16+15
NONCRITICAL_MSG equ 0
SOUND equ ON;OFF
OUTDUMP equ 0
OUTLINE equ 8
FL_SHUFFLE equ 0x01
FL_REPEAT equ 0x02
FL_HIDDEN equ 0x04
FL_MUTE equ 0x08
FL_REVERSE equ 0x10
FL_ADD equ 0x20
FL_PLAY equ 0x40
FL_LOCK equ 0x80
FL_BOTTRED equ 0x100
FL_MULSEL equ 0x8000
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd APP_MEM
dd APP_MEM-1024
dd I_PARAM
listsel dd 0
channel dd 0
COLOR_ORDER equ MENUETOS
include 'macros.inc' ; decrease code size (optional)
lang fix en
;purge mov
include 'debug.inc'
include 'dlg.inc'
include 'playlist.inc'
include 'gif_lite.inc'
bottom:
file 'bottom.gif'
hdrimg:
file 'hdr.gif'
btns:
file 'buttons.gif'
START:
or [flag],FL_BOTTRED;+FL_MUTE
mov ecx,ipcarea
call init_ipc
mcall 40,1000111b
mov esi,btns
mov edi,btn_raw
mov eax,hash_table
call ReadGIF
mov esi,hdrimg
mov edi,hdr_raw
mov eax,hash_table
call ReadGIF
mov esi,bottom
mov edi,bottom_raw
mov eax,hash_table
call ReadGIF
call respawn
mcall 9,prcinfo,-1
mov edx,[ebx+30]
mov [parentPID],edx
mov esi,I_PARAM
cmp dword[esi],0
jnz .yesparam
call PL_load
cmp [list_count],0
je noparam
mov eax,[pl_ptr]
or word[eax],FL_MULSEL
jmp auto_load
.yesparam:
mov al,byte[esi]
cmp al,'/'
je .defact
mov [param],al
inc esi
.defact:
mov edi,filename;fnbuf
mov ecx,64
rep movsd
jmp open_file
clearpath:
newline
mov [fname_len],0
noparam:
mov [param],'W'
or [flag],FL_ADD
call fopen
get_path:
cmp byte[filename],0
jz still
open_file:
cmp [param],'W'
je .noplay
cmp [param],'H'
jne .nohidd
; or [flag],FL_PLAY
or [flag],FL_HIDDEN
call draw_window
and [flag],not FL_HIDDEN
call Shade
; jmp .noplay
.nohidd:
or [flag],FL_PLAY
.noplay:
xor eax,eax
mov [play_area],ax
mov [tick_count],eax
mov [delta],eax
inc eax
mov [fsize],eax
mov [curnote],0x80
mov ecx,64
mov esi,filename
mov edi,I_PARAM
rep movsd
mov eax,58
mov ebx,file_info
int 0x40
mov eax,ebx
shr eax,9
inc eax
mov [fsize],eax
add ebx,workarea
mov [midi_limit],ebx
mov edi,I_PARAM
call find_slash
mov [fn_ptr],edi
mov edi,filename
call str_len
mov [fname_len],eax
mov eax,58
mov ebx,file_info
int 0x40
midi_kill:
call kill
include 'midilite.inc'
decode_end:
; dpd edi
; dps <13,10,'Notes='>
; sub edi,[midi_limit]
; shr edi,1
; dpd edi
dps ' Notes: max='
movzx eax,[max_note]
dpd eax
dps 'min='
movzx eax,[min_note]
dpd eax
newline
; sub esi,workarea
; jmp _close
.play:
call kill
call respawn
xor edx,edx
mov esi,[midi_limit]
mov [cur_ptr],esi
mov [cur_tick],edx
mov [delta],edx
.count_ticks:
lodsw
test eax,eax
jz .eof
and eax,0x7f
add edx,eax
jmp .count_ticks
.eof:
mov [tick_count],edx
if OUTDUMP eq 1
mov esi,[midi_limit]
call out_dump
end if
and [flag],not FL_LOCK
test [flag],FL_PLAY
jz .noplay
call draw_window
mcall 5,100
mov eax,IPC_PLAY
call ipc_send
.noplay:
test [flag],FL_ADD
jz red
mov esi,filename
mov ecx,[fname_len]
movzx eax,[list_count]
mov [play_num],eax
add_song:
call PL_add
and [flag],not FL_ADD
red:
call draw_window
still:
mov ecx,ipcarea
call init_ipc
mov eax,10
int 0x40
prc_event:
test eax,eax
jz still
.evt:
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
cmp eax,7
jne still
movzx eax,byte[ipcarea+16]
cmp eax,IPC_UPDT
jne .noupdt
call draw_bar
jmp still
.noupdt:
cmp eax,IPC_NEXT
jne still
cmp [param],'H'
je _close
xor edx,edx
test [flag],FL_SHUFFLE
jz .noshuf
mcall 26,9
movzx ebx,byte[list_count]
div ebx
mov eax,edx
jmp play_
.noshuf:
test [flag],FL_REPEAT
jnz decode_end.play
mov eax,[play_num]
inc eax
cmp al,[list_count]
jb bList.next
mov eax,IPC_PAUS
call ipc_send
jmp red
if OUTDUMP eq 1
out_dump:
mov ecx,OUTLINE
.next_byte:
lodsd
bswap eax
dph eax
dps ' '
lodsd
bswap eax
dph eax
dps <13,10>
loop .next_byte
ret
end if
str_len:
; in: edi-str ptr
; out: eax-str length
push ecx edi
xor eax,eax
mov ecx,256
repne scasb
jecxz .nofn
sub edi,[esp]
mov eax,edi
.nofn:
pop edi ecx
ret
fopen:
or [flag],FL_LOCK
opendialog draw_window, ret_path, ret_path, filename
ret_path:
and [flag],not FL_LOCK
ret
include 'event.inc'
include "thread.inc"
include "draw.inc"
; ‡¤¥áì ­ å®¤ïâáï ¤ ­­ë¥ ¯à®£à ¬¬ë:
dd -2 shl 16+4,251,12 shl 16,29 shl 16+5
dd 21,16
main_coo:
dd 14 shl 16, 42 shl 16,23 shl 16
dd 228 shl 16+38
dd 14 shl 16+10
dd 236 shl 16+15
btncoords:
dd 120 shl 16+20, 1 shl 16+15
dd 149 shl 16+44, 2 shl 16+12
dd 195 shl 16+26, 2 shl 16+12
dd -2 shl 16+4,54,63 shl 16,6 shl 16+4
dd 6,6
main_coo2:
dd 169 shl 16, 4 shl 16,9 shl 16
dd 121 shl 16+40
dd 3 shl 16+9
dd 130 shl 16+4
btncoords2:
dd 48 shl 16+6, 6
dd 2000 shl 16+44, 2 shl 16+12
dd 2000 shl 16+26, 2 shl 16+12
ipcarea rb 20
ipcarea2 rb 20
dots db ':-'
text db 'tone> chnl> <trk'
text_end:
coo dd main_coo
play_limit dd playlist
pl_ptr dd playlist
param db 'W'
curnote db 0x80
tick_count dd 0
play_area dw ?
file_info:
dd 0
dd 0
fsize dd 1
dd workarea
dd hash_table
I_END: ; ª®­¥æ ¯à®£à ¬¬ë
filename:
rb 1024+16
prcinfo process_information
I_PARAM rb 256
childPID dd ?
parentPID dd ?
play_num dd ?
counter dd ?
flag dd ?
fname_len dd ?
fn_ptr dd ?
delta dd ?
cur_ptr dd ?
cur_tick dd ?
quarter dd ?
octave db ?
tempo dd ?
midi_limit dd ?
track_len dd ?
list_count db ?
cur_track db ?
sel_track db ?
ipcmsg db ?
fnbuf:
rb 256
btn_raw rb 222*17*3+12
hdr_raw rb 275*29*3+12
bottom_raw rb 25*378*3+12
rb 4
playlist rb 256*LISTITEMS
hash_table:
rd 4096
dir_table rb DIR_SIZE
workarea:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1 @@
fasm MIDAMP.ASM MIDAMP

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View File

@ -0,0 +1,137 @@
macro debug_print str
{
local ..string, ..label
jmp ..label
..string db str,0
..label:
pushf
pushad
mov edx,..string
call debug_outstr
popad
popf
}
dps fix debug_print
macro debug_print_dec arg
{
pushf
pushad
if ~arg eq eax
mov eax,arg
end if
call debug_outdec
popad
popf
}
dpd fix debug_print_dec
;---------------------------------
debug_outdec: ;(eax - num, edi-str)
push 10 ;2
pop ecx ;1
push -'0' ;2
.l0:
xor edx,edx ;2
div ecx ;2
push edx ;1
test eax,eax ;2
jnz .l0 ;2
.l1:
pop eax ;1
add al,'0' ;2
call debug_outchar ; stosb
jnz .l1 ;2
ret ;1
;---------------------------------
debug_outchar: ; al - char
pushf
pushad
mov cl,al
mov eax,63
mov ebx,1
int 0x40
popad
popf
ret
debug_outstr:
mov eax,63
mov ebx,1
@@:
mov cl,[edx]
test cl,cl
jz @f
int 40h
inc edx
jmp @b
@@:
ret
_debug_crlf db 13, 10, 0
macro newline
{
pushf
pushad
mov edx, _debug_crlf
call debug_outstr
popad
popf
}
macro print message
{
dps message
newline
}
macro pregs
{
dps "EAX: "
dpd eax
dps " EBX: "
dpd ebx
newline
dps "ECX: "
dpd ecx
dps " EDX: "
dpd edx
newline
}
macro debug_print_hex arg
{
pushf
pushad
if ~arg eq eax
mov eax, arg
end if
call debug_outhex
popad
popf
}
dph fix debug_print_hex
debug_outhex:
; eax - number
mov edx, 8
.new_char:
rol eax, 4
movzx ecx, al
and cl, 0x0f
mov cl, [__hexdigits + ecx]
pushad
mcall 63, 1
popad
dec edx
jnz .new_char
ret
__hexdigits:
db '0123456789ABCDEF'

View File

@ -0,0 +1,209 @@
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
;
; 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
xor eax,eax
mov ecx,(1024+16)/4
rep stosb
;mov [get_loops],0
mov [dlg_pid_get],0
; Get my PID in dec format 4 bytes
; mov eax,9
; mov ebx,prcinfo
; mov ecx,-1
; int 0x40
mov eax,[parentPID]
; convert eax bin to param dec
; mov eax,dword [prcinfo+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,1024+16 ; size
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,70
mov ebx,run_fileinfo
int 0x40
call redproc
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
dec eax
jz mred
dec eax
jz mkey
dec eax
jz mbutton
cmp al, 7-3
jz mgetmes
; Get number of procces
mov ebx,prcinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
loox:
mov eax,9
mov ebx,prcinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [prcinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
jmp erroff
dlg_is_work:
cmp [prcinfo+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 1024 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,1024/4
rep movsd
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 7
dd 0
dd param
dd 0
dd 0
;run_filepath
db '/RD/1/SYSXTREE',0
;prcinfo:
;times 256 db 0
}

View File

@ -0,0 +1,356 @@
; *********************************************
; ******* DRAW PLAY BAR **********************
; *********************************************
draw_bar:
push eax ebp
mov eax,[cur_tick]
test eax,eax
jz .ex
mov ebp,[coo]
mov ebx,[ebp-20]
mul ebx
mov ebx,[tick_count]
test ebx,ebx
jz .ex
div ebx
mov ebx,[ebp-16]
mov bx,ax
mov ecx,[ebp-12]
mov edx,0x84706a
mov eax,13
int 0x40
mov esi,TOTALTIME_XY
mov eax,[tick_count]
call draw_total_time
.nobar:
mov esi,[ebp+20]
mov ebx,[ebp+12]
mov ecx,[ebp+16]
call draw_cur_time
mov esi,140 shl 16+(WND_HEIGHT-18)
sub ebx,95 shl 16
add ecx,(WND_HEIGHT-34)shl 16
call draw_cur_time
.ex:
pop ebp eax
ret
; *********************************************
; ******* Ž<EFBFBD><EFBFBD>…„…<EFBFBD>ˆ ˆ Ž<EFBFBD>ˆŽŠ€ ŽŠ<EFBFBD> *******
; *********************************************
draw_window:
mov eax,12
mov ebx,1
int 0x40
or [flag],FL_BOTTRED
xor eax,eax
mov ebx,100*65536+275
mov ecx,200*65536+WND_HEIGHT
mov edi,hdr_raw+12
mov ebp,[coo]
test [flag],FL_HIDDEN
jz .nohide1
and ebx,0xffff
and ecx,0xffff
add edi,275*14*3
.nohide1:
push edi
mov edx,WND_BACK
mov esi,edx
mov edi,edx
int 0x40
mov ecx,[channel]
shl ecx,4
add cl,[sel_track]
mcall 47,0x20100,,<191,15>,0xf0f000
movsx ecx,[octave]
add ecx,100
mcall ,0x30000,,<132,15>
pop ebx
mcall 7,,(275 shl 16+14),0
mov esi,0x80ecce7a
mov eax,8
mov ebx,265 shl 16+7
mov ecx,3 shl 16+7
mov edx,1+1 shl 30
int 0x40 ; close button
sub ebx,10 shl 16
mov edx,100+1 shl 30
int 0x40 ; shade button-101
sub ebx,10 shl 16
add edx,3
int 0x40 ; minimize button-103
sub ebx,239 shl 16
inc edx ; about button-104
int 0x40
xor esi,esi
xor edi,edi
mov ecx,3
pushd [ebp+12]
pushd [ebp+16]
call draw_navigation
add esp,8
mov ebx,[ebp-16]
add ebx,[ebp-20]
mov ecx,[ebp-12]
add ecx,[ebp-24]
mov esi,0x2c2b46
mov edx,2+1 shl 29
int 0x40
shr eax,1
mov ecx,12
mov ebx,FN_XY
mov edx,[fn_ptr];I_PARAM;filename
mov esi,1;[fname_len]
mov edi,0x00e200
.fnlp:
push ecx
mcall ,,edi
add ebx,1 shl 16
mcall
add ebx,6 shl 16
inc edx
pop ecx
loop .fnlp
add ebx,5 shl 16
mcall ,,0xa0a0a0,text,text_end-text
call draw_bar
call PL_show
test [flag],FL_HIDDEN
jnz .nohide2
mov eax,7
mov ebx,btn_raw+12
mov ecx,BTNS_SIZE
mov edx,BTNS_XY
int 0x40
.nohide2:
mov esi,FL_SHUFFLE
mov edi,btncoords+8
mov eax,13
mov edx,0xd600
mov ecx,2
.loo3:
test [flag],esi
je .el
mov ebx,[edi]
add ebx,5 shl 16
add ebx,[ebp]
mov bx,3
push ecx
mov ecx,[edi+4]
add ecx,4 shl 16
add ecx,[ebp+4]
mov cx,2
int 0x40
pop ecx
.el:
add edi,8
inc esi
loop .loo3
.enddraw:
mov eax,12
mov ebx,2
int 0x40
ret
draw_navigation:
; ebp - coordinates
push esi edi ecx
mov eax,8
mov ecx,5
mov ebx,[ebp]
add ebx,[ebp-8]
add ebx,esi
mov edx,3+1 shl 30
.btnloo:
push ecx
mov ecx,[ebp+4]
add ecx,[ebp-4]
add ecx,edi
int 0x40
pop ecx
add ebx,[ebp+8]
inc edx
loop .btnloo
pop ecx
lea edi,[ebp+24]
.btnloo2:
mov ebx,[edi]
add ebx,[ebp]
add ebx,[esp+4]
push ecx
mov ecx,[edi+4]
add ecx,[ebp+4]
add ecx,[esp+4]
int 0x40
pop ecx
add edi,8
inc edx
loop .btnloo2
pop edi esi
ret
draw_cur_time:
pusha
mcall 13,,,WND_BACK
mcall 8,,,101+1 shl 29+1 shl 30
mov ebx,[tick_count]
mov eax,[cur_tick]
test [flag],FL_REVERSE
jz .norev
xchg eax,ebx
sub eax,ebx
lea ebx,[esi-6 shl 16]
push eax
mcall 4,,0xf000,dots+1,1
pop eax
.norev:
mov [esp+28],eax
popa
draw_total_time: ; eax -time to show
pusha
xor edx,edx
mov ebx,100
div ebx
xor edx,edx
mov ebx,60
div ebx
push edx
mov ecx,eax
mcall 47,0x20000,,esi,0xf000
pop ecx
add edx,17 shl 16
int 0x40
sub edx,5 shl 16
mcall 4,edx,esi,dots,1
popa
ret
BOTT_BTN equ 25 shl 16+18
BOTT_SIZEX equ 25
BOTT_SIZEY equ 18
BOTT_S equ BOTT_SIZEX*BOTT_SIZEY*3
BOTT_X equ PL_X
BOTT_Y equ (WND_HEIGHT-27)
BOTT_SPACE equ 30 shl 16
popup db -1
draw_bottom:
pusha
mcall 13,175,(BOTT_Y-5)shl 16+24,WND_BACK
add ebx,(266-30)shl 16-135
mcall
mov ecx,5
mov esi,bot_btn
push esi
mov ebx,bottom_raw+12
xor eax,eax
.nxt:
push ecx
lodsw
shl eax,16
lea edx,[eax+BOTT_Y]
mcall 7,,BOTT_BTN
add ebx,BOTT_S*4
pop ecx
cmp ecx,4
jne .noadj
add ebx,BOTT_S
.noadj:
loop .nxt
mov esi,[esp]
mov ecx,5
mov ebp,BOTT_Y shl 16+BOTT_SIZEY
mov edx,20+1 shl 30
.nxt2:
push ecx
lodsw
shl eax,16
lea ebx,[eax+BOTT_SIZEX+2 shl 16-3]
mcall 8,,ebp
inc edx
pop ecx
loop .nxt2
pop esi
call draw_popup
popa
ret
draw_popup:
movsx eax,[popup]
cmp eax,0
jge .ok
mov edx,30+1 shl 31
mov ecx,21
mov eax,8
.clr:
mcall
inc edx
loop .clr
jmp .ex
.ok:
push eax
lea edx,[eax+1 shl 31+20]
mcall 8
pop eax
mov ebx,eax
shl eax,2
mov ecx,3
cmp eax,4
jne .noadj1
inc ecx
.noadj1:
cmp eax,8
jb .noadj2
inc eax
.noadj2:
inc eax
push eax
movzx edx,word[bot_btn+ebx*2]
shl edx,16
add edx,BOTT_Y
push edx
.noadj3:
imul ebx,eax,BOTT_S
add ebx,bottom_raw+12
push ecx
.nxt:
push ecx
mcall 7,,BOTT_BTN
add ebx,BOTT_S
sub edx,BOTT_SIZEY
pop ecx
loop .nxt
pop ecx ebx edx
mov ebp,BOTT_Y shl 16+BOTT_SIZEY
mov eax,8
add edx,1 shl 30+30
add ebx,2 shl 16
mov bx,BOTT_SIZEX-3
.nxt2:
push ecx
mcall ,,ebp
inc edx
sub ebp,BOTT_SIZEY shl 16
pop ecx
loop .nxt2
.ex:
ret
bot_btn:
dw 10,40,70,100,240
about1:
db 13,10,'* MIDAMP for MenuetOS v1.0 by Willow, July 2005 *',13,10,0

View File

@ -0,0 +1,449 @@
key_codes db 27,182,109,115,114,122,98,118,108,120,99,13,8,32,0, 0, 0,0
db 180,181,93,91
; bottom actions
db 0, 0, 0, 0, 0,185,0, 0, 0, 0,0,0,92
btn_codes db 1, 0, 0, 9, 10, 3, 7, 6, 8, 4, 5, 0,0, 0,101,100,11,2
db 0, 0, 0, 0
; bottom actions
db 35,49,48,37,31,32,41,42,40,36,103,104,0
jmps dw _close, kDel,kMute, bList.shuf, bList.repe, bList.prev, bList.next
dw bList.stop, kLoad, Xpress, Rewind.space, auto_load,Rewind, Rewind.space
dw bReverse, bShade, bList, bBar, bOctU, bOctD, bSelTrack, bSelChannel
; bottom actions
dw kDel,bLsave,bLload,bRemAll,bAdd,bAddDir,bSelZero,bInvSel,bSelAll,bRemCrop
dw bMinimize,bAbout,bResetTrk
jmps_end:
key:
mov eax,2
int 0x40
mov edi,key_codes
cmp ah,48
jb .jump
cmp ah,57
ja .jump
sub ah,48
mov byte[channel],ah
jmp midi_kill
.jump:
mov ecx,(jmps_end-jmps)/2
mov ebx,edi
shr eax,8
repne scasb
jne play_.noplsel
sub edi,ebx
jmp word[jmps+edi*2-2]
kDel:
call PL_del
call PL_show
jmp still
kMute:
xor [flag],FL_MUTE
jmp still
kLoad:
; dps 'Load'
cmp [list_count],LISTITEMS
jbe noparam
jmp still
Xpress:
mov eax,IPC_PLAY
call ipc_send
jmp still;Rewind.space
auto_load:
call PL_get1stsel
mov eax,ebx
play_:
mov [play_num],eax
call PL_getbyindex
mov edi,filename;fnbuf
rep movsb
xor eax,eax
mov byte[edi],al
and [flag],not FL_ADD
or [flag],FL_PLAY
jmp open_file
.noplsel:
call PL_get1stsel
test ebx,ebx
jz .noupward
cmp al,178
jne .noupa
.seldec:
dec ebx;[listsel]
.listdraw:
call PL_clearsel
mov eax,ebx
call PL_getbyindex
or word[esi-2],FL_MULSEL
call PL_show
jmp still
.noupa:
cmp al,184
jne .noupward
dec [listsel]
.swap:
dec ebx
call PL_swap
jmp .listdraw
.noupward:
inc ebx
cmp bl,[list_count]
jae still
cmp al,177
je .listdraw
.nodowna:
cmp al,183
jne still
inc [listsel]
jmp .swap
Rewind:
push [midi_limit]
pop [cur_ptr]
and [cur_tick],0
jmp red
.space:
cmp [tick_count],0
jz still
mov eax,IPC_TRIG
call ipc_send
jmp red
button:
mov eax,17
int 0x40
cmp ah,20
jb .nobott
cmp ah,25
ja .nobott
sub ah,20
mov [popup],ah
.sh:
or [flag],FL_BOTTRED
call PL_show
jmp still
.nobott:
cmp ah,31
jb .nopop
cmp ah,50
ja .nopop
mov [popup],-1
or [flag],FL_BOTTRED
call PL_show
SH_POPUP equ 10
if SH_POPUP eq 1
mov ebx,eax
shr ebx,8
dps 'Popup#='
dpd ebx
jmp .sh
end if
.nopop:
mov edi,btn_codes
jmp key.jump
bReverse:
xor [flag],FL_REVERSE
call draw_bar
jmp still
_close:
call kill
or eax,-1
int 0x40
bShade:
call Shade
jmp still
Shade:
xor [flag],FL_HIDDEN
test [flag],FL_HIDDEN
jz .open
mov esi,14
mov [coo],main_coo2
jmp .op
.open:
mov esi,WND_HEIGHT
mov [coo],main_coo
.op:
mov ebx,-1
mov ecx,ebx
mov edx,ebx
mov eax,67
int 0x40
ret
bMinimize:
; mcall 18,10
jmp still
bList:
mov [popup],-1
mov edx,[listsel]
call PL_getitemclick
mov [listsel],eax
mcall 66,3
mov ebx,eax
; dph ebx
test ebx,1100b
jnz .mul
call PL_clearsel
test ebx,11b
jz .skipor
mov ecx,[listsel]
mov [listsel],edx
cmp ecx,edx
je .skipor
ja .above
xchg ecx,edx
.above:
sub ecx,edx
inc ecx
mov eax,edx
push ecx
call PL_getbyindex
sub esi,2
pop ecx
call PL_shiftsel
jmp .plsh
.mul:
bts [flag],15
jc .skipor
mov eax,edx
call PL_getbyindex
or word[esi-2],FL_MULSEL
.skipor:
mov eax,[listsel]
call PL_getbyindex
xor word[esi-2],FL_MULSEL
.plsh:
call PL_show
mcall 40,111b
mcall 23,30
push eax
mcall 40,1000111b
pop eax
cmp eax,3
jne still
mcall 17
cmp ah,11
jne still
call PL_getitemclick
cmp eax,[listsel]
je auto_load
mov [listsel],eax
call PL_show
jmp still
.repe:
xor [flag],FL_REPEAT
jmp red
.stop:
mov eax,IPC_PAUS
call ipc_send
jmp Rewind
.shuf:
xor [flag],FL_SHUFFLE
jmp red
.prev:
mov eax,[play_num]
test eax,eax
jz still
dec eax
jmp play_
.next:
mov eax,[play_num]
inc eax
cmp al,[list_count]
jae still
jmp play_
bBar:
cmp [tick_count],0
jz still
mov eax,37
mov ebx,1
int 0x40
mov ebp,[coo]
sub eax,[ebp-16]
shr eax,16
mov ebx,[tick_count]
mul ebx
mov ebx,[ebp-20]
div ebx
mov ebx,eax ; ebx - selected tick
xor ecx,ecx
mov esi,[midi_limit]
.further:
lodsw
and eax,0x7f
add ecx,eax
cmp ecx,ebx
jb .further
sub ecx,eax
mov [cur_tick],ecx
sub esi,2
mov [cur_ptr],esi
drw:
jmp red
OCT_CH equ 3
bOctU:
add [octave],OCT_CH
jmp midi_kill
bOctD:
sub [octave],OCT_CH
jmp midi_kill
bSelChannel:
call get_num
cmp eax,-1
je still
dps <13,10,'Channel#'>
dpd eax
mov [channel],eax
jmp midi_kill
bSelTrack:
call get_num
cmp eax,-1
je still
dps <13,10,'Track#'>
dpd eax
mov [sel_track],al
jmp midi_kill
bResetTrk:
xor eax,eax
mov [sel_track],al
mov [channel],eax
dps <13,10,'Both track & channel are 0',13,10>
jmp midi_kill
bLsave:
call PL_save
bLload:
call PL_load
jmp red
bRemAll:
and [list_count],0
mov [play_limit],playlist-2
jmp red
bAdd:
movzx eax,[list_count]
dpd eax
call fopen
mov edi,filename
cmp byte[edi],0
jz still
call str_len
xchg eax,ecx
mov esi,edi
jmp add_song
bAddDir:
call fopen
mov edi,filename
cmp byte[edi],0
jz still
call find_slash
lea edx,[edi-filename+fnbuf] ; edx -> '/'
and byte[edi],0
mov esi,filename
mov edi,fnbuf
mov ecx,64
rep movsb
mov dword[file_info+12],dir_table
mov dword[file_info+8],DIR_SIZE/512
.nxt2:
mcall 58,file_info
mov ecx,DIR_SIZE/32
mov esi,dir_table
.nxt:
mov al,[esi]
cmp al,0xe5
je .no
test al,al
jz .end
test byte[esi+12],11000b
jnz .no
mov eax,[esi+7]
mov al,'.'
cmp eax,'.MID'
je .ok
cmp eax,'.KAR'
jne .no
.ok:
mov [esi+8],eax
pusha
mov edi,edx
mov ecx,12
rep movsb
and byte[edi],0
mov ecx,edi
sub ecx,fnbuf
mov esi,fnbuf
call PL_add
popa
.no:
add esi,32
loop .nxt
add dword[file_info+4],DIR_SIZE/512
jmp .nxt2
.end:
mov ebx,file_info
and dword[ebx+4],0
mov [fsize],1
mov dword[ebx+12],workarea
jmp red;still
bSelZero:
call PL_clearsel
jmp red
bInvSel:
call PL_invsel
jmp red
bSelAll:
call PL_clearsel
call PL_invsel
jmp red
bRemCrop:
call PL_invsel
call PL_del
jmp bSelAll
bAbout:
mov edx,about1
call debug_outstr
jmp still
get_num: ; out: eax-number entered
or [flag],FL_LOCK
mcall 10
dpd eax
cmp eax,1
jne .nored
call draw_window
jmp get_num
.nored:
cmp eax,2
jne .nokey
mcall 2
movzx eax,ah
sub eax,'0'
jl .none
cmp eax,9
jbe .ok
.none:
mov eax,-1
.ok:
and [flag],not FL_LOCK
ret
.nokey:
cmp eax,3
jne get_num
mcall 17
jmp get_num
find_slash:
; in: edi-filename, out: edi-slash ptr-1
push eax ecx
call str_len
mov ecx,eax
std
add edi,eax
mov al,'/'
repne scasb
cld
add edi,2
pop ecx eax
ret

View File

@ -0,0 +1,328 @@
; GIF LITE v2.0 by Willow
; Written in pure assembler by Ivushkin Andrey aka Willow
;
; This include file will contain functions to handle GIF image format
;
; Created: August 15, 2004
; Last changed: September 9, 2004
; Change COLOR_ORDER in your program
; if colors are displayed improperly
if ~ (COLOR_ORDER in <MENUETOS,OTHER>)
; This message may not appear under MenuetOS, so watch...
display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10
end if
; virtual structure, used internally
struc GIF_list
{
.NextImg rd 1
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
struc GIF_info
{
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
_null fix 0x1000
; ****************************************
; FUNCTION GetGIFinfo - retrieve Nth image info
; ****************************************
; in:
; esi - pointer to image list header
; ecx - image_index (0...img_count-1)
; edi - pointer to GIF_info structure to be filled
; out:
; eax - pointer to RAW data, or 0, if error
GetGIFinfo:
push esi ecx edi
xor eax,eax
jecxz .eloop
.lp:
mov esi,[esi]
test esi,esi
jz .error
loop .lp
.eloop:
add esi,4
movsd
movsd
mov eax,esi
.error:
pop edi ecx esi
ret
; ****************************************
; FUNCTION ReadGIF - unpacks GIF image
; ****************************************
; in:
; esi - pointer to GIF file in memory
; edi - pointer to output image list
; eax - pointer to work area (MIN 16 KB!)
; out:
; eax - 0, all OK;
; eax - 1, invalid signature;
; eax >=8, unsupported image attributes
;
; ecx - number of images
ReadGIF:
push esi edi
mov [.table_ptr],eax
mov [.cur_info],edi
xor eax,eax
mov [.globalColor],eax
mov [.img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne .er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc .nextblock
mov [.globalColor],esi
call .Gif_skipmap
.nextblock:
cmp byte[edi],0x21
jne .noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne .no_gc
add edi,7
jmp .nextblock
.no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne .no_comm
inc edi
.block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz .block_skip
inc edi
jmp .nextblock
.no_comm:
cmp byte[edi],0xff ; Application Ext
jne .nextblock
add edi,13
jmp .block_skip
.noextblock:
cmp byte[edi],0x2c ; image beginning
jne .er
inc [.img_count]
inc edi
mov esi,[.cur_info]
add esi,4
xchg esi,edi
movsd
movsd
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc .uselocal
push [.globalColor]
mov edi,esi
jmp .setPal
.uselocal:
call .Gif_skipmap
push esi
.setPal:
movzx ecx,byte[edi]
inc ecx
mov [.codesize],ecx
dec ecx
pop [.Palette]
lea esi,[edi+1]
mov edi,[.table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [.block_ofs],eax
mov [.bit_count],8
mov eax,1
shl eax,cl
mov [.CC],eax
inc eax
mov [.EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
.filltable:
stosd
inc eax
loop .filltable
pop edi
mov [.img_start],edi
.reinit:
mov edx,[.EOI]
inc edx
push [.codesize]
pop [.compsize]
call .Gif_get_sym
cmp eax,[.CC]
je .reinit
call .Gif_output
.cycle:
movzx ebx,ax
call .Gif_get_sym
cmp eax,edx
jae .notintable
cmp eax,[.CC]
je .reinit
cmp eax,[.EOI]
je .end
call .Gif_output
.add:
push eax
mov eax,[.table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae .cycle
inc edx
bsr ebx,edx
cmp ebx,[.compsize]
jne .noinc
inc [.compsize]
.noinc:
jmp .cycle
.notintable:
push eax
mov eax,ebx
call .Gif_output
push ebx
movzx eax,bx
call .Gif_output
pop ebx eax
jmp .add
.er:
pop edi
jmp .ex
.end:
mov eax,[.cur_info]
mov [eax],edi
mov [.cur_info],edi
add esi,2
xchg esi,edi
.nxt:
cmp byte[edi],0
jnz .continue
inc edi
jmp .nxt
.continue:
cmp byte[edi],0x3b
jne .nextblock
xor eax,eax
stosd
mov ecx,[.img_count]
.ex:
pop edi esi
ret
.Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
.Gif_get_sym:
mov ecx,[.compsize]
push ecx
xor eax,eax
.shift:
ror byte[esi],1
rcr eax,1
dec [.bit_count]
jnz .loop1
inc esi
cmp esi,[.block_ofs]
jb .noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz .nextbl
mov eax,[.EOI]
sub esi,2
add esp,8
jmp .exx
.nextbl:
add eax,esi
mov [.block_ofs],eax
pop eax
.noblock:
mov [.bit_count],8
.loop1:
loop .shift
pop ecx
rol eax,cl
.exx:
xor ecx,ecx
ret
.Gif_output:
push esi eax edx
mov edx,[.table_ptr]
.next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz .next
shl ebx,16
mov bx,[esp]
.loop2:
pop ax
lea esi,[eax+eax*2]
add esi,[.Palette]
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
loop .loop2
pop edx eax esi
ret
.globalColor rd 1
.img_count rd 1
.cur_info rd 1 ; image table pointer
.img_start rd 1
.codesize rd 1
.compsize rd 1
.bit_count rd 1
.CC rd 1
.EOI rd 1
.Palette rd 1
.block_ofs rd 1
.table_ptr rd 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,267 @@
; 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,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b 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
}
; 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

View File

@ -0,0 +1,247 @@
MIDAMP for Menuet v1.0 July 29, 2005
Written in pure assembler by Ivushkin Andrey aka Willow
Monophonic MIDI player
Vivat assembler et MENUETOS!
MenuetOS still has a poor sound capabilities. Drivers are written for a few
soundcard models. Till recently I considered MEOS to be as voiceless as an
oyster. But then an alternative appeared; dear VaStaNi wrote kernel support of
PC speaker. Old good times of Pascal and MS-DOS came to me again. About 5 years
ago I wrote a Pascal application that parsed and played a note string in QBasic
syntax.
Now MeOS gets the simplest, speaker-driven sound scheme in Mario79's distro,
but the first melody in Menuet I heard was from the my program MIDAMP in
December, 2004. On technical reasons its release takes place only now.
So, MIDAMP is the simplest single-voiced MIDI player. It cannot do much though
it resembles the famous WinAmp. All it can do is to beep MIDI files.
There are no equalizer, balance and fader, and they won't appear. Moreover,
I may guarantee the correct sound only for files having a single track, one
instrument channel and within technological range of notes :-(
#########
System requirements:
1. Kernel having following function implemented:
55/55 - PC speaker interface (critical!)
67 - window shading;
66/3 - for extended mouse selection in playlist.
2. SYSXTREE version not below 52 - opening files and directories (critical!)
3. RAM amount for application - about 150 Kbytes.
#########
MIDAMP still uses a single playlist - /HD/1/PLAYLIST.TXT by default. Persons
interested can change the PLAYLIST_PATH constant value in MIDAMP.ASM. Playlist
is a simple text file having filenames to be played in each line. It is NOT
RECOMMENDED to edit the playlist by hand - bugs may appear while loading MIDAMP.
When started, MIDAMP creates a new thread whose job is actually playing. Early
versions had main thread that processed everything, therefore unpleasant sound
delays appeared when managing the playlist. Threads communicate intensively
through IPC, although I think it's an excess in such a case. But it works not
bad.
MIDAMP is able to shade to window header by pressing the proper button. I tried
to perform complete minimization through mcall 18,10 (new feature of Kolibri4),
but ran into the problem while restoring of window when PANEL button pressed.
That function possibly does not support windows type II ?
Hotkeys - almost like in WinAmp:
Del - delete the selected tracks;
z - previous track;
x, Enter, double click - play selected file;
c, Space - pause;
v - stop;
b - next track;
Esc - close the program;
m - sound on/off;
PgUp, PgDn - swap 2 tracks (not completed!);
BackSpace - rewind track;
Home/End - increase/decrease melody notes offset and play track from beginning
(it is shown near 'tone>' text).
In the case of polyphonic MIDI, if an intelligent melody isn't heard, you may
try to choose another track 'trk' or instrument channel 'chnl', pressing '[' or
']' accordingly and then a number key from '0' to '9'. The file will be played
from the beginning. To reset track and channel to the default value, press '\' .
Explaining some interface buttons:
Shuffle toggles random playback on/off. Repeat - current track will loop again
and again. An icon in the top left corner outputs a brief info about the
program to the Debug Board. Clicking the time toggles its view - from beginning
or from the end of file.
Mouse click on playlist when holding Shift or Ctrl button works like in WinAmp.
Remarks to bottom buttons:
'Add URL' not implemented, on clear reasons;
'Add Dir' - specify any file in the directory desired. *.MID and *.KAR files of
that directory will be added to the list;
'Misc' submenu is not implemented;
'New List' does nothing. MIDAMP still uses a fixed playlist.
One of the following flags may precede a filename in the commandline:
W - to load a file and wait (default);
P - to play a file;
H - to start shaded and close after playback.
To-Do list:
1. Increase playlist size (40 items for now).
2. Add dialog to select tracks of polyphonic melodies including analysis on
notes.
3. Reading text in Karaoke files.
4. Playlist select.
5. Note editor, as in Ringtone Editor.
6. Add comments to source.
7. Correct bugs to be found.
Special thanks to:
VaStaNi - there would be no need of MIDAMP w/o his code
Standard MIDI Files 0.06 March 1, 1988
MIDI 1.0 Specification
General MIDI Level Spec
MIDI SAMPLE DUMP STANDARD
Standard MIDI File Format by Dustin Caldwell
Files format of MIDI
The USENET MIDI Primer by Bob McQueer
Pavlushin Evgeny for his splendid SYSXTREE (DLGS.INC is the opendialog macro
of ASCL library edited to meet MIDAMP specific needs)
Send the wishes and bug reports to wil_low@hotbox.ru or to the meos.sysbin.com
forum.
See you later!
****************************************
****************************************
MIDAMP ¤«ï Menuet v1.0 29 ¨î«ï 2005 £.
<20> ¯¨á ­  ­  ç¨á⮬  áᥬ¡«¥à¥ ˆ¢ã誨­ë¬ €­¤à¥¥¬ (Willow)
Œ®­®ä®­¨ç¥áª¨© MIDI-¯«¥¥à
Vivat assembler et MENUETOS!
‘® §¢ãª®¬ ¢ MenuetOS â㣮 ¤® á¨å ¯®à. „à ©¢¥à  ­ ¯¨á ­ë ¤«ï ®£à ­¨ç¥­­®£® ªà㣠
§¢ãª®¢ëå ª àâ. „® ­¥¤ ¢­¥£® ¢à¥¬¥­¨ MeOS ¡ë«  ¤«ï ¬¥­ï ­¥¬ , ª ª àë¡ . <20>® ¯®â®¬
¯®ï¢¨« áì  «ìâ¥à­ â¨¢  - 㢠¦ ¥¬ë© VaStaNi ­ ¯¨á « ¯®¤¤¥à¦ªã PC ᯨª¥à . Œ­¥
áࠧ㠢ᯮ¬­¨«¨áì áâ àë¥ ¤®¡àë¥ ¢à¥¬¥­  <20> áª «ï ¨ MS-DOS. ‹¥â 5 ­ § ¤ ­ ¯¨á «
­  <20> áª «¥ ¯à®£à ¬¬ªã, ª®â®à ï ¯ àᨫ ,   ¯®â®¬ ¢®á¯à®¨§¢®¤¨«  áâப㠭®â ¢
ᨭ⠪á¨á¥ QBasic.
‘¥©ç á MeOS ¢ ¤¨áâਡã⨢¥ Mario79 ®¡à¥â ¥â ¯à®á⥩èãî §¢ãª®¢ãî á奬ã á ¯®¬®éìî
ᯨª¥à , ­® ¯¥à¢ãî ¬¥«®¤¨î ¢ Menuet ï ãá«ëè « ¢á¥-â ª¨ ®â ᢮¥© ¯à®£à ¬¬ë -
MIDAMP ¢ ¤¥ª ¡à¥ 2004 £®¤ . <20>® â¥å­¨ç¥áª¨¬ ¯à¨ç¨­ ¬ ¥¥ ५¨§ ¯à®¨á室¨â ⮫쪮
ᥩç á.
ˆâ ª, MIDAMP - ¯à®á⥩訩 ®¤­®£®«®áë© MIDI-¯à®¨£à뢠⥫ì. Ž­ ­¥ ¯à¥â¥­¤ã¥â ­ 
¬­®£®¥, å®âì ¨ ¯®å®¦ ­  WinAmp. ‚á¥, çâ® ®­ 㬥¥â, íâ® ¯¨«¨ª âì MIDI-ä ©«ë.
<EFBFBD>ª¢ « ©§¥à , ¡ « ­á  ¨ ॣã«ïâ®à  £à®¬ª®á⨠­¥â ¨ ­¥ ¯à¥¤¢¨¤¨âáï. <20>®«¥¥ ⮣®,
ª®à४⭮¥ §¢ãç ­¨¥ ¬®£ã £ à ­â¨à®¢ âì «¨èì ¤«ï ä ©«®¢ á 1 â४®¬, 1 ª ­ «®¬
¨­áâà㬥­â  ¨ ¢ ¯à¥¤¥« å â¥å­®«®£¨ç¥áª®£® ¤¨ ¯ §®­  ­®â :-(
#########
‘¨á⥬­ë¥ âॡ®¢ ­¨ï:
1. Ÿ¤à® á ॠ«¨§ æ¨¥© á«¥¤ãîé¨å á¨á⥬­ëå ä㭪権:
55/55 - ¨­â¥à䥩á PC ᯨª¥à  (­¥®¡å®¤¨¬®!);
67 - ᢮à ç¨¢ ­¨¥ ®ª­  ¢ § £®«®¢®ª;
66/3 - ¤«ï ०¨¬®¢ ¢ë¤¥«¥­¨ï â४®¢ ¬ëèìî.
2. SYSXTREE ¢¥àᨨ ­¥ ­¨¦¥ 52 - ®âªàë⨥ ä ©«®¢ ¨ ª â «®£®¢ (­¥®¡å®¤¨¬®!)
3. Ž¡ê¥¬ ¯ ¬ï⨠¤«ï ¯à®£à ¬¬ë - ®ª®«® 150 Š¡.
#########
<EFBFBD>®ª  çâ® MIDAMP ¨á¯®«ì§ã¥â ¥¤¨­á⢥­­ë© ¯«¥©«¨áâ - ¯® 㬮«ç ­¨î
/HD/1/PLAYLIST.TXT. †¥« î騥 ¬®£ãâ ¨§¬¥­¨âì §­ ç¥­¨¥ ª®­áâ ­âë PLAYLIST_PATH ¢
ä ©«¥ MIDAMP.ASM. <20>«¥©«¨áâ - ®¡ëç­ë© ⥪áâ®¢ë© ä ©«, ¢ ª ¦¤®© áâப¥ ª®â®à®£®
­ å®¤¨âáï ¨¬ï ä ©«  ¤«ï ¢®á¯à®¨§¢¥¤¥­¨ï. …£® <20><20>…ŠŽŒ…<C592>„“…Ÿ ¯à ¢¨âì ¢àãç­ãî -
¢®§¬®¦­ë ¡ £¨ ¯à¨ ¯®á«¥¤ãî饩 § £à㧪¥ ¥£® ¯à¨«®¦¥­¨¥¬.
<EFBFBD>ਠ§ ¯ã᪥ MIDAMP ᮧ¤ ¥â ­®¢ë© ¯®â®ª, § ¤ ç¥© ª®â®à®£® ï¥âáï ᮡá⢥­­®
®§¢ã窠. à ­­¨å ¢¥àá¨ïå ¢á¥ ¤¥« « £« ¢­ë© ¯®â®ª, ¯®í⮬㠢®§­¨ª «¨ ­¥¯à¨ïâ­ë¥
§ ¤¥à¦ª¨ ¢ §¢ãç ­¨¨ ¢® ¢à¥¬ï ã¯à ¢«¥­¨ï ¯«¥©«¨á⮬. <20>®â®ª¨ ¨­â¥­á¨¢­® ®¡é îâáï
¬¥¦¤ã ᮡ®© ç¥à¥§ IPC, å®âï ï ᪫®­ïîáì ª ⮬ã, çâ® ¢ ¤ ­­®¬ á«ãç ¥ íâ®
¨§«¨è¥á⢮. <20>® à ¡®â ¥â ­¥¯«®å®.
MIDAMP 㬥¥â ᢮à ç¨¢ âìáï ¢ áâப㠧 £®«®¢ª  ­ ¦ â¨¥¬ ᮮ⢥âáâ¢ãî饩 ª­®¯ª¨.
Ÿ ¯ëâ «áï ᤥ« âì ¯®«­®¥ ᢮à ç¨¢ ­¨¥ ç¥à¥§ mcall 18,10 (­®¢ ï ä¨ç  Kolibri4),
­® á⮫ª­ã«áï á ¯à®¡«¥¬®© ¢®ááâ ­®¢«¥­¨ï ®ª­  ­ ¦ â¨¥¬ ª­®¯ª¨ PANEL. ‚®§¬®¦­®,
äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥â ®ª­  ⨯  II ?
ƒ®àï稥 ª« ¢¨è¨ - ¯®ç⨠ª ª ¢ WinAmp:
Del - 㤠«¨âì ¢ë¤¥«¥­­ë¥ â४¨;
z - ¯à¥¤ë¤ã騩 â४;
x, Enter, ¤¢®©­®© 饫箪 ­  ä ©«¥ - ¢®á¯à®¨§¢¥¤¥­¨¥;
c, Space - ¯ ã§ ;
v - á⮯;
b - á«¥¤ãî騩 â४;
Esc - § ªàëâì ¯à®£à ¬¬ã;
m - ¢ª«îç¨âì/¢ëª«îç¨âì §¢ãª;
PgUp, PgDn - ¯®¬¥­ïâì ¬¥áâ ¬¨ 2 á®á¥¤­¨å â४  (­¥ § ª®­ç¥­®!);
BackSpace - ¯¥à¥¬®âª  â४  ¢ ­ ç «®;
Home/End - 㢥«¨ç¨âì/㬥­ìè¨âì â®­ «ì­®áâì ¬¥«®¤¨¨ ¨ ¯à®¨£à âì ¥¥ á ­ ç « 
(®â®¡à ¦ ¥âáï à冷¬ á ­ ¤¯¨áìî 'tone>').
á«ãç ¥ ¯®«¨ä®­¨ç¥áª¨å MIDI, ¥á«¨ ®á¬ëá«¥­­®© ¬¥«®¤¨¨ ­¥ ¯®«ãç ¥âáï, ¬®¦­®
¯®¯à®¡®¢ âì ¢ë¡à âì ¤à㣮© â४ 'trk' ¨«¨ ª ­ « ¨­áâà㬥­â  'chnl', ­ ¦ ¢
ᮮ⢥âá⢥­­® '[' ¨«¨ ']' ¨ § â¥¬ ª« ¢¨èã á ­®¬¥à®¬ ®â 0 ¤® 9. ” ©« ¡ã¤¥â
¢®á¯à®¨§¢¥¤¥­ á á ¬®£® ­ ç « . ‘¡à®á ¤®à®¦ª¨ ¨ ª ­ «  ¢ §­ ç¥­¨¥ ¯® 㬮«ç ­¨î -
­ ¦ â¨¥¬ '\' .
<EFBFBD> §­ ç¥­¨¥ ­¥ª®â®àëå ª­®¯®ª ¨­â¥à䥩á :
Shuffle - á«ãç ©­ë© ¯®à冷ª ¯à®¨£à뢠­¨ï â४®¢. Repeat - ⥪ã騩 â४ ¡ã¤¥â
¯à®¨£à뢠âìáï á­®¢  ¨ á­®¢ . ‡­ ç®ª ¢ «¥¢®¬ ¢¥àå­¥¬ 㣫㠢뢮¤¨â ªà âªãî
¨­ä®à¬ æ¨î ® ¯à®£à ¬¬¥ ­  ¤®áªã ®â« ¤ª¨. ™¥«ç®ª ­  ¢à¥¬¥­­®© ¬¥âª¥ ¬¥­ï¥â
ᯮᮡ ¥¥ ®â®¡à ¦¥­¨ï - á ­ ç «  ¨«¨ á ª®­æ  ä ©« .
™¥«ç®ª ¬ëèìî ­  ¯«¥©«¨áâ¥ á ­ ¦ âë¬ Shift ¨«¨ Ctrl à ¡®â ¥â  ­ «®£¨ç­® WinAmp.
‡ ¬¥ç ­¨ï ®â­®á¨â¥«ì­® ª­®¯®ª ¢­¨§ã:
'Add URL' ­¥ ॠ«¨§®¢ ­® ¯® ¯®­ïâ­ë¬ ¯à¨ç¨­ ¬;
'Add Dir' - 㪠¦¨â¥ «î¡®© ä ©« ¢ ¦¥« ¥¬®¬ ª â «®£¥. ” ©«ë *.MID ¨ *.KAR í⮣®
ª â «®£  ¡ã¤ãâ ¤®¡ ¢«¥­ë ¢ ᯨ᮪;
'Misc' ¯®¤¬¥­î ­¥ ॠ«¨§®¢ ­®;
'New List' ­¨ç¥£® ­¥ ¤¥« ¥â. <20>®ª  ¨á¯®«ì§ã¥âáï 䨪á¨à®¢ ­­ë© ¯«¥©«¨áâ.
ª®¬ ­¤­®© áâப¥ ¯¥à¥¤ ¨¬¥­¥¬ ä ©«  ¤«ï ¢®á¯à®¨§¢¥¤¥­¨ï ¬®¦¥â áâ®ïâì ®¤¨­ ¨§
ä« £®¢:
W - ¯à®áâ® § £à㧨âì ä ©« (¯® 㬮«ç ­¨î);
P - ¢®á¯à®¨§¢¥á⨠䠩«;
H - áâ à⮢ âì ᢥà­ãâë¬ ¢ § £®«®¢®ª, § ªàëâìáï ¯®á«¥ ¢®á¯à®¨§¢¥¤¥­¨ï.
—â® ¥é¥ ­ã¦­® ᤥ« âì:
1. “¢¥«¨ç¨âì à §¬¥àë ¯«¥©«¨áâ  (ᥩç á 40 ¯®§¨æ¨©).
2. „®¡ ¢¨âì ¤¨ «®£ ¢ë¡®à  â४®¢ ¯®«¨ä®­¨ç¥áª¨å ¬¥«®¤¨© á ¨å  ­ «¨§®¬ ¯®
­ «¨ç¨î ­®â.
3. —⥭¨¥ ⥪áâ  ¢ ª à ®ª¥-ä ©« å.
4. ‚ë¡®à ¯«¥©«¨áâ .
5. <20>®â­ë© । ªâ®à, ª ª ¢ Ringtone Editor.
6. Žâª®¬¬¥­â¨à®¢ âì ª®¤ (ª ª ¢á¥£¤ , «¥­ì).
7. ˆá¯à ¢¨âì ¡ £¨, ª®â®àë¥, ­¥á®¬­¥­­®, ­ ©¤ãâáï ;-)
Žá®¡ë¥ ¡« £®¤ à­®áâ¨:
VaStaNi - ¡¥§ ¥£® ª®¤  ­ ¯¨á ­¨¥ MIDAMP ­¥ ¨¬¥«® ¡ë á¬ëá« 
Standard MIDI Files 0.06 March 1, 1988
MIDI 1.0 Specification
General MIDI Level Spec
MIDI SAMPLE DUMP STANDARD
Standard MIDI File Format by Dustin Caldwell
”®à¬ â ä ©«®¢ MIDI
The USENET MIDI Primer by Bob McQueer
<20> ¢«îè¨­ã …¢£¥­¨î §  ­¥¯à¥¢§®©¤¥­­ë© SYSXTREE (DLGS.INC - ¯¥à¥à ¡®â ­­ë© á
ãç¥â®¬ ᯥæ¨ä¨ª¨ MIDAMP'a ¬ ªà®á opendialog ¡¨¡«¨®â¥ª¨ ASCL)
<EFBFBD>®¦¥« ­¨ï ¨ á®®¡é¥­¨ï ®¡ ®è¨¡ª å ­ ¯à ¢«ï©â¥ ­  wil_low@hotbox.ru ¨«¨ ­  ä®àã¬
meos.sysbin.com.
„® ­®¢ëå ¢áâà¥ç!

View File

@ -0,0 +1,292 @@
SYS equ meos
midi_parse:
and [max_note],0
and [cur_track],0
mov [min_note],0xff
mov edi,[midi_limit]
cmp dword[workarea],'MThd'
je .head_ok
mov edx,sHeadInv
call debug_outstr
jmp clearpath
.head_ok:
cmp dword[workarea+4],0x6000000
je .heads_ok
mov edx,sHSizeInv
call debug_outstr
jmp clearpath
.heads_ok:
cmp dword[workarea+8],0x1000000
jmp .headt_ok
mov edx,sTypeUnsup
call debug_outstr
jmp clearpath
.headt_ok:
movzx eax,word[workarea+12]
rol ax,8
mov [quarter],eax
mov [tempo],50
mov esi,workarea+0xe
skip_sections:
lodsd
cmp eax,'MTrk'
je track_found
if SYS eq meos
; dps <'What?',13,10>
end if
lodsd
add esi,eax
cmp esi,[midi_limit]
jbe skip_sections
if NONCRITICAL_MSG eq 1
dps 'No more tracks'
end if
and word[edi],0
; ud2
jmp decode_end
track_found:
if SYS eq meos1
dps <13,10,'Track '>
push esi
sub esi,workarea
; dpd esi
pop esi
end if
lodsd
bswap eax
mov bl,[cur_track]
cmp bl,[sel_track]
je .trk_fnd
add esi,eax
jmp next_event.eot
.trk_fnd:
mov [track_len],eax
dps 'TRK'
next_event:
call readvar
; dpd eax
add [delta],eax
lodsw ; al -event, ah - next byte
if SYS eq meos1
dph eax
dps <' ',13,10>
newline
end if
test al,0x80 ; check if a valid event
jnz .valid_evt2
dec esi
shl ax,8
mov al,[prev_cmd]
jmp .valid_evt
.valid_evt2:
mov [prev_cmd],al
.valid_evt:
cmp al,0xf0
jne .nosysex
dec esi
call readvar
add esi,eax
jmp next_event
.nosysex:
cmp al,0xff
jne .no_meta
; meta events
cmp ah,0x51
jne .notempo
push eax edx
mov eax,[esi]
xor al,al
bswap eax
xor edx,edx
mov ebx,10000
div ebx
pop edx eax
jmp .no_eot
.notempo:
cmp ah,0x2f ; end of track
jne .no_eot
inc esi
if SYS eq meos1
dps <13,10,'EOT'>
push esi
sub esi,workarea
dpd esi
pop esi
; mcall 5,200
; dph eax
; ud2
end if
.eot:
; dps 'EOT '
inc [cur_track]
jmp skip_sections;decode_end
.no_eot:
lodsb
movzx ecx,al ; ecx - length of metadata
add esi,ecx
jmp next_event
.no_meta:
cmp al,0xfa ; system ctl events
jb .no_sys
.dec_esi:
dec esi
jmp next_event
.no_sys:
cmp al,0xf8
je .dec_esi
movzx ecx,al ; ecx - MIDI Event Command
and ecx,0xf ; cl - channel
and al,0xf0 ; al - event code
cmp al,0xe0 ; Pitch wheel change
je .inc_esi
cmp al,0xb0
ja .no_inc
.inc_esi:
inc esi
.no_inc:
cmp ecx,[channel] ; Channel must be 0 !!!
jz .chan_ok
if NONCRITICAL_MSG eq 1
dps 'C' ; Reference to unsupported channel !!!
dpd ecx
mov ecx,esi
dps '-'
sub ecx,workarea+1
dpd ecx
end if
jmp next_event
.chan_ok:
cmp al,0x90 ; Note On
jne .no_noon
add al,[octave]
cmp [curnote],0x80
je .note_ok
if NONCRITICAL_MSG eq 1
dps 'N!' ; Note On without Off !!!
end if
.note_ok:
; dps 'N+'
; movzx ecx,ah
; dpd ecx
call insert_pause
mov [curnote],ah ; [curnote]=note number
jmp next_event
.no_noon:
cmp al,0x80 ; Note Off
jne .no_nooff
add ah,[octave]
cmp ah,[curnote]
je .off_ok
if NONCRITICAL_MSG eq 1
dps 'n!' ; Note Off mismatch !!!
end if
.off_ok:
; dps 'N-'
cmp ah,[max_note]
jbe .nomax
mov [max_note],ah
.nomax:
cmp ah,[min_note]
jae .ins
mov [min_note],ah
.ins:
call insert_note
mov [curnote],al
.no_nooff: ; No more supported events
jmp next_event
prev_cmd db ?
max_note db ?
min_note db ?
; *********************************************
; ******* READ VARIABLE BYTES ****************
; *********************************************
readvar:
; in: esi - pointer;
; out: esi - new pointer; eax - value;
push ebx ecx
movzx ebx,byte[esi]
inc esi
btr ebx,7
jnc .exit
.next:
shl ebx,7
lodsb
mov ecx,eax
and eax,0x7f
add ebx,eax
cmp cl,0x7f
ja .next
.exit:
mov eax,ebx
pop ecx ebx
ret
; *********************************************
; ******* INSERT PAUSE ***********************
; *********************************************
insert_pause:
cmp [delta],0
jz return
push eax ebx ecx
mov ah,0xff
jmp write_note
; *********************************************
; ******* INSERT NOTE ************************
; *********************************************
insert_note: ; ah - note code
push eax ebx ecx
movzx eax,ah
mov ebx,12
div bl
shl al,4
add ah,al
sub ah,0x1f
write_note:
push eax
mov eax,[delta]
mov edx,[tempo]
mul edx
mov ecx,[quarter]
div ecx ; ax - note delay
cmp eax,0x7f
jb .ok
mov eax,0x7f
.ok:
movzx ecx,al
or ecx,0x80
pop eax
mov al,cl
stosw
xor eax,eax
mov [delta],eax
pop ecx ebx eax
return:
ret
sHeadInv:
if lang eq ru
db "<EFBFBD>¥¢¥à­ë© § £®«®¢®ª",0
else
db "Header invalid",0
end if
sHSizeInv:
if lang eq ru
db '<27>¥¢¥à­ë© à §¬¥à § £®«®¢ª ',0
else
db 'Header size invalid',0
end if
sTypeUnsup:
if lang eq ru
db '’¨¯ MIDI ­¥ ¯®¤¤¥à¦¨¢ ¥âáï',0
else
db 'MIDI type not supported',0
end if

View File

@ -0,0 +1,349 @@
; Playlist support for MIDPLAY
LCOLOR equ 0x00ff00
PCOLOR equ 0xffffff
PL_X equ 10 shl 16
PL_Y equ PLY shl 16
PL_XY equ 10 shl 16+PLY
PL_show:
test [flag],FL_HIDDEN
jnz .ex
pusha
and [counter],0
mov ebx,PL_X+255
mov eax,13
mov ecx,PL_Y-1 shl 16+4+9*LISTITEMS
xor edx,edx
int 0x40
movzx ecx,byte[list_count]
test ecx,ecx
jz .ex2
push ecx
imul ecx,9
add ecx,PL_Y-1 shl 16-2
mov edx,11+1 shl 29+1 shl 30
mov eax,8
int 0x40
pop ecx
mov edi,[pl_ptr]
mov eax,4
mov ebx,PL_XY+2 shl 16
.sh_loop:
movzx esi,word[edi]
and esi,not FL_MULSEL
add edi,2
pusha
mov edx,edi
mov ecx,[counter]
test word[edi-2],FL_MULSEL
jz .nosel
pusha
mov ebx,PL_X+255+1 shl 16-2
imul ecx,9
shl ecx,16
add ecx,PL_Y-1 shl 16+8
mov edx,0xc6
mov eax,13
int 0x40
popa
.nosel:
pusha
mov edx,ebx
mov esi,0xa0a0a0;0x508cec
mcall 47,0x30000
popa
cmp ecx,[play_num]
je .high
mov ecx,LCOLOR
jmp .int
.high:
mov ecx,PCOLOR
.int:
add ebx,25 shl 16
int 0x40
popa
add edi,esi
add ebx,9
inc [counter]
loop .sh_loop2
jmp .ex2
.sh_loop2:
jmp .sh_loop
.ex2:
popa
test [flag],FL_BOTTRED
jz .nobott
pusha
mcall 7,hdr_raw+12+275*16*3,<275,12>,<10,(WND_HEIGHT-20)>
mov ebp,main_coo2
mov esi,10 shl 16
mov edi,(WND_HEIGHT-22)shl 16
mov ecx,1
pushd 155 shl 16+5
pushd (WND_HEIGHT-22) shl 16+5
call draw_navigation
add esp,8
popa
call draw_bottom
and [flag],not FL_BOTTRED
.nobott:
.ex:
ret
PL_add:
; in: esi->filename,ecx->fname_len
jecxz .ex
cmp [list_count],LISTITEMS
jae .ex
pusha
mov edi,[play_limit]
mov [edi],cx
add edi,2
rep movsb
mov [play_limit],edi
inc [list_count]
popa
.ex:
ret
PL_del:
movzx ecx,byte[list_count]
jecxz .ex
call PL_get1stsel
mov edx,ebx
.lp:
mov edi,esi
xor eax,eax
lodsw
btr eax,15
jc .elp2
add esi,eax
jmp .elp
.elp2:
push esi ecx
add esi,eax
mov ecx,[play_limit]
sub ecx,esi
rep movsb
mov [play_limit],edi
dec [list_count]
cmp edx,[play_num]
ja .no
dec [play_num]
.no:
pop ecx esi
sub esi,2
.elp:
inc edx
loop .lp
.ex:
ret
PL_getitemclick:
; out: eax- item # (0..n)
mov ebx,1
mov eax,37
int 0x40
sub eax,PLY-1
mov ebx,9
div bl
movzx eax,al
ret
PL_getbyindex:
; in:eax-index, out: esi-filename, ecx-length
mov esi,[pl_ptr]
mov ecx,eax
.loop:
lodsw
and eax,not FL_MULSEL
jecxz .gbi
add esi,eax
dec ecx
jmp .loop
.gbi:
movzx ecx,ax
ret
PL_get1stsel:
; out: esi- 1st selected, ebx - index
mov esi,[pl_ptr]
xor ebx,ebx
PL_getnextsel:
push eax ecx
movzx ecx,[list_count]
.lp:
movzx eax,word[esi]
btr eax,15
jc .ex2
lea esi,[esi+eax+2]
inc ebx
loop .lp
xor ebx,ebx
.ex2:
pop ecx
.ex:
pop eax
ret
PL_clearsel:
pusha
mov ebx,not FL_MULSEL
xor eax,eax
mov esi,[pl_ptr]
movzx ecx,[list_count]
jecxz .flg
.loop:
and word[esi],bx
lodsw
add esi,eax
loop .loop
.flg:
and [flag],not FL_MULSEL
popa
ret
PL_shiftsel:
pusha
xor eax,eax
; mov esi,[pl_ptr]
; movzx ecx,[list_count]
.loop:
lodsw
or word[esi-2],FL_MULSEL
add esi,eax
loop .loop
jmp PL_clearsel.flg
PL_invsel:
pusha
mov ebx,not FL_MULSEL
xor eax,eax
mov esi,[pl_ptr]
movzx ecx,[list_count]
jecxz .ex
.loop:
xor word[esi],FL_MULSEL
lodsw
and eax,ebx
add esi,eax
loop .loop
.ex:
jmp PL_clearsel.flg
PL_load:
and [list_count],0
mov [pl_ptr],playlist
mov ebx,PL_info
mov dword[ebx+12],playlist
mov eax,58
int 0x40
test eax,eax
jz .ok1 ; ebx- filesize
cmp eax,6
jne .ex
.ok1:
mov eax,0x0a0d
cmp word[playlist],ax
je .ok
sub [pl_ptr],2
.ok:
mov edi,[pl_ptr]
add ebx,edi
mov word[ebx],ax
add edi,2
.loo:
mov edx,edi
.loo2:
mov ecx,256
repne scasb
cmp edi,ebx
jb .ok2
lea edi,[ebx+1]
.ok2:
mov ecx,edi
sub ecx,edx
dec ecx
inc edi
jecxz .shift
mov [edx-2],cx
inc [list_count]
cmp edi,ebx
jb .loo
.ex1:
sub ebx,2
mov [play_limit],ebx
.ex:
ret
.shift:
mov ecx,ebx
sub ecx,edi
jecxz .ex1
sub ebx,2
mov esi,edi
sub edi,2
push edi
rep movsb
pop edi
jmp .loo
PL_save:
movzx ecx,byte[list_count]
jecxz .ex
mov eax,0x0a0d
mov edi,[pl_ptr]
lea edx,[edi+2]
mov [PL_info+12],edx
.savl:
movzx ebx,word[edi]
and bx,not FL_MULSEL
stosw
add edi,ebx
loop .savl
stosw
sub edi,[pl_ptr]
mov ebx,PL_info
mov [ebx+8],edi
mov dword[ebx],1
mov eax,58
int 0x40
.ex:
ret
PL_swap: ; swap [ebx] with [ebx+1]
mov eax,ebx
call PL_getbyindex
add ecx,2
sub esi,2
push ecx esi ; save begin & length of 1st fname
mov edi,fnbuf
rep movsb
movzx ecx,word[esi]
and cx,not FL_MULSEL
add ecx,2
pop edi
rep movsb
pop ecx
mov esi,fnbuf
rep movsb
cmp ebx,[play_num]
jne .nosel1
inc [play_num]
ret
.nosel1:
inc ebx
cmp ebx,[play_num]
jne .nosel2
dec [play_num]
.nosel2:
ret
PL_info:
.mode dd 0
dd 0
.bytes dd 20
dd 0
dd hash_table
db PLAYLIST_PATH,0

View File

@ -0,0 +1,30 @@
/HD/1/MIDI2/MID/CALIFOR .MID
/HD/1/MIDI2/ZNAYU .MID
/HD/1/MIDI2/MID/WILD_D~1.MID
/HD/1/MIDI/FILES/JACKSON .MID
/HD/1/MIDI/FILES/MOZART .MID
/HD/1/MIDI2/MID/FAVGAME .MID
/HD/1/MIDI/PETERB .MID
/HD/1/MIDI/KVN .MID
/HD/1/MIDI2/911 .MID
/HD/1/MIDI2/HYMN .MID
/HD/1/MIDI2/GEIGU .MID
/HD/1/MIDI2/MID/COMEAS .MID
/HD/1/MIDI/FILES/SAINTS .MID
/HD/1/MIDI/FILES/SNOW .MID
/HD/1/MIDI/FILES/90210 .MID
/HD/1/MIDI/FILES/AMAZING .MID
/HD/1/MIDI/FILES/99LUFT~1.MID
/HD/1/MIDI/FILES/EUROPE .MID
/HD/1/MIDI/FILES/VANESSA .MID
/HD/1/MIDI/FILES/SPICE .MID
/HD/1/MIDI/FILES/NIEMAL~1.MID
/HD/1/MIDI/FILES/SMS .MID
/HD/1/MIDI/FILES/PRIMA .MID
/HD/1/MIDI/FILES/POPCORN .MID
/HD/1/MIDI/FILES/POLKKA .MID
/HD/1/MIDI/FILES/SW_FINAL.MID
/HD/1/MIDI/FILES/MAJORT~1.MID
/HD/1/MIDI/FILES/7DAYS .MID
/HD/1/MIDI/FILES/AADAMS .MID

View File

@ -0,0 +1,293 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Copyright 2003 VaStaNi *
* vastani@ukr.net *
* >>>- SIMPLY - QUICKLY - SHORTLY -<<< *
* *
* About Player Notes for Speaker PC. *
* ( PLAYNOTE.INC v.1.1 for MENUET OS ) *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
--- ATTACH ---
>>> Insert string: include "PLAYNOTE.INC" in list file KERNEL32.INC
.........
......... ......... .............................
......... ......... .............................
......... ......... .............................
; sound
include "SB16.INC" ; playback for Sound Blaster 16
include "PLAYNOTE.INC" ; player Note for Speaker PC
.........
......... ......... .............................
......... ......... .............................
>>> Insert line --->>> call playNote --->>> in procedure irq0
( listing file SYS32.INC for KERNEL.ASM )
.... ....
.... ....
.... ....
no_error_in_previous_process:
mov edi,[0x3000]
imul edi,8
mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
inc dword [0xfdf0]
mov eax,[0xfdf0]
call playNote ; <<<--- INSERT THIS LINE !!!!!!!!!!
cmp eax,[next_usage_update]
jb nocounter
add eax,100
mov [next_usage_update],eax
call updatecputimes
nocounter:
.... ....
.... ....
.... ....
>>> file SB16.INC have this label...
.... ....
.... ....
.... ....
no_SB16_data_format:
ret
>>> I suggest add this code for subfunction #55 function #55 OS (player notes)
.... ....
.... ....
.... ....
no_SB16_data_format:
cmp eax, edi ; this is subfunction #55 ?
jne retFunc55 ; if no then return.
movzx eax, byte [countDelayNote]
or al, al ; player is busy ?
jnz retFunc55 ; return counter delay Note
mov eax, [0x3010]
mov eax, [eax+0x10] ; address application im memory
add eax, edx ; add offset Delay-Note string
mov [memAdrNote], eax
xor eax, eax ; Ok! EAX = 0
retFunc55:
mov [esp+36], eax ; return value EAX for application
ret
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
--- USE ---
>>> Example use in your programs:
.... ....
.... ....
.... ....
mov eax, 55 ; OS function #55
mov ebx, eax ; EBX = 55 for subfunction Play Note
mov esi, MyMusic_1 ; ESI = head string Delay-Note code
int 0x40 ; start play
.... ....
.... ....
.... ....
>>> Very simply OS use. Only put dword adress head string in [memAdrNote]
.... ....
mov [memAdrNote], dword MyMusic_1 ; IRQ0 -> start play!!!
.... ....
!!! Example OS use for send: error tone, ring signal, disconnect hardware...
!!! Saund Card may be OFF, but Speaker PC always IS ON !!!
..... .. ..
..... .. ..
MyMusic_1 db .., .., .., .., .., 0 ; string Delay-Note code for MUSIC
... .. ..
...... .. ..
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
--- CODE DELAY & NOTEs ---
>>> Format Delay-Note string:
1. Free style play Tone
db 1..0x80 ; !!! only (1..0x80) byte for Delay Tone
db 1..0xFF ; lower byte (counter for period oscillate)
db 1..0xFF ; upper byte (counter for period oscillate)
.. .. \
.. .. > 3 bytes for 1 TONE !!!
.. .. /
db 0 ; THE END Play!
2. Musical style play Note
db 0x81..0xFE ; !!! 0x80 + byte (1..0x7E) for Delay Note
db 1..0xFF ; PACK CODE (number Note & number Octave)
.. .. \
.. .. / 2 bytes for 1 Note in 1 Octave !!!
db 0 ; THE END Play!
-= DELAY CODE =-
ÚÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÉÍÍ 1 Í»ÉÍÍ 2 Í»
³¤«¨â¥«ì­®á⨳ DELAY NOTE ³ DELAY º DELAY ºº DELAY º
³ <20>Ž ³ mSec ³ IRQ 0 º CODE ºº CODE º
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÌÍÍÍÍÍÍÍ͹ÌÍÍÍÍÍÍÍ͹
³ 楫 ï ³ 2000 ³ º 0xC8 ºº absent º
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ÇÄÄÄÄÄÄÄĶÇÄÄÄÄÄÄÄĶ
³ 1/2 ³ 1000 ³ º 0x64 ºº 0xE4 º
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ÇÄÄÄÄÄÄÄĶÇÄÄÄÄÄÄÄĶ
³ 1/4 ³ 500 ³ º 0x32 ºº 0xB2 º
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ 10 ºÄÄÄÄÄÄÄĶºÄÄÄÄÄÄÄĶ
³ 1/8 ³ 250 ³ mSec º 0x19 ºº 0x99 º
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ÇÄÄÄÄÄÄÄĶÇÄÄÄÄÄÄÄĶ
³ 1/16 ³ 125 ³ º 0xC ºº 0x8C º
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ºÄÄÄÄÄÄÄĶºÄÄÄÄÄÄÄĶ
³ 1/32 ³ 62.5 ³ º 6 ºº 0x86 º
ÃÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄ´ ÇÄÄÄÄÄÄÄĶÇÄÄÄÄÄÄÄĶ
³ 1/64 ³ 31.25 ³ º 3 ºº 0x83 º
ÀÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÈÍÍÍÍÍÍÍͼÈÍÍÍÍÍÍÍͼ
-= PACK CODE =-
!!!!! IF PACK CODE = 0xFF THEN PAUSE = DELAY CODE !!!!!
ÚÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÉÍÍÍÍÍÍÍÍÍÍ» ÚÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÂÄÄÄÄÄÄÉÍÍÍÍÍÍÍÍÍÍ»
³ ˆ<E28099> ³number³ code ºupper CODEº ³ <20>Ž ³type³numberºlower CODEº
³ ŽŠ’€‚ ³OCTAVE³numberºBit7..Bit4º ³ ŽŠ’€‚› ³NOTE³ NOTE ºBit3..Bit0º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÌÍÍÍÍÍÍÍÍÍ͹ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄÌÍÍÍÍÍÍÍÍÍ͹
³ª®­âப⠢ ³ -3 ³ 0 º 0000 º ³ „Ž ³ C ³ 1 º 0001 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÌÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ¡®«ìè ï ³ -2 ³ 1 º 0001 º ³ „Ž ¡¥¬®«ì ³ C# ³ 2 º 0010 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÇÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ¬ « ï ³ -1 ³ 2 º 0010 º ³ <20>… ³ D ³ 3 º 0011 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄĺÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ¯¥à¢ ï ³ 1 ³ 3 º 0011 º ³ <20>… ¡¥¬®«ì ³ D# ³ 4 º 0100 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÇÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ¢â®à ï ³ 2 ³ 4 º 0100 º ³ Œˆ ³ E ³ 5 º 0101 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄĺÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ âà¥âìï ³ 3 ³ 5 º 0101 º ³ ”€ ³ F ³ 6 º 0110 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÇÄÄÄÄÄÄÄÄÄĶ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ç¥â¢¥àâ ï ³ 4 ³ 6 º 0110 º ³ ”€ ¡¥¬®«ì ³ F# ³ 7 º 0111 º
ÀÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÈÍÍÍÍÍÍÍÍÍͼ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ‘Ž‹œ ³ G ³ 8 º 1000 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³‘Ž‹œ ¡¥¬®«ì³ G# ³ 9 º 1001 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ‹Ÿ ³ A ³ 10 º 1010 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ‹Ÿ ¡¥¬®«ì ³ A# ³ 11 º 1011 º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄĶ
³ ˆ ³ B ³ 12 º 1100 º
ÀÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÁÄÄÄÄÄÄÈÍÍÍÍÍÍÍÍÍͼ
PACK CODE = (number Note) AND ((code number Octave) SHL 4)
or
PACK CODE = (number Note) AND ((code number Octave) * 16)
-= PERIOD OSCILLATE =-
counter = 1193180 / FREQUENCY;
(WORD) (sound Hz)
ÚÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÂÄÄÄÄÄÄÉÍÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍ»
³ ˆ<E28099> ³number³ code ³ <20>Ž ³type³numberºfrequency PACK º
³ ŽŠ’€‚› ³OCTAVE³number³ 1© Ž‘’€‚› ³NOTE³ NOTE ºsound Hz CODE º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄÌÍÍÍÍÍÍÍÍÍ ÍÍÍÍÍ͹
³ ³ ³ ³ „Ž ³ C ³ 1 º 523,251 -- 0x31 º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | ÄÄÄÄÄĶ
³ ³ ³ ³ „Ž ¡¥¬®«ì ³ C# ³ 2 º 554,365 --|-- 0x32 º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ³ ³ ³ <20>… ³ D ³ 3 º 587,33 | | 0x33 º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ³ ³ ³ <20>… ¡¥¬®«ì ³ D# ³ 4 º 622,254 | | 0x34 º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ³ ³ ³ Œˆ ³ E ³ 5 º 659,255 | | 0x35 º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ³ ³ ³ ”€ ³ F ³ 6 º 698,456 | | 0x36 º
³ ¯¥à¢ ï ³ 1 ³ 3 ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ( first ³ ³ ³ ”€ ¡¥¬®«ì ³ F# ³ 7 º 739,989 | | 0x37 º
³ octave ) ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ³ ³ ³ ‘Ž‹œ ³ G ³ 8 º 783,991 0x38 º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ x 2 ÄÄÄÄÄĶ
³ ³ ³ ³‘Ž‹œ ¡¥¬®«ì³ G# ³ 9 º 830,609 0x39 º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ³ ³ ³ ‹Ÿ ³ A ³ 10 º 880 | | 0x3A º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ³ ³ ³ ‹Ÿ ¡¥¬®«ì ³ A# ³ 11 º 932,328 | | 0x3B º
³ ³ ³ ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄ | | ÄÄÄÄÄĶ
³ ³ ³ ³ ˆ ³ B ³ 12 º 987,767 | | 0x3C º
ÃÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄÌÍÍÍÍÍÍÍÍÍ | | ÍÍÍÍÍ͹
³ ¢â®à ï ³ 2 ³ 4 ³ „Ž ³ ³ 1 º1046,502 <- | 0x41 º
...... .. .. ... .. .. .... ... <----
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
--- EXAMPLE MUSIC ---
<EFBFBD>ਬ¥à ¬ã§¨æ¨à®¢ ­¨ï ¯® ­®â ¬ ¬¥«®¤¨¨ ˆ.Š à­¥«îª  "ƒ®à¨â ®ç £..."
ª 䨫ì¬ã "<22> ­¤¨â᪨© <20>¥â¥à¡ãà£"
MyMusic_1:
db 0xe4,0x35, 0x99,0x33, 0x99,0x31, 0x99,0x33, 0xe4,0x35, 0x99,0x35, 0x99,0x36
db 0x99,0x38, 0x99,0x3a, 0xe4,0x36, 0xe4,0x36, 0xb2,0xff, 0xe4,0x33, 0x99,0x31
db 0x99,0x2c, 0x99,0x31, 0xe4,0x33, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x35
db 0xe4,0x35, 0xb2,0xff, 0x99,0x35, 0x99,0x36, 0xe4,0x33, 0x99,0x35, 0x99,0x36
db 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x39
db 0xe4,0x39, 0xb2,0xff, 0x99,0x35, 0x99,0x36, 0xe4,0x33, 0x99,0x35, 0x99,0x36
db 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x35
db 0xe4,0x35, 0
MyMusic_2:
db 0x90,0x31, 0x90,0x33, 0x90,0x35, 0x90,0x36, 0xA0,0xFF, 0xA0,0x06, 0x90,0xFF
db 0xA0,0x06, 0x90,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37, 0x90,0x38, 0xA0,0xFF
db 0xA0,0x18, 0x90,0xFF, 0xA0,0x18, 0x90,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37
db 0x90,0x38, 0xA0,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37, 0x90,0x38, 0xA0,0xFF
db 0x90,0x31, 0x90,0x33, 0x90,0x35, 0x90,0x36, 0xA0,0xFF, 0xA0,0x16, 0x90,0xFF
db 0xA0,0x16, 0
MyMusic_3:
db 0x99,0x31, 0xB2,0x36, 0x99,0x3A, 0xB2,0x36, 0x99,0x33, 0xB2,0x28, 0xBC,0x38
db 0
<<<<<<< >>>>>>>
|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> !GOOD LUCK! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<|
<<<<<<< >>>>>>>

View File

@ -0,0 +1,121 @@
new_thread:
mov ecx,ipcarea2
call init_ipc
mcall 40,1000000b
tstill:
mov dword[ipcarea2],0
mov dword[ipcarea2+4],8
mcall 10
.prc:
cmp eax,7
jne tstill
and [flag],not FL_PLAY
mov eax,dword[ipcarea2+8]
cmp eax,[parentPID]
jne tstill
cmp byte[ipcarea2+16],IPC_PLAY
je .play_next
cmp byte[ipcarea2+16],IPC_TRIG
jne tstill
.play_next:
or [flag],FL_PLAY
mov edi,[cur_ptr]
movzx eax,word[edi]
mov [play_area],ax
add [cur_ptr],2
if SOUND eq ON
test [flag],FL_MUTE
jnz .nosound
mov esi,play_area
mov eax,55
mov ebx,eax
int 0x40
.nosound:
end if
movzx ebx,byte[play_area]
and ebx,0x7f
add [cur_tick],ebx
mov eax,23
int 0x40
cmp word[edi],0
jne .checkevt
mov eax,IPC_NEXT
call ipc_send
jmp tstill
.checkevt:
test eax,eax
jz .upd
cmp eax,7
jne tstill
cmp byte[ipcarea2+16],IPC_PLAY
jne tstill
.upd:
mov eax,IPC_UPDT
call ipc_send
jmp .play_next
respawn:
mcall 9,prcinfo,-1
mov ecx,eax
xor edx,edx
xor esi,esi
.nxt:
mcall 9
cmp dx,[ebx+4]
jae .less
mov dx,[ebx+4]
mov esi,[ebx+30]
.less:
loop .nxt
push esi
mcall 51,1,new_thread,APP_MEM
pop edx
cmp edx,[childPID]
jne .nochild
mov edx,[parentPID]
.nochild:
mov [childPID],eax
call prc_find
mcall 18,3
ret
kill:
mov edx,[childPID]
call prc_find
mcall 18,2
.nothread:
ret
prc_find: ;in: edx-PID, out: ecx-number
mcall 9,prcinfo,-1
mov ecx,eax
.nxt:
mcall 9
cmp edx,[ebx+30]
je .found
loop .nxt
.found:
ret
init_ipc:
mcall 60,1,,20
ret
ipc_send: ;eax-msg
test [flag],FL_LOCK
jnz .noipc
pusha
mov [ipcmsg],al
mov ebx,ipcarea2
mov ecx,childPID
cmp eax,0xb0
jb .noparent
add ecx,4
sub ebx,20
.noparent:
mov dword[ebx],0
mov dword[ebx+4],8
mcall 60,2,[ecx],ipcmsg,1
popa
.noipc:
ret

View File

@ -110,7 +110,7 @@ if SYS eq win
else
Msg 0
Msg 1
mcall 40,10000101b
mcall 40,1000101b
; jmp again
CmdLine
cmdl:

View File

@ -261,8 +261,8 @@ local dlg_is_work, ready
;; mov esi,path
mov edi,path
xor eax,eax
mov ecx,200
rep stosb
mov ecx,(1024+16)/4
rep stosd
;mov [get_loops],0
mov [dlg_pid_get],0
@ -301,7 +301,7 @@ new_d:
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
mov edx,1024+16 ; size
int 0x40
mcall 40,1000111b
@ -309,7 +309,7 @@ new_d:
; STEP 3 run SYSTEM XTREE with parameters
;
mcall 58,run_fileinfo
mcall 70,run_fileinfo
call redproc
@ -318,15 +318,14 @@ 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
dec eax
jz mred
dec eax
jz mkey
dec eax
jz mbutton
cmp al, 7-3
jz mgetmes
; Get number of procces
mcall 9,os_work,-1
@ -405,14 +404,14 @@ mgetmes:
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; Second message is 1024 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 ecx,1024/4
rep movsd
mov [edi],byte 0
jmp openoff
@ -428,11 +427,11 @@ param:
dd 0,0 ; Type of dialog
run_fileinfo:
dd 16
dd 7
dd 0
dd param
dd 0
dd os_work ; 0x10000
dd 0
;run_filepath
db '/RD/1/SYSXTREE',0

View File

@ -68,8 +68,8 @@ else
; db '/hd/1/zip/test2.zip',0
end if
db 0
rb 256-($-filename)
I_END:
rb 1024+16-($-filename)
if SYS eq win
cr_lf db 0xa,0xd

View File

@ -143,6 +143,11 @@ macro mcall a,b,c,d,e,f { ; mike.dld
; 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>
@ -174,7 +179,7 @@ macro sub arg1,arg2
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1

View File

@ -385,12 +385,26 @@ get_6ASCII_num:
}
StartPad:
; mcall 19,editorcmd,dumpfile
pusha
mov esi,[outfile.size]
; dpd esi
mov [par_fsize],esi
mcall 19,editorcmd,editor_par
; convert number in esi to decimal representation
mov ecx, 10
push -'0'
mov eax, esi
@@:
xor edx, edx
div ecx
push edx
test eax, eax
jnz @b
mov edi, par_fsize
@@:
pop eax
add al, '0'
stosb
jnz @b
mcall 70,fileinfo
mov ecx,eax
mcall 5,20
mcall 60,2,,[outfile.out];output
@ -398,7 +412,13 @@ StartPad:
popa
ret
editorcmd db 'TINYPAD '
fileinfo:
dd 7
dd 0
dd editor_par
dd 0
dd 0
db '/RD/1/TINYPAD',0
editor_par db '*'
par_fsize dd ?
par_fsize rb 11
end if

View File

@ -133,9 +133,9 @@ local dlg_is_work, ready, procinfo
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
xor eax,eax
mov ecx,(1024+16)/4
rep stosd
;mov [get_loops],0
mov [dlg_pid_get],0
@ -177,7 +177,7 @@ new_d:
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,150 ; size 150 bytes
mov edx,1024+16 ; size
int 0x40
; change wanted events list 7-bit IPC event
@ -189,7 +189,7 @@ new_d:
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,58
mov eax,70
mov ebx,run_fileinfo
int 0x40
@ -200,15 +200,14 @@ 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
dec eax
jz mred
dec eax
jz mkey
dec eax
jz mbutton
cmp al, 7-3
jz mgetmes
; Get number of procces
mov ebx,procinfo
@ -295,14 +294,14 @@ mgetmes:
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; Second message is 1024 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 ecx,1024/4
rep movsd
mov [edi],byte 0
jmp openoff
@ -318,16 +317,16 @@ param:
dd 0,0 ; Type of dialog
run_fileinfo:
dd 16
dd 7
dd 0
dd param
dd 0
dd procinfo ; 0x10000
dd 0
;run_filepath
db '/RD/1/SYSXTREE',0
procinfo:
times 256 db 0
times 1024 db 0
}
@ -345,9 +344,9 @@ local dlg_is_work, ready, procinfo
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
xor eax,eax
mov ecx,(1024+16)/4
rep stosd
;mov [get_loops],0
mov [dlg_pid_get],0
@ -389,7 +388,7 @@ new_d:
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,120 ; size 150 bytes
mov edx,1024+16 ; size
int 0x40
; change wanted events list 7-bit IPC event
@ -401,7 +400,7 @@ new_d:
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,58
mov eax,70
mov ebx,run_fileinfo
int 0x40
@ -412,15 +411,14 @@ 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
dec eax
jz mred
dec eax
jz mkey
dec eax
jz mbutton
cmp al, 7-3
jz mgetmes
; Get number of procces
mov ebx,procinfo
@ -457,6 +455,7 @@ mred:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
@ -506,14 +505,14 @@ mgetmes:
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; Second message is 1024 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 ecx,1024/4
rep movsd
mov [edi],byte 0
jmp openoff
@ -525,25 +524,26 @@ dlg_pid_get dd 0
DLGPID dd 0
param:
rb 4 ; My dec PID
rb 6 ; Type of dialog
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
run_fileinfo:
dd 16
dd 7
dd 0
dd param
dd 0
dd procinfo
run_filepath:
dd 0
;run_filepath:
db '/RD/1/SYSXTREE',0
procinfo:
times 256 db 0
times 1024 db 0
}
; RANDOM - generate random count (small)
; (SYNTAX) RANDOM MaxCount,OutArgument
; (SAMPLE) RANDOM 10000,eax

View File

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

View File

@ -143,6 +143,8 @@ macro mcall a,b,c,d,e,f { ; mike.dld
; language for programs
lang fix ru ; ru en fr ge fi

View File

@ -40,20 +40,19 @@ GUTTER equ 10
BENCH equ 0;1
syms equ 12
use32 ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
org 0x0 ;  ¤à¥á æ¨ï á ­ã«ï
use32 ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
org 0x0 ;  ¤à¥á æ¨ï á ­ã«ï
db 'MENUET01' ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
dd START ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
dd I_END0 ; à §¬¥à ¯à®£à ¬¬ë
dd esp_end ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
dd sys_mem ;  ¤à¥á ¢¥à設ë áâíª 
dd fname_buf ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
dd 0x0 ; § à¥§¥à¢¨à®¢ ­®
db 'MENUET01' ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
dd START ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
dd I_END0 ; à §¬¥à ¯à®£à ¬¬ë
dd esp_end ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
dd sys_mem ;  ¤à¥á ¢¥à設ë áâíª 
dd fname_buf ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
dd 0x0 ; § à¥§¥à¢¨à®¢ ­®
include 'lang.inc'
include 'macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
include 'MACROS.INC' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
include 'debug.inc'
if ~ RENDER eq PIX
TOP=TOP+4
@ -77,7 +76,7 @@ START:
end if
start2:
cmp byte[fname_buf],0
je load_file;top_red
je load_file;top_red
jmp noactivate
prep_load:
; mcall 18,3,dword[prcinfo+30]
@ -103,9 +102,9 @@ START:
mov [HClick],-100
load_help:
test eax,eax
jz .sizok
jz .sizok
cmp eax,5
je .sizok
je .sizok
.nosizok:
mov dword[fileinfo.name],N_A
.sizok:
@ -124,38 +123,38 @@ START:
mov [fname_size],edi
top_red:
mov [top],TOP
red: ; ¯¥à¥à¨á®¢ âì ®ª­®
red: ; ¯¥à¥à¨á®¢ âì ®ª­®
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª­ 
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª­ 
;---------------------------------------------------------------------
;--- –ˆŠ‹ Ž<><C5BD><EFBFBD>ŽŠˆ Ž<E28098>ˆ‰ ----------------------------------------
;---------------------------------------------------------------------
still:
mcall 10 ; äã­ªæ¨ï 10 - ¦¤ âì ᮡëâ¨ï
mcall 10 ; äã­ªæ¨ï 10 - ¦¤ âì ᮡëâ¨ï
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª­® ?
je red ; ¥á«¨ ¤  - ­  ¬¥âªã red
cmp eax,3 ; ­ ¦ â  ª­®¯ª  ?
je button ; ¥á«¨ ¤  - ­  button
cmp eax,2 ; ­ ¦ â  ª« ¢¨è  ?
je key ; ¥á«¨ ¤  - ­  key
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª­® ?
je red ; ¥á«¨ ¤  - ­  ¬¥âªã red
cmp eax,3 ; ­ ¦ â  ª­®¯ª  ?
je button ; ¥á«¨ ¤  - ­  button
cmp eax,2 ; ­ ¦ â  ª« ¢¨è  ?
je key ; ¥á«¨ ¤  - ­  key
jmp still ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
jmp still ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
;---------------------------------------------------------------------
key: ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
mcall 2 ; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®«  (¢ ah)
cmp ah,104 ; HELP
key: ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
mcall 2 ; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®«  (¢ ah)
cmp ah,104 ; HELP
jne .nohelp
.help:
xor [mode],RTF_HELP
test [mode],RTF_HELP
jz load_file
jz load_file
mov ecx,help_end-help_file
mov [block_end],ecx
add [block_end],I_END
@ -176,34 +175,34 @@ still:
; je still
; jmp prep_load
.nohelp2:
cmp ah,114 ; R - redraw
je red
cmp ah,99 ; C - color
cmp ah,114 ; R - redraw
je red
cmp ah,99 ; C - color
jne .nocolor
.color:
xor [mode],RTF_COLORLESS
jmp red
.nocolor:
cmp ah,97 ; A - alignment
cmp ah,97 ; A - alignment
jne .noalign
.alignment:
xor [mode],RTF_ALIGNLESS
jmp red
.noalign:
cmp ah,44 ; < - pitch dec
cmp ah,44 ; < - pitch dec
jne .nopd
.decp:
dec [pitch]
jmp red
.nopd:
cmp ah,46 ; < - pitch inc
cmp ah,46 ; < - pitch inc
jne .nopi
.incp:
inc [pitch]
jmp red
.nopi:
cmp ah,180 ; Home
je top_red
cmp ah,180 ; Home
je top_red
mov ebx,dword[prcinfo+46]
sub ebx,TOP+15
cmp ah,183 ;PgDn
@ -221,20 +220,20 @@ still:
jne .nopgup
add [top],bx
cmp [top],TOP
jl red
jl red
mov [top],TOP
cmp cx,[top]
je still
je still
jmp red
.nopgup:
cmp ah,178 ;arrUp
jne .noarup
add [top],CHARH
cmp [top],TOP
jl red
jl red
mov [top],TOP
cmp cx,[top]
je still
je still
jmp red
.noarup:
if RENDER eq FREE
@ -255,10 +254,10 @@ still:
jmp .zoom
.nominus:
end if
cmp ah,108 ; L - load
cmp ah,108 ; L - load
jne stilld
.file_open:
or [mode],RTF_OPENING
or [mode],RTF_OPENING
opendialog draw_window, prep_load, st_1, fname_buf
st_1:
and [mode],not RTF_OPENING
@ -269,37 +268,37 @@ still:
;---------------------------------------------------------------------
button:
mcall 17 ; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
mcall 17 ; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
cmp ah,2
je key.help
je key.help
cmp ah,3
je key.color
je key.color
cmp ah,4
je key.alignment
je key.alignment
cmp ah,5
je key.file_open
je key.file_open
cmp ah,6
je key.incp
je key.incp
cmp ah,7
je key.decp
je key.decp
if RENDER eq FREE
cmp ah,8
je key.zminus
je key.zminus
cmp ah,9
je key.zplus
je key.zplus
end if
cmp ah, 1 ; ¥á«¨ <20>… ­ ¦ â  ª­®¯ª  á ­®¬¥à®¬ 1,
jne .noexit ; ¢¥à­ãâìáï
cmp ah, 1 ; ¥á«¨ <20>… ­ ¦ â  ª­®¯ª  á ­®¬¥à®¬ 1,
jne .noexit ; ¢¥à­ãâìáï
.exit:
mcall -1 ; ¨­ ç¥ ª®­¥æ ¯à®£à ¬¬ë
mcall -1 ; ¨­ ç¥ ª®­¥æ ¯à®£à ¬¬ë
.noexit:
cmp ah,20
jne still
mcall 37,1
and eax,0xffff
cmp eax,[HClick]
je still
je still
mov [HClick],eax
sub eax,25
mul [HDoc]
@ -317,13 +316,14 @@ still:
draw_window:
mcall 12, 1 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
; 1 - ­ ç¨­ ¥¬ à¨á®¢ âì
mcall 12, 1 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
; 1 - ­ ç¨­ ¥¬ à¨á®¢ âì
mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x805080D0, 0x005080D0
mcall 9,procinfo,-1
mov eax,[procinfo.x_size]
cmp eax,1
ja .temp12345
ja .temp12345
ret
.temp12345:
@ -344,10 +344,10 @@ draw_window:
and [mode],not RTF_TOEOF
mov ebx,[edi+42]
cmp ebx,[wSave]
je .nochg
je .nochg
.chg:
mov [wSave],ebx
or [mode],RTF_TOEOF
or [mode],RTF_TOEOF
and [HDoc],0
and [line_count],0
mov [HClick],-100
@ -359,29 +359,29 @@ draw_window:
mov esi,0xb810e7
mov edx,2
BTN_SPACE equ 14 shl 16
mcall 8 ;2
mcall 8 ;2
sub ebx,BTN_SPACE
inc edx
mcall 8,,,,0x459a ;3
mcall 8,,,,0x459a ;3
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0x107a30 ;4
mcall ,,,,0x107a30 ;4
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0xcc0000 ;5
mcall ,,,,0xcc0000 ;5
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0x575f8c ;6
mcall ,,,,0x575f8c ;6
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0x575f8c ;7
mcall ,,,,0x575f8c ;7
if RENDER eq FREE
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0x6a73d0 ;8
mcall ,,,,0x6a73d0 ;8
sub ebx,BTN_SPACE
inc edx
mcall ,,,,0xd048c8 ;9
mcall ,,,,0xd048c8 ;9
end if
shr ecx,16
mov bx,cx
@ -476,9 +476,9 @@ end if
loop .l0
end if
.ex:
mcall 12, 2 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
; 2, § ª®­ç¨«¨ à¨á®¢ âì
ret ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
mcall 12, 2 ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
; 2, § ª®­ç¨«¨ à¨á®¢ âì
ret ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
if GUTTER eq 1
arrow db 0x19
@ -547,6 +547,8 @@ end if
Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0
end if
I_END0:
fname_buf:
rb 1024+16
if BENCH eq 1
bench dd ?
end if
@ -594,16 +596,15 @@ save_stack:
rb RTFSTACKSIZE
save_limit:
rb BGIFONTSIZE
fname_buf rd 16
listptr dd ?
szKeyword rb 31
szParameter rb 21
block_end dd ?
I_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
I_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
rb RTFSIZE
esp1:
rb ESPSIZE
sys_mem:
rb ESPSIZE
esp_end:
esp_end: