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.
;-P
Probably best if you avoid future attempts at humour. Maybe you have strengths in another field.
And a nicer assembler developer would emit: "Warning: Numeric constant/expression out of range for target register."
Having an assembler source file assigning a value larger than 8 bits would not manage to let the microcontroller see any overflow
Well, the designer of an 8051 assembler might, in a particularly nasty mood, decide to actually respect the expressed wish of such assembly program writers and translate
mov r0, #100h
as if the source had been
mov r0, #0 setb c
Setting an overflow bit would be something only the microcontroller running a program can do.
Having an assembler source file assigning a value larger than 8 bits would not manage to let the microcontroller see any overflow - the assembler wouldn't manage to find any space for storing that overflow bit in the assing instruction. So any truncate has to happen in the assembler, before a machine code instruction is generated.
It does not set/reset any flag. The flags are affected only after any arithmetic or logical operations and not after any data transfer instruction.
It seams to me that mov r0, #100h is the same as ... mov r0, #0 I think that the OP didn't know this while writing the code. He just wrote the instruction and it turned out to be correct. :|
This side of the pond we spell that word correctly.
very well then my majesty:
s/the/thy/
It seams to me that mov r0, #100h is the same as clr r0 ... there is no clr r0
It seams to me that mov r0, #100h is the same as ... mov r0, #0 it is
It seams to me that mov r0, #100h is the same as clr r0 or mov r0, #0. Am I missing something? Does it set the overflow bit or somesuch?
I'm just returning the favor
Now I know you're not me. This side of the pond we spell that word correctly.
choose your own!
people are using my name. I'm just returning the favor. Looks like the consultants are getting agitated again. good!
. 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!
"... the bumhard approach to teaching."
... work with consultants? In your case specifically, I suspect it doesn't.
You've got quite a hard-on for consultants, pandyman. That's most all you write about.
I'm warming to the bumhard approach to teaching.
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. :)
View all questions in Keil forum