Subversion Repositories Kolibri OS

Rev

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

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