GDMike Posted July 16, 2020 Author Share Posted July 16, 2020 (edited) Looky at my asterisk, sitting on top of! For the life of me I don't know why automation code didn't work for me This took me 5 minutes maybe 10 I don't know I'm that messed up I guess.. Uh oh...I just found the word FOUND when looking for FIND. Edited July 16, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 16, 2020 Author Share Posted July 16, 2020 It's always fun to find, but I found "FOUND" when looking for "FIND" I'll look at the code, too just to see if it's something I did Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 16, 2020 Author Share Posted July 16, 2020 (edited) I don't think it's me, seems to tend to follow through on first letter found, then gives up. More pictures here looking for orange on example picture 2., Not found Edited July 17, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 16, 2020 Author Share Posted July 16, 2020 But I don't understand"FIND" vs "FOUND" But still a great performance! VID_20200716_174154878.mp4 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 17, 2020 Author Share Posted July 17, 2020 Maybe after finding the first character, but not the second, the length of search word needs to be reinstated? Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted July 17, 2020 Share Posted July 17, 2020 44 minutes ago, GDMike said: Maybe after finding the first character, but not the second, the length of search word needs to be reinstated? If you look at my code, you will see that the search string parameters are always reset after a partial match failure by JuMPing to SEARCH. If your question has to do with my last comment, I was talking about where to restart the search in the buffer not the search string (always reset). ...lee 1 Quote Link to comment Share on other sites More sharing options...
+9640News Posted July 17, 2020 Share Posted July 17, 2020 33 minutes ago, Lee Stewart said: If you look at my code, you will see that the search string parameters are always reset after a partial match failure by JuMPing to SEARCH. If your question has to do with my last comment, I was talking about where to restart the search in the buffer not the search string (always reset). ...lee Now, only if the search string function was case insensitive...……………………... Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 17, 2020 Share Posted July 17, 2020 (edited) 1 hour ago, Lee Stewart said: If you look at my code, you will see that the search string parameters are always reset after a partial match failure by JuMPing to SEARCH. If your question has to do with my last comment, I was talking about where to restart the search in the buffer not the search string (always reset). ...lee Your code worked for me!... SEARCH MOV R2,R4 ; copy search string address MOV R3,R5 ; copy search string size INC R1 ; adjust range for next instruction SLOOP DEC R1 ; decrement search range JEQ SNFND ; to SNFND if out of range CB *R4,*R0+ ; first char of search string found? JNE SLOOP ; if not, check next char INC R4 ; if so, set to second search char SLOOP1 DEC R5 ; decrement search char count JEQ SFOUND ; if done, string is found! DEC R1 ; decrement search range JEQ SNFND ; to SNFND if out of range CB *R4+,*R0+ ; next char found? JEQ SLOOP1 ; if so, check next char DEC R0 ; if not, correct buffer address JMP SEARCH ; reset search string parameters SNFND CLR R0 ; string not found in range RT ; return with R0 = 0 SFOUND S R3,R0 ; we found it! correct address RT ; return with address of found string AORG >FE00 QUERI TEXT 'FIND' AORG >C016 TEXT 'GTRFOUNDDTH21HFFINDTEHDR' DEF START REF VMBW BUFF TEXT 'HAHA!' START LI R0,>C000 LI R1,>1000 LI R2,QUERI LI R3,4 BL @SEARCH CI R0,>0 JEQ NOTFND FOUND MOV R0,R1 CLR R0 MOV R3,R2 BLWP @VMBW JMP WAIT NOTFND CLR R0 LI R1,BUFF LI R2,5 BLWP @VMBW WAIT JMP WAIT END FOUND was ignored, in favor of FIND. Edited July 17, 2020 by HOME AUTOMATION Punct., improved example, somewhat. 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted July 17, 2020 Share Posted July 17, 2020 25 minutes ago, BeeryMiller said: Now, only if the search string function was case insensitive...……………………... That should not be too difficult. I will work on it. ...lee 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 17, 2020 Author Share Posted July 17, 2020 (edited) I'll try again I'm always a day late and a dollar short! I misplaced a jump to search and that was my problem. Sorry, bout that. it must of been a busy day yesterday with the construction out front tearing into the yard. But, I'm on track. I'm all good, except for the upper lowercase mix results. I'll continue with inverting colors of word found routine, and replace, continue and stop options... Thanks so much. This is beautiful VID_20200717_131805198.mp4 Edited July 17, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
apersson850 Posted July 17, 2020 Share Posted July 17, 2020 (edited) If you are thinking about case insensitive searches, then remember that the difference between 'A' and 'a' is just one bit. 0100 0001 vs. 0110 0001. * Assuming R0 is buffer pointer and R2 is search string pointer, which already is in upper case LI R5,>2000 MOVB *R0+,R4 SZCB R5,R4 CB R4,*R2+ * Now you've compared the byte at *R2 with the byte at *R0, where the latter gives the same result, upper or lower case Note that this approach also gives the same result for <CR> and '-', for example. But it's a fast method. Before you start, you should convert the whole search string to upper case, so you don't spend time doing that for each search position. Edited July 18, 2020 by apersson850 Corrected a program error 1 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 17, 2020 Author Share Posted July 17, 2020 (edited) The strings in my program could consist of mixed sets, lower upper but I also have inverted characters, these are 123 bytes down the character set that are color inverted, i.e.,A=65, inverted A is character 65+123 Small a, same thing, character a+123 for the inverted color. Edited July 18, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 17, 2020 Author Share Posted July 17, 2020 Interesting. Quote Link to comment Share on other sites More sharing options...
+9640News Posted July 18, 2020 Share Posted July 18, 2020 4 hours ago, apersson850 said: If you are thinking about case insensitive searches, then remember that the difference between 'A' and 'a' is just one bit. 0100 0001 vs. 0110 0001. * Assuming R0 is buffer pointer and R2 is search string pointer, which already is in upper case LI R5,>30 MOVB *R0+,R4 SZCB R5,R4 CB R4,*R2+ * Now you've compared the byte at *R2 with the byte at *R0, where the latter gives the same result, upper or lower case Note that this approach also gives the same result for <CR> and '-', for example. But it's a fast method. Before you start, you should convert the whole search string to upper case, so you don't spend time doing that for each search position. Shouldn't that be a LI R5,>20 ????? Beery 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted July 18, 2020 Share Posted July 18, 2020 3 hours ago, BeeryMiller said: Shouldn't that be a LI R5,>20 ????? Beery Yes—but it should be in the MSB, so LI R5,>2000 ...lee 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted July 18, 2020 Share Posted July 18, 2020 7 hours ago, apersson850 said: If you are thinking about case insensitive searches, then remember that the difference between 'A' and 'a' is just one bit. 0100 0001 vs. 0110 0001. * Assuming R0 is buffer pointer and R2 is search string pointer, which already is in upper case LI R5,>30 MOVB *R0+,R4 SZCB R5,R4 CB R4,*R2+ * Now you've compared the byte at *R2 with the byte at *R0, where the latter gives the same result, upper or lower case Note that this approach also gives the same result for <CR> and '-', for example. But it's a fast method. Before you start, you should convert the whole search string to upper case, so you don't spend time doing that for each search position. There are actually more characters than <CR> and ‘-’ that would be confused as well as not being able to distinguish <space> from <null> ( 0 ). It would be better (and, admittedly, slower) to convert only ‘a’ – ‘z’ to uppercase during comparison. The search string (as @apersson850 pointed out) should be converted to uppercase once at the beginning of a case-insensitive search routine, but, the conversion of only ‘a’ – ‘z’ will take more time because of the need to test for the lowercase range for each character in the search buffer. ...lee 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 18, 2020 Share Posted July 18, 2020 Yes! ...But I have a draft ready to add to my 1st character fail scenario! Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 18, 2020 Share Posted July 18, 2020 (edited) I think ...it's ALIVE! AORG >FE00 QUERI TEXT 'COMEFINDMEBRO' DATA 0 AORG >A000 SAVRT DATA 0 VALID DATA 0 SEARCH MOV R11,@SAVRT LI R12,>4100 LI R13,>5A00 LI R14,>6100 LI R15,>7A00 LI R3,QUERI MOV R4,R7 CMPARE CB *R3,*R4+ JEQ NEXT C R4,R6 JNE CMPARE BL @CASE JEQ NEXT OUTNO JMP BYE NEXT MOV R4,R5 CONT CB *R3,@VALID JEQ OUTYES C R4,R6 JEQ OUTNO INC R3 CB *R3,*R4+ JEQ CONT BL @CASE JEQ CONT C R4,R6 JEQ OUTNO RESTAR MOV R5,R4 JMP SEARCH OUTYES MOV R5,R4 DEC R4 BYE MOV @SAVRT,R11 RT CASE CB *R3,R12 JLT OUT CB *R3,R13 JGT HIVAL MOVB *R3,R8 AI R8,>2000 JMP SCAN1B HIVAL CB *R3,R14 JLT OUT CB *R3,R15 JGT OUT MOVB *R3,R8 AI R8,->2000 SCAN1B MOV R7,R4 SCANB CB R4,R6 JEQ OUT CB R8,*R4+ JNE SCANB OUT RT AORG >B008 TEST TEXT 'COMEFINDMEBRO' AORG >AA00 DEF START REF VMBW BUFF TEXT 'HAHA...' START LI R4,>B000 LI R6,>C000 BL @SEARCH C R4,R6 JEQ NOTFND FOUND CLR R0 MOV R4,R1 LI R2,30 BLWP @VMBW JMP WAIT NOTFND CLR R0 LI R1,BUFF LI R2,30 BLWP @VMBW WAIT JMP WAIT END ...Although, I could have had a V8 ...and some . Edit: Turns out... When two of the same characters in the document, with cases different from the search string are parsed... I can't come up with a short paragraph to describe what's wrong with the above code. But if you use it ...You'll be SORRY! Edited July 20, 2020 by HOME AUTOMATION 1 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 18, 2020 Share Posted July 18, 2020 HaHa, I thought it was B O E ! Spoiler ...I didnnn know EASY BUG doesn't load the LOWER CASE character set! Quote Link to comment Share on other sites More sharing options...
apersson850 Posted July 18, 2020 Share Posted July 18, 2020 9 hours ago, Lee Stewart said: There are actually more characters than <CR> and ‘-’ that would be confused as well as not being able to distinguish <space> from <null> ( 0 ). It would be better (and, admittedly, slower) to convert only ‘a’ – ‘z’ to uppercase during comparison. The search string (as @apersson850 pointed out) should be converted to uppercase once at the beginning of a case-insensitive search routine, but, the conversion of only ‘a’ – ‘z’ will take more time because of the need to test for the lowercase range for each character in the search buffer. Yes, there are. I took carriage return as an example, since it's one of the more probable ones to find in a general set of strings. As a line separator, I mean. If the strings are stored with a length byte instead, then any code is possible. If you use an inverted character set, then you should definitely space that an even (binary) number apart from the non-inverted characters. Preferably so that you can only set or clear bits to change from inverted to non-inverted. So a spacing of 128 works fine, for example. If you need to set one and clear another bit to make the switch, it takes longer time. The TMS 9900 provides SOC, SOCB, SZC and SZCB, which can be used to set or clear bits. Provided you use the correct bit mask, ehrm.... ? Thanks for pointing that out! ? But the XOR instruction in the 9900 is 16 bit only, and the destination has to be a register. Provided the spacing between inverted and non-inverted is 128, you can go from one version to the other, for a string in memory, like this * Make them normal LI R0,STRPNT LI R1,STRLEN LI R2,>8000 LOOP SZCB R2,*R0+ DEC R1 JNE LOOP * Make them inverted LI R0,STRPNT LI R1,STRLEN LI R2,>8000 LOOP SOCB R2,*R0+ DEC R1 JNE LOOP 3 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 18, 2020 Share Posted July 18, 2020 I haven't test this but I think you could make a toggle function like this. * TOGGLE higlight/normal LI R0,STRPNT LI R1,STRLEN LI R2,>8000 LOOP XOR R2,*R0+ DEC R1 JNE LOOP 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 18, 2020 Author Share Posted July 18, 2020 I got lost way back..I'll just wait for my mind to catch up. I'm in a loop from there to here. Bwhahaha I can easily convert a-z to uppercase, I was also thinking about this. Make a copy of the screen, convert to uppercase, test the search, lock my cursor position, put my screen back to normal, place my cursor (invert my word for highlight) Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 18, 2020 Share Posted July 18, 2020 (edited) On 7/18/2020 at 4:01 AM, HOME AUTOMATION said: ...Although, I could have had a V8 ...and some . My code, works with random CaSeS, in both, search and searched terms. Edit: Now, if only it worked right! Edited July 20, 2020 by HOME AUTOMATION 1 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 18, 2020 Author Share Posted July 18, 2020 (edited) I haven't had success with the earlier one. I'll save Lee's version, and push yours into where I had Lee's. Is your version asking for the same parameters as Lee's? R0,R1,R2,R3 And your moving what you neeed from those? If not, I'll have to find out where and how to get my Params to where you need them. I'm only Searching 860 bytes at a given address. Can you make it like Lee's, just take my 3 values, length of search word, starting address, buffer length and returning me an address or zero? I must add this: I think this comes from thinking forth, Lee sets up the argument needs quite well, asking for parameters to be passed to his routines. I admire this thinking. Edited July 18, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 19, 2020 Share Posted July 19, 2020 ...I might. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.