EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

BRCLR

Started by bal_gill21 January 15, 2005

Happy new year all,
The code below is part of a larger program and does not seem to be
working. I am expecting it to loop to "busy" because the tested byte
is not zero. The mask is 00000001 and the tested byte is 00000001,
the program goes to "skip" instead. Help!

org $c000
ldaa #%00000001
staa $c601
busy ldx $c600
BRCLR $0,x $1 skip
jmp busy
skip wai





> -----Original Message-----
> From: bal_gill21 [mailto:]
> Sent: Saturday, January 15, 2005 1:57 PM
> To:
> Subject: [m68HC11] BRCLR
>
> Happy new year all,
> The code below is part of a larger program and does not seem to be
> working. I am expecting it to loop to "busy" because the tested byte
> is not zero. The mask is 00000001 and the tested byte is 00000001,
> the program goes to "skip" instead. Help!
>
> org $c000
> ldaa #%00000001
> staa $c601
> busy ldx $c600 <==== DID you mean IMMEDIATE? (As in point to $C600!)
> BRCLR $0,x $1 skip
> jmp busy
> skip wai

*
| __O Thomas C. Sefranek
|_-\<,_ Amateur Radio Operator: WA1RHP
(*)/ (*) Bicycle mobile on 145.41, PL 74.4

http://hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org




No, i'm loading the contents of $c600 into x register.

--- In , "Thomas Sefranek" <tcs@c...> wrote:
>
>
> > -----Original Message-----
> > From: bal_gill21 [mailto:bal_gill21@y...]
> > Sent: Saturday, January 15, 2005 1:57 PM
> > To:
> > Subject: [m68HC11] BRCLR
> >
> > Happy new year all,
> > The code below is part of a larger program and does not seem to be
> > working. I am expecting it to loop to "busy" because the tested
byte
> > is not zero. The mask is 00000001 and the tested byte is 00000001,
> > the program goes to "skip" instead. Help!
> >
> > org $c000
> > ldaa #%00000001
> > staa $c601
> > busy ldx $c600 <==== DID you mean IMMEDIATE? (As in point
to $C600!)
> > BRCLR $0,x $1 skip
> > jmp busy
> > skip wai
> >
> >
>
> *
> | __O Thomas C. Sefranek WA1RHP@A...
> |_-\<,_ Amateur Radio Operator: WA1RHP
> (*)/ (*) Bicycle mobile on 145.41, PL 74.4
>
> http://hamradio.cmcorp.com/inventory/Inventory.html
> http://www.harvardrepeater.org




> -----Original Message-----
> From: bal_gill21 [mailto:]
> Sent: Saturday, January 15, 2005 2:30 PM
> To:
> Subject: [m68HC11] Re: BRCLR
>
> No, i'm loading the contents of $c600 into x register.

O.K. I'm missing something here...

Your putting a ONE in the LSB of the address of X. (The contents of $C600
MSB is undefined, AND $C601 is a 1.) So X is pointing... who knows where..
and your Testing the location X is pointing to for it to be clear...

A few comments in your code to explain what you MEANT to do would help.
>
*
| __O Thomas C. Sefranek
|_-\<,_ Amateur Radio Operator: WA1RHP
(*)/ (*) Bicycle mobile on 145.41, PL 74.4

http://hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org




org $c000
ldaa #%00000001
staa $c601
busy ldx $c600 ;line 4
BRCLR $0,x $1 skip ;line 5
jmp busy
skip wai

line 4: I have put $c600 here because its going into the X register,
so $c600 has nothing in it ie 00000000. $c601 has a $1 in it ie
00000001. When it's loaded into the x register it looks
like :0000000000000001.

