/programs/other/calc/trunk/calc.asm |
---|
0,0 → 1,803 |
;; Calculator for MenuetOS |
;; (c)Ville Turjanmaa |
;; Compile with FASM for Menuet |
;; |
;; «ìªã«ïâ®à 1.1 alpha |
;; (c)Pavel Rymovski aka Heavyiron |
;;What's new:1)changed design |
;; 2)new procedure of draw window (10 decimal digits, 23 binary, "+" not displayed now) |
;; 3)window with skin |
;; 4)I had used macroses |
;; Calc 1.2 alpha |
;; 1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2 |
;; Calc 1.3 |
;; 1)optimised program |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd 0x1000 ; memory for app |
dd 0x1000 ; esp |
dd 0x0 , 0x0 ; I_Param , I_Icon |
include 'macros.inc' |
START: |
red: |
call draw_window |
still: |
push 10 |
pop eax |
int 40h |
dec eax |
jz red |
dec eax |
jz key |
button: |
mcall 17 ; ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨ |
shr eax,8 |
jmp testbut |
key: |
mcall 2 ; ¯®«ãç¨âì ASCII-ª®¤ ¦ ⮩ ª« ¢¨è¨ |
shr eax,8 |
mov edi,asci ; ¯¥à¥¢®¤ ASCII ¢ ¨¤¥â¨ä¨ª â®à ª®¯ª¨ |
mov ecx,18 |
cld |
repne scasb |
jne still |
sub edi,asci |
dec edi |
mov esi,butid |
add esi,edi |
lodsb |
testbut: |
cmp eax,1 ; ª®¯ª 1 - § ªàë⨥ ¯à®£à ¬¬ë |
jne noclose |
mcall -1 |
noclose: |
cmp eax,2 |
jne no_reset |
call clear_all |
jmp still |
no_reset: |
finit |
mov ebx,muuta1 ; ¥à¥¢®¤ ¢ ä®à¬ â FPU |
mov esi,18 |
call atof |
fstp [trans1] |
mov ebx,muuta2 |
mov esi,18 |
call atof |
fst [trans2] |
cmp eax,33 |
jne no_sign |
cmp [dsign],byte '-' |
jne no_m |
mov [dsign],byte '+' |
call print_display |
jmp still |
no_m: |
mov [dsign],byte '-' |
call print_display |
jmp still |
no_sign: |
cmp eax,3 |
jne no_display_change |
inc [display_type] |
cmp [display_type],2 |
jbe display_continue |
mov [display_type],0 |
display_continue: |
mov eax,[display_type] |
mov eax,[multipl+eax*4] |
mov [entry_multiplier],eax |
call print_display |
jmp still |
multipl: dd 10,16,2 |
no_display_change: |
cmp eax,6 |
jb no_a_f |
cmp eax,11 |
jg no_a_f |
add eax,4 |
call number_entry |
jmp still |
no_a_f: |
cmp eax,12 |
jb no_13 |
cmp eax,14 |
jg no_13 |
sub eax,11 |
call number_entry |
jmp still |
no_13: |
cmp eax,19 |
jb no_46 |
cmp eax,21 |
jg no_46 |
sub eax,15 |
call number_entry |
jmp still |
no_46: |
cmp eax,26 |
jb no_79 |
cmp eax,28 |
jg no_79 |
sub eax,19 |
call number_entry |
jmp still |
no_79: |
cmp eax,34 |
jne no_0 |
mov eax,0 |
call number_entry |
jmp still |
no_0: |
cmp eax,35 |
jne no_id |
inc [id] |
and [id],1 |
mov [new_dec],100000 |
jmp still |
no_id: |
cmp eax,17 |
jne no_sin |
fld [trans1] |
fsin |
jmp show_result |
no_sin: |
cmp eax,18 |
jne no_asin |
fld [trans1] |
fld st0 |
fmul st,st1 |
fld1 |
fsubrp st1,st0 |
fsqrt |
fpatan |
jmp show_result |
no_asin: |
cmp eax,16 |
jne no_int |
fld [trans1] |
frndint |
jmp show_result |
no_int: |
cmp eax,23 |
jne no_1x |
fld [trans1] |
fld1 |
fdiv st,st1 |
jmp show_result |
no_1x: |
cmp eax,24 |
jne no_cos |
fld [trans1] |
fcos |
jmp show_result |
no_cos: |
cmp eax,25 |
jne no_acos |
fld [trans1] |
fld1 |
fsub st,st1 |
fsqrt |
fld1 |
fadd st,st2 |
fsqrt |
fpatan |
fadd st,st0 |
jmp show_result |
no_acos: |
cmp eax,30 |
jne no_x2 |
fld [trans1] |
fmul st,st0 |
jmp show_result |
no_x2: |
cmp eax,31 |
jne no_tan |
fld [trans1] |
fptan |
fstp st2 |
jmp show_result |
no_tan: |
cmp eax,32 |
jne no_atan |
fld [trans1] |
fld1 |
fpatan |
jmp show_result |
no_atan: |
cmp eax,38 |
jne no_pi |
fldpi |
jmp show_result |
no_pi: |
cmp eax,37 |
jne no_sqrt |
fld [trans1] |
fsqrt |
jmp show_result |
no_sqrt: |
cmp eax,15 |
jne no_add |
call calculate |
call new_entry |
mov [calc],'+' |
jmp still |
no_add: |
cmp eax,22 |
jne no_sub |
call calculate |
call new_entry |
mov [calc],'-' |
jmp still |
no_sub: |
cmp eax,29 |
jne no_div |
call calculate |
call new_entry |
mov [calc],'/' |
jmp still |
no_div: |
cmp eax,36 |
jne no_mul |
call calculate |
mov [calc],'*' |
call new_entry |
jmp still |
no_mul: |
cmp eax,39 |
jne no_calc |
call calculate |
jmp still |
no_calc: |
jmp still |
show_result: |
call ftoa |
call print_display |
jmp still |
error: |
jmp still |
calculate: |
pusha |
cmp [calc],' ' |
je no_calculation |
cmp [calc],'/' |
jne no_cdiv |
fdiv [trans1] |
no_cdiv: |
cmp [calc],'*' |
jne no_cmul |
fmul [trans1] |
no_cmul: |
cmp [calc],'+' |
jne no_cadd |
fadd [trans1] |
no_cadd: |
cmp [calc],'-' |
jne no_cdec |
fsub [trans1] |
no_cdec: |
call ftoa |
no_calculation: |
call print_display |
popa |
ret |
number_entry: |
pusha |
cmp eax,[entry_multiplier] |
jge no_entry |
cmp [id],1 |
je decimal_entry |
mov ebx,[integer] |
test ebx,0xc0000000 |
jnz no_entry |
mov ebx,eax |
mov eax,[integer] |
mov ecx,[entry_multiplier] |
mul ecx |
add eax,ebx |
mov [integer],eax |
call print_display |
call to_muuta |
popa |
ret |
decimal_entry: |
imul eax,[new_dec] |
add [decimal],eax |
mov eax,[new_dec] |
xor edx,edx |
mov ebx,[entry_multiplier] |
div ebx |
mov [new_dec],eax |
call print_display |
call to_muuta |
popa |
ret |
no_entry: |
call print_display |
call to_muuta |
popa |
ret |
to_muuta: |
pusha |
mov al,[dsign] |
mov esi,muuta0 |
mov edi,muuta1 |
mov ecx,18 |
cld |
rep movsb |
mov [muuta1],al |
mov edi,muuta1+10 ; 楫®¥ |
mov eax,[integer] |
new_to_muuta1: |
mov ebx,10 |
xor edx,edx |
div ebx |
mov [edi],dl |
add [edi],byte 48 |
dec edi |
cmp edi,muuta1+1 |
jge new_to_muuta1 |
mov edi,muuta1+17 ; ¤à®¡®¥ |
mov eax,[decimal] |
new_to_muuta2: |
mov ebx,10 |
xor edx,edx |
div ebx |
mov [edi],dl |
add [edi],byte 48 |
dec edi |
cmp edi,muuta1+12 |
jge new_to_muuta2 |
popa |
ret |
new_entry: |
pusha |
mov esi,muuta1 |
mov edi,muuta2 |
mov ecx,18 |
cld |
rep movsb |
mov esi,muuta0 |
mov edi,muuta1 |
mov ecx,18 |
cld |
rep movsb |
mov [integer],0 |
mov [decimal],0 |
mov [id],0 |
mov [new_dec],100000 |
mov [sign],byte '+' |
popa |
ret |
ten dd 10.0,0 |
tmp dw 1,0 |
sign db 1,0 |
tmp2 dq 0x0,0 |
exp dd 0x0,0 |
new_dec dd 100000,0 |
id db 0x0,0 |
res dd 0 |
trans1 dq 0 |
trans2 dq 0 |
controlWord dw 1 |
ftoa: ; fpu st0 -> [integer],[decimal] |
pusha |
fst [tmp2] |
fstcw [controlWord] ; set truncate integer mode |
mov ax,[controlWord] |
mov [tmp], ax |
or [tmp], word 0x0c00 |
fldcw [tmp] |
ftst ; test if st0 is negative |
fstsw ax |
and ax, 0x4500 |
mov [sign], 0 |
cmp ax, 0x0100 |
jne no_neg |
mov [sign],1 |
no_neg: |
fistp [integer] |
fld [tmp2] |
fisub [integer] |
fldcw [controlWord] |
cmp byte [sign], 0 ; change fraction to positive |
je no_neg2 |
fchs |
no_neg2: |
mov [res],0 ; convert 6 decimal numbers |
mov edi,6 |
newd: |
fimul [kymppi] |
fist [decimal] |
mov ebx,[res] |
imul ebx,10 |
mov [res],ebx |
mov eax,[decimal] |
add [res],eax |
fisub [decimal] |
ftst |
fstsw ax |
dec edi |
jz real_done |
jmp newd |
real_done: |
mov eax,[res] |
mov [decimal],eax |
cmp [integer],0x80000000 |
jne no_error |
call clear_all |
mov [calc],'E' |
no_error: |
mov [dsign],byte '+' |
cmp [sign],byte 0 ; convert negative result |
je no_negative |
mov eax,[integer] |
not eax |
inc eax |
mov [integer],eax |
mov [dsign],byte '-' |
no_negative: |
call to_muuta |
popa |
ret |
atof: |
push ax |
push di |
fldz |
mov di, 0 |
cmp si, 0 |
je .error ; Jump if string has 0 length. |
mov byte [sign], 0 |
cmp byte [bx], '+' ; Take care of leading '+' or '-'. |
jne .noPlus |
inc di |
jmp .noMinus |
.noPlus: |
cmp byte [bx], '-' |
jne .noMinus |
mov byte [sign], 1 ; Number is negative. |
inc di |
.noMinus: |
cmp si, di |
je .error |
call atof_convertWholePart |
jc .error |
call atof_convertFractionalPart |
jc .error |
cmp byte [sign], 0 |
je .dontNegate |
fchs ; Negate value |
.dontNegate: |
mov bh, 0 ; Set bh to indicate the string is a valid number. |
jmp .exit |
.error: |
mov bh, 1 ; Set error code. |
fstp st0 ; Pop top of fpu stack. |
.exit: |
pop di |
pop ax |
ret |
atof_convertWholePart: |
; Convert the whole number part (the part preceding the decimal |
; point) by reading a digit at a time, multiplying the current |
; value by 10, and adding the digit. |
.mainLoop: |
mov al, [bx + di] |
cmp al, '.' |
je .exit |
cmp al, '0' ; Make sure character is a digit. |
jb .error |
cmp al, '9' |
ja .error |
; Convert single character to digit and save to memory for |
; transfer to the FPU. |
sub al, '0' |
mov ah, 0 |
mov [tmp], ax |
; Multiply current value by 10 and add in digit. |
fmul dword [ten] |
fiadd word [tmp] |
inc di |
cmp si, di ; Jump if end of string has been reached. |
je .exit |
jmp .mainLoop |
.error: |
stc ; Set error (carry) flag. |
ret |
.exit: |
clc ; Clear error (carry) flag. |
ret |
atof_convertFractionalPart: |
fld1 ; Load 1 to TOS. This will be the value of the decimal place. |
.mainLoop: |
cmp si, di ; Jump if end of string has been reached. |
je .exit |
inc di ; Move past the decimal point. |
cmp si, di ; Jump if end of string has been reached. |
je .exit |
mov al, [bx + di] |
cmp al, '0' ; Make sure character is a digit. |
jb .error |
cmp al, '9' |
ja .error |
fdiv dword [ten] ; Next decimal place |
sub al, '0' |
mov ah, 0 |
mov [tmp], ax |
; Load digit, multiply by value for appropriate decimal place, |
; and add to current total. |
fild word [tmp] |
fmul st0, st1 |
faddp st2, st0 |
jmp .mainLoop |
.error: |
stc ; Set error (carry) flag. |
fstp st0 ; Pop top of fpu stack. |
ret |
.exit: |
clc ; Clear error (carry) flag. |
fstp st0 ; Pop top of fpu stack. |
ret |
; ********************************************* |
; ******* ******** |
; ********************************************* |
draw_window: |
mcall 12,1 |
mcall 0,200*65536+255,200*65536+180,0x03ddeeff ; äãªæ¨ï 0: ®¯à¥¤¥«¨âì ¨ ®âà¨á®¢ âì ®ª® |
mcall 4,8*65536+8,0x10000000,labelt,label_len ; |
mov ebx,24*65536+28 |
mov ecx,70*65536+18 |
mov edx,6 |
mov esi,0x0066ee |
mov edi,7 |
newbutton: |
dec edi |
jnz no_new_row |
mov edi,7 |
mov ebx,24*65536+25+3 |
add ecx,20*65536 |
no_new_row: |
mcall 8 |
add ebx,30*65536 |
inc edx |
cmp edx,39 |
jbe newbutton |
mcall 8,225*65536+8,28*65536+8,3 ; 'dec-bin-hex' |
mcall 8,204*65536+28,70*65536+18,2,0xcc0000 ; 'C' |
mov ebx,25*65536+75 ; à®à¨á®¢ª ¯®¤¯¨á¥© ª®¯®ª |
mov ecx,0xffffff |
mov edx,text |
mov esi,34 |
newline: |
mcall 4 |
add ebx,20 |
add edx,34 |
cmp [edx],byte 'x' |
jne newline |
call print_display |
mcall 12,2 |
ret |
print_display: |
pusha |
mcall 13,100*65536+120,25*65536+13,0x00ddeeff |
mcall 13,23*65536+210,40*65536+13,0xffffff |
mcall 4,140*65536+28,0,calc,1 |
mov eax,4 |
mov ebx,203*65536+29 |
mov ecx,0 |
mov edx,[display_type] |
shl edx,2 |
add edx,display_type_text |
mov esi,3 |
int 0x40 |
cmp [dsign],byte '+' |
je positive |
mcall 4,28*65536+43,0x0,dsign,1 |
positive: |
cmp [display_type],0 ; ¤¥áïâ¨ç ï á¨á⥬ áç¨á«¥¨ï |
jne no_display_decimal |
cmp [decimal],0 |
je whole |
mcall 47,10*65536,[integer],125*65536+43,0x0 ; ®â®¡à ¦ âì 10 æ¨äà |
mcall 4,185*65536+43,0x0,dot,1 |
mcall 47,6*65536,[decimal],192*65536+43,0x0 ; ®â®¡à ¦ âì 6 æ¨äà ¯®á«¥ § ¯ï⮩ |
popa |
ret |
whole: |
cmp [integer],0 |
je null |
mcall 47,10*65536,[integer],165*65536+43,0x0 |
mcall 4,225*65536+43,0x0,dot,1 |
popa |
ret |
no_display_decimal: |
cmp [integer],0 |
je null |
cmp [display_type],1 |
jne no_display_hexadecimal |
mcall 47,1*256+8*65536,[integer],178*65536+43,0x0 ; ®â®¡à ¦ âì 8 è¥áâ ¤æ â¨à¨çëå æ¨äà |
popa |
ret |
no_display_hexadecimal: |
cmp [integer],0 |
je null |
cmp [display_type],2 |
jne null |
mcall 47,2*256+32*65536,[integer],37*65536+43,0x0 ; ®â®¡à ¦ âì 32 ¤¢®¨çë¥ æ¨äàë |
popa |
ret |
null: |
mcall 47,1*65536,0,219*65536+43,0x0 |
cmp [display_type],0 |
jne end_pr |
mcall 4,225*65536+43,0x0,dot,1 |
end_pr: |
popa |
ret |
clear_all: |
pusha |
mov [calc],' ' |
mov [integer],0 |
mov [decimal],0 |
mov [id],0 |
mov [dsign],byte '+' |
mov esi,muuta0 |
mov edi,muuta1 |
mov ecx,18 |
cld |
rep movsb |
mov esi,muuta0 |
mov edi,muuta2 |
mov ecx,18 |
cld |
rep movsb |
call print_display |
popa |
ret |
;¡« áâì ¤ ëå |
display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary |
entry_multiplier dd 10 |
display_start_y dd 0x0 |
display_type_text db 'dec hex bin' |
dot db '.' |
calc db ' ' |
integer dd 0 |
decimal dd 0 |
kymppi dd 10 |
dsign: |
muuta1 db '+0000000000.000000' |
muuta2 db '+0000000000.000000' |
muuta0 db '+0000000000.000000' |
text: |
db ' A B C D E F C ' |
db ' 1 2 3 + Int Sin Asin' |
db ' 4 5 6 - 1/x Cos Acos' |
db ' 7 8 9 / x^2 Tan Atan' |
db ' +/- 0 . * Sqr Pi = ' |
db 'x' |
asci: db 49,50,51,52,53,54,55,56,57,48,43,61,45,42,47,44,46,27 |
butid: db 12,13,14,19,20,21,26,27,28,34,15,39,22,36,29,35,35,1 |
labelt: |
db 'Calc 1.3' |
label_len = $ - labelt |
I_END: |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/calc/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm calc.asm calc |
@pause |
/programs/other/calc/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm calc.asm calc |
@pause |
/programs/other/calc/trunk/macros.inc |
---|
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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/rtfread/trunk/READER.RTF |
---|
0,0 → 1,30 |
{\rtf1\ansi\ansicpg1251{\colortbl;\red0\green0\blue0; |
\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128; |
\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}\pard\plain |
\qc \li0\ri0\faauto\rin0\lin0 \fs24\cgrid\langnp1049 {\b\fs28\cf11 RTF Reader for MenuetOS |
\par }{\f36\fs20 \'e2\'e5\'f0\'f1\'e8\'ff 1}{\f1\fs20 .}{\f36\fs20 032}{\b\f1\fs20\cf11 |
\par }{\f36\fs20 |
\par }\pard \qr \li0\ri0\faauto\rin0\lin0 {\f36\fs20 \'ed\'e0\'ef\'e8\'f1\'e0\'ed \'ed\'e0 \'f7\'e8\'f1\'f2\'ee\'ec \'e0\'f1\'f1\'e5\'ec\'e1\'eb\'e5\'f0\'e5 \'c8\'e2\'f3\'f8\'ea\'e8\'ed\'fb\'ec \'c0\'ed\'e4\'f0 |
\'e5\'e5\'ec}{\f1\fs20 aka Willow |
\par }\pard \ql \li0\ri0 {\f1\fs20 |
\par }\pard \ql \fi710\li0\ri0\faauto\rin0\lin0 {\f36\fs20 \'cf\'f0\'ee\'e3\'f0\'e0\'ec\'ec\'e0 \'ef\'ee\'ea\'e0 \'ee\'e1\'eb\'e0\'e4\'e0\'e5\'f2 \'ed\'e5\'e1\'ee\'eb\'fc\'f8\'e8\'ec\'e8 \'e2\'ee\'e7\'ec\'ee\'e6\'ed\'ee\'f1\'f2 |
\'ff\'ec\'e8: |
\par {\pntext\pard\plain\f3\fs20 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard \ql \fi710\li0\ri0{\*\pn \ilvl0\ls1\pnrnot0\pnf3 { \'b7}}\faauto\ls1\rin0\lin0 {\f36\fs20 \tab \'f7\'f2\'e5\'ed\'e8\'e5 |
}{\f1\fs20 RTF }{\f36\fs20 \'f4\'ee\'f0\'ec\'e0\'f2\'e0 \'e1\'e5\'e7 \'ef\'ee\'e4\'e4\'e5\'f0\'e6\'ea\'e8 \'e2\'ed\'e5\'e4\'f0\'e5\'ed\'ed\'fb\'f5 \'ee\'e1\'fa\'e5\'ea\'f2\'ee\'e2, \'f2\'e0\'e1 |
\'eb\'e8\'f6, \'f8\'f0\'e8\'f4\'f2\'ee\'e2;}{\f36\fs20 |
\par {\pntext\pard\plain\f3\fs20 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}{\f36\fs20 \tab \'e7\'e0\'f7\'e0\'f2\'ee\'f7\'ed\'fb\'e5 \'f1\'ef\'ee\'f1\'ee\'e1\'ed\'ee\'f1\'f2\'e8 \'f4\'ee\'f0\'ec\'e0\'f2\'e8\'f0\'ee\'e2\'e0\'ed\'e8\'ff \'e0\'e1\'e7\'e0 |
\'f6\'e5\'e2;}{\f36\fs20 |
\par {\pntext\pard\plain\f3\fs20 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}{\f36\fs20 \tab \'ee\'f2\'ea\'f0\'fb\'e2\'e0\'e5\'ec\'fb\'e5 \'f4\'e0\'e9\'eb\'fb \'ec\'ee\'e3\'f3\'f2 \'e8\'ec\'e5\'f2\'fc }{\f36\fs20\cf6 \'ee\'f7\'e5\'ed\'fc |
}{\f36\fs20 \'e1\'ee\'eb\'fc\'f8\'f3\'fe \'e4\'eb\'e8\'ed\'f3 (\'ed\'f3\'e6\'ed\'ee, \'ea\'f1\'f2\'e0\'f2\'e8, \'ef\'f0\'ee\'e2\'e5\'f0\'e8\'f2\'fc)!}{\f36\fs20 |
\par }\pard \ql \li0\ri0\faauto\rin0\lin0 {\f36\fs20 |
\par }\pard \qc \li0\ri0\faauto\rin0\lin0 {\f36\fs20 \'cd\'e0\'e7\'ed\'e0\'f7\'e5\'ed\'e8\'e5 \'ea\'ed\'ee\'ef\'ee\'ea "\'ef\'e0\'ed\'e5\'eb\'e8 \'e8\'ed\'f1\'f2\'f0\'f3\'ec\'e5\'ed\'f2\'ee\'e2": |
\par }\pard \ql \li0\ri0\faauto\rin0\lin0 {\b\f1\fs20\cf6 L }{\f1\fs20 - }{\f36\fs20 \'ee\'f2\'ea\'f0\'fb\'f2\'fc \'e4\'e8\'e0\'eb\'ee |
\'e3 \'e2\'fb\'e1\'ee\'f0\'e0 \'f4\'e0\'e9\'eb\'e0 (\'e1\'e5\'e7 }{\f1\fs20 SYSXTREE }{\f36\fs20 \'f0\'e0\'e1\'ee\'f2\'e0\'f2\'fc \'ed\'e5 \'e1\'f3\'e4\'e5\'f2); |
\par }{\b\f36\fs20\cf11 \'c0}{\f36\fs20 - \'e2\'ea\'eb\'fe\'f7\'e8\'f2\'fc/\'e2\'fb\'ea\'eb\'fe\'f7\'e8\'f2\'fc \'e2\'fb\'f0\'e0\'e2\'ed\'e8\'e2\'e0\'ed\'e8\'e5 \'e0\'e1\'e7\'e0\'f6\'e5\'e2; |
\par }{\b\f36\fs20\cf2 \'d1}{\f36\fs20 - \'e2\'ea\'eb\'fe\'f7\'e8\'f2\'fc/\'e2\'fb\'ea\'eb\'fe\'f7\'e8\'f2\'fc \'f6\'e2\'e5\'f2\'ed\'ee\'e9 \'f8\'f0\'e8\'f4\'f2. |
\par }{\f1\fs20 |
\par \tab }{\f36\fs20 \'ca\'ed\'ee\'ef\'ea\'e8 \'e4\'f3\'e1\'eb\'e8\'f0\'ee\'e2\'e0\'ed\'fb \'f1 \'ea\'eb\'e0\'e2\'e8\'e0\'f2\'f3\'f0\'fb (\'e8\'f1\'ef\'ee\'eb\'fc\'e7\'f3\'e9\'f2\'e5 \'ec\'e0\'eb\'e5\'ed\'fc\'ea\'e8\'e5 \'e1\'f3\'ea\'e2\'fb). |
\'d0\'e0\'e1\'ee\'f2\'e0\'fe\'f2 \'ea\'eb\'e0\'e2\'e8\'f8\'e8 \'f1\'f2\'f0\'e5\'eb\'ee\'ea, }{\b\f1\fs20 PgUp}{\f1\fs20 , }{ |
\b\f1\fs20 PgDn}{\f1\fs20 , }{\f36\fs20 \'e8 }{\b\f1\fs20 Home}{\f36\fs20 . |
\par \tab \'cf\'ee\'ea\'e0 \'e2\'f1\'e5!}{\f36\fs20 |
\par }} |
/programs/other/rtfread/trunk/ascl.inc |
---|
0,0 → 1,835 |
lang equ ru ; ru en fr ge fi |
; |
; Assembler |
; SMALL |
; CODE |
; Libary |
; |
; Ver 0.14 By Pavlushin Evgeni (RUSSIA) |
; www.waptap@mail.ru |
;Please compile aplications on FASM ver1.54 or higer!!! |
;InfoList |
;0.01 scank,putpix,puttxt |
;0.02 label,random,colors |
;0.03 window,startwd,endwd,attributes |
;0.04 close,delay,scevent ~30.04.2004 |
;0.05 small random, ~04.05.2004 |
;0.06 wtevent ~09.05.2004 |
;0.07 timeevent ~23.05.2004 |
;0.08 txtput ~14.06.2004 |
;0.09 opendialog,savedialog ~20.06.2004 |
;0.10 wordstoreg by halyavin, add at ~30.08.2004 |
; random bug deleted eax is use. |
;0.11 loadfile from me +puttxt bug del ~07.09.2004 |
;0.12 open/save dialog ~13.09.2004 |
;0.13 dialogs bugs deleted |
;0.14 drawlbut ~03.10.2004 |
; LOADFILE |
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area |
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area |
macro loadfile file_name,file_load_area,file_temp_area |
{ |
local open,fileinfo,string |
jmp open |
fileinfo: |
dd 0 |
dd 0 |
dd 1 |
dd file_load_area |
dd file_temp_area |
string: |
db file_name,0 |
open: |
mov dword [fileinfo+8],1 ; how many blocks to read (1) |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
mov eax,[file_load_area+2] |
shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
inc eax |
mov dword [fileinfo+8],eax |
mov eax,58 |
mov ebx,fileinfo |
int 0x40 |
} |
macro wordstoreg reg,hiword,loword |
{ |
if hiword eqtype 0 & loword eqtype 0 |
mov reg,hiword*65536+loword |
else if hiword eqtype 12 & loword eqtype eax |
mov reg,hiword*65536 |
add reg,loword |
else if hiword eqtype 12 & loword eqtype [123] |
mov reg,hiword*65536 |
add reg,loword |
else |
mov reg,hiword |
shl reg,16 |
add reg,loword |
end if |
} |
; DRAW BUTTON with label |
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor |
{ |
local asd,lab |
jmp asd |
lab db text ;arg label |
asd: |
wordstoreg ebx,x,xs |
wordstoreg ecx,y,ys |
mov edx,id |
mov esi,bcolor |
mov eax,8 |
int 0x40 |
mov eax,asd-lab ;calc size |
mov ebx,6 |
mul ebx |
mov esi,eax |
mov eax,xs |
sub eax,esi |
shr eax,1 |
add eax,x |
mov edx,ys |
sub edx,7 |
shr edx,1 |
add edx,y |
mov ebx,eax |
shl ebx,16 |
add ebx,edx |
mov ecx,tcolor ;arg4 color |
mov edx,lab |
mov esi,asd-lab ;calc size |
mov eax,4 |
int 0x40 |
} |
macro opendialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready, procinfo |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
mov eax,0 |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; convert eax bin to param dec |
mov eax,dword [procinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,150 ; size 150 bytes |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,58 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mov ebx,procinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [procinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
mov eax,2 |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
dd 0 ; My dec PID |
dd 0,0 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd procinfo ; 0x10000 |
;run_filepath |
db '/RD/1/SYSXTREE',0 |
procinfo: |
times 256 db 0 |
} |
macro savedialog redproc,openoff,erroff,path |
{ |
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc |
local run_fileinfo, run_filepath, param |
local getmesloop, loox, mred, mkey, mbutton, mgetmes |
local dlg_is_work, ready, procinfo |
; |
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
; |
cld |
;; mov esi,path |
mov edi,path |
mov eax,0 |
mov ecx,200 |
rep stosb |
;mov [get_loops],0 |
mov [dlg_pid_get],0 |
; Get my PID in dec format 4 bytes |
mov eax,9 |
mov ebx,procinfo |
mov ecx,-1 |
int 0x40 |
; convert eax bin to param dec |
mov eax,dword [procinfo+30] ;offset of myPID |
mov edi,param+4-1 ;offset to 4 bytes |
mov ecx,4 |
mov ebx,10 |
cld |
new_d: |
xor edx,edx |
div ebx |
add dl,'0' |
mov [edi],dl |
dec edi |
loop new_d |
; wirite 1 byte space to param |
mov [param+4],byte 32 ;Space for next parametr |
; and 1 byte type of dialog to param |
mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) |
; |
; STEP2 prepare IPC area for get messages |
; |
; prepare IPC area |
mov [path],dword 0 |
mov [path+4],dword 8 |
; define IPC memory |
mov eax,60 |
mov ebx,1 ; define IPC |
mov ecx,path ; offset of area |
mov edx,120 ; size 150 bytes |
int 0x40 |
; change wanted events list 7-bit IPC event |
mov eax,40 |
mov ebx,01000111b |
int 0x40 |
; |
; STEP 3 run SYSTEM XTREE with parameters |
; |
mov eax,58 |
mov ebx,run_fileinfo |
int 0x40 |
call redproc |
mov [get_loops],0 |
getmesloop: |
mov eax,23 |
mov ebx,50 ;0.5 sec |
int 0x40 |
cmp eax,1 |
je mred |
cmp eax,2 |
je mkey |
cmp eax,3 |
je mbutton |
cmp eax,7 |
je mgetmes |
; Get number of procces |
mov ebx,procinfo |
mov ecx,-1 |
mov eax,9 |
int 0x40 |
mov ebp,eax |
loox: |
mov eax,9 |
mov ebx,procinfo |
mov ecx,ebp |
int 0x40 |
mov eax,[DLGPID] |
cmp [procinfo+30],eax ;IF Dialog find |
je dlg_is_work ;jmp to dlg_is_work |
dec ebp |
jnz loox |
jmp erroff |
dlg_is_work: |
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
je erroff ;TESTODP2 terminated too |
cmp [dlg_pid_get],dword 1 |
je getmesloop |
inc [get_loops] |
cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
jae erroff |
jmp getmesloop |
mred: |
call redproc |
jmp getmesloop |
mkey: |
int 0x40 ; read (eax=2) |
jmp getmesloop |
mbutton: |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne getmesloop |
mov eax,-1 ; close this program |
int 0x40 |
mgetmes: |
; If dlg_pid_get then second message get jmp to still |
cmp [dlg_pid_get],dword 1 |
je ready |
; First message is number of PID SYSXTREE dialog |
; convert PID dec to PID bin |
movzx eax,byte [path+16] |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+1] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+2] |
add eax,ebx |
sub eax,48 |
imul eax,10 |
movzx ebx,byte [path+16+3] |
add eax,ebx |
sub eax,48 |
mov [DLGPID],eax |
; Claear and prepare IPC area for next message |
mov [path],dword 0 |
mov [path+4],dword 8 |
mov [path+8],dword 0 |
mov [path+12],dword 0 |
mov [path+16],dword 0 |
; Set dlg_pid_get for get next message |
mov [dlg_pid_get],dword 1 |
call redproc ;show DLG_PID |
jmp getmesloop |
ready: |
; |
; The second message get |
; Second message is 100 bytes path to SAVE/OPEN file |
; shl path string on 16 bytes |
; |
cld |
mov esi,path+16 |
mov edi,path |
mov ecx,200 |
rep movsb |
mov [edi],byte 0 |
jmp openoff |
; DATA AREA |
get_loops dd 0 |
dlg_pid_get dd 0 |
DLGPID dd 0 |
param: |
rb 4 ; My dec PID |
rb 6 ; Type of dialog |
run_fileinfo: |
dd 16 |
dd 0 |
dd param |
dd 0 |
dd procinfo |
run_filepath: |
db '/RD/1/SYSXTREE',0 |
procinfo: |
times 256 db 0 |
} |
; RANDOM - generate random count (small) |
; (SYNTAX) RANDOM MaxCount,OutArgument |
; (SAMPLE) RANDOM 10000,eax |
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations |
randomuse = 0 |
macro random arg1,arg2 |
{ |
local rxproc |
randomuse = randomuse + 1 |
jmp rxproc |
if defined randomuse & randomuse = 1 |
randomproc: |
jmp rnj |
rsx1 dw 0x4321 |
rsx2 dw 0x1234 |
rnj: |
; mov eax,arg1 |
push bx |
push cx |
push dx |
push si |
push di |
mov cx,ax |
mov ax,word ptr rsx1 |
mov bx,word ptr rsx2 |
mov si,ax |
mov di,bx |
mov dl,ah |
mov ah,al |
mov al,bh |
mov bh,bl |
xor bl,bl |
rcr dl,1 |
rcr ax,1 |
rcr bx,1 |
add bx,di |
adc ax,si |
add bx,0x62e9 |
adc ax,0x3619 |
mov word ptr rsx1,bx |
mov word ptr rsx2,ax |
xor dx,dx |
cmp ax,0 |
je nodiv |
cmp cx,0 |
je nodiv |
div cx |
nodiv: |
mov ax,dx |
pop di |
pop si |
pop dx |
pop cx |
pop bx |
and eax,0000ffffh |
; mov arg2,0 |
; mov arg2,eax |
ret |
end if |
rxproc: |
mov eax,arg1 |
call randomproc |
mov arg2,eax |
} |
macro scank |
{ |
mov eax,10 |
int 0x40 |
} |
macro putpix x,y,color |
{ |
mov ebx,x |
mov ecx,y |
mov edx,color |
mov eax,1 |
int 0x40 |
} |
macro puttxt x,y,offs,size,color |
{ |
; mov ebx,x |
; shl ebx,16 |
; add ebx,y |
wordstoreg ebx,x,y |
mov ecx,color |
mov edx,offs |
mov esi,size |
mov eax,4 |
int 0x40 |
} |
macro outcount data, x, y, color, numtype |
{ |
mov ecx,data |
mov ebx,numtype |
mov bl,0 |
; mov edx,x*65536+y |
wordstoreg edx,x,y |
mov esi,color |
mov eax,47 |
int 0x40 |
} |
; SCEVENT - Scan event |
macro scevent red,key,but |
{ |
mov eax,11 |
int 0x40 |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; WTEVENT - Wait event |
macro wtevent red,key,but |
{ |
mov eax,10 |
int 0x40 |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; TIMEEVENT - Wite for event with timeout |
macro timeevent xfps,noevent,red,key,but |
{ |
mov eax,23 |
mov ebx,xfps |
int 0x40 |
cmp eax,0 |
je noevent |
dec eax |
jz red |
dec eax |
jz key |
dec eax |
jz but |
} |
; CLOSE - Close program |
macro close |
{ |
mov eax,-1 |
int 0x40 |
} |
; DELAY - Create delay 1/100 sec |
; (SYNTAX) Delay time |
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec |
macro delay arg1 |
{ |
mov eax,5 |
mov ebx,arg1 |
int 0x40 |
} |
; WINDOW - Draw window |
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color |
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned |
macro window arg1,arg2,arg3,arg4,arg5 |
{ |
; mov ebx,arg1*65536+arg3 |
; mov ecx,arg2*65536+arg4 |
wordstoreg ebx,arg1,arg3 |
wordstoreg ecx,arg2,arg4 |
mov edx,arg5 |
mov eax,0 |
int 0x40 |
} |
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 |
{ |
mov ebx,arg1*65536+arg3 |
mov ecx,arg2*65536+arg4 |
mov edx,arg5 |
mov esi,arg6 |
mov edi,arg7 |
mov eax,0 |
int 0x40 |
} |
; STARTWD - Start of window draw |
macro startwd |
{ |
mov eax,12 |
mov ebx,1 |
int 0x40 |
} |
; ENDWD - End window draw |
macro endwd |
{ |
mov eax,12 |
mov ebx,2 |
int 0x40 |
} |
; LABEL - Put text to frame |
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color |
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big |
macro label arg1,arg2,arg3,arg4 |
{ |
local asd,lab |
jmp asd |
lab db arg3 ;arg label |
asd: |
; mov ebx,arg1 ;arg1=y arg2=x |
; shl ebx,16 |
; add ebx,arg2 |
wordstoreg ebx,arg1,arg2 |
mov ecx,arg4 ;arg4 color |
mov edx,lab |
mov esi,asd-lab ;calc size |
mov eax,4 |
int 0x40 |
} |
;Key's |
key_Up equ 178 |
key_Down equ 177 |
key_Right equ 179 |
key_Left equ 176 |
key_Esc equ 27 |
key_Space equ 32 |
key_Enter equ 13 |
key_Bspace equ 8 |
key_F1 equ 50 |
key_F2 equ 51 |
key_F3 equ 52 |
key_F4 equ 53 |
key_F5 equ 54 |
key_F6 equ 55 |
key_F7 equ 56 |
key_F8 equ 57 |
key_F9 equ 48 |
key_F10 equ 49 |
key_F11 equ 68 |
key_F12 equ 255 |
key_Home equ 180 |
key_End equ 181 |
key_PgUp equ 184 |
key_PgDown equ 183 |
;Attributes |
;Window Attributes |
window_Skinned equ 0x03000000 |
window_Type2 equ 0x02000000 |
window_Type1 equ 0x00000000 |
window_Reserve equ 0x01000000 |
;Font Attributes |
font_Big equ 0x10000000 |
;Colors |
cl_White equ 0x00ffffff |
cl_Black equ 0x00000000 |
cl_Grey equ 0x00888888 |
cl_Red equ 0x00ff0000 |
cl_Lime equ 0x0000ff00 |
cl_Green equ 0x0000af00 |
cl_Blue equ 0x000000ff |
cl_Purple equ 0x008080ff |
cl_Violet equ 0x008040ff |
cl_Cyan equ 0x0040e0ff |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/rtfread/trunk/bgifont.inc |
---|
0,0 → 1,692 |
; BGIFONT.INC v1.0 beta |
; |
; Written in pure assembler by Ivushkin Andrey aka Willow |
; |
; Created: December 16, 2004 |
; |
; Last changed: February 2, 2005 |
; |
; Compile with FASM |
; BGI constants |
BGI_NODRAW equ 0x10000 |
BGI_ITALIC equ 0x20000 |
BGI_BOLD equ 0x40000 |
BGI_HALEFT equ 0x0 |
BGI_HARIGHT equ 0x1000 |
BGI_HACENTER equ 0x2000 |
BGI_VABOTTOM equ 0x0 |
BGI_VATOP equ 0x4000 |
BGI_VACENTER equ 0x8000 |
BGI_FREE equ 0x80000000 |
BGI_HAMASK equ 0x3000 |
BGI_VAMASK equ 0xc000 |
; Freetext structure |
struc BGIfree FontName,XY,Angle,ScaleX,ScaleY,StrPtr,StrLen,Color,Align |
{ |
dd FontName ;0 |
dd XY ;4 |
dd Angle ;8 |
dd ScaleX ;12 |
dd ScaleY ;16 |
dd StrPtr ;20 |
dd StrLen ;24 |
dd Color ;28 |
dd Align ;32 |
} |
; font options structure |
struc BGIrec FontName,CharsCount,FirstChar,UpperMargin,LowerMargin,\ |
Widths,FirstData,EOF,font_data |
{ |
.FontName dd ? ; 0 |
.CharsCount db ? ; 4 |
.FirstChar db ? ; 5 |
.UpperMargin db ? ; 6 |
.LowerMargin db ? ; 7 |
.Widths dd ? ; 8 |
.FirstData dd ? ; 12 |
.EOF dd ? ; 16 |
.font_data dd ? ; 20 follows (Offsets) |
} |
macro BGIfont_GetID |
{ |
call _BGIfont_GetID |
} |
macro BGIfont_Prepare |
{ |
call _BGIfont_Prepare |
} |
macro BGIfont_Freetext |
{ |
call _BGIfont_Freetext |
} |
macro BGIfont_Outtext |
{ |
call _BGIfont_Outtext |
} |
macro _FI name,_size |
{ |
db name |
if BGI_LEVEL eq KERNEL |
dw _size |
end if |
} |
BGIfont_names: |
_FI 'LCOM',11485 ;7 |
_FI 'EURO',8117 ;5 |
_FI 'GOTH',13816 ;6 |
_FI 'LITT',3596 ;8 |
_FI 'TRIP',11932 ;14 |
_FI 'SCRI',8490 ;11 |
_FI 'SMAL',4162 ;13 |
_FI 'TSCR',12134 ;15 |
_FI 'SANS',8453 ;10 |
_FI 'SIMP',9522 ;12 |
BGIfont_names_end: |
macro BGIfont_Init |
{ |
; in: ecx - number of fonts to load; |
; esi-> _FI structure |
; edi-> where to load |
push edi |
if BGI_LEVEL eq KERNEL |
mov edi,0x40000 |
end if |
.nfont: |
mov edx,[esi] |
if BGI_LEVEL eq KERNEL |
movzx ebx,word[esi+4] |
mov [BGIfont_Prepare.okflag],'N' |
end if |
call _BGIfont_Prepare |
if ~ BGI_LEVEL eq KERNEL |
add esi,4 |
else |
push esi |
test eax,eax |
jz .fail |
mov [BGIfont_Prepare.okflag],'*' |
.fail: |
mov esi,BGIfont_Prepare.font |
call boot_log |
pop esi |
add esi,6 |
end if |
loop .nfont |
dph2 _BGI_BOLD,300,550 |
; movzx edi,byte[0x40000] |
pop edi |
} |
BGIfont_get2head: |
shr ecx,28 ; font # |
sub ecx,4 |
jb .exit2 ; invalid # |
mov edi,[BGIfont_Ptr] |
inc edi |
cmp cl,[edi-1] |
jae .exit2 ; # too large |
jecxz .ex |
.fnext: |
mov edi,[edi+16] |
loop .fnext |
jmp .ex |
.exit2: |
xor edi,edi |
.ex: |
ret |
BGIfont_GetName: |
; in: ecx-fontID; |
; out: edx-font name. |
call BGIfont_get2head |
xor edx,edx |
test edi,edi |
jz .ex |
mov edx,[edi] |
.ex: |
ret |
macro dps2 _str |
{ |
if ~ BGI_LEVEL eq KERNEL |
if LOAD_MSG eq 1 |
dps _str |
end if |
else |
pusha |
mov esi,BGIfont_Prepare.okflag |
mov byte[esi], _str |
call boot_log |
popa |
end if |
} |
macro dph2 num,x,y |
{ |
if BGI_LEVEL eq KERNEL |
pusha |
mov eax,0x00080100 |
mov ebx,num |
mov ecx,x shl 16+y |
mov edx,0xFF0000 |
call display_number |
popa |
end if |
} |
_BGIfont_GetID: |
; in: edx-font name; |
; out: eax-fontID, edi->BGIrec |
push ecx edi |
mov edi,[BGIfont_Ptr] |
movzx ecx,byte[edi] ; ecx-font count |
mov eax,ecx |
inc edi ; edi->FontName |
jecxz .ex |
.fnext: |
cmp edx,[edi] |
jne .floop |
sub eax,ecx |
add eax,4 |
shl eax,28 |
jmp .ex |
.floop: |
mov edi,[edi+16] |
loop .fnext |
.num0: |
xor eax,eax |
.ex: |
pop edi ecx |
ret |
_BGIfont_Prepare: |
; in: edx-font name, edi->pointer to load fonts (fonts_count) |
; out: eax-ID of new font loaded; eax=0 error |
cmp [BGIfont_Ptr],0 |
jne .already |
mov [BGIfont_Ptr],edi |
.already: |
pusha |
mov edi,[BGIfont_Ptr] |
movzx ecx,byte[edi] ; ecx-font count |
mov eax,ecx |
inc edi ; edi->FontName |
jecxz .fload |
.fnext: |
cmp edx,[edi] |
jne .loop |
sub eax,ecx |
inc eax |
jmp .cr_id |
.loop: |
mov edi,[edi+16] |
loop .fnext |
.fload: |
mov dword[.font],edx ; filename |
mov esi,edi ; esi->FontName |
mov [.dest],edi ; ptr to load font |
if ~ BGI_LEVEL eq KERNEL |
mov [.fsize],1 |
mov eax,58 |
mov ebx,.fontinfo |
int 0x40 |
test eax,eax |
jnz .fail |
dps2 '1' |
shr ebx,9 |
inc ebx |
mov [.fsize],ebx |
mov ebx,.fontinfo |
mov eax,58 |
int 0x40 ; ebx - file size |
else |
push edi esi edx |
mov eax,.font |
xor ebx,ebx |
mov esi,12 |
mov ecx,ebx |
mov edx,edi |
call fileread |
pop edx esi edi |
mov ebp,edi |
add ebp,ebx |
cmp ebp,0x50000 |
ja .fail |
end if |
cmp dword[edi],0x08084b50 ; 'PK',8,8 |
jne .fail |
dps2 '2' |
inc edi |
mov eax,26 ; #EOF |
mov ecx,253 |
cld |
repne scasb ; skip Copyright |
test ecx,ecx |
jz .fail |
dps2 '3' |
cmp edx,[edi+2] ; FontName |
jne .fail |
dps2 '4' |
movzx ecx,word[edi] ; HeaderSize |
sub ebx,ecx ; Filesize-Headersize |
movzx eax,word[edi+6] ; FontSize |
cmp eax,ebx |
jb .fail ; file truncated |
add ecx,[.dest] |
dps2 '5' |
cmp byte[ecx],'+' ; ParPrefix |
jne .fail |
; font is valid, let's fill parameter table |
dps2 '>' |
mov [esi],edx ; FontName |
mov edx,eax |
add eax,ecx |
mov [esi+16],eax ; Font EOF |
movzx eax,word[ecx+5] |
add eax,ecx |
mov [esi+12],eax |
lea edi,[esi+4] ; edi->CharsCount |
lea esi,[ecx+1] ; esi->ParPrefix+1 |
xor eax,eax |
lodsw |
stosb ; CharsCount |
inc esi |
movsb ; FirstChar |
add esi,3 |
lodsw |
stosb ; UpperMargin |
movsb ; LowerMargin |
add esi,5 ; esi->offsets |
mov eax,[esi] |
push edi ; edi->Widths |
; prepare moving data |
add edi,12 ; edi->offsets |
lea ecx,[edx-16] |
rep movsb |
pop edi ; edi->Widths |
mov [edi+8],esi ; EOF |
; mov eax,[edi] |
movzx ecx,byte[edi-4] ; CharsCount |
lea eax,[edi+12+ecx*2] ; eax->widths |
stosd ; edi->FirstData |
add eax,ecx |
stosd ; edi->EOF |
mov eax,[esp] ; eax->fonts_count |
inc byte[eax] ; increase font counter |
movzx eax,byte[eax] |
.cr_id: |
add eax,0x3 ; create unique ID |
shl eax,28 ; to easy use in color(ecx) |
jmp .exit |
.fail: |
xor eax,eax |
.exit: |
mov [esp+28],eax |
popa |
ret |
if ~ BGI_LEVEL eq KERNEL |
.fontinfo: |
dd 0 |
dd 0 |
.fsize dd 0 |
.dest dd 0 |
dd 0x10000 |
db BGIFONT_PATH |
.font db 'FONT.CHR',0 |
else |
.dest dd 0 |
.font db 'FONT CHR' |
.okflag db ' ',0 |
end if |
BGIfont_Coo: |
; y->word[txt.y1], x->word[txt.x1] |
fild [txt.y1] ;y |
fmul st0,st0; y*y |
fild [txt.x1] ;x |
fmul st0,st0; x*x |
faddp ; x*x+y*y |
fsqrt ; sqrt, angle |
fild [txt.y1];y |
fabs |
fild [txt.x1] ; x |
fabs |
fpatan ; arctg(y/x) |
.skip: |
cmp [txt.x1],0 |
jge .xplus |
fchs |
fadd st0,st3 |
.xplus: |
cmp [txt.y1],0 |
jge .yplus |
fchs |
.yplus: |
fadd st0,st2 |
fsincos |
fmul st0,st2 |
fiadd [txt.x0] |
fistp [txt.x1] ; x=r*cos a |
fmulp ; y=r*sin a,angle |
fiadd [txt.y0] |
fistp [txt.y1] |
ret |
_BGIfont_Freetext: |
; in: ebx-BGIfree structure |
; out: eax-new drawing coords |
mov edx,[ebx] |
call _BGIfont_GetID |
test eax,eax |
jnz .fexists |
ret |
.fexists: |
pusha |
fninit |
fldpi |
fld [pi180] |
fimul dword[ebx+8] |
fst [BGIangle] |
mov esi,[ebx+28] |
and esi,0xffffff |
add esi,eax |
mov eax,[ebx+32] |
and [deform],0 |
test eax,BGI_ITALIC |
jz .norm |
mov [deform],0.4 |
.norm: |
mov ebp,eax |
or ebp,BGI_FREE |
mov eax,[ebx+12] |
mov [Xscale],eax |
mov eax,[ebx+16] |
mov [Yscale],eax |
mov ecx,[ebx+20] |
mov edx,ebp |
and edx,BGI_FREE+BGI_VAMASK+BGI_HAMASK |
add edx,[ebx+24] |
mov eax,[ebx+4] |
mov ebx,esi |
add ebx,0x6000000 |
mov [esp+4],edx |
mov [esp+20],ecx |
jmp txt |
pi180 dd 0.017453 |
_BGIfont_Outtext: |
; in: ebx-[x][y], ecx-color, edx-string, esi-length |
pusha |
mov ebp,esi |
if ~ BGI_LEVEL eq KERNEL |
mov eax,ebx |
mov ebx,ecx |
mov ecx,edx |
mov edx,esi |
end if |
; in: eax-[x][y], ebx-color, ecx-string, edx-length |
txt: |
if ~ BGI_LEVEL eq KERNEL |
if BGI_WINDOW_CLIP eq 1 |
pusha |
mov eax,9 |
mov ebx,BGI_PRC_INFO |
mov ecx,-1 |
int 0x40 |
popa |
end if |
end if |
mov [.y0],ax |
shr eax,16 |
mov [.x0],ax |
mov ecx,ebx ; color |
and ebx,0xfffffff |
mov [.color],ebx |
call BGIfont_get2head |
test edi,edi |
jz .exit |
mov ecx,[esp+4]; str length |
mov esi,[esp+20]; str ptr |
movzx eax,byte[edi+5] |
push ecx |
and ecx,0xff |
jnz .lenok |
add esp,4 |
jmp .ex2 |
.lenok: |
pusha |
push dword[txt.y0] |
and dword[txt.y0],0 |
xor edx,edx |
mov ebx,[edi+8] |
.next: |
call txt.BGIfont_GetChar |
movzx eax,byte[ebx+eax] |
add edx,eax |
loop .next |
mov ecx,edx ; ecx - x size |
movzx dx,byte[edi+6] |
mov [BGIheight],dx |
mov ebx,[esp+36] |
and ebx,BGI_HAMASK |
cmp ebx,BGI_HARIGHT |
je .nova |
ja .subv |
xor ecx,ecx |
jmp .nova |
.subv: |
shr cx,1 |
.nova: |
mov ebx,[esp+36] |
and ebx,BGI_VAMASK |
cmp ebx,BGI_VATOP |
je .def |
ja .subh |
xor edx,edx |
jmp .def |
.subh: |
shr dx,1 |
.def: |
call txt.BGIfont_Deform |
pop dword[txt.y0] |
popa |
pop ebx |
mov ax,[txt.y1] |
sub [txt.y0],ax |
mov ax,[txt.x1] |
sub [txt.x0],ax |
xor eax,eax |
cld |
.mloop: |
push [.y0] |
pop [.y] |
push [.x0] |
pop [.x] |
call .BGIfont_GetChar |
push esi |
lea esi,[edi+20] ; offset |
movzx edx,word[esi+eax*2] ; ofs1 |
add edx,[edi+12] |
inc eax |
cmp al,[edi+4] |
je .eof |
movzx eax,word[esi+eax*2]; ofs2 |
add eax,[edi+12] |
jmp .prc_vec |
.eof: |
mov eax,[edi+16] ; ofs2=eof |
.prc_vec: ; edx-vec cmd ifs, eax-cmd limit |
mov [.vec_end],eax |
push ecx |
.vec_loop: |
mov ax,word[edx] |
push edx |
mov ecx,eax |
and eax,0x8080 ; op |
and ecx,0x7f ; xx |
mov edx,[edx+1] |
and edx,0x7f ; yy |
cmp edx,63 |
jbe .positive |
sub edx,128 ; yy-=128 |
.positive: |
cmp ecx,63 |
jbe .positive2 |
sub ecx,128 ; xx-=128 |
.positive2: |
call .BGIfont_Deform |
cmp eax,0x8080 |
jne .noline |
test ebp,BGI_NODRAW |
jnz .noline |
; draw vector |
if ~ BGI_LEVEL eq KERNEL |
push eax |
mov ebx,dword[.x1] |
mov ecx,dword[.y1] |
if BGI_WINDOW_CLIP eq 1 |
movzx eax,[.x] |
cmp eax,dword[BGI_PRC_INFO+42] |
ja .nobold |
movzx eax,[.y] |
cmp eax,dword[BGI_PRC_INFO+46] |
ja .nobold |
xor eax,eax |
cmp ax,bx |
jg .nobold |
cmp ax,cx |
jg .nobold |
end if |
mov edx,[.color] |
mov eax,38 |
int 0x40 |
test ebp,BGI_BOLD |
jz .nobold |
test ebp,BGI_FREE |
jnz .free5 |
.free5: |
add ebx,1 shl 16+1 |
int 0x40 |
.nobold: |
pop eax |
else |
pusha |
mov eax,dword[.x1] |
mov ebx,dword[.y1] |
mov ecx,[.color] |
; call syscall_drawline |
test dword[esp+8],BGI_BOLD |
jz .nobold |
add eax,1 shl 16+1 |
; call syscall_drawline |
.nobold: |
popa |
end if |
.noline: |
pop edx |
test eax,eax |
je .eovecs ; op=0 |
push [.y1] |
pop [.y] |
push [.x1] |
pop [.x] |
add edx,2 |
cmp edx,[.vec_end] |
jb .vec_loop |
.eovecs: |
pop ecx esi |
push [.y] |
pop [.y0] |
push [.x] |
pop [.x0] |
loop .mloop1 |
jmp .exit |
.mloop1: |
jmp .mloop |
.exit: |
mov eax,dword[.y0] |
mov [esp+28],eax |
.ex2: |
popa |
ret |
.BGIfont_Deform: |
test ebp,BGI_FREE |
jnz .free0 |
movzx ebx,byte[.color+3] ;ebx=scale |
imul ecx,ebx |
add ecx,2 |
shr ecx,2 |
imul edx,ebx |
add edx,2 |
shr edx,2 |
neg edx |
mov [.x1],cx |
mov [.y1],dx |
jmp .add |
.free0: |
mov [.x1],cx |
mov [.y1],dx |
fild [.y1] |
fld st0 |
fmul [Yscale] |
fchs |
fistp [.y1] |
fmul [deform] |
fiadd [.x1] |
fmul [Xscale] |
fistp [.x1] |
cmp [BGIangle],0 |
je .add |
call BGIfont_Coo |
jmp .eax |
.add: |
mov cx,[.x0] |
add [.x1],cx |
mov cx,[.y0] |
add [.y1],cx |
.eax: |
ret |
.BGIfont_GetChar: |
; in: esi -> string; edi -> BGIrec |
; out: esi -> next char; al - char obtained |
lodsb ; al - char from str |
sub al,[edi+5] |
jb .out |
cmp al,[edi+4] |
jb .in |
.out: |
xor al,al ; al - 1st symbol available |
.in: |
ret |
.y0 dw ? |
.x0 dw ? |
.x1 dw ? |
.x dw ? |
.y1 dw ? |
.y dw ? |
.color dd ? |
.vec_end dd ? |
BGIfont_Ptr dd 0 |
BGIheight dw ? |
deform dd ? |
BGIangle dd ? |
Xscale dd ? |
Yscale dd ? |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/rtfread/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm rtfread.asm rtfread |
@pause |
/programs/other/rtfread/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm rtfread.asm rtfread |
@pause |
/programs/other/rtfread/trunk/debug.inc |
---|
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' |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/rtfread/trunk/macros.inc |
---|
0,0 → 1,266 |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,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 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/rtfread/trunk/rtf_lite.inc |
---|
0,0 → 1,635 |
;workarea: <- RTF_work |
; listptr dd savelist 0 |
; szKeyword rb 31 4 |
; szParameter rb 21 35 |
include 'rtftype.inc' |
include 'rtfactn.inc' |
read_next_block: |
inc [cur_block] |
read_block: |
mov esi,I_END |
pusha |
mov ecx,[cur_block] |
mov ebx,fileinfo |
mov eax,ecx |
shl eax,7 |
mov [ebx+4],eax |
; mov [ebx+12],esi |
mcall 58 |
if DEBUG_BLOCK eq 1 |
; dps 'B=' |
; dpd ecx |
; dps <13,10> |
end if |
cmp ecx,[max_block] |
je .last |
mov ebx,I_END+RTFSIZE |
jmp .add |
.last: |
mov ebx,[tail] |
; dpd ebx |
.add: |
; dpd ebx |
mov [block_end],ebx |
popa |
; dpd esi |
; dps <13,10> |
ret |
; |
; %%Function: ecRtfParse |
; |
; Step 1: |
; Isolate RTF keywords and send them to ecParseRtfKeyword; |
; Push and pop state at the start and end of RTF groups; |
; Send text to ecParseChar for further processing. |
; |
macro CopySave _src,_dest |
{ |
pusha |
mov ecx,SIZE_save |
mov esi,_src |
mov edi,_dest |
rep movsb |
popa |
} |
RtfParse: |
if BENCH eq 1 |
mcall 26,9 |
mov [bench],eax |
end if |
mov [RetroPtr],esi |
CopySave Chp,RetroSave |
push dword[Free+4] |
pop dword[RetroXY] |
xor eax,eax |
mov [cur_block],eax |
mov [RetroBlock],eax |
push [cGroup] |
pop [RetroGroup] |
and [mode],not RTF_BLIND |
mov [listptr],save_stack |
mov [fileinfo.size],128 |
; test ebp,RTF_HELP |
test [mode],RTF_HELP |
jne .noread |
call read_block |
.noread: |
mov [RetroPtr],esi |
.nib2: |
mov [nibble],2 |
and [b],al |
.getc: |
xor eax,eax |
lods_block |
cmp [cGroup],0 |
jge .ok1 |
Return ecStackUnderflow |
.ok1: |
cmp [ris],risBin |
jne .nobin |
RetError ecParseChar |
.nobin: |
cmp al,'{' |
jne .nobr1 |
RetError ecPushRtfState |
.nobr1: |
cmp al,'}' |
jne .nobr2 |
RetError ecPopRtfState |
.nobr2: |
cmp al,'\' |
jne .noslash |
RetError ecParseRtfKeyword |
.noslash: |
cmp al,0xd |
je .getc |
cmp al,0xa |
je .getc |
.nouc: |
cmp [ris],risNorm |
jne .nonorm |
call ecParseChar |
cmp eax,ecOutOfWindow |
je .__ex |
test eax,eax |
je .getc |
jmp .__ex |
.nonorm: |
cmp [ris],risHex |
je .noassert |
Return ecAssertion |
.noassert: |
shl [b],4 |
isdigit al, .nodig |
sub al,'0' |
add [b],al |
jmp .nibble |
.nodig: |
islower al, .nolow |
cmp al,'a' |
jb .inval |
cmp al,'f' |
ja .inval |
sub al,'a'-10 |
jmp .nib0 |
.inval: |
if INVALHEX eq 0 |
jmp .getc |
else |
; sub esi,I_END+1 |
; dpd esi |
; movzx eax,al |
; dpd eax |
; movzx eax,[b] |
; dpd eax |
Return ecInvalidHex |
end if |
.nolow: |
cmp al,'A' |
jb .inval |
cmp al,'F' |
ja .inval |
sub al,'A'-10 |
.nib0: |
add [b],al |
.nibble: |
dec [nibble] |
cmp [nibble],0 |
jnz .getc |
movzx eax,[b] |
mov [ris],risNorm |
call ecParseChar |
test eax,eax |
jnz .__ex |
; mov [ris],risNorm |
jmp .nib2 |
.eof: |
xor eax,eax |
cmp eax,[cGroup] |
je .__ex |
jg .unbr |
Return ecStackUnderflow |
.unbr: |
mov eax,ecUnmatchedBrace |
.__ex: |
ret |
nibble db 2 |
b db 0 |
RTF_maxlist dd ? |
; |
; %%Function: ecParseRtfKeyword |
; |
; Step 2: |
; get a control word (and its associated value) and |
; call ecTranslateKeyword to dispatch the control. |
; |
ecParseRtfKeyword: |
; ch-al,bl-fParam, bh-fNeg |
mov [ris],risNorm |
xor eax,eax |
xor ebx,ebx |
push edx |
mov [szKeyword],al |
mov [szParameter],al |
lods_block |
isalpha al,.ctrl |
jmp .alph |
.ctrl: |
push esi |
mov esi,szKeyword |
inc byte[esi] |
mov [esi+1],al |
mov eax,ebx |
xor ebx,ebx |
call ecTranslateKeyword |
pop esi |
jmp .__ex |
.alph: |
push edi |
mov edi,szKeyword+1 |
.loop1: |
stosb |
inc [szKeyword] |
lods_block |
isalpha al,.outloop1 |
jmp .loop1 |
.outloop1: |
pop edi |
cmp al,'-' |
jne .noneg |
not bh |
lods_block |
.noneg: |
isdigit al,.nodig |
not bl |
push edi |
mov edi,szParameter+1 |
.loop2: |
stosb |
inc [szParameter] |
lods_block |
isdigit al,.outloop2 |
jmp .loop2 |
.outloop2: |
pop edi |
push eax esi |
mov esi,szParameter |
atoi |
pop esi |
mov edx,eax |
pop eax |
mov [lParam],edx |
test bh,bh |
jz .nodig |
neg edx |
.nodig: |
cmp al,' ' |
je .space |
cmp esi,I_END |
jne .ok_block |
dec [cur_block] |
call read_block |
mov esi,[block_end] |
.ok_block: |
dec esi |
.space: |
mov eax,ebx |
mov ebx,edx |
push esi |
mov esi,szKeyword |
call ecTranslateKeyword |
pop esi |
.__ex: |
pop edx |
ret |
; |
; %%Function: ecParseChar |
; |
; Route the character to the appropriate destination stream. |
; |
ecParseChar: |
;in: ch-al, esi->rtf |
cmp [ris],risBin |
jne .nobin |
dec [cbBin] |
cmp [cbBin],0 |
jg .nobin |
mov [ris],risNorm |
.nobin: |
cmp [rds],rdsColor |
jne .nodelim |
cmp al,';' |
jne .non |
mov eax,[colorptr] |
cmp eax,ct_end-4 |
jae .non |
add [colorptr],4 |
jmp .non |
.nodelim: |
cmp [rds],rdsSkip |
je .non |
cmp [rds],rdsNorm |
je ecPrintChar |
; ret |
.non: |
mov eax,ecOK |
ret |
macro PrintTrap _char |
{ |
local .notrap |
cmp byte[esi],_char |
jne .notrap |
sub esi,I_END |
dps 'Trapped at ' |
dpd esi |
dps <13,10> |
ud2 |
.notrap: |
} |
; |
; %%Function: ecPrintChar |
; |
; Send a character to the output file. |
; |
ecPrintChar: |
; in:ch-al, esi - rtf pointer |
; stosb |
; jmp .nowrap |
mov ebp,[mode] |
cmp al,0xa |
jne .nopar |
; and ebp,not RTF_NO1STLINE |
and [mode],not RTF_NO1STLINE |
jmp .par |
.nopar: |
cmp al,0x9 |
jne .notab |
add word[Free+6],CHARW*3 |
jmp .chkwrap |
.notab: |
xor ebx,ebx |
if ~ RENDER eq FREE |
cmp word[Free+4],TOP |
jl .nodraw |
end if |
ansi2oem |
mov [char],al |
; PrintTrap '/' |
pusha |
xor eax,eax |
; test [mode],RTF_BLIND |
test ebp,RTF_BLIND |
je .rend |
; test [mode],RTF_COLORLESS |
test ebp,RTF_COLORLESS |
jz .setcolor |
mov ecx,DEFCOLOR |
jmp .rend |
.setcolor: |
movzx ecx,byte[Chp+3] |
mov ecx,[colortbl+ecx*4] |
.rend: |
if RENDER eq FREE |
mov ebx,Free |
mov dword[ebx+32],eax |
mov [ebx+28],ecx |
; test [mode], RTF_BOTTOM |
test ebp, RTF_BOTTOM |
jne .nodraw2 |
cmp word[Free+4],TOP |
jl .nodraw2 |
cmp byte[Chp],fTrue |
jne .nobold |
or dword[ebx+32],BGI_BOLD |
.nobold: |
; test [mode], RTF_BLIND |
test ebp, RTF_BLIND |
jne .freet |
.nodraw2: |
or dword[ebx+32],BGI_NODRAW |
.freet: |
BGIfont_Freetext |
mov [Free+4],eax |
test [mode],RTF_BLIND |
; jmp .nohei |
jne .nohei |
fild word[BGIheight] |
fmul dword[Free+12] |
; fistp word[curheight] |
fistp word[maxheight] |
; movzx eax,[curheight] |
; dpd eax |
; cmp ax,[maxheight] |
; jae .nohei |
; mov [maxheight],ax |
; dps 'M' |
; dpd eax |
; dps <13,10> |
.nohei: |
else |
and ecx,0xffffff |
mov ebx,[Free+4] |
mov edx,char |
mov esi,1 |
end if |
if RENDER eq BGI |
add ecx,0x44000000 |
cmp byte[Chp],fTrue |
jne .nobold |
or esi,BGI_BOLD |
.nobold: |
test ebp,RTF_BLIND |
; test [mode],RTF_BLIND |
jne .freet |
or esi,BGI_NODRAW |
.freet: |
BGIfont_Outtext |
mov [Free+4],eax |
end if |
if RENDER eq PIX |
; test [mode],RTF_TOEOF |
; jne .blind |
; test [mode],RTF_BOTTOM |
test ebp,RTF_BOTTOM |
jne .nobold |
.blind: |
; test [mode],RTF_BLIND |
test ebp,RTF_BLIND |
je .nobold |
mcall 4 |
cmp byte[Chp],fTrue |
jne .nobold |
add ebx,1 shl 16 |
mcall |
.nobold: |
end if |
popa |
.nodraw: |
if RENDER eq PIX |
add word[Free+6],CHARW |
end if |
movsx eax,[pitch] |
add word[Free+6],ax |
.chkwrap: |
mov eax,dword[prcinfo+42] |
cmp ax,word[Free+6] |
ja .nowrap |
; or ebp,RTF_NO1STLINE |
or [mode],RTF_NO1STLINE |
.par: |
xor [mode],RTF_BLIND |
; not [blind] |
test [mode] ,RTF_BLIND |
je .makewrap |
; [blind]=false |
movzx eax,word[Free+6] |
sub ax,word[RetroXY+2] |
push dword[RetroXY] |
pop dword[Free+4] |
mov [mark],0xff0000 |
test [mode],RTF_ALIGNLESS |
jnz .letsdraw |
cmp byte[Pap+12],justR |
jb .letsdraw |
mov [mark],0xff |
mov ebx,dword[prcinfo+42] ; wnd width |
sub ebx,eax |
cmp byte[Pap+12],justC |
jne .nocenter |
shr ebx,1 |
mov [mark],0x00ff00 |
.nocenter: |
mov word[Free+6],bx |
.letsdraw: |
; test [mode],RTF_NO1STLINE |
; jnz .no1st |
; add word[Free+6],60 |
.no1st: |
if STEPBYSTEP eq 1 |
; movzx eax,[mode] |
; dph eax |
; test [mode],RTF_NO1STLINE |
; jnz .no1st |
; mcall 4,[RetroXY],[mark],sym,1 |
; dps '1st ' |
; .no1st: |
dps <'false ',13,10> |
; dpd eax |
; dpd ebx |
end if |
if SHOWALIGN eq 1 |
mcall 4,[RetroXY],[mark],sym,1 |
end if |
if STEPBYSTEP eq 1 |
mcall 10 |
mcall 2 |
end if |
mov eax,[RetroBlock] |
cmp eax,[cur_block] |
je .norblock |
mov [cur_block],eax |
call read_block |
.norblock: |
mov esi,[RetroPtr] |
push [RetroGroup] |
pop [cGroup] |
CopySave RetroSave,Chp |
jmp .nowrap |
.makewrap: ; second pass preparing |
; [blind]=true |
if STEPBYSTEP eq 1 |
dps 'true ' |
mcall 10 |
mcall 2 |
end if |
mov word[Free+6],LMARGIN |
if RENDER eq FREE |
fld [line_space] |
fimul [maxheight] |
fistp [maxheight] |
movzx eax,[maxheight] |
add word[Free+4],ax |
; and [maxheight],0 |
; add word[Free+4],CHARH |
else |
mov eax,CHARH |
add word[Free+4],ax |
end if |
test [mode],RTF_TOEOF |
je .nohdoc |
add [HDoc],eax |
inc [line_count] |
.nohdoc: |
test [mode],RTF_BOTTOM |
jne .text |
; dps '1' |
mov ebx,dword[prcinfo+46] |
cmp bx,word[Free+4] |
jge .text |
or [mode],RTF_BOTTOM |
dps <'btm',13,10> |
test [mode],RTF_TOEOF |
jne .text |
mov eax,ecOutOfWindow |
ret |
; end if |
.text: |
push dword[Free+4] |
pop dword[RetroXY] |
mov word[RetroXY+2],LMARGIN |
mov [RetroPtr],esi |
push [cur_block] |
pop [RetroBlock] |
CopySave Chp,RetroSave |
push [cGroup] |
pop [RetroGroup] |
; if STEPBYSTEP eq 1 |
; mcall 10 |
; mcall 2 |
; end if |
.nowrap: |
mov eax,ecOK |
ret |
mark dd ? |
sym db 0x10 |
line_space dd 1.6 |
; |
; %%Function: ecPushRtfState |
; |
; Save relevant info on a linked list of SAVE structures. |
; |
ecPushRtfState: |
pusha |
mov edi,[listptr] |
mov eax,edi |
mov ecx,SIZE_save |
add eax,ecx |
cmp eax,save_limit |
jb .malloc |
Return ecStackOverflow |
.malloc: |
mov esi,Chp |
rep movsb |
mov [listptr],edi |
mov [ris],risNorm |
inc [cGroup] |
xor eax,eax |
Epilog |
; %%Function: ecPopRtfState |
; |
; If we're ending a destination (that is, the destination is changing), |
; call ecEndGroupAction. |
; Always restore relevant info from the top of the SAVE list. |
ecPopRtfState: |
pusha |
mov esi,[listptr] |
cmp esi,save_stack |
ja .okpop |
Return ecStackUnderflow |
.okpop: |
movzx eax,[rds] |
cmp al,[esi-2] |
je .noega |
RetError ecEndGroupAction, .noega |
.noega: |
mov ecx,SIZE_save |
sub esi,ecx |
mov [listptr],esi |
mov edi,Chp |
rep movsb |
dec [cGroup] |
xor eax,eax |
Epilog |
ansitbl: |
db 0xaa,0xba,0xbf,0xaf |
db 0xa7,0xa8,0xa1,0xab,0xb0,0xb2,0xb3,0xb6,0xb7,0xb8,0xb9 |
db 0xa2,0xbb,0x93,0x94,0x85 |
oematbl: |
if RENDER eq PIX |
db 0xf2,0xf3,0xf5,0xf4 |
else |
db 0x85,0xa5,0x69,0x49 |
end if |
db 0x15,0xf0,0xf6,0x22,0x1d,0x49,0x69,0x14,0x1c,0xf1,0x23 |
db 0xf7,0x22,0x22,0x22,0x16 |
uctbl: |
dw 0x451 |
oemutbl: |
db 0xb8 |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/rtfread/trunk/rtfactn.inc |
---|
0,0 → 1,389 |
rgsymRtf: |
; Keyword descriptions |
;rgsymRtf[] = { |
; keyword dflt fPassDflt kwd idx implemented |
if syms eq 12 |
SYM "f", 0, fFalse, kwdProp, ipropFont |
SYM "*", 0, fFalse, kwdSpec, ipfnSkipDest ,1 |
SYM "'", 0, fFalse, kwdSpec, ipfnHex ,1 |
SYM "par", 0, fFalse, kwdChar, 0x0a ,1 |
SYM "u", 0, fFalse, kwdUC, 0 ,1 |
SYM "line", 0, fFalse, kwdChar, 0xa ,1 |
SYM "plain", 0, fFalse, kwdProp, ipropPlain ,1 |
SYM 0x9, 0, fFalse, kwdChar, 0x09 ,1 |
SYM "tab", 0, fFalse, kwdChar, 0x09 ,1 |
SYM "b", 1, fFalse, kwdProp, ipropBold ,1 |
SYM "ul", 1, fFalse, kwdProp, ipropUnderline |
SYM "i", 1, fFalse, kwdProp, ipropItalic ,1 |
SYM "li", 0, fFalse, kwdProp, ipropLeftInd |
SYM "ri", 0, fFalse, kwdProp, ipropRightInd |
SYM "fi", 0, fFalse, kwdProp, ipropFirstInd |
SYM "~", 0, fFalse, kwdChar, ' ' ,1 |
SYM "cols", 1, fFalse, kwdProp, ipropCols |
SYM "qc", justC, fTrue, kwdProp, ipropJust ,1 |
SYM "ql", justL, fTrue, kwdProp, ipropJust ,1 |
SYM "qr", justR, fTrue, kwdProp, ipropJust ,1 |
SYM "qj", justF, fTrue, kwdProp, ipropJust |
SYM "cf", 0, fFalse, kwdProp, ipropForeColor ,1 |
SYM "red", 0, fFalse, kwdColor, 16 ,1 |
SYM "green", 0, fFalse, kwdColor, 8 ,1 |
SYM "blue", 0, fFalse, kwdColor, 0 ,1 |
SYM "fs", 0, fFalse, kwdProp, ipropFontSize ,1 |
SYM "sbknone", sbkNon, fTrue, kwdProp, ipropSbk |
SYM "sbkcol", sbkCol, fTrue, kwdProp, ipropSbk |
SYM "sbkeven", sbkEvn, fTrue, kwdProp, ipropSbk |
SYM "sbkodd", sbkOdd, fTrue, kwdProp, ipropSbk |
SYM "sbkpage", sbkPg, fTrue, kwdProp, ipropSbk |
SYM "pgnx", 0, fFalse, kwdProp, ipropPgnX |
SYM "pgny", 0, fFalse, kwdProp, ipropPgnY |
SYM "pgndec", pgDec, fTrue, kwdProp, ipropPgnFormat |
SYM "pgnucrm", pgURom, fTrue, kwdProp, ipropPgnFormat |
SYM "pgnlcrm", pgLRom, fTrue, kwdProp, ipropPgnFormat |
SYM "pgnucltr", pgULtr, fTrue, kwdProp, ipropPgnFormat |
SYM "pgnlcltr", pgLLtr, fTrue, kwdProp, ipropPgnFormat |
SYM "paperw", 12240, fFalse, kwdProp, ipropXaPage |
SYM "paperh", 15480, fFalse, kwdProp, ipropYaPage |
SYM "margl", 1800, fFalse, kwdProp, ipropXaLeft |
SYM "margr", 1800, fFalse, kwdProp, ipropXaRight |
SYM "margt", 1440, fFalse, kwdProp, ipropYaTop |
SYM "margb", 1440, fFalse, kwdProp, ipropYaBottom |
SYM "pgnstart", 1, fTrue, kwdProp, ipropPgnStart |
SYM "facingp", 1, fTrue, kwdProp, ipropFacingp |
SYM "landscape",1, fTrue, kwdProp, ipropLandscape |
SYM "ldblquote",0, fFalse, kwdChar, '"' ,1 |
SYM "rdblquote",0, fFalse, kwdChar, '"' ,1 |
SYM "bin", 0, fFalse, kwdSpec, ipfnBin ,1 |
SYM "author", 0, fFalse, kwdDest, idestSkip |
SYM "buptim", 0, fFalse, kwdDest, idestSkip |
SYM "bullet", 0, fFalse, kwdChar, '*' ,1 |
SYM "cell", 0, fFalse, kwdChar, 0x09 ,1 |
SYM "colortbl", 0, fFalse, kwdDest, idestColor ,1 |
SYM "comment", 0, fFalse, kwdDest, idestSkip |
SYM "creatim", 0, fFalse, kwdDest, idestSkip |
SYM "doccomm", 0, fFalse, kwdDest, idestSkip |
SYM "fonttbl", 0, fFalse, kwdDest, idestSkip |
SYM "footer", 0, fFalse, kwdDest, idestSkip |
SYM "footerf", 0, fFalse, kwdDest, idestSkip |
SYM "footerl", 0, fFalse, kwdDest, idestSkip |
SYM "footerr", 0, fFalse, kwdDest, idestSkip |
SYM "footnote", 0, fFalse, kwdDest, idestSkip |
SYM "ftncn", 0, fFalse, kwdDest, idestSkip |
SYM "ftnsep", 0, fFalse, kwdDest, idestSkip |
SYM "ftnsepc", 0, fFalse, kwdDest, idestSkip |
SYM "header", 0, fFalse, kwdDest, idestSkip |
SYM "headerf", 0, fFalse, kwdDest, idestSkip |
SYM "headerl", 0, fFalse, kwdDest, idestSkip |
SYM "headerr", 0, fFalse, kwdDest, idestSkip |
SYM "info", 0, fFalse, kwdDest, idestSkip |
SYM "keywords", 0, fFalse, kwdDest, idestSkip |
SYM "operator", 0, fFalse, kwdDest, idestSkip |
SYM "pict", 0, fFalse, kwdDest, idestSkip |
SYM "printim", 0, fFalse, kwdDest, idestSkip |
SYM "private1", 0, fFalse, kwdDest, idestSkip |
SYM "revtim", 0, fFalse, kwdDest, idestSkip |
SYM "row", 0, fFalse, kwdChar, 0x0a ,1 |
SYM "rxe", 0, fFalse, kwdDest, idestSkip |
SYM "stylesheet",0, fFalse, kwdDest, idestSkip |
SYM "subject", 0, fFalse, kwdDest, idestSkip |
SYM "tc", 0, fFalse, kwdDest, idestSkip |
SYM "title", 0, fFalse, kwdDest, idestSkip |
SYM "trowd", 0, fFalse, kwdChar, 0x0a ,1 |
SYM "txe", 0, fFalse, kwdDest, idestSkip |
SYM "xe", 0, fFalse, kwdDest, idestSkip |
SYM "{", 0, fFalse, kwdChar, '{' ,1 |
SYM "}", 0, fFalse, kwdChar, '}' ,1 |
SYM "\", 0, fFalse, kwdChar, '\' ,1 |
end if |
SYM 0xa, 0, fFalse, kwdChar, 0x0a ,1 |
SYM 0xd, 0, fFalse, kwdChar, 0x0a ,1 |
; |
; %%Function: ecApplyPropChange |
; |
; Set the property identified by _iprop_ to the value _val_. |
; |
ecApplyPropChange: |
; in : eax-iprop, ebx - value |
pusha |
cmp [rds],rdsSkip |
jne .noskip |
.ok: |
Return ecOK |
.noskip: |
lea esi,[eax*2+eax+rgprop] ;rgprop[iprop] |
mov cx,word[esi] |
movzx edx,byte[esi+2] |
Prcheck Dop |
Prcheck Sep |
Prcheck Pap |
Prcheck Chp |
cmp byte[esi],actnSpec |
jne .bad |
.checked: |
cmp cl,actnByte |
jne .nob |
mov byte[esi+edx],bl |
jmp .ok |
.nob: |
cmp cl,actnWord |
jne .now |
mov [esi+edx],ebx |
jmp .ok |
.now: |
cmp cl,actnSpec |
jne .nos |
call ecParseSpecialProperty |
jmp .__ex |
.nos: |
cmp cl,actnFloatFS |
jne .bad |
mov [Chp+5],ebx |
call updFS |
jmp .ok |
.bad: |
mov eax,ecBadTable |
Epilog |
updFS: |
cmp dword[Chp+5],0 |
jnz .no0 |
mov dword[Chp+5],24 |
.no0: |
fild dword[Chp+5] |
fmul dword[Free-4] |
fst dword[Free+12] |
fstp dword[Free+16] |
ret |
; |
; %%Function: ecParseSpecialProperty |
; |
; Set a property that requires code to evaluate. |
; |
ecParseSpecialProperty: |
; in : eax-iprop, ebx - value |
; cmp al,ipropPard |
; jne .nopap |
; push eax |
; mov ecx,SIZE_Pap |
; mov edi,RetroSave+9 |
; xor eax,eax |
; rep stosb |
; pop eax |
; .nopap: |
MemSet ipropPard,Pap |
MemSet ipropPlain,Chp |
MemSet ipropSectd,Sep |
mov eax,ecBadTable |
ret |
.ms: |
xor eax,eax |
rep stosb |
ret |
; |
; %%Function: ecTranslateKeyword. |
; |
; Step 3. |
; Search rgsymRtf for szKeyword and evaluate it appropriately. |
; |
; Inputs: |
; szKeyword: The RTF control to evaluate. |
; param: The parameter of the RTF control. |
; fParam: fTrue if the control had a parameter; (that is, if param is valid |
; fFalse if it did not. |
ecTranslateKeyword: |
; in: esi->pasKeyword; ebx-param, eax-fParam |
pusha |
mov edx,isymMax |
mov edi,rgsymRtf |
.next: |
add edi,5 |
movzx ecx,byte[edi] |
inc ecx |
push edi esi ecx |
repe cmpsb |
pop ecx esi edi |
jz .found |
add edi,ecx |
; inc edi |
dec edx |
test edx,edx |
jne .next |
cmp dl,[fSkipDestIfUnk] |
jz .discard |
mov [rds],rdsSkip |
mov [fSkipDestIfUnk],dl |
.discard: |
Return ecOK |
.found: |
and [fSkipDestIfUnk],0 |
mov cx,[edi-3] |
cmp ch,kwdProp |
jne .nop |
test cl,cl |
jnz .usedeflt |
test al,al |
jnz .validparm |
.usedeflt: |
mov ebx,[edi-5] |
.validparm: |
movzx eax,byte[edi-1] |
call ecApplyPropChange |
jmp .__ex |
.nop: |
movzx eax,byte[edi-1] |
cmp ch,kwdChar |
jne .noc |
.pchar: |
mov edi,[esp] |
test eax,eax |
jz .__ex |
mov esi,[esp+36] |
call ecParseChar |
mov [esp],edi |
mov [esp+36],esi |
jmp .__ex |
.noc: |
cmp ch,kwdDest |
jne .nod |
call ecChangeDest |
jmp .__ex |
.nod: |
cmp ch,kwdSpec |
jne .nos |
call ecParseSpecialKeyword |
jmp .__ex |
.nos: |
cmp ch,kwdColor |
jne .nocol |
cmp [rds],rdsColor |
jne .bad |
mov edx,[colorptr] |
mov ecx,eax |
mov esi,0xff |
shl esi,cl |
not esi |
shl ebx,cl |
and [edx],esi |
or [edx],ebx |
.okk: |
Return ecOK |
.nocol: |
cmp ch,kwdUC |
jne .bad |
mov eax,[esp+36] |
cmp byte[eax],'\' |
je .nobyte |
inc dword[esp+36] |
.nobyte: |
cmp ebx,0x400 |
jb .okk |
mov eax,ebx |
uc2oem |
cmp ecx,1 |
jae .pchar |
lea eax,[ebx-0x410+0xc0] |
jmp .pchar |
.bad: |
mov eax,ecBadTable |
Epilog |
; %%Function: ecChangeDest |
; |
; Change to the destination specified by idest. |
; There's usually more to do here than this... |
ecChangeDest: |
; in: eax- idest |
cmp [rds],rdsSkip |
jne .noskip |
jmp .okk;Return ecOK |
.noskip: |
cmp eax,rdsColor |
jne .nocol |
mov [rds],al |
jmp .okk |
.nocol: |
mov [rds],rdsSkip |
.okk: |
mov eax,ecOK |
.ex: |
ret |
; %%Function: ecEndGroupAction |
; |
; The destination specified by rds is coming to a close. |
; If there's any cleanup that needs to be done, do it now. |
ecEndGroupAction: |
; in: eax-rds |
mov eax,ecOK |
ret |
; %%Function: ecParseSpecialKeyword |
; |
; Evaluate an RTF control that needs special processing. |
ecParseSpecialKeyword: |
; in: eax-IPFN |
cmp [rds],rdsSkip |
jne .noskip |
cmp eax,ipfnBin |
jne .ok |
.noskip: |
cmp eax,ipfnBin |
jne .nobin |
mov [ris],risBin |
push [lParam] |
pop [cbBin] |
jmp .ok |
.nobin: |
cmp eax,ipfnSkipDest |
jne .noskd |
mov [fSkipDestIfUnk],fTrue |
jmp .ok |
.noskd: |
cmp eax,ipfnHex |
jne .nohex |
mov [ris],risHex |
jmp .ok |
.nohex: |
Return ecBadTable |
.ok: |
mov eax,ecOK |
.__ex: |
ret |
; RTF parser tables |
rgprop: |
; Property descriptions |
;PROP rgprop [ipropMax] = { |
PROP actnByte, propChp, 0 ; ipropBold |
PROP actnByte, propChp, 1 ; ipropItalic |
PROP actnByte, propChp, 2 ; ipropUnderline |
PROP actnWord, propPap, 0 ; ipropLeftInd |
PROP actnWord, propPap, 4 ; ipropRightInd |
PROP actnWord, propPap, 8 ; ipropFirstInd |
PROP actnWord, propSep, 0 ; ipropCols |
PROP actnWord, propSep, 5 ; ipropPgnX |
PROP actnWord, propSep, 9 ; ipropPgnY |
PROP actnWord, propDop, 0 ; ipropXaPage |
PROP actnWord, propDop, 4 ; ipropYaPage |
PROP actnWord, propDop, 8 ; ipropXaLeft |
PROP actnWord, propDop, 12 ; ipropXaRight |
PROP actnWord, propDop, 16 ; ipropYaTop |
PROP actnWord, propDop, 20 ; ipropYaBottom |
PROP actnWord, propDop, 24 ; ipropPgnStart |
PROP actnByte, propSep, 4 ; ipropSbk |
PROP actnByte, propSep, 13 ; ipropPgnFormat |
PROP actnByte, propDop, 28 ; ipropFacingp |
PROP actnByte, propDop, 29 ; ipropLandscape |
PROP actnByte, propPap, 12 ; ipropJust |
PROP actnSpec, propPap, 0 ; ipropPard |
PROP actnSpec, propChp, 0 ; ipropPlain |
PROP actnSpec, propSep, 0 ; ipropSectd |
PROP actnByte, propChp, 3 ; ipropForeColor |
PROP actnByte, propChp, 4 ; ipropFont |
PROP actnFloatFS,propChp, 5 ; ipropFontSize |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/rtfread/trunk/rtfread.asm |
---|
0,0 → 1,609 |
; RTF READER FOR MENUET v1. |
; Written in pure assembler by Ivushkin Andrey aka Willow |
; |
;--------------------------------------------------------------------- |
M64 equ 64*1024 |
N_A equ 0x412f4e |
RTFSIZE equ M64 |
RTFSTACKSIZE equ M64 |
BGIFONTSIZE equ 120*1024 |
ESPSIZE equ M64 |
LMARGIN equ 20 |
CHARW equ 6 |
CHARH equ 11 |
WINW equ 600 |
WINH equ 450 |
WIN_COLOR equ 0x3f0f0f0 |
DEFCOLOR equ 0x303030 |
;RENDER equ PIX |
;RENDER equ BGI |
RENDER equ FREE |
BGIFONT_PATH equ '/rd/1/' |
FONT_NAME equ 'LITT' |
TOP =35 |
MODE equ RTF |
INVALHEX equ 0 |
RTF_COLORLESS equ 1 |
RTF_ALIGNLESS equ 2 |
RTF_NO1STLINE equ 4 |
RTF_OPENING equ 8 |
RTF_HELP equ 16 |
RTF_VALID equ 32 |
RTF_BLIND equ 64 |
RTF_TOEOF equ 128 |
RTF_BOTTOM equ 256 |
STEPBYSTEP equ 10 |
DEBUG_BLOCK equ 10 |
SHOWALIGN equ 10 |
GUTTER equ 10 |
BENCH equ 0;1 |
syms equ 12 |
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 ; § १¥à¢¨à®¢ ® |
include 'lang.inc' |
include 'macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§ì áᥬ¡«¥à騪®¢! |
include 'debug.inc' |
if ~ RENDER eq PIX |
TOP=TOP+4 |
include 'bgifont.inc' |
end if |
include 'rtf_lite.inc' |
include 'ascl.inc' |
;--------------------------------------------------------------------- |
;--- ---------------------------------------------- |
;--------------------------------------------------------------------- |
help_file: |
file 'reader.rtf' |
help_end: |
START: |
mov [pitch],2 |
if ~ RENDER eq PIX |
mov edx,FONT_NAME |
mov edi,save_limit |
BGIfont_Prepare |
end if |
start2: |
cmp byte[fname_buf],0 |
je load_file;top_red |
jmp noactivate |
prep_load: |
; mcall 18,3,dword[prcinfo+30] |
noactivate: |
; and ebp,not RTF_OPENING |
; and ebp,not RTF_HELP |
; and [mode],not RTF_OPENING |
and [mode],not (RTF_HELP+RTF_OPENING) |
mov ecx,16 |
mov edi,fileinfo.name |
mov esi,fname_buf |
rep movsd |
load_file: |
xor eax,eax |
mov ebx,fileinfo |
mov [ebx+4],eax |
inc eax |
mov [fileinfo.size],eax |
mcall 58 |
dpd ebx |
and [wSave],0 |
mov [HClick],-100 |
load_help: |
test eax,eax |
jz .sizok |
cmp eax,5 |
je .sizok |
.nosizok: |
mov dword[fileinfo.name],N_A |
.sizok: |
mov eax,ebx |
and eax,RTFSIZE-1 |
add eax,I_END |
mov [tail],eax |
shr ebx,16 |
; dpd ebx |
mov [max_block],ebx |
xor eax,eax |
mov ecx,256 |
mov edi,fileinfo.name |
repne scasb |
sub edi,fileinfo.name+1 |
mov [fname_size],edi |
top_red: |
mov [top],TOP |
red: ; ¯¥à¥à¨á®¢ âì ®ª® |
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª |
;--------------------------------------------------------------------- |
;--- ---------------------------------------- |
;--------------------------------------------------------------------- |
still: |
mcall 10 ; äãªæ¨ï 10 - ¦¤ âì ᮡëâ¨ï |
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª® ? |
je red ; ¥á«¨ ¤ - ¬¥âªã red |
cmp eax,3 ; ¦ â ª®¯ª ? |
je button ; ¥á«¨ ¤ - button |
cmp eax,2 ; ¦ â ª« ¢¨è ? |
je key ; ¥á«¨ ¤ - key |
jmp still ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ç «® 横« |
;--------------------------------------------------------------------- |
key: ; ¦ â ª« ¢¨è ª« ¢¨ âãॠ|
mcall 2 ; äãªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®« (¢ ah) |
cmp ah,104 ; HELP |
jne .nohelp |
.help: |
xor [mode],RTF_HELP |
test [mode],RTF_HELP |
jz load_file |
mov ecx,help_end-help_file |
mov [block_end],ecx |
add [block_end],I_END |
mov [tail],ecx |
add [tail],I_END |
mov esi,help_file |
mov edi,I_END |
rep movsb |
; or [mode],RTF_HELP |
xor eax,eax |
mov [max_block],eax |
jmp top_red |
.nohelp: |
; test [mode],RTF_HELP |
; jz .nohelp2 |
; and [mode],not RTF_HELP |
; cmp dword[fileinfo.name],N_A |
; je still |
; jmp prep_load |
.nohelp2: |
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 |
jne .noalign |
.alignment: |
xor [mode],RTF_ALIGNLESS |
jmp red |
.noalign: |
cmp ah,44 ; < - pitch dec |
jne .nopd |
.decp: |
dec [pitch] |
jmp red |
.nopd: |
cmp ah,46 ; < - pitch inc |
jne .nopi |
.incp: |
inc [pitch] |
jmp red |
.nopi: |
cmp ah,180 ; Home |
je top_red |
mov ebx,dword[prcinfo+46] |
sub ebx,TOP+15 |
cmp ah,183 ;PgDn |
jne .nopgdn |
sub [top],bx |
jmp red |
.nopgdn: |
cmp ah,177 ;arrDn |
jne .noardn |
sub [top],CHARH |
jmp red |
.noardn: |
mov cx,[top] |
cmp ah,184 ;PgUp |
jne .nopgup |
add [top],bx |
cmp [top],TOP |
jl red |
mov [top],TOP |
cmp cx,[top] |
je still |
jmp red |
.nopgup: |
cmp ah,178 ;arrUp |
jne .noarup |
add [top],CHARH |
cmp [top],TOP |
jl red |
mov [top],TOP |
cmp cx,[top] |
je still |
jmp red |
.noarup: |
if RENDER eq FREE |
cmp ah,56 ;zoom+ |
jne .noplus |
.zplus: |
fld [FreeFontscale] |
fmul [Zoomscale] |
.zoom: |
fstp [FreeFontscale] |
jmp red |
.noplus: |
cmp ah,54 ;zoom- |
jne .nominus |
.zminus: |
fld [FreeFontscale] |
fdiv [Zoomscale] |
jmp .zoom |
.nominus: |
end if |
cmp ah,108 ; L - load |
jne stilld |
.file_open: |
or [mode],RTF_OPENING |
opendialog draw_window, prep_load, st_1, fname_buf |
st_1: |
and [mode],not RTF_OPENING |
jmp still;red |
stilld: |
jmp still |
;--------------------------------------------------------------------- |
button: |
mcall 17 ; 17 - ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨ |
cmp ah,2 |
je key.help |
cmp ah,3 |
je key.color |
cmp ah,4 |
je key.alignment |
cmp ah,5 |
je key.file_open |
cmp ah,6 |
je key.incp |
cmp ah,7 |
je key.decp |
if RENDER eq FREE |
cmp ah,8 |
je key.zminus |
cmp ah,9 |
je key.zplus |
end if |
cmp ah, 1 ; ¥á«¨ ¦ â ª®¯ª á ®¬¥à®¬ 1, |
jne .noexit ; ¢¥àãâìáï |
.exit: |
mcall -1 ; ¨ ç¥ ª®¥æ ¯à®£à ¬¬ë |
.noexit: |
cmp ah,20 |
jne still |
mcall 37,1 |
and eax,0xffff |
cmp eax,[HClick] |
je still |
mov [HClick],eax |
sub eax,25 |
mul [HDoc] |
mov ebx,dword[prcinfo+46] |
sub ebx,25 |
div ebx |
dpd eax |
mov [top],TOP |
sub [top],ax |
dps 'B' |
jmp red;still |
;--------------------------------------------------------------------- |
;--- ---------------------------------- |
;--------------------------------------------------------------------- |
draw_window: |
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 |
ret |
.temp12345: |
mcall 4, <8,8>, 0x10DDEEFF, header, headersize-header |
mov esi,ecx |
mcall 47,0x30000,isymImplemented,<114,8> |
add edx,36 shl 16 |
mcall ,,isymMax |
add edx,40 shl 16 |
mov esi,0x104e00e7;0x10f27840 |
cmp dword[fileinfo.name],N_A |
jne .noNA |
mov esi,0x10ff0000 |
.noNA: |
mcall 4,edx,esi,fileinfo.name,[fname_size] |
mov edi,prcinfo |
mcall 9,edi,-1 |
and [mode],not RTF_TOEOF |
mov ebx,[edi+42] |
cmp ebx,[wSave] |
je .nochg |
.chg: |
mov [wSave],ebx |
or [mode],RTF_TOEOF |
and [HDoc],0 |
and [line_count],0 |
mov [HClick],-100 |
.nochg: |
sub ebx,60 |
shl ebx,16 |
mov bx,12 |
mov ecx,5 shl 16+12 |
mov esi,0xb810e7 |
mov edx,2 |
BTN_SPACE equ 14 shl 16 |
mcall 8 ;2 |
sub ebx,BTN_SPACE |
inc edx |
mcall 8,,,,0x459a ;3 |
sub ebx,BTN_SPACE |
inc edx |
mcall ,,,,0x107a30 ;4 |
sub ebx,BTN_SPACE |
inc edx |
mcall ,,,,0xcc0000 ;5 |
sub ebx,BTN_SPACE |
inc edx |
mcall ,,,,0x575f8c ;6 |
sub ebx,BTN_SPACE |
inc edx |
mcall ,,,,0x575f8c ;7 |
if RENDER eq FREE |
sub ebx,BTN_SPACE |
inc edx |
mcall ,,,,0x6a73d0 ;8 |
sub ebx,BTN_SPACE |
inc edx |
mcall ,,,,0xd048c8 ;9 |
end if |
shr ecx,16 |
mov bx,cx |
add ebx,3 shl 16+3 |
mcall 4,,0x10ddeeff,btn_text,btn_end-btn_text |
sub dword[prcinfo+42],LMARGIN |
sub dword[prcinfo+46],CHARH |
if GUTTER eq 1 |
mov ebx,LMARGIN shl 16+20 |
mov ecx,20 |
mov eax,4 |
mov edx,arrow |
mov esi,1 |
.loop1: |
push ecx |
mcall ,,0xff0000 |
pop ecx |
add ebx,50 shl 16 |
loop .loop1 |
end if |
mov ebx,dword[prcinfo+42] |
shl ebx,16 |
add ebx,7 shl 16+7 |
mov ecx,dword[prcinfo+46] |
add ecx,25 shl 16-25 |
mov edx,20+1 shl 29 |
mcall 8 |
mov ecx,[HClick] |
shl ecx,16 |
add ecx,6-3 shl 16 |
mcall 13,,,0xe26830 |
if MODE eq RTF |
test [mode],RTF_OPENING |
jne .ex |
and [mode],not (RTF_BOTTOM);+RTF_TOEOF) |
mov [colorptr],colortbl |
mov eax,DEFCOLOR |
mov edi,colortbl |
mov ecx,16 |
rep stosd |
xor eax,eax |
mov [cGroup],eax |
mov edi,Chp |
mov ecx,SIZE_save |
rep stosb |
mov ax,[top] |
mov word[Free+6],10 |
mov word[Free+4],ax |
mov esi,I_END |
call RtfParse |
dpd eax |
dps 'Lines=' |
mov eax,[line_count] |
dpd eax |
newline |
; movzx eax,word[Free+4] |
; dpd eax |
mov eax,dword[prcinfo+42] |
mov edx,WIN_COLOR |
call draw_progress |
if BENCH eq 1 |
mcall 26,9 |
sub eax,[bench] |
dps <13,10,'Bench='> |
dpd eax |
end if |
else |
mov [char],0 |
mov ebx,10 shl 16+TOP |
mov ecx,16 |
.l0: |
push ecx |
mov ecx,16 |
.l1: |
push ecx |
if RENDER eq BGI |
mov edx,char |
mov ecx,0x48000000 |
mov esi,1 |
BGIfont_Outtext |
else |
mcall 4,,0x10000000,char,1 |
end if |
pop ecx |
inc [char] |
add ebx,(CHARW+3) shl 16 |
loop .l1 |
pop ecx |
add ebx,CHARH+2 |
and ebx,0x0000ffff |
add ebx,10 shl 16 |
loop .l0 |
end if |
.ex: |
mcall 12, 2 ; äãªæ¨ï 12: á®®¡é¨âì ®¡ ®âà¨á®¢ª¥ ®ª |
; 2, § ª®ç¨«¨ à¨á®¢ âì |
ret ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë |
if GUTTER eq 1 |
arrow db 0x19 |
end if |
;--------------------------------------------------------------------- |
;--- ---------------------------------------------- |
;--------------------------------------------------------------------- |
; ¨â¥àä¥©á ¯à®£à ¬¬ë ¬®£®ï§ëçë© |
; ë ¬®¦¥â¥ § ¤ âì ï§ëª ¢ MACROS.INC (lang fix ï§ëª) |
procinfo process_information |
header: |
db 'RTF READER v1. ( ):' |
headersize: |
btn_text: |
if RENDER eq FREE |
db '+ - ' |
end if |
db '< > L A C H' |
btn_end: |
fileinfo: |
dd 0 |
.block: |
dd 0 |
.size dd 1 |
dd I_END |
dd sys_mem |
.name: |
; db '//' |
; db ' /HD/1/RTF/texts/FASM.TXT',0 |
; db '/HD/1/RTF/TEST2.RTF',0 |
; db '/HD/1/RTF/texts/index_ru.RTF',0 |
; db '/HD/1/RTF/texts/stas.RTF',0 |
; db '/HD/1/RTF/texts/zed.RTF',0 |
; db '/HD/1/RTF/PRACT.RTF',0 |
; db '/HD/1/RTF/SETUP2.RTF',0 |
; db '/HD/1/RTF/texts/TC_RU.RTF',0 |
; db '/HD/1/RTF/texts/WORD.RTF',0 |
; db '/HD/1/RTF/texts/WORD97.RTF',0 |
; db '/HD/1/RTF/texts/MASTAPP.RTF',0 |
; db '/HD/1/RTF/texts/1c_tor77.RTF',0 |
; db '/HD/1/RTF/texts/RELATION.RTF',0 |
; db '/HD/1/RTF/texts/PLANETS.RTF',0 |
; db '/HD/1/RTF/texts/LOTRRUS.RTF',0 |
db '/HD/1/RTF/texts/RULEBOOK.RTF',0 |
; db '/HD/1/RTF/texts/RULEBK2.RTF',0 |
; db '/HD/1/RTF/texts/GLEB.RTF',0 |
; db '/HD/1/RTF/texts/DWG13_14.RTF',0 |
; db '/HD/1/RTF/texts/LK.RTF',0 |
; db '/HD/1/RTF/texts/JUSTIFY.RTF',0 |
rb 256-($-.name) |
;--------------------------------------------------------------------- |
;blind db ? |
if RENDER eq PIX |
; rd 2 |
Free rd 9 |
else |
if RENDER eq BGI |
FreeFontscale dd 0.07 |
else |
Zoomscale dd 1.15 |
FreeFontscale dd 0.04 |
end if |
Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0 |
end if |
I_END0: |
if BENCH eq 1 |
bench dd ? |
end if |
tail dd ? |
cGroup dd ? |
Chp: |
CHP |
Pap: |
PAP |
Sep: |
SEP |
Dop: |
DOP |
rds db ? |
ris db ? |
cbBin dd ? |
lParam dd ? |
fSkipDestIfUnk db ? |
mode dd ? |
curheight dw ? |
maxheight dw ? |
RetroBlock dd ? |
RetroSave: |
SAVE |
prcinfo rb 1024 |
RetroPtr dd ? |
colorptr dd ? |
colortbl rd 16 |
ct_end: |
fname_size dd ? |
max_block dd ? |
cur_block dd ? |
HDoc dd ? |
HClick dd ? |
top dw ? |
line_count dd ? |
par_count dd ? |
char db ? |
pitch db ? |
wSave dd ? |
RetroXY dd ? |
RetroGroup dd ? |
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: ; ¬¥âª ª®æ ¯à®£à ¬¬ë |
rb RTFSIZE |
esp1: |
rb ESPSIZE |
sys_mem: |
rb ESPSIZE |
esp_end: |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
/programs/other/rtfread/trunk/rtftype.inc |
---|
0,0 → 1,374 |
macro Return _result |
{ |
mov eax,_result |
jmp .__ex |
} |
macro Epilog |
{ |
.__ex: |
mov [esp+28],eax |
popa |
ret |
} |
macro isdigit _reg, lbl_fail |
{ |
cmp _reg,'0' |
jb lbl_fail |
cmp _reg,'9' |
ja lbl_fail |
} |
macro islower _reg, lbl_fail |
{ |
cmp _reg,'a' |
jb lbl_fail |
cmp _reg,'z' |
ja lbl_fail |
} |
macro isalpha _reg, lbl_fail |
{ |
local .ok |
cmp _reg,'A' |
jb lbl_fail |
cmp _reg,'Z' |
jbe .ok |
islower _reg, lbl_fail |
.ok: |
} |
macro dump _ptr, _len |
{ |
if DEBUG_BLOCK eq 1 |
pusha |
lea edx,[_ptr] |
dps 'Dump at ' |
dpd edx |
newline |
mov eax,0x0d0a |
xchg eax,[edx+_len] |
pusha |
call debug_outstr |
popa |
mov [edx+_len],eax |
mcall 10 |
mcall 2 |
popa |
end if |
} |
macro lods_block |
{ |
local .noeof,.eof,.lod,.nog |
.lod: |
lodsb |
cmp esi,[block_end] |
jb .noeof |
dump esi-20,20 |
mov esi,[cur_block] |
cmp esi,[max_block] |
jae .eof |
if DEBUG_BLOCK eq 1 |
pusha |
mcall 4,[Free+4],0xff0000,sym,1 |
popa |
; dps 'Block=' |
; dpd esi |
end if |
call read_next_block |
; test [mode],RTF_TOEOF |
; jz .nog |
test [mode],RTF_BLIND |
jne .nog |
mov eax,dword[prcinfo+42] |
mul [cur_block] |
div [max_block] |
mov edx,0xff0000 |
call draw_progress |
.nog: |
dump esi,20 |
jmp .noeof;lod |
.eof: |
mov eax,ecOK;ecEndOfFile |
jmp .__ex |
.noeof: |
} |
macro RetError routine, route |
{ |
call routine |
test eax,eax |
if route eq |
je .getc |
else |
je route |
end if |
Return eax |
} |
macro Prcheck _prop |
{ |
local .no |
cmp ch, prop#_prop |
jne .no |
mov esi, _prop |
jmp .checked |
.no: |
} |
macro MemSet _prop,_struc |
{ |
local .no |
cmp al,_prop |
jne .no |
mov ecx,SIZE_#_struc |
mov edi, _struc |
jmp .ms |
.no: |
} |
macro atoi |
{ |
; in: esi->pasParameter |
; out: eax->long |
local .nxt |
push ebx ecx |
xor eax,eax |
xor ebx,ebx |
movzx ecx,byte[esi] |
inc esi |
.nxt: |
lodsb |
sub eax,'0' |
imul ebx,10 |
add ebx,eax |
loop .nxt |
mov eax,ebx |
pop ecx ebx |
} |
macro uc2oem |
{ |
local .ex1 |
push edi |
mov ecx,(oemutbl-uctbl)/2+1 |
mov edi,uctbl |
repne scasw |
jne .ex1 |
sub edi,uctbl |
shr edi,1 |
dec edi |
mov al,[oemutbl+edi] |
.ex1: |
pop edi |
} |
macro ansi2oem |
{ |
local .ex2,.notintbl |
push edi ecx |
mov ecx,oematbl-ansitbl |
mov edi,ansitbl |
repne scasb |
jne .notintbl |
dec edi |
mov al,[oematbl-ansitbl+edi] |
jmp .ex2 |
.notintbl: |
cmp al,0xc0 |
jb .ex2 |
sub al,0x40 |
cmp al,0xb0 |
jb .ex2 |
add al,0x30 |
.ex2: |
pop ecx edi |
} |
draw_progress: |
lea ebx,[eax+05 shl 16] |
mov ecx,dword[prcinfo+46] |
shl ecx,16 |
add ecx,2+5 shl 16 |
mcall 13 |
ret |
fTrue equ 1 |
fFalse equ 0 |
macro CHP ; CHaracter Properties |
{ |
db ?;fBold; 0 |
db ?;fUnderline; 1 |
db ?;fItalic; 2 |
db ?;fColor 3 |
db ?;fFont 4 |
dd ?;fFontSize 5 |
} |
SIZE_Chp equ 9 |
macro PAP ; PAragraph Properties |
{ |
dd ?;xaLeft; ; left indent in twips 0 |
dd ?;xaRight; ; right indent in twips 4 |
dd ?;xaFirst; ; first line indent in twips 8 |
db ?; just; ; justification 12 |
} |
SIZE_Pap equ 13 |
macro SEP |
{ |
dd ?;cCols; ; number of columns 0 |
db ?;sbk; ; section break type 4 |
dd ?;xaPgn; ; x position of page number in twips 5 |
dd ?;yaPgn; ; y position of page number in twips 9 |
db ?;pgnFormat; ; how the page number is formatted 13 |
} ; SEction Properties |
SIZE_Sep equ 14 |
macro DOP |
{ |
dd ?;xaPage; ; page width in twips 0 |
dd ?;yaPage; ; page height in twips 4 |
dd ?;xaLeft; ; left margin in twips 8 |
dd ?;yaTop; ; top margin in twips 12 |
dd ?;xaRight; ; right margin in twips 16 |
dd ?;yaBottom; ; bottom margin in twips 20 |
dd ?;pgnStart; ; starting page number in twips 24 |
db ?;fFacingp; ; facing pages enabled? 28 |
db ?;fLandscape; ; landscape or portrait?? 29 |
} ; ; DOcument Properties |
SIZE_Dop equ 30 |
justL equ 0 |
justF equ 1 |
justR equ 2 |
justC equ 3 |
sbkNon equ 0 |
sbkCol equ 1 |
sbkEvn equ 2 |
sbkOdd equ 3 |
sbkPg equ 4 |
pgDec equ 0 |
pgURom equ 1 |
pgLRom equ 2 |
pgULtr equ 3 |
pgLLtr equ 4 |
rdsNorm equ 0 |
rdsSkip equ 1 ; Rtf Destination State |
rdsColor equ 2 |
risNorm equ 0 |
risBin equ 1 |
risHex equ 2 ; Rtf Internal State |
macro SAVE ; property save macrostructure |
{ |
CHP ;chp; 0 |
PAP ;pap; 9 |
SEP ;sep; 22 |
DOP ;dop; 36 |
RDS db ?;rds; 66 |
RIS db ?;ris; 67 |
} |
SIZE_save equ (SIZE_Chp+SIZE_Pap+SIZE_Sep+SIZE_Dop+2) |
; What types of properties are there? |
ipropBold equ 0 |
ipropItalic equ 1 |
ipropUnderline equ 2 |
ipropLeftInd equ 3 |
ipropRightInd equ 4 |
ipropFirstInd equ 5 |
ipropCols equ 6 |
ipropPgnX equ 7 |
ipropPgnY equ 8 |
ipropXaPage equ 9 |
ipropYaPage equ 10 |
ipropXaLeft equ 11 |
ipropXaRight equ 12 |
ipropYaTop equ 13 |
ipropYaBottom equ 14 |
ipropPgnStart equ 15 |
ipropSbk equ 16 |
ipropPgnFormat equ 17 |
ipropFacingp equ 18 |
ipropLandscape equ 19 |
ipropJust equ 20 |
ipropPard equ 21 |
ipropPlain equ 22 |
ipropSectd equ 23 |
ipropForeColor equ 24 |
ipropFont equ 25 |
ipropFontSize equ 26 |
ipropMax equ 27 |
actnSpec equ 0 |
actnByte equ 1 |
actnWord equ 2 |
actnFloatFS equ 3 |
propChp equ 0 |
propPap equ 1 |
propSep equ 2 |
propDop equ 3 |
macro PROP _actn,_prop,_offset |
{ |
db _actn; 0 ; size of value |
db _prop; 1 ; macrostructure containing value |
db _offset; 2 ; offset of value from base of macrostructure |
} |
PROP_SIZE equ 3 |
ipfnBin equ 0 |
ipfnHex equ 1 |
ipfnSkipDest equ 2 |
idestPict equ 0 |
idestSkip equ 1 |
idestColor equ 2 |
kwdChar equ 0 |
kwdDest equ 1 |
kwdProp equ 2 |
kwdSpec equ 3 |
kwdColor equ 4 |
kwdUC equ 5 |
isymMax =0 |
isymImplemented=0 |
macro SYM _szKeyword,_dflt,_fPassDflt,_kwd,_idx,_impl |
{ |
local .r |
if _impl eq 1 |
isymImplemented=isymImplemented+1 |
end if |
dw _dflt; 0 ; default value to use |
db _fPassDflt; 2 ; true to use default value from this table |
db _kwd; 3 ; base action to take |
db _idx; 4 ; index into property table if kwd == kwdProp |
; index into destination table if kwd == kwdDest |
; character to print if kwd == kwdChar |
db .r-$-1 ; 5 |
db _szKeyword; ; RTF keyword |
.r: |
isymMax=isymMax+1 |
} |
; RTF parser error codes |
ecOK equ 0 ; Everything's fine! |
ecStackUnderflow equ 1 ; Unmatched '}' |
ecStackOverflow equ 2 ; Too many '{' -- memory exhausted |
ecUnmatchedBrace equ 3 ; RTF ended during an open group. |
ecInvalidHex equ 4 ; invalid hex character found in data |
ecBadTable equ 5 ; RTF table (sym or prop) invalid |
ecAssertion equ 6 ; Assertion failure |
ecEndOfFile equ 7 ; End of file reached while reading RTF |
ecOutOfWindow equ 8 ; Decoding interrupted after window edge |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |