EASy68K  
It is currently Mon Mar 27, 2017 6:24 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: BCHG.L
PostPosted: Tue Dec 17, 2013 1:48 pm 
Offline

Joined: Tue Nov 15, 2005 7:58 am
Posts: 128
Location: Oregon, USA
Should
Code:
        BCHG.L    Dn,Address

assemble?

What is the range of values Dn can contain, and what happens if it's outside of that range?


Top
 Profile  
Reply with quote  
 Post subject: Re: BCHG.L
PostPosted: Tue Dec 17, 2013 4:43 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
The assembler does not permit a size code (.B or .L).

BCHG Dn,Address is always byte.
All others are long.

{edited}

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject: Re: BCHG.L
PostPosted: Wed Dec 18, 2013 9:47 am 
Offline

Joined: Tue Nov 15, 2005 7:58 am
Posts: 128
Location: Oregon, USA
These all assemble the same:
Code:
00001004  0543                      14              bchg    D2,D3
00001006  0579 00001020             15              bchg    D2,test
0000100C  0579 00001020             16              bchg.B  D2,test
00001012  0579 00001020             17              bchg    D2,test.L
...

00001020= 00000000 00000000         24  test        dc.l    0,0


For this code:
Code:
    ORG    $1000
START:                  ; first instruction of program

* Put program code here
   moveq   #0,D2
   move.l   D2,D3
loop:
   bchg   D2,D3
   bchg   D2,test
   ADDQ   #1,D2
   bne   loop

       SIMHALT             ; halt simulator

* Put variables and constants here
test   dc.l   0

       END    START        ; last line of source

as D2 increments, the bit changed walks across D3.L and wraps every 32 iterations. The bit changed in memory (test.L) wraps every 8 bits, affecting only a single byte. Sounds like the opposite of what you describe. Mardell's reference guide is not helpful. Easy 68K Quick Reference v2.1 seems to indicate that there are byte and longword versions for any destination mode.


Top
 Profile  
Reply with quote  
 Post subject: Re: BCHG.L
PostPosted: Fri Dec 20, 2013 1:24 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
Sorry, you are correct. I must have been low on caffeine when I responded the first time.

From a 68000 user guide:

    A bit in the destination operand is tested and the state of the specified bit is reflected in the Z condition code. After the test, the state of the specified bit is changed in the destination. If a data register is the destination, then the bit numbering is modulo 32 allowing bit manipulation on all bits in a data register. If a memory location is the destination, a byte is read from that location, the bit operation performed using the bit number modulo 8, and the byte written back to the location with zero referring to the least-significant bit. The bit number for this operation may be specified in two different ways:
    1. Immediate -- the bit number is specified in a second word of the instruction.
    2. Register -- the bit number is contained in a data register specified in the instruction.
    Condition Codes:
    N Not affected.
    Z Set if the bit tested is zero. Cleared otherwise.
    V Not affected.
    C Not affected.
    X Not affected.

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject: Re: BCHG.L
PostPosted: Sat Dec 21, 2013 4:57 am 
Offline

Joined: Tue Nov 15, 2005 7:58 am
Posts: 128
Location: Oregon, USA
Thanks. I just found my 68K book and it agrees.


Top
 Profile  
Reply with quote  
 Post subject: Re: BCHG.L
PostPosted: Mon Jan 27, 2014 2:44 pm 
Offline

Joined: Mon Jan 27, 2014 2:34 pm
Posts: 1
Dear Prof Kelly,

First of all: Thanks for that great tool.
I've a similar question: In the manual the BTST instruction is defined for a data length of byte or long. However, if I put

Code:
 BTST.B #0,d0


in the editor, the error message

Quote:
ERROR: Invalid size code


appears. Am I using it wrong or is it a bug in the tool?

Best regards,
Norman Kluge


Top
 Profile  
Reply with quote  
 Post subject: Re: BCHG.L
PostPosted: Tue Jan 28, 2014 4:30 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
When the destination is a data register the size is always .L. This may be specified in the instruction or not with the same result. When the destination is memory the size is always .B. Again the size may be specified in the instruction or omitted with the same result:
Code:
00001000  0800 0000                  9      BTST.L  #0,D0
00001004  0800 0000                 10      BTST    #0,D0
00001008  0838 0000 1000            11      BTST.B  #0,$1000
0000100E  0838 0000 1000            12      BTST    #0,$1000

I'm delighted that EASy68K is a useful tool. :cool

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group