EASy68K  
It is currently Tue Apr 25, 2017 2:27 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Aug 06, 2015 4:13 pm 
Offline

Joined: Thu Aug 06, 2015 12:18 am
Posts: 1
When used with full 32-bit addresses (that is, non-zero data in the highest 8 bits), the bset and bclr instructions will frequently either corrupt data at the specified address or generate a runtime exception.

Attached is sample code that demonstrates this behavior as well as a runtime log. Note that, at the end of execution, the value of the byte at $FF2000 is $79. If the simulator were operating correctly, the expected value would be $0C.

I suspect that the simulator is not correctly dropping the high byte of the address, and that this issue also affect the bchg instruction. However, I have not personally tested anything other than bset and bclr.

(Apologies for the large copy/paste. The forum's attachment system will not allow me to upload .X68 or .txt files.)

Sample code:
Code:
    ORG    $1000
   
TestVar equ $FFFF2000
   
START:               
    lea TestVar, a0
    move.b #0, (a0)
   
    bclr #0, (a0)

    bset #2, (a0)
    bset #3, (a0)   

    SIMHALT           

    END START

*~Font name~Courier New~
*~Font size~10~
*~Tab type~1~
*~Tab size~4~

Runtime log:
Code:
EASy68K execution log file: 8/5/2015 3:51:14 PM


00FF2000: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ----------------

D0=00000000 D4=00000000 A0=00000000 A4=00000000    T_S__INT___XNZVC
D1=00000000 D5=00000000 A1=00000000 A5=00000000 SR=0010000000000000
D2=00000000 D6=00000000 A2=00000000 A6=00000000 US=00FF0000
D3=00000000 D7=00000000 A3=00000000 A7=01000000 SS=01000000
PC=00001000  Code=41F9 FFFF2000          Line=    6      lea TestVar, a0

00FF2000: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ----------------

D0=00000000 D4=00000000 A0=FFFF2000 A4=00000000    T_S__INT___XNZVC
D1=00000000 D5=00000000 A1=00000000 A5=00000000 SR=0010000000000000
D2=00000000 D6=00000000 A2=00000000 A6=00000000 US=00FF0000
D3=00000000 D7=00000000 A3=00000000 A7=01000000 SS=01000000
PC=00001006  Code=10BC 0000              Line=    7      move.b #0, (a0)

00FF2000: 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ----------------

D0=00000000 D4=00000000 A0=FFFF2000 A4=00000000    T_S__INT___XNZVC
D1=00000000 D5=00000000 A1=00000000 A5=00000000 SR=0010000000000100
D2=00000000 D6=00000000 A2=00000000 A6=00000000 US=00FF0000
D3=00000000 D7=00000000 A3=00000000 A7=01000000 SS=01000000
PC=0000100A  Code=0890 0000              Line=    9      bclr #0, (a0)

00FF2000: 70 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF p---------------

D0=00000000 D4=00000000 A0=FFFF2000 A4=00000000    T_S__INT___XNZVC
D1=00000000 D5=00000000 A1=00000000 A5=00000000 SR=0010000000000100
D2=00000000 D6=00000000 A2=00000000 A6=00000000 US=00FF0000
D3=00000000 D7=00000000 A3=00000000 A7=01000000 SS=01000000
PC=0000100E  Code=08D0 0002              Line=   11      bset #2, (a0)

00FF2000: 75 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF u---------------

D0=00000000 D4=00000000 A0=FFFF2000 A4=00000000    T_S__INT___XNZVC
D1=00000000 D5=00000000 A1=00000000 A5=00000000 SR=0010000000000100
D2=00000000 D6=00000000 A2=00000000 A6=00000000 US=00FF0000
D3=00000000 D7=00000000 A3=00000000 A7=01000000 SS=01000000
PC=00001012  Code=08D0 0003              Line=   12      bset #3, (a0)   

00FF2000: 79 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF y---------------

D0=00000000 D4=00000000 A0=FFFF2000 A4=00000000    T_S__INT___XNZVC
D1=00000000 D5=00000000 A1=00000000 A5=00000000 SR=0010000000000100
D2=00000000 D6=00000000 A2=00000000 A6=00000000 US=00FF0000
D3=00000000 D7=00000000 A3=00000000 A7=01000000 SS=01000000
PC=00001016  Code=FFFF FFFF              Line=   14      SIMHALT           


Top
 Profile  
 
PostPosted: Thu Aug 13, 2015 1:28 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
Corrected in Sim68K v5.15.04

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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:  
Powered by phpBB® Forum Software © phpBB Group