2006-09-19 12:58:07 +02:00
|
|
|
|
;; Calculator for MenuetOS (original version)
|
2006-07-27 14:29:46 +02:00
|
|
|
|
;; (c)Ville Turjanmaa
|
2006-01-03 10:43:31 +01:00
|
|
|
|
;; Compile with FASM for Menuet
|
2006-09-19 12:58:07 +02:00
|
|
|
|
;;
|
|
|
|
|
;;What's new:
|
|
|
|
|
;; Calc 1.1
|
|
|
|
|
;; 1)changed design
|
2006-07-27 14:29:46 +02:00
|
|
|
|
;; 2)new procedure of draw window (10 decimal digits, 23 binary, "+" not displayed now)
|
|
|
|
|
;; 3)window with skin
|
|
|
|
|
;; 4)I had used macroses
|
2006-09-19 12:58:07 +02:00
|
|
|
|
;; Calc 1.2
|
2006-07-27 14:29:46 +02:00
|
|
|
|
;; 1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2
|
2006-09-19 12:58:07 +02:00
|
|
|
|
;; Calc 1.31
|
2006-07-27 14:29:46 +02:00
|
|
|
|
;; 1)optimised program
|
2006-09-19 12:58:07 +02:00
|
|
|
|
;; 2)new type of window (you need kernel 114 revision or higher)
|
|
|
|
|
;; Pavel Rymovski (Heavyiron)
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
appname equ 'Calc '
|
|
|
|
|
version equ '1.31'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
use32
|
|
|
|
|
org 0x0
|
2006-07-27 14:29:46 +02:00
|
|
|
|
db 'MENUET01' ; 8 byte id
|
2006-01-03 10:43:31 +01:00
|
|
|
|
dd 0x01 ; header version
|
|
|
|
|
dd START ; start of code
|
|
|
|
|
dd I_END ; size of image
|
|
|
|
|
dd 0x1000 ; memory for app
|
|
|
|
|
dd 0x1000 ; esp
|
2006-09-19 12:58:07 +02:00
|
|
|
|
dd 0x0,0x0 ; I_Param , I_Icon
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
include 'macros.inc'
|
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
START:
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
red:
|
2006-01-03 10:43:31 +01:00
|
|
|
|
call draw_window
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
still:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
push 10
|
|
|
|
|
pop eax
|
|
|
|
|
int 40h
|
|
|
|
|
dec eax
|
|
|
|
|
jz red
|
|
|
|
|
dec eax
|
|
|
|
|
jz key
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
button:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov al,17 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䨪<EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>⮩ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int 0x40
|
2006-07-27 14:29:46 +02:00
|
|
|
|
shr eax,8
|
|
|
|
|
jmp testbut
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
|
|
|
|
key:
|
|
|
|
|
mov al,2 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ASCII-<2D><><EFBFBD> <20><><EFBFBD><EFBFBD>⮩ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int 0x40
|
2006-01-03 10:43:31 +01:00
|
|
|
|
shr eax,8
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov edi,asci ; <20><>ॢ<EFBFBD><E0A5A2> ASCII <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䨪<EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2006-07-27 14:29:46 +02:00
|
|
|
|
mov ecx,18
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
|
|
|
|
jne still
|
|
|
|
|
sub edi,asci
|
|
|
|
|
dec edi
|
|
|
|
|
mov esi,butid
|
|
|
|
|
add esi,edi
|
|
|
|
|
lodsb
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
testbut:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp eax,1 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 - <20><><EFBFBD><EFBFBD><EFBFBD>⨥ <20>ணࠬ<E0AEA3><E0A0AC>
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne noclose
|
2006-09-19 12:58:07 +02:00
|
|
|
|
or eax,-1
|
|
|
|
|
int 0x40
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
noclose:
|
|
|
|
|
cmp eax,2
|
|
|
|
|
jne no_reset
|
|
|
|
|
call clear_all
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_reset:
|
|
|
|
|
finit
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ebx,muuta1 ; <20><>ॢ<EFBFBD><E0A5A2> <20> <20><>ଠ<EFBFBD> FPU
|
|
|
|
|
mov esi,18
|
|
|
|
|
call atof
|
|
|
|
|
fstp [trans1]
|
|
|
|
|
mov ebx,muuta2
|
|
|
|
|
mov esi,18
|
|
|
|
|
call atof
|
|
|
|
|
fst [trans2]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,33
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_sign
|
|
|
|
|
cmp [dsign],byte '-'
|
|
|
|
|
jne no_m
|
|
|
|
|
mov [dsign],byte '+'
|
|
|
|
|
call print_display
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_m:
|
|
|
|
|
mov [dsign],byte '-'
|
|
|
|
|
call print_display
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_sign:
|
|
|
|
|
cmp eax,3
|
|
|
|
|
jne no_display_change
|
|
|
|
|
inc [display_type]
|
|
|
|
|
cmp [display_type],2
|
|
|
|
|
jbe display_continue
|
|
|
|
|
mov [display_type],0
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
display_continue:
|
|
|
|
|
mov eax,[display_type]
|
|
|
|
|
mov eax,[multipl+eax*4]
|
|
|
|
|
mov [entry_multiplier],eax
|
|
|
|
|
call print_display
|
|
|
|
|
jmp still
|
2006-09-19 12:58:07 +02:00
|
|
|
|
multipl: dd 10,16,2
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
no_display_change:
|
|
|
|
|
cmp eax,6
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jb no_a_f
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp eax,11
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jg no_a_f
|
2006-01-03 10:43:31 +01:00
|
|
|
|
add eax,4
|
|
|
|
|
call number_entry
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
|
|
|
|
no_a_f:
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp eax,12
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jb no_13
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp eax,14
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jg no_13
|
2006-01-03 10:43:31 +01:00
|
|
|
|
sub eax,11
|
|
|
|
|
call number_entry
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_13:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,19
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jb no_46
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,21
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jg no_46
|
2006-07-27 14:29:46 +02:00
|
|
|
|
sub eax,15
|
2006-01-03 10:43:31 +01:00
|
|
|
|
call number_entry
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_46:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,26
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jb no_79
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,28
|
2006-09-19 12:58:07 +02:00
|
|
|
|
jg no_79
|
2006-07-27 14:29:46 +02:00
|
|
|
|
sub eax,19
|
2006-01-03 10:43:31 +01:00
|
|
|
|
call number_entry
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_79:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,34
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
xor eax,eax
|
2006-01-03 10:43:31 +01:00
|
|
|
|
call number_entry
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
|
|
|
|
no_0:
|
|
|
|
|
cmp eax,35
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_id
|
|
|
|
|
inc [id]
|
|
|
|
|
and [id],1
|
|
|
|
|
mov [new_dec],100000
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_id:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,17
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_sin
|
|
|
|
|
fld [trans1]
|
|
|
|
|
fsin
|
|
|
|
|
jmp show_result
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_sin:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
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
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_int
|
|
|
|
|
fld [trans1]
|
|
|
|
|
frndint
|
|
|
|
|
jmp show_result
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_int:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,23
|
|
|
|
|
jne no_1x
|
|
|
|
|
fld1
|
2006-10-11 00:20:38 +02:00
|
|
|
|
fdiv [trans1]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
jmp show_result
|
|
|
|
|
|
|
|
|
|
no_1x:
|
|
|
|
|
cmp eax,24
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_cos
|
|
|
|
|
fld [trans1]
|
|
|
|
|
fcos
|
|
|
|
|
jmp show_result
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_cos:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,25
|
|
|
|
|
jne no_acos
|
|
|
|
|
fld [trans1]
|
|
|
|
|
fld1
|
|
|
|
|
fsub st,st1
|
|
|
|
|
fsqrt
|
|
|
|
|
fld1
|
|
|
|
|
fadd st,st2
|
|
|
|
|
fsqrt
|
|
|
|
|
fpatan
|
|
|
|
|
fadd st,st0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp show_result
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
|
|
|
|
no_acos:
|
|
|
|
|
cmp eax,30
|
|
|
|
|
jne no_x2
|
2006-01-03 10:43:31 +01:00
|
|
|
|
fld [trans1]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
fmul st,st0
|
|
|
|
|
jmp show_result
|
|
|
|
|
|
|
|
|
|
no_x2:
|
|
|
|
|
cmp eax,31
|
|
|
|
|
jne no_tan
|
2006-01-03 10:43:31 +01:00
|
|
|
|
fld [trans1]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
fptan
|
|
|
|
|
fstp st2
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp show_result
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_tan:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,32
|
|
|
|
|
jne no_atan
|
|
|
|
|
fld [trans1]
|
|
|
|
|
fld1
|
|
|
|
|
fpatan
|
|
|
|
|
jmp show_result
|
|
|
|
|
|
|
|
|
|
no_atan:
|
|
|
|
|
cmp eax,38
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_pi
|
|
|
|
|
fldpi
|
|
|
|
|
jmp show_result
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_pi:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,37
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_sqrt
|
|
|
|
|
fld [trans1]
|
|
|
|
|
fsqrt
|
|
|
|
|
jmp show_result
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_sqrt:
|
|
|
|
|
cmp eax,15
|
|
|
|
|
jne no_add
|
|
|
|
|
call calculate
|
|
|
|
|
call new_entry
|
|
|
|
|
mov [calc],'+'
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_add:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,22
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_sub
|
|
|
|
|
call calculate
|
|
|
|
|
call new_entry
|
|
|
|
|
mov [calc],'-'
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_sub:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,29
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_div
|
|
|
|
|
call calculate
|
|
|
|
|
call new_entry
|
|
|
|
|
mov [calc],'/'
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_div:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,36
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_mul
|
|
|
|
|
call calculate
|
|
|
|
|
mov [calc],'*'
|
|
|
|
|
call new_entry
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_mul:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp eax,39
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_calc
|
|
|
|
|
call calculate
|
|
|
|
|
jmp still
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_calc:
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
show_result:
|
|
|
|
|
call ftoa
|
|
|
|
|
call print_display
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
calculate:
|
|
|
|
|
pusha
|
|
|
|
|
cmp [calc],' '
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je no_calculation
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [calc],'/'
|
|
|
|
|
jne no_cdiv
|
|
|
|
|
fdiv [trans1]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_cdiv:
|
|
|
|
|
cmp [calc],'*'
|
|
|
|
|
jne no_cmul
|
|
|
|
|
fmul [trans1]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_cmul:
|
|
|
|
|
cmp [calc],'+'
|
|
|
|
|
jne no_cadd
|
|
|
|
|
fadd [trans1]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_cadd:
|
|
|
|
|
cmp [calc],'-'
|
|
|
|
|
jne no_cdec
|
|
|
|
|
fsub [trans1]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_cdec:
|
|
|
|
|
call ftoa
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_calculation:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
call print_display
|
2006-01-03 10:43:31 +01:00
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
number_entry:
|
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
|
|
cmp eax,[entry_multiplier]
|
|
|
|
|
jge no_entry
|
|
|
|
|
cmp [id],1
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je decimal_entry
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,[integer]
|
2006-10-11 00:20:38 +02:00
|
|
|
|
test ebx,0xF0000000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
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
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
|
|
|
|
to_muuta:
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
mov al,[dsign]
|
|
|
|
|
mov esi,muuta0
|
|
|
|
|
mov edi,muuta1
|
|
|
|
|
mov ecx,18
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov [muuta1],al
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov edi,muuta1+10 ; 楫<><E6A5AB>
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax,[integer]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
new_to_muuta1:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
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
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov edi,muuta1+17 ; <20><EFBFBD><E0AEA1><EFBFBD>
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax,[decimal]
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
new_to_muuta2:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
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
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
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
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
ftoa: ; fpu st0 -> [integer],[decimal]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
pusha
|
|
|
|
|
fst [tmp2]
|
|
|
|
|
fstcw [controlWord] ; set truncate integer mode
|
|
|
|
|
mov ax,[controlWord]
|
|
|
|
|
mov [tmp], ax
|
2006-09-19 12:58:07 +02:00
|
|
|
|
or [tmp], word 0x0c00
|
2006-01-03 10:43:31 +01:00
|
|
|
|
fldcw [tmp]
|
|
|
|
|
ftst ; test if st0 is negative
|
|
|
|
|
fstsw ax
|
2006-07-27 14:29:46 +02:00
|
|
|
|
and ax, 0x4500
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov [sign], 0
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp ax, 0x0100
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_neg
|
|
|
|
|
mov [sign],1
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_neg:
|
2006-10-11 00:20:38 +02:00
|
|
|
|
fld [tmp2]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
fistp [integer]
|
|
|
|
|
fld [tmp2]
|
|
|
|
|
fisub [integer]
|
|
|
|
|
fldcw [controlWord]
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp byte [sign], 0 ; change fraction to positive
|
|
|
|
|
je no_neg2
|
2006-01-03 10:43:31 +01:00
|
|
|
|
fchs
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_neg2:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov [res],0 ; convert 6 decimal numbers
|
2006-01-03 10:43:31 +01:00
|
|
|
|
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]
|
2006-10-11 00:20:38 +02:00
|
|
|
|
fst [tmp2]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
ftst
|
|
|
|
|
fstsw ax
|
2006-10-11 00:20:38 +02:00
|
|
|
|
test ax,1
|
|
|
|
|
jnz real_done
|
|
|
|
|
fld [tmp2]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
dec edi
|
2006-10-11 00:20:38 +02:00
|
|
|
|
jz real_done
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp newd
|
|
|
|
|
|
|
|
|
|
real_done:
|
|
|
|
|
mov eax,[res]
|
|
|
|
|
mov [decimal],eax
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp [integer],0x80000000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_error
|
|
|
|
|
call clear_all
|
|
|
|
|
mov [calc],'E'
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_error:
|
|
|
|
|
mov [dsign],byte '+'
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp [sign],byte 0 ; convert negative result
|
|
|
|
|
je no_negative
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax,[integer]
|
|
|
|
|
not eax
|
|
|
|
|
inc eax
|
|
|
|
|
mov [integer],eax
|
|
|
|
|
mov [dsign],byte '-'
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_negative:
|
|
|
|
|
call to_muuta
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
atof:
|
|
|
|
|
push ax
|
|
|
|
|
push di
|
|
|
|
|
fldz
|
|
|
|
|
mov di, 0
|
|
|
|
|
cmp si, 0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je .error ; Jump if string has 0 length.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov byte [sign], 0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp byte [bx], '+' ; Take care of leading '+' or '-'.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne .noPlus
|
|
|
|
|
inc di
|
|
|
|
|
jmp .noMinus
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
.noPlus:
|
|
|
|
|
cmp byte [bx], '-'
|
|
|
|
|
jne .noMinus
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov byte [sign], 1 ; Number is negative.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
inc di
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
.noMinus:
|
|
|
|
|
cmp si, di
|
|
|
|
|
je .error
|
|
|
|
|
call atof_convertWholePart
|
|
|
|
|
jc .error
|
|
|
|
|
call atof_convertFractionalPart
|
|
|
|
|
jc .error
|
|
|
|
|
cmp byte [sign], 0
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je .dontNegate
|
|
|
|
|
fchs ; Negate value
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
.dontNegate:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov bh, 0 ; Set bh to indicate the string is a valid number.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp .exit
|
|
|
|
|
|
|
|
|
|
.error:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov bh, 1 ; Set error code.
|
|
|
|
|
fstp st0 ; Pop top of fpu stack.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
.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
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp al, '0' ; Make sure character is a digit.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
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
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp si, di ; Jump if end of string has been reached.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
je .exit
|
|
|
|
|
jmp .mainLoop
|
|
|
|
|
|
|
|
|
|
.error:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
stc ; Set error (carry) flag.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.exit:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
clc ; Clear error (carry) flag.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
atof_convertFractionalPart:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
fld1 ; Load 1 to TOS. This will be the value of the decimal place.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
.mainLoop:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp si, di ; Jump if end of string has been reached.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
je .exit
|
2006-09-19 12:58:07 +02:00
|
|
|
|
inc di ; Move past the decimal point.
|
|
|
|
|
cmp si, di ; Jump if end of string has been reached.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
je .exit
|
|
|
|
|
mov al, [bx + di]
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp al, '0' ; Make sure character is a digit.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jb .error
|
|
|
|
|
cmp al, '9'
|
|
|
|
|
ja .error
|
2006-09-19 12:58:07 +02:00
|
|
|
|
fdiv dword [ten] ; Next decimal place
|
2006-01-03 10:43:31 +01:00
|
|
|
|
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:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
stc ; Set error (carry) flag.
|
|
|
|
|
fstp st0 ; Pop top of fpu stack.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.exit:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
clc ; Clear error (carry) flag.
|
|
|
|
|
fstp st0 ; Pop top of fpu stack.
|
2006-01-03 10:43:31 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
; *********************************************
|
2006-09-19 12:58:07 +02:00
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW *********
|
2006-01-03 10:43:31 +01:00
|
|
|
|
; *********************************************
|
|
|
|
|
|
|
|
|
|
draw_window:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
|
|
|
|
mov eax,48
|
|
|
|
|
mov ebx,3
|
|
|
|
|
mov ecx,sc
|
|
|
|
|
mov edx,sizeof.system_colors
|
|
|
|
|
int 0x40
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,12
|
|
|
|
|
mov ebx,1
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-10-11 00:20:38 +02:00
|
|
|
|
xor eax,eax
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ebx,200*65536+255
|
|
|
|
|
mov ecx,200*65536+180
|
|
|
|
|
mov edx,[sc.work]
|
|
|
|
|
or edx,0x33000000
|
|
|
|
|
mov edi,header
|
|
|
|
|
int 0x40
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,8
|
|
|
|
|
mov ebx,19*65536+28
|
|
|
|
|
mov ecx,49*65536+18
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edx,6
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov esi,[sc.work_button]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edi,7
|
|
|
|
|
newbutton:
|
|
|
|
|
dec edi
|
|
|
|
|
jnz no_new_row
|
2006-07-27 14:29:46 +02:00
|
|
|
|
mov edi,7
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ebx,19*65536+28
|
2006-01-03 10:43:31 +01:00
|
|
|
|
add ecx,20*65536
|
|
|
|
|
no_new_row:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
int 0x40
|
2006-01-03 10:43:31 +01:00
|
|
|
|
add ebx,30*65536
|
|
|
|
|
inc edx
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp edx,39
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jbe newbutton
|
2006-07-27 14:29:46 +02:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mcall ,199*65536+28,49*65536+18,2 ; 'C'
|
|
|
|
|
mcall ,220*65536+8,7*65536+8,3 ; 'dec-bin-hex'
|
|
|
|
|
|
|
|
|
|
mov eax,4
|
|
|
|
|
mov ebx,27*65536+54
|
|
|
|
|
mov ecx,[sc.work_button_text]
|
|
|
|
|
mov edx,text
|
|
|
|
|
mov esi,33
|
2006-01-03 10:43:31 +01:00
|
|
|
|
newline:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
int 0x40
|
2006-07-27 14:29:46 +02:00
|
|
|
|
add ebx,20
|
2006-09-19 12:58:07 +02:00
|
|
|
|
add edx,33
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edx],byte 'x'
|
|
|
|
|
jne newline
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
call print_display
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
|
|
|
|
mov eax,12
|
|
|
|
|
mov ebx,2
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
print_display:
|
|
|
|
|
pusha
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mcall 13,18*65536+210,19*65536+13,0xffffff
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax,4
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ebx,135*65536+7
|
|
|
|
|
mov ecx,[sc.work_text]
|
|
|
|
|
or ecx,0x40000000
|
|
|
|
|
mov edx,calc
|
|
|
|
|
mov esi,1
|
|
|
|
|
mov edi,[sc.work]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov ebx,198*65536+8
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edx,[display_type]
|
|
|
|
|
shl edx,2
|
|
|
|
|
add edx,display_type_text
|
|
|
|
|
mov esi,3
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov edi,[sc.work]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp [dsign],byte '+'
|
2006-09-19 12:58:07 +02:00
|
|
|
|
je positive
|
|
|
|
|
mov ebx,23*65536+22
|
|
|
|
|
mov ecx,0x0
|
|
|
|
|
mov edx,dsign
|
|
|
|
|
mov esi,1
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
positive:
|
|
|
|
|
cmp [display_type],0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne no_display_decimal
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp [decimal],0
|
|
|
|
|
je whole
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
|
|
|
|
mov ebx,180*65536+22
|
|
|
|
|
mov ecx,0x0
|
|
|
|
|
mov edx,dot
|
|
|
|
|
mov esi,1
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov eax,47
|
|
|
|
|
mov ebx,10*65536
|
|
|
|
|
mov ecx,[integer]
|
|
|
|
|
mov edx,120*65536+22
|
|
|
|
|
mov esi,0x0
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
mov ebx,6*65536
|
|
|
|
|
mov ecx,[decimal]
|
|
|
|
|
mov edx,187*65536+22
|
|
|
|
|
mov esi,0x0
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
whole:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov ebx,220*65536+22
|
|
|
|
|
mov ecx,0x0
|
|
|
|
|
mov edx,dot
|
|
|
|
|
mov esi,1
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp [integer],0
|
|
|
|
|
je null
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
|
|
|
|
mov eax,47
|
|
|
|
|
mov ebx,10*65536
|
|
|
|
|
mov ecx,[integer]
|
|
|
|
|
mov edx,160*65536+22
|
|
|
|
|
mov esi,0x0
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
popa
|
|
|
|
|
ret
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_display_decimal:
|
|
|
|
|
cmp [display_type],1
|
|
|
|
|
jne no_display_hexadecimal
|
2006-09-19 12:58:07 +02:00
|
|
|
|
cmp [integer],0
|
|
|
|
|
je null
|
|
|
|
|
|
|
|
|
|
mov eax,47
|
|
|
|
|
mov ebx,256+8*65536
|
|
|
|
|
mov ecx,[integer]
|
|
|
|
|
mov edx,173*65536+22
|
|
|
|
|
mov esi,0x0
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
no_display_hexadecimal:
|
2006-07-27 14:29:46 +02:00
|
|
|
|
cmp [integer],0
|
|
|
|
|
je null
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
|
|
|
|
mov eax,47
|
|
|
|
|
mov ebx,2*256+32*65536
|
|
|
|
|
mov ecx,[integer]
|
|
|
|
|
mov edx,32*65536+22
|
|
|
|
|
mov esi,0x0
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
null:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
mov eax,47
|
|
|
|
|
mov ebx,1*65536
|
|
|
|
|
mov ecx,0
|
|
|
|
|
mov edx,214*65536+22
|
|
|
|
|
mov esi,0x0
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
;data
|
|
|
|
|
|
|
|
|
|
header db appname,version,0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-07-27 14:29:46 +02:00
|
|
|
|
display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary
|
2006-01-03 10:43:31 +01:00
|
|
|
|
entry_multiplier dd 10
|
2006-07-27 14:29:46 +02:00
|
|
|
|
display_type_text db 'dec hex bin'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-09-19 12:58:07 +02:00
|
|
|
|
dot db '.'
|
|
|
|
|
calc db ' '
|
2006-01-03 10:43:31 +01:00
|
|
|
|
integer dd 0
|
|
|
|
|
decimal dd 0
|
|
|
|
|
kymppi dd 10
|
|
|
|
|
|
|
|
|
|
dsign:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
muuta1 db '+0000000000.000000'
|
|
|
|
|
muuta2 db '+0000000000.000000'
|
|
|
|
|
muuta0 db '+0000000000.000000'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
text:
|
2006-09-19 12:58:07 +02:00
|
|
|
|
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 = '
|
2006-07-27 14:29:46 +02:00
|
|
|
|
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
|
2006-09-19 12:58:07 +02:00
|
|
|
|
|
|
|
|
|
I_END:
|
|
|
|
|
|
|
|
|
|
sc system_colors
|