Subversion Repositories Kolibri OS

Rev

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