//MACRO String.comp String1, String2, Branch[2], WReg[2] //-------------------------------------------------------------------------------------------------- // // @ CopyRight Roberti & Parau Enterprises, Inc. 2021-2023 // // This work is licensed under the Creative Commons Attribution-NoDerivatives 4.0 International License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/4.0/ // or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. // //-------------------------------------------------------------------------------------------------- // var branch0= Branch[0]; var branch1= Branch[1]; var WReg0= WReg[0]; var WReg1= WReg[1]; // // Compare NUL terminated strings // \#Label LB #WReg0, 0[#String1] // Load first byte string 1 \ LB #WReg1, 0[#String2] // Load first byte string 2 \ WHILE // Start compare loop one byte a time \ IF ( #WReg0 < #WReg1 ), GOTO, ID= #branch0 // Branch to first Branch entry if less than \ IF ( #WReg0 > #WReg1 ), GOTO, ID= #branch1 // Branch to second Branch entry if greater than \ IF ( #WReg0 == 0 ), BREAK // Done if both character are NUL \ ADDI #String1, 1 // Load next 'from' byte address \ LB #WReg0, 0[#String1] // Load first byte string 1 \ ADDI #String2, 1 // Load next 'to' byte address \ LB #WReg1, 0[#String2] // Load first byte string 2 \ ENDWHILE // End of compare loop