Jump to content
GDMike

Assembly code samples

Recommended Posts

1 hour ago, GDMike said:

they can't fix my ac until next week.

Well, if you should try to work on the AC, yourself. Make sure, not to connect the bottle to the "high side", whatever you do!!!:-o

 

 

  • Like 2

Share this post


Link to post
Share on other sites
Posted (edited)

I have another idea for my program if I decide to get on it today. I need to figure another way.

Thx for your tips. Hope your doing well.

"When things get rough, I buy gold from Rosland capital" 

Edited by GDMike

Share this post


Link to post
Share on other sites
On 6/30/2020 at 10:15 PM, HOME AUTOMATION said:
       AORG >CBD4           *DELETE
TEST   TEXT 'COMEFINDMEBRO' *DEL
       AORG >7D00           *DEL
QUERI  TEXT 'COMEFINDMEBRO' *SET THIS LINE UP IN YOUR PROGRAM, DELETE FROM HERE
       DATA 0               *THIS SHOULD FOLLOW YOUR BUFFER SPACE, DELETE FROM HERE
VALID  DATA 0
ENTRY  LI   R4,>A000        *SET THIS VALUE UP IN YOUR PROGRAM, DELETE FROM HERE
       LI   R6,>0000        *SET THIS VALUE UP IN YOUR PROGRAM, DELETE FROM HERE
SEARCH LI   R3,QUERI        *THIS IS THE LINE TO BL TO!
CMPARE CB   *R3,*R4+
       JEQ  NEXT
       C    R4,R6
       JNE  CMPARE
OUTNO  RT
NEXT   MOV  R4,R5
CONT   CB   *R3,@VALID
       JEQ  OUTYES
       C    R4,R6
       JEQ  OUTNO
       INC  R3
       CB   *R3,*R4+
       JEQ  CONT
RESTAR MOV  R5,R4
       JMP  SEARCH
OUTYES MOV  R5,R4
       DEC  R4
       RT
       END

Here, I removed the testing lines for you. I hope I did it right.

VALID  DATA 0
SEARCH LI   R3,QUERI        *THIS IS THE LINE TO BL TO!
CMPARE CB   *R3,*R4+
       JEQ  NEXT
       C    R4,R6
       JNE  CMPARE
OUTNO  RT
NEXT   MOV  R4,R5
CONT   CB   *R3,@VALID
       JEQ  OUTYES
       C    R4,R6
       JEQ  OUTNO
       INC  R3
       CB   *R3,*R4+
       JEQ  CONT
RESTAR MOV  R5,R4
       JMP  SEARCH
OUTYES MOV  R5,R4
       DEC  R4
       RT
       END


Set up a buffer labeled QUERI, make sure to fill it with all zeros, before overlaying your search term.

This buffer should have an extra 1 or 2 zeros after it's max. length! This will indicate the search completed successfully, when found by my program.

 

R4=Where to start searching from.
R6=Where to stop searching.

BL @SEARCH

 

This should find the first occurrence, before returning to your program.


R4 will be set to the starting address of the found term.

or

R4 will be equal to R6 if nothing was found.


 Adding the length of the search term to R4, then BL-ing back to SEARCH, should allow you to find the next occurrence.

 

Good luck, you might need it.

:)
 

  EDIT:

 

I hope these comments make more sense to you, than they do to me!:lol:

 

VALID  DATA 0               TERM FOUND, COMPARATOR.
SEARCH LI   R3,QUERI        R3=SEARCH TERM'S ADDRESS. *THIS IS THE ENTRY ADDRESS!
CMPARE CB   *R3,*R4+        COMPARE 1st LETTER OF SEARCH TERM, TO THE LETTERS IN THE SPECIFIED RANGE, ONE LETTER AT A TIME.
       JEQ  NEXT            DO THEY MATCH? YES! CHECK IF SECOND LETTERS MATCH. NO! CONTINUE.
       C    R4,R6           HAVE WE REACHED THE END OF THE SEARCH RANGE YET?
       JNE  CMPARE          NO! CHECK NEXT LETTER IN THE SPECIFIED RANGE. YES! CONTINUE.
