Hello forums, I started playing with a coding the 8051 after a long search for an assembly language to learn and it seemed like the way coolest one. I looked around a bit for how to do this but I probably just couldn't word it correctly; what I'm trying to do is fill memory locations 0x0200-0x05ff with a certain value, doesn't matter what it is. If i had to just do something like fill locations 0x200-0x2ff it would be easy as I could just use:
mov r0, # 100h mov dptr, # 200h a: mov a, #27 mov @dptr, a inc dptr djnz r0, a
but what is the best way to do it for more than 256 bytes?
Answers on a postcard please.
OOps. Over looked the h in the code. But in either way, the OP expects that his loop will execute 100H * 5 times, which wont happen. The loop will be executed 100H + 5 times only.
Didnt mean to sound Harsh. No Offenses. :)
The loop will be executed 100H + 5 times only.
No. You would like to try again? The newbie is obviously smarter than you think he is. He's clearly smarter than you. If you don't understand what's happening, try it with a simulator.
May be He is. I stand corrected once again.
This time infact i think that the loop will execute only 5 times and not more than that.
No. Do yourself a big favour and try it in a simulator.
OK. Does decrementing a register which is 00H yields FFH?? In that case, this was a good conversation.
i would have implemented it in following way.
MOV R1, count1 MOV A, #27 L2: MOV R0, count2 L1: MOV @DPTR, A INC DPTR DJNZ R0, L1 DJNZ R1, L2 loop executes for count1*count2 times
Does decrementing a register which is 00H yields FFH?? In that case, this was a good conversation.
Yes. Good lad. You've learnt something today. Did you intend to set your loop count from internal data?
ya. would prefer fetching the count value from internal RAM locations (or may be external RAM) [re-usability]. Incase of external RAM access, would use MOVX n DPTR. :)
I'm warming to the bumhard approach to teaching.
You've got quite a hard-on for consultants, pandyman. That's most all you write about.
"... the bumhard approach to teaching."
... work with consultants? In your case specifically, I suspect it doesn't.
. work with consultants? In your case specifically, I suspect it doesn't.
If you want to use a false name, at least have the decency to choose your own!
choose your own!
people are using my name. I'm just returning the favor. Looks like the consultants are getting agitated again. good!
I'm just returning the favor
Now I know you're not me. This side of the pond we spell that word correctly.
This side of the pond we spell that word correctly.
very well then my majesty:
s/the/thy/