Subversion Repositories Kolibri OS

Rev

Rev 109 | Rev 175 | 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.     fld  [trans1]
  200.     fld1
  201.     fdiv st,st1
  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,0xc0000000
  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.     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.     ftst
  495.     fstsw  ax
  496.    
  497.     dec    edi
  498.     jz     real_done
  499.     jmp    newd
  500.  
  501.   real_done:
  502.     mov    eax,[res]
  503.     mov    [decimal],eax
  504.     cmp    [integer],0x80000000
  505.     jne    no_error
  506.     call   clear_all
  507.     mov    [calc],'E'
  508.  
  509.   no_error:
  510.     mov    [dsign],byte '+'
  511.     cmp    [sign],byte 0      ; convert negative result
  512.     je     no_negative
  513.     mov    eax,[integer]
  514.     not    eax
  515.     inc    eax
  516.     mov    [integer],eax
  517.     mov    [dsign],byte '-'
  518.  
  519.   no_negative:
  520.     call   to_muuta
  521.     popa
  522.     ret
  523.  
  524.  
  525. atof:
  526.     push ax
  527.     push di
  528.     fldz
  529.     mov di, 0
  530.     cmp si, 0
  531.     je .error            ; Jump if string has 0 length.
  532.     mov byte [sign], 0
  533.     cmp byte [bx], '+'   ; Take care of leading '+' or '-'.
  534.     jne .noPlus
  535.     inc di
  536.     jmp .noMinus
  537.  
  538.   .noPlus:
  539.     cmp byte [bx], '-'
  540.     jne .noMinus
  541.     mov byte [sign], 1   ; Number is negative.
  542.     inc di
  543.  
  544.   .noMinus:
  545.     cmp si, di
  546.     je .error
  547.     call atof_convertWholePart
  548.     jc .error
  549.     call atof_convertFractionalPart
  550.     jc .error
  551.     cmp byte [sign], 0
  552.     je .dontNegate
  553.     fchs    ; Negate value
  554.  
  555.   .dontNegate:
  556.     mov bh, 0    ; Set bh to indicate the string is a valid number.
  557.     jmp .exit
  558.  
  559.   .error:
  560.     mov bh, 1    ; Set error code.
  561.     fstp st0    ; Pop top of fpu stack.
  562.  
  563.   .exit:
  564.     pop di
  565.     pop ax
  566.     ret
  567.  
  568. atof_convertWholePart:
  569.  
  570.     ; Convert the whole number part (the part preceding the decimal
  571.     ; point) by reading a digit at a time, multiplying the current
  572.     ; value by 10, and adding the digit.
  573.  
  574. .mainLoop:
  575.     mov al, [bx + di]
  576.     cmp al, '.'
  577.     je .exit
  578.     cmp al, '0'       ; Make sure character is a digit.
  579.     jb .error
  580.     cmp al, '9'
  581.     ja .error
  582.  
  583.     ; Convert single character to digit and save to memory for
  584.     ; transfer to the FPU.
  585.  
  586.     sub al, '0'
  587.     mov ah, 0
  588.     mov [tmp], ax
  589.  
  590.     ; Multiply current value by 10 and add in digit.
  591.  
  592.     fmul dword [ten]
  593.     fiadd word [tmp]
  594.     inc di
  595.     cmp si, di         ; Jump if end of string has been reached.
  596.     je .exit
  597.     jmp .mainLoop
  598.  
  599.   .error:
  600.     stc                ; Set error (carry) flag.
  601.     ret
  602.  
  603.   .exit:
  604.     clc                ; Clear error (carry) flag.
  605.     ret
  606.  
  607.  
  608. atof_convertFractionalPart:
  609.     fld1               ; Load 1 to TOS.  This will be the value of the decimal place.
  610.  
  611.   .mainLoop:
  612.     cmp si, di         ; Jump if end of string has been reached.
  613.     je .exit
  614.     inc di             ; Move past the decimal point.
  615.     cmp si, di         ; Jump if end of string has been reached.
  616.     je .exit
  617.     mov al, [bx + di]
  618.     cmp al, '0'        ; Make sure character is a digit.
  619.     jb .error
  620.     cmp al, '9'
  621.     ja .error
  622.     fdiv dword [ten]   ; Next decimal place
  623.     sub al, '0'
  624.     mov ah, 0
  625.     mov [tmp], ax
  626.  
  627.     ; Load digit, multiply by value for appropriate decimal place,
  628.     ; and add to current total.
  629.  
  630.     fild  word [tmp]
  631.     fmul  st0, st1
  632.     faddp st2, st0
  633.     jmp .mainLoop
  634.  
  635.   .error:
  636.     stc           ; Set error (carry) flag.
  637.     fstp st0    ; Pop top of fpu stack.
  638.     ret
  639.  
  640.   .exit:
  641.     clc              ; Clear error (carry) flag.
  642.     fstp st0    ; Pop top of fpu stack.
  643.     ret
  644.  
  645. ;   *********************************************
  646. ;   ******* WINDOW DEFINITIONS AND DRAW *********
  647. ;   *********************************************
  648.  
  649. draw_window:
  650.    
  651.     mov  eax,48
  652.     mov  ebx,3
  653.     mov  ecx,sc
  654.     mov  edx,sizeof.system_colors
  655.     int  0x40
  656.  
  657.     mov  eax,12
  658.     mov  ebx,1
  659.     int  0x40
  660.                                    
  661.     mov  eax,0                    
  662.     mov  ebx,200*65536+255        
  663.     mov  ecx,200*65536+180
  664.     mov  edx,[sc.work]
  665.     or   edx,0x33000000
  666.     mov  edi,header
  667.     int  0x40
  668.  
  669.     mov  eax,8
  670.     mov  ebx,19*65536+28
  671.     mov  ecx,49*65536+18
  672.     mov  edx,6
  673.     mov  esi,[sc.work_button]
  674.     mov  edi,7
  675.   newbutton:
  676.     dec  edi
  677.     jnz  no_new_row
  678.     mov  edi,7
  679.     mov  ebx,19*65536+28
  680.     add  ecx,20*65536
  681.   no_new_row:
  682.     int  0x40
  683.     add  ebx,30*65536
  684.     inc  edx
  685.     cmp  edx,39
  686.     jbe  newbutton
  687.  
  688.     mcall  ,199*65536+28,49*65536+18,2                  ; 'C'
  689.     mcall  ,220*65536+8,7*65536+8,3                     ; 'dec-bin-hex'
  690.  
  691.     mov  eax,4
  692.     mov  ebx,27*65536+54
  693.     mov  ecx,[sc.work_button_text]
  694.     mov  edx,text
  695.     mov  esi,33
  696.   newline:
  697.     int  0x40
  698.     add  ebx,20
  699.     add  edx,33
  700.     cmp  [edx],byte 'x'
  701.     jne  newline
  702.    
  703.     call print_display
  704.    
  705.     mov  eax,12
  706.     mov  ebx,2
  707.     int  0x40
  708.  
  709.     ret
  710.  
  711. print_display:
  712.     pusha
  713.     mcall 13,18*65536+210,19*65536+13,0xffffff
  714.  
  715.     mov  eax,4
  716.     mov  ebx,135*65536+7
  717.     mov  ecx,[sc.work_text]
  718.     or   ecx,0x40000000
  719.     mov  edx,calc
  720.     mov  esi,1
  721.     mov  edi,[sc.work]
  722.     int  0x40
  723.  
  724.     mov  ebx,198*65536+8
  725.     mov  edx,[display_type]
  726.     shl  edx,2
  727.     add  edx,display_type_text
  728.     mov  esi,3
  729.     mov  edi,[sc.work]
  730.     int  0x40
  731.    
  732.     cmp  [dsign],byte '+'
  733.     je   positive
  734.     mov  ebx,23*65536+22
  735.     mov  ecx,0x0
  736.     mov  edx,dsign
  737.     mov  esi,1
  738.     int  0x40  
  739.  
  740. positive:  
  741.     cmp  [display_type],0
  742.     jne  no_display_decimal
  743.     cmp  [decimal],0
  744.     je   whole
  745.  
  746.     mov  ebx,180*65536+22
  747.     mov  ecx,0x0
  748.     mov  edx,dot
  749.     mov  esi,1
  750.     int  0x40
  751.    
  752.     mov  eax,47
  753.     mov  ebx,10*65536
  754.     mov  ecx,[integer]
  755.     mov  edx,120*65536+22
  756.     mov  esi,0x0
  757.     int  0x40    
  758.    
  759.     mov  ebx,6*65536
  760.     mov  ecx,[decimal]
  761.     mov  edx,187*65536+22    
  762.     mov  esi,0x0
  763.     int  0x40
  764.  
  765.     popa
  766.     ret
  767.    
  768. whole:
  769.     mov  ebx,220*65536+22
  770.     mov  ecx,0x0
  771.     mov  edx,dot
  772.     mov  esi,1
  773.     int  0x40
  774.  
  775.     cmp  [integer],0
  776.     je  null
  777.  
  778.     mov  eax,47
  779.     mov  ebx,10*65536
  780.     mov  ecx,[integer]
  781.     mov  edx,160*65536+22
  782.     mov  esi,0x0
  783.     int  0x40
  784.  
  785.     popa
  786.     ret
  787.              
  788.   no_display_decimal:
  789.     cmp  [display_type],1
  790.     jne  no_display_hexadecimal
  791.     cmp  [integer],0
  792.     je  null
  793.    
  794.     mov  eax,47
  795.     mov  ebx,256+8*65536
  796.     mov  ecx,[integer]
  797.     mov  edx,173*65536+22
  798.     mov  esi,0x0
  799.     int  0x40
  800.  
  801.     popa
  802.     ret
  803.  
  804.   no_display_hexadecimal:
  805.     cmp  [integer],0
  806.     je  null
  807.  
  808.     mov  eax,47
  809.     mov  ebx,2*256+32*65536
  810.     mov  ecx,[integer]
  811.     mov  edx,32*65536+22
  812.     mov  esi,0x0
  813.     int  0x40
  814.  
  815.     popa
  816.     ret
  817.  
  818.   null:
  819.     mov  eax,47
  820.     mov  ebx,1*65536
  821.     mov  ecx,0
  822.     mov  edx,214*65536+22
  823.     mov  esi,0x0
  824.     int  0x40
  825.  
  826.     popa
  827.     ret
  828.  
  829. clear_all:
  830.     pusha
  831.     mov  [calc],' '
  832.     mov  [integer],0
  833.     mov  [decimal],0
  834.     mov  [id],0
  835.     mov  [dsign],byte '+'
  836.     mov  esi,muuta0
  837.     mov  edi,muuta1
  838.     mov  ecx,18
  839.     cld
  840.     rep  movsb
  841.     mov  esi,muuta0
  842.     mov  edi,muuta2
  843.     mov  ecx,18
  844.     cld
  845.     rep  movsb
  846.     call print_display
  847.     popa
  848.     ret
  849.  
  850.  
  851. ;data
  852.  
  853. header db appname,version,0
  854.  
  855. display_type       dd  0    ; 0 = decimal, 1 = hexadecimal, 2= binary
  856. entry_multiplier   dd  10
  857. display_type_text  db  'dec hex bin'
  858.  
  859. dot     db  '.'
  860. calc    db  ' '
  861. integer dd    0
  862. decimal dd    0
  863. kymppi  dd   10
  864.  
  865. dsign:
  866. muuta1  db   '+0000000000.000000'
  867. muuta2  db   '+0000000000.000000'
  868. muuta0  db   '+0000000000.000000'
  869.  
  870. text:
  871.     db ' A    B    C    D    E    F    C '
  872.     db ' 1    2    3    +   Int  Sin Asin'
  873.     db ' 4    5    6    -   1/x  Cos Acos'
  874.     db ' 7    8    9    /   x^2  Tan Atan'
  875.     db '+/-   0    .    *   Sqr  Pi    = '
  876.     db 'x'
  877.  
  878. asci:  db 49,50,51,52,53,54,55,56,57,48,43,61,45,42,47,44,46,27
  879. butid: db 12,13,14,19,20,21,26,27,28,34,15,39,22,36,29,35,35,1
  880.  
  881. I_END:
  882.  
  883. sc     system_colors
  884.