1,22 → 1,25 |
;; Calculator for MenuetOS (original version) |
;; (c)Ville Turjanmaa |
;; Calculator for MenuetOS (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)I had used macroses |
;; 4) 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) |
;; Pavel Rymovski (Heavyiron) |
;; Calc 1.32 |
;; 1)fixed arccos |
|
|
appname equ 'Calc ' |
version equ '1.31' |
version equ '1.32' |
|
use32 |
org 0x0 |
32,6 → 35,12 |
|
START: |
|
mov eax,48 |
mov ebx,3 |
mov ecx,sc |
mov edx,sizeof.system_colors |
int 0x40 |
|
red: |
call draw_window |
|
115,7 → 124,6 |
mov [entry_multiplier],eax |
call print_display |
jmp still |
multipl: dd 10,16,2 |
|
no_display_change: |
cmp eax,6 |
212,14 → 220,13 |
cmp eax,25 |
jne no_acos |
fld [trans1] |
fld st0 |
fmul st,st1 |
fld1 |
fsub st,st1 |
fsubrp st1,st0 |
fsqrt |
fld1 |
fadd st,st2 |
fsqrt |
fxch st1 |
fpatan |
fadd st,st0 |
jmp show_result |
|
no_acos: |
441,17 → 448,6 |
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 |
471,8 → 467,7 |
|
no_neg: |
fld [tmp2] |
fistp [integer] |
fld [tmp2] |
fist [integer] |
fisub [integer] |
fldcw [controlWord] |
cmp byte [sign], 0 ; change fraction to positive |
562,7 → 557,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 |
652,12 → 647,6 |
|
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 |
865,6 → 854,18 |
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' |