Here is the code for super calulator. This should give you an idear on how i did the other programs.
IF check display mode(800,600,16) = 1
set display mode 800,600,16
else
cls 0 : sync : end
endif
SET EMULATION on : sync rate 0 : sync on : HIDE mouse
start:
cls 0
ink RGB(255,255,255) , 0
text 50 , 60 , "Super calculator V 0.04 By Joseph Allen ( ALIEN )"
text 50 , 100 , "Version info:"
text 80 , 120 , " + Function Version 0.01"
text 80 , 140 , " - Function Version 0.01"
text 80 , 160 , " * Function Version 0.01"
text 80 , 180 , " / Function Version 0.01"
text 50 , 220 , "Press any key to continue"
sync
suspend for key
cls 0
text 50 , 40 , "Testing + function"
Temp_STRING1$ = "987654321"
Temp_STRING2$ = "123456789"
text 50 , 80 , "Verible 1: " + Temp_STRING1$
text 50 , 100 , "Verible 2: " + Temp_STRING2$
text 50 , 120 , "Result : " + CAL_ADD( Temp_STRING1$ , Temp_STRING2$ )
Temp_STRING1$ = "99999999746461355448798773321166476777999773531332116554977883349997747"
Temp_STRING2$ = "12130456779984462201464678798564436626464977998775646646797875461647"
text 50 , 160 , "Verible 1: " + Temp_STRING1$
text 50 , 180 , "Verible 2: " + Temp_STRING2$
text 50 , 200 , "Result : " + CAL_ADD( Temp_STRING1$ , Temp_STRING2$ )
text 50 , 240 , "Press any key to continue"
sync : suspend for key
cls 0
text 50 , 40 , "Testing - function"
Temp_STRING1$ = "987654321"
Temp_STRING2$ = "123456789"
text 50 , 80 , "Verible 1: " + Temp_STRING1$
text 50 , 100 , "Verible 2: " + Temp_STRING2$
text 50 , 120 , "Result : " + CAL_subtract( Temp_STRING1$ , Temp_STRING2$ )
Temp_STRING1$ = "99999999746461355448798773321166476777999773531332116554977883349997747"
Temp_STRING2$ = "12130456779984462201464678798564436626464977998775646646797875461647"
text 50 , 160 , "Verible 1: " + Temp_STRING1$
text 50 , 180 , "Verible 2: " + Temp_STRING2$
text 50 , 200 , "Result : " + CAL_subtract( Temp_STRING1$ , Temp_STRING2$ )
text 50 , 240 , "Press any key to continue"
sync : suspend for key
cls 0
text 50 , 40 , "Testing * function"
Temp_STRING1$ = "123456789"
Temp_STRING2$ = "987654321"
text 50 , 80 , "Verible 1: " + Temp_STRING1$
text 50 , 100 , "Verible 2: " + Temp_STRING2$
text 50 , 120 , "Result : " + CAL_times( Temp_STRING1$ , Temp_STRING2$ )
Temp_STRING1$ = "99999999746461355448798773321166476777999773531332116554977883349997747"
Temp_STRING2$ = "12130456779984462201464678798564436626464977998775646646797875461647"
text 50 , 160 , "Verible 1: " + Temp_STRING1$
text 50 , 180 , "Verible 2: " + Temp_STRING2$
temp_String3$ = CAL_times( Temp_STRING1$ , Temp_STRING2$ )
text 50 , 200 , "Result : " + temp_String3$
text 50 , 220 , "Length : " + str$( len( temp_String3$ ) )
text 50 , 260 , "Press any key to continue"
sync : suspend for key
cls 0
text 50 , 40 , "Testing / function"
Temp_STRING1$ = "987654321"
Temp_STRING2$ = "123456789"
text 50 , 80 , "Verible 1: " + Temp_STRING1$
text 50 , 100 , "Verible 2: " + Temp_STRING2$
temp_result_one$ = CAL_devide( Temp_STRING1$ , Temp_STRING2$ )
temp_result_two$ = cal_Devide_remming( Temp_STRING1$ , Temp_STRING2$ )
text 50 , 120 , "Result : " + temp_result_one$
text 50 , 140 , "left over: " + temp_result_two$
Temp_STRING1$ = "545668791321654987987542756190846843878648616087384"
Temp_STRING2$ = "165145640354351879169814"
text 50 , 180 , "Verible 1: " + Temp_STRING1$
text 50 , 200 , "Verible 2: " + Temp_STRING2$
text 50 , 220 , "Result : " + CAL_devide( Temp_STRING1$ , Temp_STRING2$ )
text 50 , 240 , "left over: " + cal_Devide_remming( Temp_STRING1$ , Temp_STRING2$ )
text 50 , 280 , "Press any key to continue"
sync : suspend for key
cls 0
text 50 , 40 , "Testing / functiion A * B + C"
Temp_STRING1$ = "165145640354351879169814"
Temp_STRING2$ = "3304167098512665351253038542"
temp_String3$ = "46050998103844711116196"
text 50 , 80 , "Verible 1: " + Temp_STRING1$
text 50 , 100 , "*"
text 50 , 120 , "Verible 2: " + Temp_STRING2$
text 50 , 140 , "+"
text 50 , 160 , "Verible 3: " + temp_String3$
temp_string_Three$ = CAL_times( Temp_STRING1$ , Temp_STRING2$ )
temp_string_four$ = CAL_ADD( temp_string_Three$ , temp_String3$ )
text 50 , 180 , "Result : " + temp_string_four$
text 50 , 200 , "should : 545668791321654987987542756190846843878648616087384"
text 50 , 240 , "Press any key to continue"
sync : suspend for key
cls 0
text 50 , 40 , "Logic text equal or grather"
Temp_STRING1$ = "1008"
Temp_STRING2$ = "1009"
text 50 , 80 , "Verible 1: " + Temp_STRING1$
text 50 , 100 , "Verible 1: " + Temp_STRING2$
text 50 , 120 , "Result : " + str$( Logic_equal_Grater_Than( Temp_STRING1$ , Temp_STRING2$ ) )
text 50 , 160 , "Press any key to continue"
sync : suspend for key
cls 0 : sync : goto start
Function Logic_equal_Grater_Than( string10$ , String20$ )
return_Value = 0
Length_one = len( string10$ )
Length_two = len( String20$ )
IF Length_one < Length_two then return_Value = 2
IF Length_one > Length_two then return_Value = 1
IF return_Value = 0
Equal_Grather = 0 : E_G_Index = 1
while Equal_Grather = 0
IF val( MID$( string10$ , E_G_Index ) ) = val( MID$( string20$ , E_G_Index ) )
IF E_G_Index = Length_one then Equal_Grather = 1 : return_Value = 1
E_G_Index = E_G_Index + 1
else
IF val( MID$( string10$ , E_G_Index ) ) < val( MID$( string20$ , E_G_Index ) )
Equal_Grather = 1 : return_Value = 0
else
Equal_Grather = 1 : return_Value = 1
endif
endif
endwhile
endif
IF return_Value = 2 then return_Value = 0
endfunction return_Value
function cal_Devide_remming( string1$ , string2$ )
result_STRING$ = ""
DIM devide_Data( LEN( string1$ ) )
current_STRING$ = ""
FOR N = 1 to len( string1$ )
current_STRING$ = current_STRING$ + mid$( string1$ , N )
while val( current_STRING$ ) >= val( string2$ )
current_STRING$ = CAL_subtract( current_STRING$ , string2$ )
devide_Data( N ) = devide_Data( N ) + 1
endwhile
NEXT N
FOR N = LEN( string1$ ) to 2 step -1
while devide_Data( N ) > 9
devide_Data( N ) = devide_Data( N ) - 10
devide_Data( N -1 ) = devide_Data( N -1 ) + 1
endwhile
NEXT N
Found_start = 0
FOR N = 1 to len( current_STRING$ )
IF Found_start = 0 and val( mid$( current_STRING$ , N ) ) > 0 then Found_start = 1
IF Found_start = 1 then result_STRING$ = result_STRING$ + mid$( current_STRING$ , N )
IF N = len( current_STRING$ ) and Found_start = 0 then result_STRING$ = result_STRING$ + "0"
NEXT N
undim devide_Data( LEN( string1$ ) )
endfunction result_STRING$
function CAL_devide( string1$ , string2$ )
result_STRING$ = ""
DIM devide_Data( LEN( string1$ ) )
current_STRING$ = ""
FOR N = 1 to len( string1$ )
current_STRING$ = current_STRING$ + mid$( string1$ , N )
while val( current_STRING$ ) >= val( string2$ )
current_STRING$ = CAL_subtract( current_STRING$ , string2$ )
devide_Data( N ) = devide_Data( N ) + 1
endwhile
NEXT N
FOR N = LEN( string1$ ) to 2 step -1
while devide_Data( N ) > 9
devide_Data( N ) = devide_Data( N ) - 10
devide_Data( N -1 ) = devide_Data( N -1 ) + 1
endwhile
NEXT N
Found_start = 0
FOR N = 1 to len( string1$ )
IF Found_start = 0 and devide_Data( N ) > 0 then Found_start = 1
IF Found_start = 1 then result_STRING$ = result_STRING$ + str$( devide_Data( N ) )
NEXT N
undim devide_Data( LEN( string1$ ) )
endfunction result_STRING$
Function CAL_times( string1$ , string2$ )
result_STRING$ = ""
times_Ten = 0
FOR N = LEN( string2$ ) to 1 step -1
Temp_Value = val( mid$( string2$ , N ) )
temp_string$ = string1$ + add_zeros( times_Ten )
while Temp_Value > 0
result_STRING$ = CAL_ADD( result_STRING$ , temp_string$ )
Temp_Value = Temp_Value - 1
endwhile
times_Ten = times_Ten + 1
NEXT N
endfunction result_STRING$
function CAL_subtract( string1$ , string2$ )
result_STRING$ = ""
NumberPassCheck = 1
IF len( string2$ ) > len( string1$ ) then NumberPassCheck = 0 : result_STRING$ = "Error"
IF NumberPassCheck = 1
subtract_Loop_one:
string_Length1 = Len( string1$ ) : string_Length2 = Len( string2$ )
IF string_Length1 < string_Length2 then string1$ = "0" + string1$ : goto subtract_Loop_one
IF string_Length2 < string_Length1 then string2$ = "0" + string2$ : goto subtract_Loop_one
Dim subtract_result( string_Length1 )
subtract_Loop_two:
FOR N = string_Length1 to 1 step -1
temp_Value_one = val( mid$( string1$ , N ) )
temp_Value_two = val( mid$( string2$ , N ) )
subtract_result( N ) = temp_Value_one - temp_Value_two
NEXT N
FOR N = string_Length1 to 2 step -1
while subtract_result( N ) < 0
subtract_result( N ) = subtract_result( N ) + 10
subtract_result( N-1 ) = subtract_result( N-1 ) - 1
endwhile
NEXT N
FOR N = 1 to string_Length1
result_STRING$ = result_STRING$ + str$( subtract_result( N ) )
NEXT N
undim subtract_result( string_Length1 )
endif
endfunction result_STRING$
Function CAL_ADD( string1$ , string2$ )
result_STRING$ = ""
addloop:
string_Length1 = Len( string1$ ) : string_Length2 = Len( string2$ )
IF string_Length1 < string_Length2 then string1$ = "0" + string1$
IF string_Length2 < string_Length1 then string2$ = "0" + string2$
DIM ADD_DATA( string_Length1 + 1)
FOR SS = 1 to string_Length1 + 1 : ADD_DATA( SS ) = 0 : NEXT SS
IF string_Length1 = string_Length2
Number_Add = 0
FOR X = string_Length1 to 1 step -1
ADD_DATA(X) = val( mid$( string1$ , X) ) + val( mid$( string2$ , X) )
IF Number_Add = 1 then ADD_DATA(X) = ADD_DATA(X) + 1 : Number_Add = 0
IF ADD_DATA(X) > 9 then ADD_DATA(X) = ADD_DATA(X) - 10 : Number_Add = 1
NEXT X
else
goto addloop
endif
IF Number_Add = 1
result_STRING$ = "1"
else
result_STRING$ = ""
endif
FOR X = 1 to string_Length1
result_STRING$ = result_STRING$ + str$( ADD_DATA( X ) )
NEXT X
UNDIM ADD_DATA( string_Length1 + 1)
endfunction result_STRING$
function add_zeros( number )
return_string$ = ""
FOR zeros = 1 to number
return_string$ = return_string$ + "0"
next zeros
endfunction return_string$
There are other function that i'm working on root, 123xy321 change the function to handle -130349 and 12401491.3580238.