line 5: I want it to check if the very last bit in x reg (1) is a 1
or 0 and jump accordingly. If the last bit is 0 I want it to go
to "skip" and "busy" if its a 1.
--- In , "Thomas Sefranek" <tcs@c...> wrote:
> > -----Original Message-----
> > From: bal_gill21 [mailto:bal_gill21@y...]
> > Sent: Saturday, January 15, 2005 2:30 PM
> > To:
> > Subject: [m68HC11] Re: BRCLR
> >
> > No, i'm loading the contents of $c600 into x register.
>
> O.K. I'm missing something here...
>
> Your putting a ONE in the LSB of the address of X. (The contents of
$C600
> MSB is undefined, AND $C601 is a 1.) So X is pointing... who knows
where..
> and your Testing the location X is pointing to for it to be clear...
>
> A few comments in your code to explain what you MEANT to do would
help.
> >
> *
> | __O Thomas C. Sefranek WA1RHP@A...
> |_-\<,_ Amateur Radio Operator: WA1RHP
> (*)/ (*) Bicycle mobile on 145.41, PL 74.4
>
> http://hamradio.cmcorp.com/inventory/Inventory.html
> http://www.harvardrepeater.org




Ahhh!

You CAN NOT test the last bit in an INDEX register.
You can only test DATA registers.

In other words you can test the bits of a byte that the INDEX is pointing
to.