OUTNO  RT                   BYE, NOTHING FOUND.
NEXT   MOV  R4,R5           SAVE THE POSITION OF THE NEXT POSSIBLE FIRST LETTER MATCH ...TO RESTART FROM IN CASE THE SECOND LETTER DOESN'T MATCH, OR TO INDICATE WHERE AN OCCURRENCE WAS FOUND LATER.
CONT   CB   *R3,@VALID      HAVE WE ALREADY MATCHED ALL CHARACTERS?
       JEQ  OUTYES          YES! MATCH FOUND! NO! CONTINUE.
       C    R4,R6           HAVE WE REACHED THE END OF THE SEARCH RANGE YET?
       JEQ  OUTNO           YES! EXIT(NO OCCURRENCE(S)) FOUND. NO! CONTINUE.
       INC  R3              ADVANCE TO THE NEXT LETTER OF THE SEARCH TERM.
       CB   *R3,*R4+        COMPARE ADDITIONAL LETTERS, ONE AT A TIME.
       JEQ  CONT            YES! CHECK 3RD AND UP, LETTERS. IF A LETTER DOESN'T MATCH, CONTINUE.
RESTAR MOV  R5,R4           RESTORE NEXT POSSIBLE FIRST LETTER MATCH ADDRESS.
       JMP  SEARCH          KEEP SEARCHING FOR NEXT FIRST LETTER MATCH.
OUTYES MOV  R5,R4           RETRIEVE POSITION OF THE PREVIOUS NEXT POSSIBLE FIRST LETTER MATCH.
       DEC  R4              SET R4 TO THE POSITION OF THE FIRST CHARACTER OF THE MATCHED TERM.
       RT                   OCCURRENCE FOUND
       END                  FEELS SO GOOD!

:)

I'm going back, back to this code and I'll try to adapt it. 

I gave my own code a try and had good results, but too good, apparently. Because I would find words like, seven when seven didn't exist, but the word even was there in my page that I was searching and so I was picking up words that had similar characters.

I found all the words I was searching for, but I can't seem to shake the errors like above mentioned.

So im going to try to adapt your sweet code again.

 

Edited by GDMike

Share this post


Link to post
Share on other sites
On 6/30/2020 at 10:15 PM, HOME AUTOMATION said:
       AORG >CBD4           *DELETE
TEST   TEXT 'COMEFINDMEBRO' *DEL
       AORG >7D00           *DEL
QUERI  TEXT 'COMEFINDMEBRO' *SET THIS LINE UP IN YOUR PROGRAM, DELETE FROM HERE
       DATA 0               *THIS SHOULD FOLLOW YOUR BUFFER SPACE, DELETE FROM HERE
VALID  DATA 0
ENTRY  LI   R4,>A000        *SET THIS VALUE UP IN YOUR PROGRAM, DELETE FROM HERE
       LI   R6,>0000        *SET THIS VALUE UP IN YOUR PROGRAM, DELETE FROM HERE
SEARCH LI   R3,QUERI        *THIS IS THE LINE TO BL TO!
CMPARE CB   *R3,*R4+
       JEQ  NEXT
       C    R4,R6
       JNE  CMPARE
OUTNO  RT
NEXT   MOV  R4,R5
CONT   CB   *R3,@VALID
       JEQ  OUTYES
       C    R4,R6
       JEQ  OUTNO
       INC  R3
       CB   *R3,*R4+
       JEQ  CONT
RESTAR MOV  R5,R4
       JMP  SEARCH
OUTYES MOV  R5,R4
       DEC  R4
       RT
       END

Here, I removed the testing lines for you. I hope I did it right.

VALID  DATA 0
SEARCH LI   R3,QUERI        *THIS IS THE LINE TO BL TO!
CMPARE CB   *R3,*R4+
       JEQ  NEXT
       C    R4,R6
       JNE  CMPARE
OUTNO  RT
NEXT   MOV  R4,R5
CONT   CB   *R3,@VALID
       JEQ  OUTYES
       C    R4,R6
       JEQ  OUTNO
       INC  R3
       CB   *R3,*R4+
       JEQ  CONT
RESTAR MOV  R5,R4
       JMP  SEARCH
OUTYES MOV  R5,R4
       DEC  R4
       RT
       END


Set up a buffer labeled QUERI, make sure to fill it with all zeros, before overlaying your search term.

This buffer should have an extra 1 or 2 zeros after it's max. length! This will indicate the search completed successfully, when found by my program.

 

