DisableContextSaving problem

General discussion on mikroBasic PRO for 8051.
Post Reply
Author
Message
BarryP
Posts: 517
Joined: 02 Apr 2007 03:57
Location: New Zealand

DisableContextSaving problem

#1 Post by BarryP » 01 Feb 2011 20:56

DisableContextSaving Only works when the routine is in the main program module

Code: Select all

program test
  include "Inc1"
  sub procedure dummy() org 0x0033
      cnt_flags = 233
  end sub
main:
  DisableContextSaving
  while true
    if Cnt_Flags = 1 then
       Cnt_Flags = 0
       P2 = 255
    else
       P2 = 0
    end if
  wend
end.

Code: Select all

module Inc1
  dim Cnt_Flags as Byte
  sub procedure Int_Tmr_100uS ()
implements

    sub procedure Int_Tmr_100uS ()  org 0x0073
        TMR3CN = TMR3CN and %01111111 '.7 = 0   'TF3
        Cnt_Flags = 1
   end sub
end.
a Portion Of The Listing , Showing the Error.

Code: Select all

_dummy:

No Context Saving Here . All Good

;test.mbas,3 :: 		sub procedure dummy() org 0x0033
;test.mbas,4 :: 		cnt_flags = 233
0x00AE	0x7508E9  	MOV _Cnt_Flags, #233
0x00B1	0x32      	RETI
; end of _dummy
_Int_Tmr_100uS:

Unexpected Context Saving Here

0x00B2	0xC0D0    	PUSH PSW
0x00B4	0xC0E0    	PUSH ACC
0x00B6	0xC0F0    	PUSH B
0x00B8	0xC082    	PUSH DPL
0x00BA	0xC083    	PUSH DPH
;inc1.mbas,6 :: 		sub procedure Int_Tmr_100uS ()  org 0x0073
;inc1.mbas,7 :: 		TMR3CN = TMR3CN and %01111111 '.7 = 0   'TF3
0x00BC	0x53917F  	ANL TMR3CN, #127
;inc1.mbas,8 :: 		Cnt_Flags = 1
0x00BF	0x750801  	MOV _Cnt_Flags, #1
0x00C2	0xD083    	POP DPH
0x00C4	0xD082    	POP DPL
0x00C6	0xD0F0    	POP B
0x00C8	0xD0E0    	POP ACC
0x00CA	0xD0D0    	POP PSW
0x00CC	0x32      	RETI
; end of _Int_Tmr_100uS
_main:
Last edited by BarryP on 02 Feb 2011 21:31, edited 2 times in total.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: DisableContextSaving problem

#2 Post by zristic » 02 Feb 2011 12:41

Yes, the Help says it should be called from main() only.

BarryP
Posts: 517
Joined: 02 Apr 2007 03:57
Location: New Zealand

Re: DisableContextSaving problem

#3 Post by BarryP » 02 Feb 2011 20:10

Thats what I did, DisableContextSaving Is Called Just below the Main:
I didn't think I would have to move all isr's into the Main Module for it to work tho.
If it's not a bug , I'll work around it.
In MB Pro For PIC The ISR Can be in another Module & DisableContextSaving Works As Expected.

Thanks.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: DisableContextSaving problem

#4 Post by zristic » 04 Feb 2011 13:43

BarryP wrote:Thats what I did, DisableContextSaving Is Called Just below the Main:
I didn't think I would have to move all isr's into the Main Module for it to work tho.
If it's not a bug , I'll work around it.
In MB Pro For PIC The ISR Can be in another Module & DisableContextSaving Works As Expected.
Ok, this requires some research, we will check the report and post here the findings.

Post Reply

Return to “mikroBasic PRO for 8051 General”