You could (And it's still not clear WHY you want to bit test the index,)
Copy the index to 2 data registers and test the effective shadow of the
index.

*
| __O Thomas C. Sefranek
|_-\<,_ Amateur Radio Operator: WA1RHP
(*)/ (*) Bicycle mobile on 145.41, PL 74.4

http://hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org

> -----Original Message-----
> From: bal_gill21 [mailto:]
> Sent: Saturday, January 15, 2005 2:55 PM
> To:
> Subject: [m68HC11] Re: BRCLR >
> org $c000
> ldaa #%00000001
> staa $c601
> busy ldx $c600 ;line 4
> BRCLR $0,x $1 skip ;line 5
> jmp busy
> skip wai
>
> line 4: I have put $c600 here because its going into the X register,
> so $c600 has nothing in it ie 00000000. $c601 has a $1 in it ie
> 00000001. When it's loaded into the x register it looks
> like :0000000000000001.
>
> line 5: I want it to check if the very last bit in x reg (1) is a 1
> or 0 and jump accordingly. If the last bit is 0 I want it to go
> to "skip" and "busy" if its a 1. >
> --- In , "Thomas Sefranek" <tcs@c...> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: bal_gill21 [mailto:bal_gill21@y...]
> > > Sent: Saturday, January 15, 2005 2:30 PM
> > > To:
> > > Subject: [m68HC11] Re: BRCLR
> > >
> > > No, i'm loading the contents of $c600 into x register.
> >
> > O.K. I'm missing something here...
> >
> > Your putting a ONE in the LSB of the address of X. (The contents of
> $C600
> > MSB is undefined, AND $C601 is a 1.) So X is pointing... who knows
> where..
> > and your Testing the location X is pointing to for it to be clear...
> >
> > A few comments in your code to explain what you MEANT to do would
> help.
> > >
> > *
> > | __O Thomas C. Sefranek WA1RHP@A...
> > |_-\<,_ Amateur Radio Operator: WA1RHP
> > (*)/ (*) Bicycle mobile on 145.41, PL 74.4
> >
> > http://hamradio.cmcorp.com/inventory/Inventory.html
> > http://www.harvardrepeater.org >
> Yahoo! Groups Links >


At line 5>>>BRCLR $0,x $1 skip <<< the lower byte of the x register contains
the contents of $c600. The BRCLR instruction interrupts the contents of x as
an address. The LSB of this address is tested. This is not what you intend
to be doing. See my note below.
Nick

-----Original Message-----
From: bal_gill21 [mailto:]
Sent: Saturday, January 15, 2005 2:55 PM
To:
Subject: [m68HC11] Re: BRCLR

org $c000
ldaa #%00000001
staa $c601
busy ldx $c600 ;line 4 <contents of $c600 to the X register which
are undefined
BRCLR $0,x $1 skip ;line 5
jmp busy
skip wai

line 4: I have put $c600 here because its going into the X register,
so $c600 has nothing in it ie 00000000. $c601 has a $1 in it ie
00000001. Nick's Note:..............................
" When it's loaded into the x register it looks
like :0000000000000001."
So, the byte located in RAM at $0001 is being tested.

line 5: I want it to check if the very last bit in x reg (1) is a 1
or 0 and jump accordingly. If the last bit is 0 I want it to go
to "skip" and "busy" if its a 1.
--- In , "Thomas Sefranek" <tcs@c...> wrote:
> > -----Original Message-----
> > From: bal_gill21 [mailto:bal_gill21@y...]
> > Sent: Saturday, January 15, 2005 2:30 PM
> > To:
> > Subject: [m68HC11] Re: BRCLR
> >
> > No, i'm loading the contents of $c600 into x register.
>
> O.K. I'm missing something here...
>
> Your putting a ONE in the LSB of the address of X. (The contents of
$C600
> MSB is undefined, AND $C601 is a 1.) So X is pointing... who knows
where..
> and your Testing the location X is pointing to for it to be clear...
>
> A few comments in your code to explain what you MEANT to do would
help.
> >
> *
> | __O Thomas C. Sefranek WA1RHP@A...
> |_-\<,_ Amateur Radio Operator: WA1RHP
> (*)/ (*) Bicycle mobile on 145.41, PL 74.4
>
> http://hamradio.cmcorp.com/inventory/Inventory.html
> http://www.harvardrepeater.org
Yahoo! Groups Links



My earlier Email was not accurate. "interrupts" should have been
"interpret". I have also added more of an explanation. Delete that Email
and use this one. Sorry about that. -----Original Message-----
From: Nick Reitter [mailto:]
Sent: Saturday, January 15, 2005 7:08 PM
To:
Subject: RE: [m68HC11] Re: BRCLR
At line 5>>>BRCLR $0,x $1 skip <<< the lower byte of the x register contains
the contents of $c600. The BRCLR instruction interprets the contents of x as
an address. The x register is a pointer register. Pointing to the location
of the bit(s) to be tested. The LSB at this address is tested. This is not
what you intend to do. Also, see my note below.
Nick

-----Original Message-----
From: bal_gill21 [mailto:]
Sent: Saturday, January 15, 2005 2:55 PM
To:
Subject: [m68HC11] Re: BRCLR

org $c000
ldaa #%00000001
staa $c601
busy ldx $c600 ;line 4 <contents of $c600 to the X register which
are undefined
BRCLR $0,x $1 skip ;line 5
jmp busy
skip wai

line 4: I have put $c600 here because its going into the X register,
so $c600 has nothing in it ie 00000000. $c601 has a $1 in it ie
00000001. Nick's Note:..............................
" When it's loaded into the x register it looks
like :0000000000000001."
So, the x register is pointing to the byte located in RAM at $0001. The LSB
at this location in RAM is being tested.

line 5: I want it to check if the very last bit in x reg (1) is a 1
or 0 and jump accordingly. If the last bit is 0 I want it to go
to "skip" and "busy" if its a 1.
--- In , "Thomas Sefranek" <tcs@c...> wrote:
> > -----Original Message-----
> > From: bal_gill21 [mailto:bal_gill21@y...]
> > Sent: Saturday, January 15, 2005 2:30 PM
> > To:
> > Subject: [m68HC11] Re: BRCLR
> >
> > No, i'm loading the contents of $c600 into x register.
>
> O.K. I'm missing something here...
>
> Your putting a ONE in the LSB of the address of X. (The contents of
$C600
> MSB is undefined, AND $C601 is a 1.) So X is pointing... who knows
where..
> and your Testing the location X is pointing to for it to be clear...
>
> A few comments in your code to explain what you MEANT to do would
help.
> >
> *
> | __O Thomas C. Sefranek WA1RHP@A...
> |_-\<,_ Amateur Radio Operator: WA1RHP
> (*)/ (*) Bicycle mobile on 145.41, PL 74.4
>
> http://hamradio.cmcorp.com/inventory/Inventory.html
> http://www.harvardrepeater.org
Yahoo! Groups Links

Yahoo! Groups Links



The 2024 Embedded Online Conference