![]() |
|
#11
|
|||
|
|||
Re: ASM programNope, im trying to edit it to do my thing so i can check for multiple characters.
Yes theres a test in place for char and im trying to get it to check char2 by copying some of the code/loops but im failing even after reading various tutorials |
|||
|
#12
|
|||
|
|||
Re: ASM programhmmm , well they say a picture is worth a thousand words so here are both!
I indented and redid the comments in the code to try to better note what is going on and point out suggestions to help YOU insert code to do what you want. CPP / C++ / C Code:
Code:
|
|
#13
|
|||
|
|||
Re: ASM programI understand you saying you cant do it for me but i appreciate the help you are giving with the comments in the code etc
I will try giving this another shot right now to see if i can get it to work again. |
|
#14
|
|||
|
|||
Re: ASM programloop:
lb $t0, str($t1) # load byte from address str($t1) into $t0 beqz $t0, strEnd # if NULL, goto "strEnd" label (exit loop) #### THIS IS WHERE YOUR COUNT IS INCREMENTED #### bne $t0, $t3, con # if $t0 != $t3 (char), breakto "con" label # which is essentially "if != skip the next line" # which is essentially "if == DO the next line" add $t2, $t2, 1 # increment counter (t2) con: # the 'break to' label # OK SO YOU JUST NEED TO DO ANOTHER CONDITIONAL # LIKE THE ONE IN THE LAST THREE LINES FOR char2 # YOU WILL ALSO NEED TO WORK IT INTO # THE REPORT PRINTING ROUTINE BELOW You know in that bit,what do you mean by the last 3 lines? all these as in the last 3 lines of code? beqz $t0, strEnd bne $t0, $t3, con add $t2, $t2, 1 :s |
|
#15
|
|||
|
|||
Re: ASM programNow who can read that! Please enclose your code in the c++ tags to preserve indents!!!
Quote:
In regards to your last question: No, I refer to the code lines within what I sectioned out. Including the 'con' label: CPP / C++ / C Code:
The 'bne' means break to the 'con' label if the two values are not equal ... so If you don't have a 'z' skip to the label on the other side of the next line. (don't increment 'z' counter) OTHERWISE you DO have a 'z' so you drop right through to the next line which increments the 'z' counter. You will need another 'skip to' label like con (maybe con2 ??? It's up to you...) it's like CPP / C++ / C Code:
Last edited by Howard_L : 21-Feb-2009 at 17:05.
|
|
#16
|
|||
|
|||
Re: ASM programOh i think i know what you mean
I have now created a 2nd loop and 2nd con for the 'z' letter. I have a new counter for 'z' aswell Im just trying to get it to scan the string as at the moment it doesnt work even if i stick a 'z' in the str |
|
#17
|
|||
|
|||
Re: ASM programYou don't need a second loop, just a second test within the first loop.
You just do two test/counts instead of one while at each character of the string. Post you code if you're really having trouble. Use indents etc. and don't forget to enclose code in C++ tags. (Check your message after posting. You have 90 minutes to edit it.) btw Just curious, are you going to be programming for any particular device? |
|
#18
|
|||
|
|||
Re: ASM programok for some reason im getting an error when i start with these....cant the registers go above $t9?
CPP / C++ / C Code:
if not, where do i go now? Im trying to add char4, char5 etc |
|
#19
|
|||
|
|||
Re: ASM programWell I haven't tried using those higher registers but I'd think you would be able to use them.
Maybe your problem is elsewhere. PCSpim is picky. Privately you sent me a version where you thought you had the loop correct. I found that it had some problems and I note them here (just the loop section): CPP / C++ / C Code:
So you were lucking out. I don't know why you keep going outside the loop. The construct is fairly simple: CPP / C++ / C Code:
Last edited by Howard_L : 22-Feb-2009 at 10:31.
|
|
#20
|
|||
|
|||
Re: ASM programnevermind iv started using registers from a different name as £tx was full
|
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Equation solver | RazoR | C Programming Language | 3 | 18-May-2008 10:24 |
| Two-Tier data dissemination code installation problem | nidhibansal1984 | Computer Software Forum - Linux | 6 | 16-Sep-2007 11:13 |
| BOOKEEPING program, HELP!! | yabud | C Programming Language | 10 | 17-Nov-2006 04:48 |
| Help with a complex program | lordfuoco | C++ Forum | 5 | 24-Jun-2006 07:03 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The