Program RAD; {$I nz-tool.box} {$I paramstr.pas} { Added the non-builtin function (in Turbo Pascal Version 2) ParamStr. Lee Bradley, Sysop, Z-Node #12, 203 665-1100 5 Sep 90. Compiled with an End Address of 3500 hex. } Function EVAL(RAD:Integer; NUM:str21):Real; { Evaluate a String variable of a given radix 2..16 to decimal Real.} Const T = '0123456789ABCDEF'; Var N : Real; Begin n := 0; If (10 Do Begin n := n * rad + Pos(num[1],t)-1; Delete(num,1,1) End; eval := n; End; Function CNVRT(R:Integer; V:Real):str21; { Convert a decimal Real number to a string of radix 2..16 } Const D = '0123456789ABCDEF'; Var S : str21; Begin s := '0'; If (v>0) And (10) Then Begin WriteLn(ParamStr(0),' Number conversion program'); WriteLn(' Syntax: ',ParamStr(0),' nnnn [r1] [r2]'); WriteLn(' where r1 is the input radix, r2 the output'); WriteLn(' radix, any of 2..16, H, D, O or B') End Else Begin r1 := 16; r2 := 10; If Length(ParamStr(3))<>0 Then r2 := rad(ParamStr(3)); If Length(ParamStr(2))<>0 Then r1 := rad(ParamStr(2)); value := eval(r1,ParamStr(1)); Write('Base ',r1,':',r2,' ',cnvrt(r2,value)) End End.