Discussion Forum

using "USING 0"directive

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Raj Shetgar
Posted
17-Dec-2003 05:55 GMT
Toolset
C51
New! using "USING 0"directive
Hello All,

I am trying to use the assembler directive "using" but I don't see the expected results, the code is as follows
;--------------------------------------
name one

extrn code (loop2,loop3)

prog 	segment code


	cseg at 0
	using 0
	jmp start

	rseg prog
start:	mov sp,#30h

loop:
	mov r1,#1
	mov r2,#2
	lcall loop2
	lcall loop3
	jmp loop

	end
;--------------------------------------
name two

public loop2

	prg1 segment code

	rseg prg1
	using 1
loop2:
	mov r3,#3
	mov r4,#4
	ret

	end
;--------------------------------------
name three

public loop3

prg2 segment code

	rseg prg2
	using 2
loop3:
	mov r5,#5
	mov r6,#6
	ret

	end
;--------------------------------------

what I wanted to do in the above code is see the contents in different register banks.
and also to my surprise I saw only 7 bits in the psw register while debugging where is the other PSW4(register select bit)...?

Question
--------
Suppose I have a subroutine, which should use a different register bank and at the end of return it should reinitialize to the previous register bank...is there any other directive to do that or should I use push psw and pop pws ?

Rgds
Raj Shetgar
Read-Only
Author
Support Keil
Posted
17-Dec-2003 08:44 GMT
Toolset
C51
New! RE: using "USING 0"directive
The USING attribute does not switch register bank. It adjusts only the symbols AR0 - AR7 that are required for absolute registerbank addressing.

Take a look to the Assembler/Utilities User's Guide for more information.

Also the file C51\ASM\Template.A51 shows you how to switch registerbanks and how to apply the USING attribute.
Read-Only
Author
Graham Cole
Posted
17-Dec-2003 09:15 GMT
Toolset
C51
New! RE: using "USING 0"directive
While in debug, the psw can be expanded to show seven fields. Each of these fields is just one bit except the rs field which is two bits and can take values 0 to 3.

Next Thread | Thread List | Previous Thread Start a Thread | Settings