-
Notifications
You must be signed in to change notification settings - Fork 7
BASIC COMPARE Function
TYPE: plusBASIC relational function
FORMAT: COMPARE ( * array1, * array2 )
Action: Compares two arrays.
-
array1 and array2 are array variable names with no parentheses after them.
-
Undimensioned array error
if either array has not be defined with theDIM
statement.
-
- Returns:
-
-1
(True) if both arrays contain identical data. -
0
(False) if the array contents differ or the array sizes are not the same.
-
Examples:
DIM A(1),B(1),C(2)
PRINT COMPARE(*A,*B)
PRINT COMPARE(*A,*C)
A(1)=9
PRINT COMPARE(*A,*B)
Prints
-1
,0
, and0
FORMAT: COMPARE ( [ @ page1 , ] address1 , [ @ page2 ,] address2 , length )
Action: Compares two sections of memory.
-
page1 and page2 are optional page numbers.
- An @ page argument causes memory in that page to be used for comparison
- address1 and address2 are the starting addresses of each section of memory to be compared.
- length is the total number of bytes to compare.
- Returns
-1
if the sections contents are identical, otherwise returns0
.
Examples:
PRINT COMPARE(15000,32000,256)
Returns -1 if the 256 bytes starting at address 15000 match the 256 bytes starting at address 32000.
PRINT COMPARE(@40,100,20000,200)
Compares 200 bytes at address 100 of page 40 with 200 bytes at address 20000 in main memory.
PRINT COMPARE(12288,@41,0,1024)
Compares 1024 bytes of memory at address 12288 in main memory with 1024 bytes at address 0 of page 41.
PRINT COMPARE(@50,500,@51,1000,500)
Compares 200 bytes at address 50 of page 50 with 1024 bytes at address 0 of page 51.