R4=Where to start searching from.
R6=Where to stop searching.

BL @SEARCH

 

This should find the first occurrence, before returning to your program.


R4 will be set to the starting address of the found term.

or

R4 will be equal to R6 if nothing was found.


 Adding the length of the search term to R4, then BL-ing back to SEARCH, should allow you to find the next occurrence.

 

Good luck, you might need it.

:)
 

  EDIT:

 

I hope these comments make more sense to you, than they do to me!:lol:

 

VALID  DATA 0               TERM FOUND, COMPARATOR.
SEARCH LI   R3,QUERI        R3=SEARCH TERM'S ADDRESS. *THIS IS THE ENTRY ADDRESS!
CMPARE CB   *R3,*R4+        COMPARE 1st LETTER OF SEARCH TERM, TO THE LETTERS IN THE SPECIFIED RANGE, ONE LETTER AT A TIME.
       JEQ  NEXT            DO THEY MATCH? YES! CHECK IF SECOND LETTERS MATCH. NO! CONTINUE.
       C    R4,R6           HAVE WE REACHED THE END OF THE SEARCH RANGE YET?
       JNE  CMPARE          NO! CHECK NEXT LETTER IN THE SPECIFIED RANGE. YES! CONTINUE.
OUTNO  RT                   BYE, NOTHING FOUND.
NEXT   MOV  R4,R5           SAVE THE POSITION OF THE NEXT POSSIBLE FIRST LETTER MATCH ...TO RESTART FROM IN CASE THE SECOND LETTER DOESN'T MATCH, OR TO INDICATE WHERE AN OCCURRENCE WAS FOUND LATER.
CONT   CB   *R3,@VALID      HAVE WE ALREADY MATCHED ALL CHARACTERS?
       JEQ  OUTYES          YES! MATCH FOUND! NO! CONTINUE.
       C    R4,R6           HAVE WE REACHED THE END OF THE SEARCH RANGE YET?
       JEQ  OUTNO           YES! EXIT(NO OCCURRENCE(S)) FOUND. NO! CONTINUE.
       INC  R3              ADVANCE TO THE NEXT LETTER OF THE SEARCH TERM.
       CB   *R3,*R4+        COMPARE ADDITIONAL LETTERS, ONE AT A TIME.
       JEQ  CONT            YES! CHECK 3RD AND UP, LETTERS. IF A LETTER DOESN'T MATCH, CONTINUE.
RESTAR MOV  R5,R4           RESTORE NEXT POSSIBLE FIRST LETTER MATCH ADDRESS.
       JMP  SEARCH          KEEP SEARCHING FOR NEXT FIRST LETTER MATCH.
OUTYES MOV  R5,R4           RETRIEVE POSITION OF THE PREVIOUS NEXT POSSIBLE FIRST LETTER MATCH.
       DEC  R4              SET R4 TO THE POSITION OF THE FIRST CHARACTER OF THE MATCHED TERM.
       RT                   OCCURRENCE FOUND
       END                  FEELS SO GOOD!

:)

Here's my code, I'll supply a video soon

 

IMG_20200712_081319891_HDR.jpg

IMG_20200712_081356170_HDR.jpg

IMG_20200712_081407238.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Here are the values:

Libad7 is the string that the user keys in, it can be a length of 16 characters. 

S32P1 is page 1 of my 16 pages in cpu,(nice find, Automation) RAM. It's 860 bytes in length. Located in lower ram, but not all of my pages are in lower ram, and not all pages are consecutive, meaning, 1 page does not follow another, necessarily.

Pages are identified as S32P1,S32P2,S32P3,S32P4,S32P5,S32P6,S32P7,S32P8,S32P9,S32PA,B,C,D,E,F,G

PAGE contains the number 1-16 this is later passed to the program, I'm setting it solid here as I already know I'm dealing with page 1, so I'm safe setting this. This represents the current search word and where it was found, page 1? Page 2? Etc..

RRA2 contains the word length of the word that the user keyed in. If the user typed TI-99 then RRA2 contains a 5.

Note: libad7 is cleared prior to the user entry data. It's cleared with >20, spaces, all 16 characters before the user typed the word that is to be searched.

 

Edited by GDMike

Share this post


Link to post
Share on other sites

