Subversion Repositories Kolibri OS

Rev

Rev 967 | Rev 2745 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;   Calculator for MenuetOS (c) Ville Turjanmaa
  2. ;;  
  3. ;;   Compile with FASM
  4. ;;  
  5. ;;   Pavel Rymovski (Heavyiron) - version for KolibriOS
  6. ;;
  7. ;; What's new:
  8. ;;   Calc 1.1
  9. ;;           1) changed design
  10. ;;           2) new procedure of draw window (10 decimal digits, 23 binary, "+" not displayed now)
  11. ;;           3) window with skin
  12. ;;   Calc 1.2
  13. ;;           1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2
  14. ;;   Calc 1.31
  15. ;;           1)optimised program
  16. ;;           2)new type of window (you need kernel 114 revision or higher)
  17. ;;   Calc 1.32
  18. ;;           1)fixed arccos
  19.  
  20.  
  21. appname equ 'Calc '
  22. version    equ '1.32'
  23.  
  24. use32
  25.                org    0x0
  26.                db    'MENUET01'            ; 8 byte id
  27.                dd     0x01                      ; header version
  28.                dd     START                    ; start of code
  29.                dd     I_END                    ; size of image
  30.                dd     0x1000                  ; memory for app
  31.                dd     0x1000                  ; esp
  32.                dd     0x0,0x0                 ; I_Param , I_Icon
  33.  
  34. include '..\..\..\macros.inc'
  35.  
  36. START:
  37.  
  38.  red:
  39.     call draw_window
  40.  
  41.  still:  
  42.     push 10
  43.     pop eax
  44.     mcall
  45.  
  46.     dec eax
  47.     jz red
  48.     dec eax
  49.     jz key
  50.  
  51.   button:
  52.     mov  al,17      ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
  53.     mcall
  54.     shr  eax,8
  55.     jmp  testbut
  56.  
  57.   key:        
  58.     mov  al,2       ; ¯®«ãç¨âì ASCII-ª®¤ ­ ¦ â®© ª« ¢¨è¨
  59.     mcall
  60.     shr  eax,8
  61.     mov  edi,asci   ; ¯¥à¥¢®¤ ASCII ¢ ¨¤¥­â¨ä¨ª â®à ª­®¯ª¨
  62.     mov  ecx,18
  63.     cld
  64.     repne scasb
  65.     jne  still
  66.     sub  edi,asci
  67.     dec  edi
  68.     mov  esi,butid
  69.     add  esi,edi
  70.     lodsb
  71.      
  72.   testbut:
  73.     cmp  eax,1      ; ª­®¯ª  1 - § ªàë⨥ ¯à®£à ¬¬ë
  74.     jne  noclose
  75.     or   eax,-1
  76.     mcall
  77.  
  78.   noclose:
  79.     cmp  eax,2
  80.     jne  no_reset
  81.     call clear_all
  82.     jmp  still
  83.  
  84.   no_reset:
  85.     finit
  86.     mov  ebx,muuta1  ; ¥à¥¢®¤ ¢ ä®à¬ â FPU
  87.     mov  esi,18
  88.     call atof
  89.     fstp [trans1]
  90.     mov  ebx,muuta2
  91.     mov  esi,18
  92.     call atof
  93.     fst  [trans2]
  94.    
  95.     cmp  eax,33
  96.     jne  no_sign
  97.     cmp  [dsign],byte '-'
  98.     jne  no_m
  99.     mov  [dsign],byte '+'
  100.     call print_display
  101.     jmp  still
  102.  
  103.   no_m:
  104.     mov  [dsign],byte '-'
  105.     call print_display
  106.     jmp  still
  107.  
  108.   no_sign:
  109.     cmp  eax,3
  110.     jne  no_display_change
  111.     inc  [display_type]
  112.     cmp  [display_type],2
  113.     jbe  display_continue
  114.     mov  [display_type],0
  115.  
  116.   display_continue:
  117.     mov  eax,[display_type]
  118.     mov  eax,[multipl+eax*4]
  119.     mov  [entry_multiplier],eax
  120.     call print_display
  121.     jmp  still
  122.  
  123.   no_display_change:
  124.     cmp  eax,6
  125.     jb   no_a_f
  126.     cmp  eax,11
  127.     jg   no_a_f
  128.     add  eax,4
  129.     call number_entry
  130.     jmp  still
  131.    
  132.    no_a_f:
  133.     cmp  eax,12
  134.     jb   no_13
  135.     cmp  eax,14
  136.     jg   no_13
  137.     sub  eax,11
  138.     call number_entry
  139.     jmp  still
  140.    
  141.    no_13:
  142.     cmp  eax,19
  143.     jb   no_46
  144.     cmp  eax,21
  145.     jg   no_46
  146.     sub  eax,15
  147.     call number_entry
  148.     jmp  still
  149.    
  150.    no_46:
  151.     cmp  eax,26
  152.     jb   no_79
  153.     cmp  eax,28
  154.     jg   no_79
  155.     sub  eax,19
  156.     call number_entry
  157.     jmp  still
  158.    
  159.    no_79:
  160.     cmp  eax,34
  161.     jne  no_0
  162.     xor  eax,eax
  163.     call number_entry
  164.     jmp  still
  165.    
  166.    no_0:
  167.     cmp  eax,35
  168.     jne  no_id
  169.     inc  [id]
  170.     and  [id],1
  171.     mov  [new_dec],100000
  172.     jmp  still
  173.  
  174.   no_id:
  175.     cmp  eax,17
  176.     jne  no_sin
  177.     fld  [trans1]
  178.     fsin
  179.     jmp  show_result
  180.  
  181.   no_sin:
  182.     cmp  eax,18
  183.     jne  no_asin
  184.     fld  [trans1]
  185.     fld  st0
  186.     fmul st,st1
  187.     fld1
  188.     fsubrp  st1,st0
  189.     fsqrt
  190.     fpatan
  191.     jmp  show_result
  192.  
  193.   no_asin:
  194.     cmp  eax,16
  195.     jne  no_int
  196.     fld  [trans1]
  197.     frndint
  198.     jmp  show_result
  199.  
  200.   no_int:
  201.     cmp  eax,23
  202.     jne  no_1x
  203.     fld1
  204.     fdiv [trans1]
  205.     jmp  show_result
  206.    
  207.   no_1x:  
  208.     cmp  eax,24
  209.     jne  no_cos
  210.     fld  [trans1]
  211.     fcos
  212.     jmp  show_result
  213.  
  214.   no_cos:
  215.     cmp  eax,25
  216.     jne  no_acos
  217.     fld  [trans1]
  218.     fld st0
  219.     fmul st,st1
  220.     fld1
  221.     fsubrp st1,st0
  222.     fsqrt
  223.     fxch st1
  224.     fpatan
  225.     jmp  show_result
  226.  
  227.   no_acos:  
  228.     cmp  eax,30
  229.     jne  no_x2
  230.     fld  [trans1]
  231.     fmul st,st0
  232.     jmp  show_result
  233.    
  234.   no_x2:  
  235.     cmp  eax,31
  236.     jne  no_tan
  237.     fld  [trans1]
  238.     fptan
  239.     fstp st2
  240.     jmp  show_result
  241.  
  242.   no_tan:
  243.     cmp  eax,32
  244.     jne  no_atan
  245.     fld  [trans1]
  246.     fld1
  247.     fpatan
  248.     jmp  show_result
  249.    
  250.    no_atan:
  251.     cmp  eax,38
  252.     jne  no_pi
  253.     fldpi
  254.     jmp  show_result
  255.    
  256.    no_pi:
  257.     cmp  eax,37
  258.     jne  no_sqrt
  259.     fld  [trans1]
  260.     fsqrt
  261.     jmp  show_result
  262.  
  263.   no_sqrt:
  264.     cmp  eax,15
  265.     jne  no_add
  266.     call calculate
  267.     call new_entry
  268.     mov  [calc],'+'
  269.     jmp  still
  270.  
  271.   no_add:
  272.     cmp  eax,22
  273.     jne  no_sub
  274.     call calculate
  275.     call new_entry
  276.     mov  [calc],'-'
  277.     jmp  still
  278.  
  279.   no_sub:
  280.     cmp  eax,29
  281.     jne  no_div
  282.     call calculate
  283.     call new_entry
  284.     mov  [calc],'/'
  285.     jmp  still
  286.  
  287.   no_div:
  288.     cmp  eax,36
  289.     jne  no_mul
  290.     call calculate
  291.     mov  [calc],'*'
  292.     call new_entry
  293.     jmp  still
  294.  
  295.   no_mul:
  296.     cmp    eax,39
  297.     jne    no_calc
  298.     call   calculate
  299.     jmp    still
  300.  
  301.   no_calc:
  302.     jmp  still
  303.  
  304.   show_result:
  305.     call   ftoa
  306.     call   print_display
  307.     jmp    still
  308.  
  309. error:
  310.     jmp  still
  311.  
  312. calculate:
  313.     pusha
  314.     cmp  [calc],' '
  315.     je   no_calculation
  316.     cmp  [calc],'/'
  317.     jne  no_cdiv
  318.     fdiv [trans1]
  319.  
  320.   no_cdiv:
  321.     cmp  [calc],'*'
  322.     jne  no_cmul
  323.     fmul [trans1]
  324.  
  325.   no_cmul:
  326.     cmp  [calc],'+'
  327.     jne  no_cadd
  328.     fadd [trans1]
  329.  
  330.   no_cadd:
  331.     cmp  [calc],'-'
  332.     jne  no_cdec
  333.     fsub [trans1]
  334.  
  335.   no_cdec:
  336.     call   ftoa
  337.    
  338.   no_calculation:
  339.     call   print_display
  340.     popa
  341.     ret
  342.  
  343. number_entry:
  344.  
  345.     pusha
  346.  
  347.     cmp  eax,[entry_multiplier]
  348.     jge  no_entry
  349.     cmp  [id],1
  350.     je   decimal_entry
  351.     mov  ebx,[integer]
  352.     test ebx,0xF0000000
  353.     jnz  no_entry
  354.     mov  ebx,eax
  355.     mov  eax,[integer]
  356.     mov  ecx,[entry_multiplier]
  357.     mul  ecx
  358.     add  eax,ebx
  359.     mov  [integer],eax
  360.     call print_display
  361.     call to_muuta
  362.     popa
  363.     ret
  364.  
  365.   decimal_entry:
  366.  
  367.     imul eax,[new_dec]
  368.     add  [decimal],eax
  369.     mov  eax,[new_dec]
  370.     xor  edx,edx
  371.     mov  ebx,[entry_multiplier]
  372.     div  ebx
  373.     mov  [new_dec],eax
  374.     call print_display
  375.     call to_muuta
  376.     popa
  377.     ret
  378.  
  379.   no_entry:
  380.  
  381.     call print_display
  382.     call to_muuta
  383.     popa
  384.     ret
  385.  
  386.  to_muuta:
  387.  
  388.     pusha
  389.     mov  al,[dsign]
  390.     mov  esi,muuta0
  391.     mov  edi,muuta1
  392.     mov  ecx,18
  393.     cld
  394.     rep  movsb
  395.     mov  [muuta1],al
  396.     mov  edi,muuta1+10     ; 楫®¥
  397.     mov  eax,[integer]
  398.  
  399.   new_to_muuta1:
  400.  
  401.     mov  ebx,10
  402.     xor  edx,edx
  403.     div  ebx
  404.     mov  [edi],dl
  405.     add  [edi],byte 48
  406.     dec  edi
  407.     cmp  edi,muuta1+1
  408.     jge  new_to_muuta1
  409.     mov  edi,muuta1+17     ; ¤à®¡­®¥
  410.     mov  eax,[decimal]
  411.  
  412.   new_to_muuta2:
  413.    
  414.     mov  ebx,10
  415.     xor  edx,edx
  416.     div  ebx
  417.     mov  [edi],dl
  418.     add  [edi],byte 48
  419.     dec  edi
  420.     cmp  edi,muuta1+12
  421.     jge  new_to_muuta2
  422.     popa
  423.     ret
  424.  
  425. new_entry:
  426.  
  427.     pusha
  428.     mov  esi,muuta1
  429.     mov  edi,muuta2
  430.     mov  ecx,18
  431.     cld
  432.     rep  movsb
  433.     mov  esi,muuta0
  434.     mov  edi,muuta1
  435.     mov  ecx,18
  436.     cld
  437.     rep  movsb
  438.     mov  [integer],0
  439.     mov  [decimal],0
  440.     mov  [id],0
  441.     mov  [new_dec],100000
  442.     mov  [sign],byte '+'
  443.     popa
  444.     ret
  445.  
  446.  
  447. ftoa:                         ; fpu st0 -> [integer],[decimal]
  448.     pusha
  449.     fst    [tmp2]
  450.     fstcw  [controlWord]      ; set truncate integer mode
  451.     mov    ax,[controlWord]
  452.     mov    [tmp], ax
  453.     or     [tmp], word 0x0c00
  454.     fldcw  [tmp]
  455.     ftst                      ; test if st0 is negative
  456.     fstsw  ax
  457.     and    ax, 0x4500
  458.     mov    [sign], 0
  459.     cmp    ax, 0x0100
  460.     jne    no_neg
  461.     mov    [sign],1
  462.  
  463.   no_neg:
  464.     fld    [tmp2]
  465.     cmp    byte [sign], 0     ; change fraction to positive
  466.     je     no_neg2
  467.     fchs
  468.  
  469.   no_neg2:
  470.     fadd   [smallValueForRounding]
  471.     fist   [integer]
  472.     fisub  [integer]
  473.     mov    [res],0     ; convert 6 decimal numbers
  474.     mov    edi,6
  475.  
  476.    newd:
  477.     fimul  [kymppi]
  478.     fist   [decimal]
  479.     mov    ebx,[res]
  480.     imul   ebx,10
  481.     mov    [res],ebx
  482.     mov    eax,[decimal]
  483.     add    [res],eax
  484.     fisub  [decimal]
  485.     fst    [tmp2]
  486.     ftst
  487.     fstsw  ax
  488.     test   ax,1
  489.     jnz    real_done
  490.     fld    [tmp2]
  491.     dec    edi
  492.     jz     real_done
  493.     jmp    newd
  494.  
  495.   real_done:
  496.     fldcw  [controlWord]
  497.     mov    eax,[res]
  498.     mov    [decimal],eax
  499.     cmp    [integer],0x80000000
  500.     jne    no_error
  501.     call   clear_all
  502.     mov    [calc],'E'
  503.  
  504.   no_error:
  505.     mov    [dsign],byte '+'
  506.     cmp    [sign],byte 0      ; convert negative result
  507.     je     no_negative
  508. ;    mov    eax,[integer]
  509. ;    not    eax
  510. ;    inc    eax
  511. ;    mov    [integer],eax
  512.     mov    [dsign],byte '-'
  513.  
  514.   no_negative:
  515.     call   to_muuta
  516.     popa
  517.     ret
  518.  
  519.  
  520. atof:
  521.     push ax
  522.     push di
  523.     fldz
  524.     mov di, 0
  525.     cmp si, 0
  526.     je .error            ; Jump if string has 0 length.
  527.     mov byte [sign], 0
  528.     cmp byte [bx], '+'   ; Take care of leading '+' or '-'.
  529.     jne .noPlus
  530.     inc di
  531.     jmp .noMinus
  532.  
  533.   .noPlus:
  534.     cmp byte [bx], '-'
  535.     jne .noMinus
  536.     mov byte [sign], 1   ; Number is negative.
  537.     inc di
  538.  
  539.   .noMinus:
  540.     cmp si, di
  541.     je .error
  542.     call atof_convertWholePart
  543.     jc .error
  544.     call atof_convertFractionalPart
  545.     jc .error
  546.     cmp byte [sign], 0
  547.     je .dontNegate
  548.     fchs    ; Negate value
  549.  
  550.   .dontNegate:
  551.     mov bh, 0    ; Set bh to indicate the string is a valid number.
  552.     jmp .exit
  553.  
  554.   .error:
  555.     mov bh, 1    ; Set error code.
  556.    ; fstp st0    ; Pop top of fpu stack.
  557.  
  558.   .exit:
  559.     pop di
  560.     pop ax
  561.     ret
  562.  
  563. atof_convertWholePart:
  564.  
  565.     ; Convert the whole number part (the part preceding the decimal
  566.     ; point) by reading a digit at a time, multiplying the current
  567.     ; value by 10, and adding the digit.
  568.  
  569. .mainLoop:
  570.     mov al, [bx + di]
  571.     cmp al, '.'
  572.     je .exit
  573.     cmp al, '0'       ; Make sure character is a digit.
  574.     jb .error
  575.     cmp al, '9'
  576.     ja .error
  577.  
  578.     ; Convert single character to digit and save to memory for
  579.     ; transfer to the FPU.
  580.  
  581.     sub al, '0'
  582.     mov ah, 0
  583.     mov [tmp], ax
  584.  
  585.     ; Multiply current value by 10 and add in digit.
  586.  
  587.     fmul dword [ten]
  588.     fiadd word [tmp]
  589.     inc di
  590.     cmp si, di         ; Jump if end of string has been reached.
  591.     je .exit
  592.     jmp .mainLoop
  593.  
  594.   .error:
  595.     stc                ; Set error (carry) flag.
  596.     ret
  597.  
  598.   .exit:
  599.     clc                ; Clear error (carry) flag.
  600.     ret
  601.  
  602.  
  603. atof_convertFractionalPart:
  604.     fld1               ; Load 1 to TOS.  This will be the value of the decimal place.
  605.  
  606.   .mainLoop:
  607.     cmp si, di         ; Jump if end of string has been reached.
  608.     je .exit
  609.     inc di             ; Move past the decimal point.
  610.     cmp si, di         ; Jump if end of string has been reached.
  611.     je .exit
  612.     mov al, [bx + di]
  613.     cmp al, '0'        ; Make sure character is a digit.
  614.     jb .error
  615.     cmp al, '9'
  616.     ja .error
  617.     fdiv dword [ten]   ; Next decimal place
  618.     sub al, '0'
  619.     mov ah, 0
  620.     mov [tmp], ax
  621.  
  622.     ; Load digit, multiply by value for appropriate decimal place,
  623.     ; and add to current total.
  624.  
  625.     fild  word [tmp]
  626.     fmul  st0, st1
  627.     faddp st2, st0
  628.     jmp .mainLoop
  629.  
  630.   .error:
  631.     stc           ; Set error (carry) flag.
  632.     fstp st0    ; Pop top of fpu stack.
  633.     ret
  634.  
  635.   .exit:
  636.     clc              ; Clear error (carry) flag.
  637.     fstp st0    ; Pop top of fpu stack.
  638.     ret
  639.  
  640. ;   *********************************************
  641. ;   ******* WINDOW DEFINITIONS AND DRAW *********
  642. ;   *********************************************
  643.  
  644. draw_window:
  645.    
  646.     mov  eax,12
  647.     mov  ebx,1
  648.     mcall
  649.                                    
  650.     mov  eax,48
  651.     mov  ebx,3
  652.     mov  ecx,sc
  653.     mov  edx,sizeof.system_colors
  654.     mcall
  655.  
  656.     xor  eax,eax                    
  657.     mov  ebx,200 shl 16+255        
  658.     mov  ecx,200 shl 16+180
  659.     mov  edx,[sc.work]
  660.     or   edx,0x34000000
  661.     mov  edi,title
  662.     mcall
  663.  
  664.     mov  eax,8
  665.     mov  ebx,19 shl 16+28
  666.     mov  ecx,49 shl 16+18
  667.     mov  edx,6
  668.     mov  esi,[sc.work_button]
  669.     mov  edi,7
  670.   newbutton:
  671.     dec  edi
  672.     jnz  no_new_row
  673.     mov  edi,7
  674.     mov  ebx,19 shl 16+28
  675.     add  ecx,20 shl 16
  676.   no_new_row:
  677.     mcall
  678.     add  ebx,30 shl 16
  679.     inc  edx
  680.     cmp  edx,39
  681.     jbe  newbutton
  682.  
  683.     mcall  ,199 shl 16+28,49 shl 16+18,2               ; 'C'
  684.     mcall  ,220 shl 16+8,7 shl 16+8,3                     ; 'dec-bin-hex'
  685.  
  686.     mov  eax,4
  687.     mov  ebx,27 shl 16+54
  688.     mov  ecx,[sc.work_button_text]
  689.     mov  edx,text
  690.     mov  esi,33
  691.   newline:
  692.     mcall
  693.     add  ebx,20
  694.     add  edx,33
  695.     cmp  [edx],byte 'x'
  696.     jne  newline
  697.    
  698.     call print_display
  699.    
  700.     mov  eax,12
  701.     mov  ebx,2
  702.     mcall
  703.  
  704.     ret
  705.  
  706. print_display:
  707.     pusha
  708.     mcall 13,18 shl 16+210,19 shl 16+13,0xffffff
  709.  
  710.     mov  eax,4
  711.     mov  ebx,135 shl 16+7
  712.     mov  ecx,[sc.work_text]
  713.     or   ecx,0x40000000
  714.     mov  edx,calc
  715.     mov  esi,1
  716.     mov  edi,[sc.work]
  717.     mcall
  718.  
  719.     mov  ebx,198 shl 16+8
  720.     mov  edx,[display_type]
  721.     shl  edx,2
  722.     add  edx,display_type_text
  723.     mov  esi,3
  724.     mov  edi,[sc.work]
  725.     mcall
  726.    
  727.     cmp  [dsign],byte '+'
  728.     je   positive
  729.     mov  ebx,23 shl 16+22
  730.     mov  ecx,0x0
  731.     mov  edx,dsign
  732.     mov  esi,1
  733.     mcall  
  734.  
  735. positive:  
  736.     cmp  [display_type],0
  737.     jne  no_display_decimal
  738.     cmp  [decimal],0
  739.     je   whole
  740.  
  741.     mov  ebx,180 shl 16+22
  742.     mov  ecx,0x0
  743.     mov  edx,dot
  744.     mov  esi,1
  745.     mcall
  746.    
  747.     mov  eax,47
  748.     mov  ebx,10 shl 16
  749.     mov  ecx,[integer]
  750.     mov  edx,120 shl 16+22
  751.     mov  esi,0x0
  752.     mcall    
  753.    
  754.     mov  ebx,6 shl 16
  755.     mov  ecx,[decimal]
  756.     mov  edx,187 shl 16+22    
  757.     mov  esi,0x0
  758.     mcall
  759.  
  760.     popa
  761.     ret
  762.    
  763. whole:
  764.     mov  ebx,220 shl 16+22
  765.     mov  ecx,0x0
  766.     mov  edx,dot
  767.     mov  esi,1
  768.     mcall
  769.  
  770.     cmp  [integer],0
  771.     je  null
  772.  
  773.     mov  eax,47
  774.     mov  ebx,10 shl 16
  775.     mov  ecx,[integer]
  776.     mov  edx,160 shl 16+22
  777.     mov  esi,0x0
  778.     mcall
  779.  
  780.     popa
  781.     ret
  782.              
  783.   no_display_decimal:
  784.     cmp  [display_type],1
  785.     jne  no_display_hexadecimal
  786.     cmp  [integer],0
  787.     je  null
  788.    
  789.     mov  eax,47
  790.     mov  ebx,256+8 shl 16
  791.     mov  ecx,[integer]
  792.     mov  edx,173 shl 16+22
  793.     mov  esi,0x0
  794.     mcall
  795.  
  796.     popa
  797.     ret
  798.  
  799.   no_display_hexadecimal:
  800.     cmp  [integer],0
  801.     je  null
  802.  
  803.     mov  eax,47
  804.     mov  ebx,2*256+32 shl 16
  805.     mov  ecx,[integer]
  806.     mov  edx,32 shl 16+22
  807.     mov  esi,0x0
  808.     mcall
  809.  
  810.     popa
  811.     ret
  812.  
  813.   null:
  814.     mov  eax,47
  815.     mov  ebx,1 shl 16
  816.     mov  ecx,0
  817.     mov  edx,214 shl 16+22
  818.     mov  esi,0x0
  819.     mcall
  820.  
  821.     popa
  822.     ret
  823.  
  824. clear_all:
  825.     pusha
  826.     mov  [calc],' '
  827.     mov  [integer],0
  828.     mov  [decimal],0
  829.     mov  [id],0
  830.     mov  [dsign],byte '+'
  831.     mov  esi,muuta0
  832.     mov  edi,muuta1
  833.     mov  ecx,18
  834.     cld
  835.     rep  movsb
  836.     mov  esi,muuta0
  837.     mov  edi,muuta2
  838.     mov  ecx,18
  839.     cld
  840.     rep  movsb
  841.     call print_display
  842.     popa
  843.     ret
  844.  
  845.  
  846. ;data
  847.  
  848. title db appname,version,0
  849.  
  850. display_type       dd  0    ; 0 = decimal, 1 = hexadecimal, 2= binary
  851. entry_multiplier   dd  10
  852. display_type_text  db  'dec hex bin'
  853.  
  854. dot           db  '.'
  855. calc          db  ' '
  856. integer       dd  0
  857. decimal       dd  0
  858. kymppi        dd  10
  859. ten           dd  10.0,0
  860. tmp           dw  1,0
  861. sign          db  1,0
  862. tmp2          dq  0x0,0
  863. exp           dd  0x0,0
  864. new_dec       dd  100000,0
  865. id            db  0x0,0
  866. res           dd  0
  867. trans1        dq  0
  868. trans2        dq  0
  869. controlWord   dw  1
  870. smallValueForRounding dq 0.0000005 ; 1/2 from last significant digit
  871. multipl:      dd  10,16,2
  872.  
  873. dsign:
  874. muuta1        db  '+0000000000.000000'
  875. muuta2        db  '+0000000000.000000'
  876. muuta0        db  '+0000000000.000000'
  877.  
  878. text:
  879.     db ' A    B    C    D    E    F    C '
  880.     db ' 1    2    3    +   Int  Sin Asin'
  881.     db ' 4    5    6    -   1/x  Cos Acos'
  882.     db ' 7    8    9    /   x^2  Tan Atan'
  883.     db '+/-   0    .    *   Sqr  Pi    = '
  884.     db 'x'
  885.  
  886. asci:  db 49,50,51,52,53,54,55,56,57,48,43,61,45,42,47,44,46,27
  887. butid: db 12,13,14,19,20,21,26,27,28,34,15,39,22,36,29,35,35,1
  888.  
  889. I_END:
  890.  
  891. sc     system_colors
  892.