Subversion Repositories Kolibri OS

Rev

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