1,25 → 1,22 |
;; Calculator for MenuetOS (c) Ville Turjanmaa |
;; |
;; Calculator for MenuetOS (original version) |
;; (c)Ville Turjanmaa |
;; Compile with FASM for Menuet |
;; |
;; Pavel Rymovski (Heavyiron) - kolibri version |
;; 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 |
;; 4)I had used macroses |
;; Calc 1.2 |
;; 1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2 |
;; Calc 1.31 |
;; 1)optimised program |
;; 2)new type of window (you need kernel 114 revision or higher) |
;; Calc 1.32 |
;; 1)fixed arccos |
;; Pavel Rymovski (Heavyiron) |
|
|
appname equ 'Calc ' |
version equ '1.32' |
version equ '1.31' |
|
use32 |
org 0x0 |
35,12 → 32,6 |
|
START: |
|
mov eax,48 |
mov ebx,3 |
mov ecx,sc |
mov edx,sizeof.system_colors |
int 0x40 |
|
red: |
call draw_window |
|
124,6 → 115,7 |
mov [entry_multiplier],eax |
call print_display |
jmp still |
multipl: dd 10,16,2 |
|
no_display_change: |
cmp eax,6 |
220,13 → 212,14 |
cmp eax,25 |
jne no_acos |
fld [trans1] |
fld st0 |
fmul st,st1 |
fld1 |
fsubrp st1,st0 |
fsub st,st1 |
fsqrt |
fxch st1 |
fld1 |
fadd st,st2 |
fsqrt |
fpatan |
fadd st,st0 |
jmp show_result |
|
no_acos: |
448,6 → 441,17 |
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 |
467,7 → 471,8 |
|
no_neg: |
fld [tmp2] |
fist [integer] |
fistp [integer] |
fld [tmp2] |
fisub [integer] |
fldcw [controlWord] |
cmp byte [sign], 0 ; change fraction to positive |
557,7 → 562,7 |
|
.error: |
mov bh, 1 ; Set error code. |
; fstp st0 ; Pop top of fpu stack. |
fstp st0 ; Pop top of fpu stack. |
|
.exit: |
pop di |
647,6 → 652,12 |
|
draw_window: |
|
mov eax,48 |
mov ebx,3 |
mov ecx,sc |
mov edx,sizeof.system_colors |
int 0x40 |
|
mov eax,12 |
mov ebx,1 |
int 0x40 |
854,18 → 865,6 |
integer dd 0 |
decimal dd 0 |
kymppi dd 10 |
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 |
multipl: dd 10,16,2 |
|
dsign: |
muuta1 db '+0000000000.000000' |