Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 484 → Rev 485

/programs/other/calc/trunk/calc.asm
1,14 → 1,14
;; Calculator for MenuetOS (c) Ville Turjanmaa
;;
;; Compile with FASM for Menuet
;; Compile with FASM
;;
;; Pavel Rymovski (Heavyiron) - kolibri version
;; Pavel Rymovski (Heavyiron) - version for KolibriOS
;;
;; What's new:
;; Calc 1.1
;; 1) changed design
;; 2) new procedure of draw window (10 decimal digits, 23 binary, "+" not displayed now)
;; 3) window with skin
;; 4) used macroses
;; Calc 1.2
;; 1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2
;; Calc 1.31
31,7 → 31,7
dd 0x1000 ; esp
dd 0x0,0x0 ; I_Param , I_Icon
 
include 'macros.inc'
include '..\..\..\macros.inc'
 
START:
 
39,7 → 39,7
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
int 0x40
mcall
 
red:
call draw_window
47,7 → 47,8
still:
push 10
pop eax
int 40h
mcall
 
dec eax
jz red
dec eax
55,13 → 56,13
button:
mov al,17 ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
int 0x40
mcall
shr eax,8
jmp testbut
 
key:
mov al,2 ; ¯®«ãç¨âì ASCII-ª®¤ ­ ¦ â®© ª« ¢¨è¨
int 0x40
mcall
shr eax,8
mov edi,asci ; ¯¥à¥¢®¤ ASCII ¢ ¨¤¥­â¨ä¨ª â®à ª­®¯ª¨
mov ecx,18
78,7 → 79,7
cmp eax,1 ; ª­®¯ª  1 - § ªàë⨥ ¯à®£à ¬¬ë
jne noclose
or eax,-1
int 0x40
mcall
noclose:
cmp eax,2
649,7 → 650,7
mov eax,12
mov ebx,1
int 0x40
mcall
xor eax,eax
mov ebx,200 shl 16+255
656,8 → 657,8
mov ecx,200 shl 16+180
mov edx,[sc.work]
or edx,0x33000000
mov edi,header
int 0x40
mov edi,title
mcall
 
mov eax,8
mov ebx,19 shl 16+28
672,7 → 673,7
mov ebx,19 shl 16+28
add ecx,20 shl 16
no_new_row:
int 0x40
mcall
add ebx,30 shl 16
inc edx
cmp edx,39
687,7 → 688,7
mov edx,text
mov esi,33
newline:
int 0x40
mcall
add ebx,20
add edx,33
cmp [edx],byte 'x'
697,7 → 698,7
mov eax,12
mov ebx,2
int 0x40
mcall
 
ret
 
712,7 → 713,7
mov edx,calc
mov esi,1
mov edi,[sc.work]
int 0x40
mcall
 
mov ebx,198 shl 16+8
mov edx,[display_type]
720,7 → 721,7
add edx,display_type_text
mov esi,3
mov edi,[sc.work]
int 0x40
mcall
cmp [dsign],byte '+'
je positive
728,7 → 729,7
mov ecx,0x0
mov edx,dsign
mov esi,1
int 0x40
mcall
positive:
cmp [display_type],0
740,7 → 741,7
mov ecx,0x0
mov edx,dot
mov esi,1
int 0x40
mcall
mov eax,47
mov ebx,10 shl 16
747,13 → 748,13
mov ecx,[integer]
mov edx,120 shl 16+22
mov esi,0x0
int 0x40
mcall
mov ebx,6 shl 16
mov ecx,[decimal]
mov edx,187 shl 16+22
mov esi,0x0
int 0x40
mcall
 
popa
ret
763,7 → 764,7
mov ecx,0x0
mov edx,dot
mov esi,1
int 0x40
mcall
 
cmp [integer],0
je null
773,7 → 774,7
mov ecx,[integer]
mov edx,160 shl 16+22
mov esi,0x0
int 0x40
mcall
 
popa
ret
789,7 → 790,7
mov ecx,[integer]
mov edx,173 shl 16+22
mov esi,0x0
int 0x40
mcall
 
popa
ret
803,7 → 804,7
mov ecx,[integer]
mov edx,32 shl 16+22
mov esi,0x0
int 0x40
mcall
 
popa
ret
814,7 → 815,7
mov ecx,0
mov edx,214 shl 16+22
mov esi,0x0
int 0x40
mcall
 
popa
ret
843,7 → 844,7
 
;data
 
header db appname,version,0
title db appname,version,0
 
display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary
entry_multiplier dd 10