Here's my video.

I can search, and if the word I found, then I manually tell it to pull up page 1 in the last part of code, but it's finding even instead of eleven. 

And not landing on the first found word, but here it's likeif the first word I'm looking for is located on the first line then it puts the cursor on the work if it's on the second line and it puts it a line behind it and if it's the third line it puts it like two lines behind it so far so on but it still pulls up to page regardless which is cool meaning it found the word.

Edited by GDMike

Share this post


Link to post
Share on other sites

I'm going to try again, and use automation's code. I'll have to push a zero to the end of my user word string, while keeping RRA2 untouched.

Share this post


Link to post
Share on other sites
NO! CHECK NEXT LETTER IN THE SPECIFIED RANGE. YES! CONTINUE.
OUTNO  RT                   BYE, NOTHING FOUND

I'm not understanding how the BL to search works If it's only finding one character in the string and returning to my program? Why do I need the BL routine? And how do I know I have a word match, because outyes is a rt.?

Anyway, the BL is confusing me. Lol

I'll keep adjusting and see what I can come up with. Yayhoooo

Edited by GDMike

Share this post


Link to post
Share on other sites
22 hours ago, GDMike said:

Haha...^^^ ^^^^^^this server is sooo silly...:lol:

 

7 hours ago, GDMike said:On 6/30/2020 at 11:15 PM, HOME AUTOMATION said:

...

R4 will be set to the starting address of the found term.

or

R4 will be equal to R6 if nothing was found.

...


This search program, as intended, will check the entire string before RETURNing to the calling program. I'm only showing it as a subroutine for convenience ...both since, that seemed to be what you have been doing and since, I envisioned that you might want to use it dynamically, and perhaps from farther away than JMPs would allow for.:ponder:

 

If R4<>R6 you've found a match(entire string)!

 

         P.S. I have yet to review your code/download video.;-)

 

         P.P.S. I should have set this up, in a working example for you.
                  However, I am burdened with many responsibilities right now!:roll::thumbsdown:

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Good to know an answer to that, probably obvious to most, but I really thought so originally, but then started thinking, and that's where I got in trouble.

Ok, I need to get rid of the BL and I do need it in a jump format, for it's driving me crazy, I cannot seem to make it work when I threw out the bl, I also tried it with keeping the BL and since I'm doing a BL to get to this, I did what Lee said, just remember r11 prior to the BL and be sure to ret back before returning to the original BL. So I tried that and found that the lockup routine I created worked but nothing else, so I've reverted back to your original code minus the BL and put it as a regular in line process to my calling BL

And just removed my old program instead. But it's lock up again.

So I'm made jumps back to search where you have RT and the program comes back saying it found the string, Even the string I don't have in memory.

But no more locking up. I've been playing with yes and no routines because I don't know where to look for a successful word find.

Thx for taking some time out of your day - no hurry automaniac man, it can wait for your next vodka. I'm just going to go play with the cb radio on skip.. lol

  • Haha 1

Share this post


Link to post
Share on other sites

wtiprtwbaqr.jpg.94e3b9fca2620f22f55c553b79943074.jpg

 

Hmm, you do realize this is searching CPU, not VDP?

 

Wish I was well enough for Vodka... was at the Liq. Store today ...but returned with only more empty boxes...:woozy:

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Yup. I said that earlier I believe. There's a difference. Oh, I hope I didn't say vdp RAM, did I? Naaaa... really? Hmmm

Oh well. Must of been having one of those days..

Did you see my code? It actually finds the words searched, but it's got some kind of problem. It's very close to working I believe.

"I'm stuck in the middle with you"

 

Share this post


Link to post
Share on other sites

Ok, I fudged and fudge and yeah, I can't get a positive or correct negative on a find. Sorry, I've exhausted my structure in your code, I'm not getting Wonderful and exciting conclusions, just wonderful confusion. Sorry. 

I've got to wait until you have time again.

I'm already doing a BL to my search routine, I call findw. It looks like this:

FINDW mov R11,@SAVRTN

               LI R9, LIBAD7 * contains my search word plus 2 zeros

LI R10,S32P1 * my page with cool stuff, like boat payment structure, future house budget, etc.

RRA2= the length of libad7, without zeroes padded

 

Take care, gotta go do my hair

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...