; 浜様様様様様様様様様様様様様様様様様様様様様様様様融 ; CALC ; 讓祀閧 ; 藩様様様様様様様様様様様様様様様様様様様様様様様様夕 ; ; Copyright (c) 1990 by Gurtjak D. ( Donetsk, USSR ) ; All right reserved. ; main segment para public; assume cs:main,ds:main org 100h start: jmp Install text db '',13,'邑',13,' 郭',3,'<',5,0,'>',3,'余' MaxFrq equ 4 SaveVideo equ ds:[2eh] System equ word ptr ds:[0e2h] TypeSystem equ byte ptr ds:[0e4h] Vseg equ word ptr ds:[0e5h] SaveCur equ ds:[0e7h] VPage equ byte ptr ds:[0ebh] XX equ ds:[0ech] ; len = 5 bytes D equ ds:[0f1h] E equ ds:[0f6h] C equ byte ptr ds:[0fbh] CC equ byte ptr ds:[0fch] CCC equ byte ptr ds:[0fdh] RegX dw 0,0 Ex db 0,0 RegY dw 0,0 Ey db 0 ap db ' ' flag db 01b ; bit 0 =1-no edit ; bit 1 =1-freq part CurWin db 0 Win db 2,3 Forms db 'ChrBinDecHex' Systs db 0,2,10,16 Mem dw 0,0 db 0 RunFlag db 0 ta db 1ah ScrStr db 9 ScrPos db 32 GetAdr PROC NEAR push ax mov al,ScrStr dec al mov ah,160 mul ah mov bp,ax mov al,ScrPos cbw shl ax,1 add bp,ax pop ax ret GetAdr ENDP SaveScreen PROC NEAR ; bp - むメ ※ぅ閧 ( 1342 ) call GetAdr push cs pop es push ds mov ds,Vseg mov si,bp lea di,SaveVideo mov dx,6 loc4: mov cx,15 ; 荐爬 rep movsw add si,130 dec dx jne loc4 pop ds ; text -> VRAM mov es,Vseg mov di,bp mov dh,2 loc78: mov si,offset text mov dl,3 loc2: mov bx,15 loc3: lodsb mov cx,1 cmp al,' ' jae DChar cbw mov cx,ax lodsb Dchar: mov ah,1Eh sub bx,cx rep stosw or bx,bx jne loc3 add di,130 dec dl jne loc2 dec dh jne loc78 ret SaveScreen ENDP RestoreScreen PROC NEAR ; bp - むメ ※ぅ閧 ( 1342 ) call GetAdr mov es,Vseg mov di,bp ; ??? lea si,SaveVideo mov dx,6 loc1: mov cx,15 ; 荐爬 rep movsw add di,130 ; ??? dec dx jne loc1 ret RestoreScreen ENDP Work PROC NEAR push ds push cs pop ds mov runflag,1 xor ax,ax mov es,ax mov dx,es:[463h] mov Vseg,0b800h cmp dl,0b4h jne ColorMode mov byte ptr Vseg+1,0B0h mov ta,10h ColorMode: mov al,0ch out dx,al inc dx in al,dx mov ah,al dec dx mov al,0dh out dx,al inc dx in al,dx mov cl,3 shr ax,cl add VSeg,ax mov cl,8 shr ax,cl ; ????? mov VPage,al ; video RAM -> psp call SaveScreen ; ; 縲. 爐. 筮爼 窶甌 mov ah,3 mov bh,VPage int 10h mov word ptr SaveCur,dx mov word ptr SaveCur+2,cx ; 痰→ 筮爼 窶甌 mov cx,0607h mov ah,1 int 10h ; 3 Step3: mov ap,' ' mov Flag,01b ; `腑 罔 Step4: mov al,ScrStr ; 襤 諷 mov bl,0 call OUTPUT mov bl,1 call OUTPUT ; 窶甌 痰牀 TYPESYSTEM mov bh,Vpage mov ah,2 mov dh,TypeSystem mov dl,ScrPos add dl,5 int 10h ; xor bh,bh mov bl,CurWin mov bl,Win[bx] mov bl,Systs[bx] or bx,bx jne m_11 or bh,1 m_11: mov System,bx Step5: xor ah,ah int 16h ; ax - character cmp al,0 je Zero jmp NoZero Zero: ; extended charactres cmp ah,82 ; Ins ( CHANGE FORMAT ) jne NoF1 mov bl,CurWin xor bh,bh mov al,Win[bx] inc al and al,3 mov Win[bx],al jmp short Step4 nof1: cmp ah,60 ; F2 ( SAVE ) jne NoF2 Save: call Exec mov ax,RegX mov Mem,ax mov ax,RegX+2 mov Mem+2,ax mov al,Ex mov byte ptr Mem+4,al jmp short Step4 nof2: cmp ah,61 ; F3 ( LOAD ) jne nof3 Load: mov ax,Mem mov RegX,ax mov ax,Mem+2 mov RegX+2,ax mov al,byte ptr Mem+4 mov Ex,al mov Flag,1 jmp short Step46 nof3: ; Arrow keys ? call RestoreScreen mov bl,ScrStr mov bh,ScrPos cmp ah,72 jne NoUp cmp bl,1 jbe Itm dec bl jmp short itm NoUp: cmp ah,75 jne NoLeft cmp bh,1 jbe Itm dec bh jmp short itm NoLeft: cmp ah,77 jne NoRight cmp bh,64 jae Itm inc bh jmp short itm NoRight: cmp ah,80 jne itm cmp bl,20 jae Itm inc bl ItM: mov ScrStr,bl mov ScrPos,bh call SaveScreen Step46: jmp Step4 ;------------------------------------- ; single chars NoZero: ; main characters cmp al,8 ; Back Space jne No_Bs Bs: test flag,1b jne Step46 test flag,10b je bs123 cmp byte ptr RegX+4,0 jne bs123 and flag,1b jmp short bs001 bs123: mov ax,RegX mov dx,RegX+2 mov cx,System xor bx,bx call LDiv mov RegX,ax mov RegX+2,dx test flag,10b je bs001 dec byte ptr RegX+4 bs001: jmp Step4 No_Bs: cmp al,9 ; Tab jne No_Tab mov al,1 sub al,CurWin mov CurWin,al jmp short bs001 No_Tab: cmp al,13 ; Enter, '=' jz ent cmp al,'=' jne No_Equ ent: call Exec step47: jmp Step4 No_Equ: cmp al,27 ; Escape jne No_Esc jmp Step10 No_Esc: cmp System,256 jne NoCh mov CC,al call Char jmp short Step46 NoCh: cmp al,61h ; 讓 瓱痰ガ 2,10,16 jl Step7 cmp al,7ah jg Step7 sub ax,20h Step7: mov Cc,al cmp al,' ' ; Space ( CLEAR ) jne No_Space Space: push cs pop es mov di,offset RegX mov cx,11 xor al,al rep stosb jmp Step3 No_Space: cmp al,'.' ; '.' ( only for 10 ) jne no_dot cmp System,10 jne no_dot test flag,1 jne x001 or flag,10b x001: jmp step4 no_dot: cmp al,'+' jz Oper cmp al,'-' jz Oper cmp al,'*' jz Oper cmp al,'/' jz Oper cmp al,'|' jz Oper cmp al,'&' jz Oper cmp al,'^' jne No_Oper Oper: call Exec mov al,CC mov Ap,al jmp Step4 No_Oper: cmp al,'Q' ; Q ( sqrt(x) ) jne no_sqr mov flag,1 call SQRT step48: jmp step4 No_sqr: cmp al,'_' ; '_' ( NEG ) jne no_neg mov ax,RegX mov dx,RegX+2 call LNeg mov RegX,ax mov RegX+2,dx jmp short step48 no_neg: cmp al,'T' ; 'T' ( Trunc ) jne No_Trunc mov flag,1 mov di,offset RegX call Trunc jmp short step48 No_Trunc: cmp al,'~' ; '~' ( NOT ) jne No_Not mov flag,1 mov di,offset RegX call Trunc not word ptr [di] not word ptr [di+2] jmp short step48 No_Not: cmp al,'<' ; '<' ( SHL ) jne No_SHL mov flag,1 shl RegX,1 rcl RegX+2,1 jmp short step48 No_SHL: cmp al,'>' ; '>' ( SHR ) jne No_SHR mov flag,1 shr RegX+2,1 rcr RegX,1 jmp short step48 No_SHR: cmp al,'0' jl No_Hex cmp al,'1' jg No_Bin Bin: call Char step489: jmp short step48 No_Bin: cmp al,'9' jg No_Decim Decim: cmp system,10 jb no_hex call Char jmp short step489 No_Decim: cmp al,'A' jl No_hex cmp al,'F' jg No_hex hexn: cmp system,16 jne no_hex call char No_hex: jmp Step4 ; psp-> vram STEP10: call RestoreScreen ; restore cursor mov ah,2 mov bh,Vpage mov dx,word ptr SaveCur int 10h mov ah,1 mov cx,word ptr SaveCur+2 int 10h the_end: mov runflag,0 pop ds retf Work ENDP Int2fh PROC FAR ; 甄 √ぅ ax - 8fcch ; es:di - むメ Work cmp ax,8fcch je addr_t db 0eah ofs2f dw 0 seg2f dw 0 addr_t: mov di,offset Work push cs pop es iret Int2fh ENDP Int09h PROC FAR pushf push ax push bx push cx push dx push si push di push bp push ds push es push cs pop ds in al,60h cmp al,70 jne Oldvec cmp runflag,0 jne Oldvec mov ax,40h mov es,ax mov al,es:[17h] test al,8 jnz Init Oldvec: pushf db 9ah OfsOld dw 0 SegOld dw 0 pop es pop ds pop bp pop di pop si pop dx pop cx pop bx pop ax popf iret Init: sti in al,61h mov ah,al or al,80h out 61h,al xchg ah,al out 61h,al mov al,20h out 20h,al push cs call Work pop es pop ds pop bp pop di pop si pop dx pop cx pop bx pop ax popf iret Int09h ENDP ;樛樛樛樛樛樛樛樛樛 く牀 樛樛樛樛樛樛樛樛樛 LNeg PROC NEAR ; -(dx:ax) -> (dx:ax) not dx not ax add ax,1 adc dx,0 ret LNeg ENDP GetSign PROC NEAR ; 2 筰 痰オ -> dx:ax= Л 祠Ε (ぅキ) ; pop bp pop si pop di and di,10000000b xor si,di push si popf jnl Sign1 call LNeg Sign1: jmp bp GetSign ENDP PutSign PROC NEAR ; ax:dx, bx:cx - 筰 痰オ , ゃ. ; pop bp or dx,dx pushf jnl Sign3 call LNeg Sign3: or bx,bx pushf jnl Sign2 not cx not bx add cx,1 adc dx,0 Sign2: jmp bp PutSign ENDP LMul PROC NEAR ; (dx:ax)=(dx:ax)*(bx:cx) push di push si push bp push bx push cx call PutSign mov di,dx mov si,ax mul cx xchg di,ax xchg si,dx ;si:di = lo_a*lo_n push dx ;dx = lo_a mul cx ;dx:ax = lo_b*hi_a add si,ax pop ax ;ax = lo_a js lm_error or dx,dx jne lm_error mul bx ;dx:ax = lo_a*hi_b add si,ax js lm_error or dx,dx jne lm_error pushf jmp short no_lme lm_error: pushf pop ax or ax,128 push ax no_lme: mov ax,di mov dx,si pop bx call GetSign push bx popf pop cx pop bx pop bp pop si pop di ret Lmul ENDP LDiv PROC NEAR ; (dx:ax) div (bx:cx) -> (dx:ax) ; zf = 0, if mod=0 push bp push di push si push bx push cx mov bp,cx or bp,bx jz ldiv1 ; arg2=0 , exit procedure call PutSign mov si,cx mov di,bx xor cx,cx xor bx,bx mov bp,33 ldiv2: rcl cx,1 rcl bx,1 sub cx,si sbb bx,di jnb ldiv3 add cx,si adc bx,di ldiv3: cmc rcl ax,1 rcl dx,1 dec bp jnz ldiv2 ; dx:ax = div; bx:cx = mod call GetSign ldiv1: mov word ptr E,cx mov word ptr E+2,bx ; E=mod or cx,bx pop cx pop bx pop si pop di pop bp ret Ldiv EndP ;--------------------------------------------------------------------- DivBp PROC NEAR ; [di] div bp, zf=1 if mod=0 push cx mov dx,[di+2] mov ax,[di] mov cx,bp xor bx,bx call LDiv mov [di],ax mov [di+2],dx pop cx ret DivBp ENDP ;--------------------------------------------------------------------- MUL10 PROC NEAR ; [si]*10^cl, if overflow - [di]/10^CL, C=C-CL xor ch,ch jcxz m10ret mov bp,10 m10_1: push cx mov dx,[si+2] mov ax,[si] mov cx,bp xor bx,bx call LMul js m10_over mov [si],ax mov [si+2],dx pop cx loop m10_1 ret m10_over: pop cx m10_2: call DivBp ; [di] div 10 dec C loop m10_2 m10ret: ret MUL10 ENDP ;--------------------------------------------------------------------- ClearB PROC NEAR ; [di]:=0 mov word ptr [di],0 mov word ptr [di+2],0 mov byte ptr [di+4],0 ret ClearB ENDP ;---------------------------------------------------------------------- FixA PROC NEAR ; fix A truncate zeros while ex>0 push di mov di,si mov bp,10 fa_1: cmp byte ptr [di+4],0 je fa_ret push [di] push [di+2] call DivBp je nextfix pop [di+2] pop [di] jmp short fa_ret nextfix: pop ax pop ax dec byte ptr [di+4] jmp short fa_1 fa_ret: pop di ret FixA ENDP ;--------------------------------------------------------------------- DivMax PROC NEAR ;div max number, if possible ( overflow ) mov bp,10 push si push di mov al,[di+4] cmp al,[si+4] ja m_1 mov al,[si+4] xchg si,di m_1: or al,al je m_120 ; Overflow Error call DivBp dec byte ptr [di+4] pop di pop si ret m_120: stc pop di pop si ret DivMax ENDP ;--------------------------------------------------------------------- FPLUS PROC NEAR ; [si]+[di] ; clear di pl_b: push si push di mov al,[di+4] cmp al,[si+4] ja pl_1 mov al,[si+4] ; al = max(ex,ey) xchg si,di pl_1: mov c,al sub al,[si+4] mov cl,al call Mul10 mov al,C pop di pop si mov [si+4],al mov [di+4],al mov ax,[di] mov dx,[di+2] mov cx,[si] mov bx,[si+2] add cx,ax adc bx,dx jno pl_ok call DivMax jc p_ret call DivMax jmp short pl_b pl_ok: mov [si],cx mov [si+2],bx call ClearB call FixA p_ret: ret FPLUS ENDP ;---------------------------------------------------------------------- FMult proc NEAR ; [si]*[di]; clear [di] m_b: mov bp,10 mov ax,[si] mov dx,[si+2] mov cx,[di] mov bx,[di+2] call Lmul jns M_ok call DivMax jc m_12 jmp short m_b m_ok: mov [si],ax mov [si+2],dx mov al,[si+4] add al,[di+4] mov [si+4],al m_3: cmp byte ptr [si+4],MaxFrq jbe m_ok1 xchg si,di call DivBp dec byte ptr [di+4] xchg si,di jmp short m_3 m_ok1: call ClearB call FixA m_12: ret FMult ENDP ;---------------------------------------------------------------------- d000 proc near cmp byte ptr [si+4],0 jne d_7 mov cl,c call mul10 ret d_7: mov byte ptr [si+4],0 ret d000 endp FDIVS PROC NEAR ; [si]:=[di]/[si]; clear [di] mov bp,10 mov al,[si+4] cmp al,[di+4] jb d_1 mov al,[di+4] ; al =min(ex,ey) d_1: sub [si+4],al sub [di+4],al mov al,[si+4] cmp al,[di+4] ja d_2 mov al,[di+4] ; al = max(ex,ey) d_2: mov c,al call d000 xchg di,si call d000 xchg di,si mov cx,[si] mov bx,[si+2] mov ax,[di] mov dx,[di+2] call Ldiv mov word ptr D,ax mov word ptr D+2,dx ;d=b/a; e=b mod a mov ax,e mov [di],ax mov ax,e+2 mov [di+2],ax xchg si,di mov cl,MaxFrq call mul10 ; b= mod*10^maxfrq mov ax,[si] mov dx,[si+2] mov cx,[di] mov bx,[di+2] call ldiv mov [di],ax mov [di+2],dx ; a= b/a push si mov si,offset D mov cl,maxfrq mov c,cl call mul10 xchg si,di mov ax,[di] add [si],ax mov ax,[di+2] adc [si+2],ax ; a=a+d mov al,c mov [si+4],al pop di call ClearB call FixA ret FDIVS ENDP ;---------------------------------------------------------------------- SQRT PROC NEAR ; regx=sqrt(regx); push ds pop es cmp RegX+2,0 jns sq_1 jmp sq_r sq_1: push RegY push RegY+2 push word ptr RegY+4 xor ax,ax mov XX+2,ax mov byte ptr XX+4,al inc ax mov XX,ax ; XX:=1 mov ccc,0 sq_lp: mov si,offset XX mov di,offset RegY mov cx,5 rep movsb ; b:=xx push RegX push RegX+2 push RegX+4 ; save a push XX push XX+2 push XX+4 ; save xx mov si,offset XX mov di,offset RegX call FDIVS ; xx:=a/xx; clear a pop RegX+4 pop RegX+2 pop RegX ; a=xx (old) mov si,offset xx mov di,offset regx call FPLUS ; xx:=a+xx ; clear a mov RegX,2 mov di,offset xx mov si,offset regx call FDivS ; a:=xx/2 mov si,offset regx mov di,offset xx mov cx,5 rep movsb pop RegX+4 ; restore a pop RegX+2 pop RegX mov cx,5 mov si,offset XX cmp word ptr [si],1 jne no_q1 cmp word ptr [si+2],0 jne no_q1 cmp byte ptr [si+4],0 ; = 1 ? je q_e no_q1: mov di,offset RegY repe cmpsb je Q_e inc ccc cmp ccc,100 je q_e jmp sq_lp q_e: pop RegY+4 pop RegY+2 pop RegY mov cx,5 mov si,offset XX mov di,offset RegX rep movsb sq_r: ret SQRT ENDP ;---------------------------------------------------------------------- NumToChar PROC NEAR ; bl - number; cx - system -> bl - char. CF cmp cl,0 jne nc1 ncrt: clc ret nc1: add bl,'0' cmp bl,'9' jbe ncrt add bl,'A'-'0'-10 jmp short ncrt NumToChar ENDP ;---------------------------------------------------------------------- DivOut Proc near ; dx:ax / bx:cx -> dx:ax, mod-> E cmp cx,10 jne NoDecOut call Ldiv ret NoDecOut: push cx xor bl,bl push cx shr cx,1 do1: shr cx,1 inc bl or cx,cx jne do1 ; bl - amount bits mov cl,bl push ax do2: shr dx,1 rcr ax,1 ; dx:ax loop do2 pop bx pop cx ; bx=ax(old), cx- system dec cx and bx,cx ; bx = mod mov word ptr E,bx pop cx ret DivOut ENDP ;---------------------------------------------------------------------- OUTPUT PROC NEAR ; Output RegX ; bl : 0 - Up Window, bl : 1 - Up Window ; push bx mov bh,bl shl bl,1 add bl,bh ; bl - 皚瓱皀讚覃 ム 痰牀 ( 1, 4) add bl,ScrStr ; bl - ム 痰牀 cmp bh,CurWin jne nocurwin mov TypeSystem,bl inc TypeSystem nocurwin: mov al,160 mul bl mov bl,ScrPos shl bl,1 add al,bl adc ah,0 add ax,2 ; ax - むメ ※ぅ閧 mov di,ax mov es,Vseg ; es:di - <筌 pop bx xor bh,bh ; bx - ム push di add di,160+10 ;??? ; Ж罔 か 筮爼 mov bl,Win[bx] ; bx - 瓱痰ガ : 0- chr,1 -bin, 2- dec,3-hex mov dl,Systs[bx] ; dx - 瓱痰ガ 瘍甄キ, 0 -chr xor dh,dh mov al,bl shl bl,1 add bl,al lea si,offset Forms[bx] ; si - むメ 痰牀 筮爼 cld movsb inc di movsb inc di movsb ; OutPut Format pop di mov cx,13 mov al,' ' mov ah,Ta rep stosw std sub di,2 ; es:di -> ユ 痰牀, df = 1 mov al,ap stosb ; 襤 Л ム罔 dec di mov si,dx ; si - 瓱痰ガ 瘍甄キ mov al,Ex cbw mov bp,ax ; bp - 瑙ぎ RegX mov ax,RegX mov dx,RegX+2 ; dx:ax - RegX cmp si,10 je NoTrunc ; メ 瓱痰ガ <> 10 - ェ珮碎 ぎ 罐 mov cx,10 xor bx,bx o_1: or bp,bp je NoTrunc call Ldiv dec bp jmp short o_1 NoTrunc: or dx,dx pushf ; 痰オ - Л 腮甄 jns o_11 cmp si,10 jne o_11 call Lneg ; x=-x o_11: mov ccc,0 mov cx,si cmp cx,10 je str55 or cx,cx jne str50 or ch,1 ; if Char - syst = 256 jmp short str50 str55: test flag,10b je str50 str5: cmp cl,2 jne NoLong cmp ccc,7 jne NoLong mov byte ptr es:[di],11h jmp short eout NoLong: inc ccc or bp,bp jne str50 mov byte ptr es:[di],'.' ; 襤 ぅ瘴皋膈 皰腦 sub di,2 dec bp str50: xor bx,bx ; bx:cx - 甅┘ 瓱痰ガ call DivOut mov bx,e ; bx - 痰皰 ぅキ call NumToChar mov es:[di],bl sub di,2 ; 襤 瓱〓 dec bp mov si,ax or si,dx jnz str5 or bp,bp jnl str5 eout: popf jns str4 cmp cx,10 jne str4 mov byte ptr es:[di],'-' ; メ 腮甄 ° 矗. str4: cld ret OUTPUT ENDP ;-------------------------------------------------------------------- Trunc PROC NEAR mov bp,10 trlp: cmp byte ptr [di+4],0 je trret call DivBp dec byte ptr [di+4] jmp short trlp trret: ret Trunc ENDP ;-------------------------------------------------------------------- Logical PROC NEAR call Trunc xchg si,di call Trunc xchg si,di mov ax,[si] mov dx,[si+2] mov cx,[di] mov bx,[di+2] cmp ap,'|' jne No_Or or ax,cx or dx,bx jmp short log1 No_Or: cmp ap,'&' jne No_And and ax,cx and dx,bx jmp short log1 No_And: xor ax,cx xor dx,bx log1: mov [si],ax mov [si+2],dx ret Logical ENDP ;-------------------------------------------------------------------- Exec PROC NEAR mov flag,1 ; set 'no edit' cmp ap,' ' je exec1 mov si,offset RegX mov di,offset RegY cmp ap,'+' jne exec2 call FPLUS jmp short exec0 exec2: cmp ap,'-' jne exec3 not word ptr [si] not word ptr [si+2] add word ptr [si],1 adc word ptr [si+2],0 ; a=-a call FPLUS jmp short exec0 exec3: cmp ap,'*' jne exec4 call FMult jmp short exec0 exec4: cmp ap,'/' jne exec50 call FDIVS jmp short exec0 exec50: call Logical exec0: exec1: mov ap,' ' mov ax,RegX mov dx,RegX+2 mov cl,Ex mov RegY,ax mov RegY+2,dx mov Ey,cl exec5: ret Exec ENDP Char PROC NEAR test flag,1b jz char1 mov RegX,0 ; if no edit then Rx=0, clear 'no edit' mov RegX+2,0 mov Ex,0 and flag,0b char1: cmp ex,maxfrq je char4 mov ax,RegX mov dx,RegX+2 or dx,dx pushf jns char111 call Lneg char111: mov cx,System xor bx,bx call Lmul js char4_ test flag,10b je ch1_0 inc ex ch1_0: mov cl,CC cmp System,256 jne NoCh2 jmp short char3 NoCh2: cmp cl,'9' jg char2 sub cl,'0' jmp short char3 char2: sub cl,'A'-10 char3: xor ch,ch add ax,cx adc dx,0 popf jns chr333 call Lneg chr333: mov RegX,ax mov RegX+2,dx char4: ret char4_: popf ret Char ENDP install: push cs pop ds mov si,81h mov cl,ds:80h xor ch,ch jcxz clc3 clc1: lodsb cmp al,' ' je clc2 mov ah,al lodsb cmp ax,'/'*256+'?' je okclc clc2: loop clc1 jmp short clc3 okclc: mov dx,offset titlh mov ah,40h mov bx,1 mov cx,lenh1 int 21h mov ah,0 int 16h mov dx,offset titlh1 mov ah,40h mov bx,1 mov cx,lenh2 int 21h int 20h clc3: mov ax,8fcch mov di,0 int 2fh or di,di jnz Repeat mov ax,3509h int 21h mov SegOld,es mov OfsOld,bx mov ax,2509h mov dx,offset Int09h int 21h mov ax,352fh int 21h mov Seg2f,es mov Ofs2f,bx mov ax,252fh mov dx,offset Int2fh int 21h mov ah,9 mov dx,offset titl int 21h lea dx,Install int 27h Repeat: mov ah,9 mov dx,offset titl int 21h int 20h lf equ 10 cr equ 13 titl db '敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳',lf,cr db ' <<<< Calculator >>>> ',lf,cr db ' (c) Copyright 1991 by Gurtjak D.A. (USSR,Donetsk) ',lf,cr db ' Version 3.0 ',lf,cr db '青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳',lf,cr db ' Usage: CALC [/?] Press Alt-ScrollLock for call Calculator.',lf,cr,'$' titlh db lf,lf,lf db ' <<<< Calculator Help >>>>',lf,cr,lf,lf db ' Esc : Exit',lf,cr db ' Arrow keys : Calculator movement on the screen',lf,cr db ' Tab : Windows toggle',lf,cr db ' Enter, "=" : Calculate',lf,cr db ' Ins : Change window format',lf,cr db ' F2 : Store number',lf,cr db ' F3 : Restore number',lf,cr db ' "0".."9","A".."F","." : Input of number',lf,cr db ' "_" (Shift "-") : Change number sign',lf,cr db ' BackSpace : Delete previous digit',lf,cr db ' Space : Clear',lf,cr db ' "+", "-", "*", "/" : Numeric operations',lf,cr db ' "&", "|", "^" : Logical operations ( AND, OR, XOR )',lf,cr db ' "<", ">" : Binary shift of a number',lf,cr db ' "~" : Number inversion',lf,cr db ' "Q" : Square root',lf,cr db ' "T" : Truncate number',lf,cr,lf db ' Press any key...',lf,cr lenh1 equ $-offset titlh titlh1 db lf,lf,lf,lf,lf db 'If you use this program and find it useful, your contribution $2',lf,cr db 'or 10 roubles will be appreciated.',lf,cr,lf db ' USSR, 340048 Donetsk, Artioma st. - 147 "g", 23',lf,cr db ' Gurtjak D.A.',lf,cr,lf db 'You are encouraged to copy and share this program with other users,',lf,cr db 'on the conditions that the program is not distributed in modified',lf,cr db 'form, that no fee or consideration is charged and that notice is',lf,cr db 'not removed.',lf,cr lenh2 equ $-offset titlh1 main ENDS end start