Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/18/03 22:51
Read: times


 
#58976 - RE: Using Direct Memory Addresses
Responding to: ???'s previous message
Hi,
I was using PSW.1 and PSW.5 on the 552, but judging from my (lack of) results that doesn't seem like a great idea now
Why? I always use both F0 and F1 flags in my programs and have no problems with them in the whole. They keep values and do it very well (= So why is it "not a great idea"?
Can I just choose upper memory locations and use them as flags instead,
yes,
like "SETB 07EH" ??
no, not so simple. You will be need to play with subroutines or macro to do it. For example, here is the macro usage (sorry for mixed ASM/C directives - it works with Keil w/o problems):
; define bit location and its mask:
#define EXTRA_FLAG_1	0x80,00000001b
#define EXTRA_FLAG_2	0x80,00000010b

; create macros:
; - set bit
SET_BIT		MACRO bit_location, bit_mask
	MOV	R0,#bit_location
	MOV	A,#bit_mask
	ORL	A,@R0
	MOV	@R0,A
		ENDM
; - clear bit
CLR_BIT		MACRO bit_location, bit_mask
	MOV	R0,#bit_location
	MOV	A,#bit_mask
	CPL	A
	ANL	A,@R0
	MOV	@R0,A
		ENDM

; somewhere in a program:
	SET_BIT	EXTRA_FLAG_1
; ...
	CLR_BIT	EXTRA_FLAG_2
Here are some notes as well: in fact, you will be need to save/restore ACC/R0/PSW inside macros (above it is just an example method);
- to check bit and jump it will take some time to imagine how it may be done with macro (I have already done it but give you a chance to do it yourself :)

cu

List of 10 messages in thread
TopicAuthorDate
Using Direct Memory Addresses            01/01/70 00:00      
   RE: Using Direct Memory Addresses            01/01/70 00:00      
      RE: Using Direct Memory Addresses            01/01/70 00:00      
         RE: Using Direct Memory Addresses            01/01/70 00:00      
            RE: Using Direct Memory Addresses            01/01/70 00:00      
               RE: Using Direct Memory Addresses            01/01/70 00:00      
   RE: Using Direct Memory Addresses            01/01/70 00:00      
   RE: Using Direct Memory Addresses            01/01/70 00:00      
   RE: Using Direct Memory Addresses            01/01/70 00:00      
   RE: why,oh why            01/01/70 00:00      

Back to Subject List