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

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Move a single bit
PostPosted: Fri Mar 06, 2015 7:44 am 
Offline

Joined: Wed Mar 04, 2015 5:42 pm
Posts: 5
Hey folks,

I'm looking to transfer a single bit from an address register's content to a data register.

Code:
move.b  (a1), d3


...Moves 2 bits. I'm reading from a file and for some reason there are extra bits after the first number that I'm trying to grab.
The file contents are 1234
d3 contains 31 when the above code is executed for the first time, and shifting the address makes d3 equal to 20

I'd like for d3 to contain 1, 2, 3, and 4 respectively.

Thanks for any help


Top
 Profile  
Reply with quote  
 Post subject: Re: Move a single bit
PostPosted: Fri Mar 06, 2015 9:15 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
31 is the ASCII code for '1'
20 is the ASCII code for Space

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject: Re: Move a single bit
PostPosted: Fri Mar 06, 2015 9:32 pm 
Offline

Joined: Wed Mar 04, 2015 5:42 pm
Posts: 5
profkelly wrote:
31 is the ASCII code for '1'
20 is the ASCII code for Space


That makes sense. Is there any way to grab the actual numbers from the file?
I.e. pulling the "1" from the text file and storing it in a data register eventually.

Thanks very much for your time. Love the simulator!


Top
 Profile  
Reply with quote  
 Post subject: Re: Move a single bit
PostPosted: Fri Mar 06, 2015 11: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.
ASCII number may be converted to binary by subtracting $30.

$31 - $30 = 1

The binary result may be calculated in a data register. If D1 contains the ASCII code then
SUB.B #$30,D1 will result in D1 containing binary 1.

_________________
Prof. Kelly


Top
 Profile  
Reply with quote  
 Post subject: Re: Move a single bit
PostPosted: Mon Mar 09, 2015 7:17 pm 
Offline

Joined: Wed Mar 04, 2015 5:42 pm
Posts: 5
profkelly wrote:
ASCII number may be converted to binary by subtracting $30.

$31 - $30 = 1

The binary result may be calculated in a data register. If D1 contains the ASCII code then
SUB.B #$30,D1 will result in D1 containing binary 1.


I ended up doing exactly that! Thanks so much for your help.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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